struct SimulationParams

Overview

NRP Simulation Startup Parameters. More…

#include <simulation_parameters.h>

struct SimulationParams {
    // typedefs

    typedef bool ParamHelpT;
    typedef std::string ParamSimCfgFileT;
    typedef std::vector<std::string> ParamPluginsT;
    typedef std::string ParamExpDirT;
    typedef std::string ParamConsoleLogLevelT;
    typedef std::string ParamFileLogLevelT;
    typedef std::string ParamLogOutputT;
    typedef std::string ParamFilenameT;
    typedef std::string ParamLogDirT;
    typedef bool ParamLogConfigT;
    typedef std::string ParamModeT;
    typedef std::vector<std::string> ParamSimParamT;
    typedef std::string ParamServerAddressT;
    typedef bool ParamSlaveT;

    // fields

    static constexpr std::string_view NRPProgramName = "NRPCoreSim";
    static constexpr std::string_view ProgramDescription = "Brain and physics simulator";
    static constexpr std::string_view ParamHelp = "h";
    static constexpr std::string_view ParamHelpLong = "h,help";
    static constexpr std::string_view ParamHelpDesc = "Print this message";
    static constexpr std::string_view ParamSimCfgFile = "c";
    static constexpr std::string_view ParamSimCfgFileLong = "c,config";
    static constexpr std::string_view ParamSimCfgFileDesc = "Simulation config file";
    static constexpr std::string_view ParamPlugins = "p";
    static constexpr std::string_view ParamPluginsLong = "p,plugins";
    static constexpr std::string_view ParamPluginsDesc = "Engine plugins to load. If omitted, all engines compiled with nrp-core are loaded";
    static constexpr std::string_view ParamExpDir = "d";
    static constexpr std::string_view ParamExpDirLong = "d,dir";
    static constexpr std::string_view ParamExpDirDesc = "The explicit location of the experiment folder";
    static constexpr std::string_view ParamConsoleLogLevelLong = "cloglevel";
    static constexpr std::string_view ParamConsoleLogLevelDesc = "Console minimum level of log severity";
    static constexpr std::string_view ParamFileLogLevelLong = "floglevel";
    static constexpr std::string_view ParamFileLogLevelDesc = "File minimum level of log severity";
    static constexpr std::string_view ParamLogOutputLong = "logoutput";
    static constexpr std::string_view ParamLogOutputDesc = "Option for logging stdout and stderr in the experiment: engines, all, silent";
    static constexpr std::string_view ParamLogFilenameLong = "logfilename";
    static constexpr std::string_view ParamLogFilenameDesc = "If 'logoutput' option is 'engines' or 'all', name of the log file";
    static constexpr std::string_view ParamLogDirLong = "logdir";
    static constexpr std::string_view ParamLogDirDesc = "Directory for the file logs";
    static constexpr std::string_view ParamLogConfig = "l";
    static constexpr std::string_view ParamLogConfigLong = "l,logconfig";
    static constexpr std::string_view ParamLogConfigDesc = "Print the simulation config in use to DEBUG log";
    static constexpr std::string_view ParamMode = "m";
    static constexpr std::string_view ParamModeLong = "m,mode";
    static constexpr std::string_view ParamModeDesc = "Operational mode, standalone or server";
    static constexpr std::string_view ParamSimParam = "o";
    static constexpr std::string_view ParamSimParamLong = "o,param";
    static constexpr std::string_view ParamSimParamDesc = "Simulation config parameter, specified as param=value, overriding configuration file parameters";
    static constexpr std::string_view ParamServerAddressLong = "server_address";
    static constexpr std::string_view ParamServerAddressDesc = "Desired address of the server in server operational mode";
    static constexpr std::string_view ParamSlaveLong = "slave";
    static constexpr std::string_view ParamSlaveDesc = "If present NRPCoreSim runs in slave mode. For internal use.";

    // methods

    static cxxopts::Options createStartParamParser();
    static jsonSharedPtr setWorkingDirectoryAndGetConfigFile(const cxxopts::ParseResult& args);

    static void parseAndSetCLISimParams(
        const ParamSimParamT& parseResults,
        nlohmann::json& simulationConfig
    );

    static NRPLogger::level_t parseLogLevel(const std::string& logLevel);
};

Detailed Documentation

NRP Simulation Startup Parameters.

Methods

static cxxopts::Options createStartParamParser()

Create a parser for start parameters.

Returns:

Returns parser

static jsonSharedPtr setWorkingDirectoryAndGetConfigFile(const cxxopts::ParseResult& args)

Get the simulation configuration from start parameters as a JSON object.

Parameters:

args

Parsed start parameters

Returns:

Returns instance of simulation config

static void parseAndSetCLISimParams(
    const ParamSimParamT& parseResults,
    nlohmann::json& simulationConfig
)

Parse cmd line simulation parameters.

Parameters:

parseResults

simulationConfig

static NRPLogger::level_t parseLogLevel(const std::string& logLevel)

parsing input parameter string log level into enum type

Parameters:

logLevel

The string expression of the log level