# 2. OMSimulator

OMSimulator is a command line wrapper for the OMSimulatorLib library.

## 2.1. OMSimulator Flags

A brief description of all command line flags will be displayed using `OMSimulator --help`:

    info:    Usage: OMSimulator [Options] [Lua script] [FMU] [SSP file]
             Options:
               --addParametersToCSV=<bool>      false              Export parameters to a .csv file
               --algLoopSolver=<arg>            "kinsol"           Specifies the loop solver method (fixedpoint, kinsol) used for algebraic loops spanning multiple components.
               --clearAllOptions                                   Reset all flags to their default values
               --CVODEMaxErrTestFails=<int>     100                Maximum number of error test failures for CVODE
               --CVODEMaxNLSFailures=<int>      100                Maximum number of nonlinear convergence failures for CVODE
               --CVODEMaxNLSIterations=<int>    5                  Maximum number of nonlinear solver iterations for CVODE
               --CVODEMaxSteps=<int>            1000               Maximum number of steps for CVODE
               --deleteTempFiles=<bool>         true               Delete temporary files as soon as they are no longer needed
               --directionalDerivatives=<bool>  true               Use directional derivatives to calculate the Jacobian for algebraic loops
               --dumpAlgLoops=<bool>            false              Dump information for algebraic loops
               --emitEvents=<bool>              true               Emit events during simulation
               --help [-h]                                         Display the help text
               --ignoreInitialUnknowns=<bool>   false              Ignore initial unknowns from the modelDescription.xml
               --initialStepSize=<double>       1e-6               Specify the initial step size
               --inputExtrapolation=<bool>      false              Enable input extrapolation using derivative information
               --intervals=<int> [-i]           500                Specify the number of communication points (arg > 1)
               --logFile=<arg> [-l]             ""                 Specify the log file (stdout is used if no log file is specified)
               --logLevel=<int>                 0                  Set the log level (0: default, 1: debug, 2: debug+trace)
               --master=<arg>                   "ma"               Specify the master algorithm (ma)
               --maxEventIteration=<int>        100                Specify the maximum number of iterations for handling a single event
               --maxLoopIteration=<int>         10                 Specify the maximum number of iterations for solving algebraic loops between system-level components. Internal algebraic loops of components are not affected.
               --minimumStepSize=<double>       1e-12              Specify the minimum step size
               --mode=<arg> [-m]                "me"               Force a certain FMI mode if the FMU provides both cs and me (cs, me)
               --numProcs=<int> [-n]            1                  Specify the maximum number of processors to use (0=auto, 1=default)
               --progressBar=<bool>             false              Show a progress bar for the simulation progress in the terminal
               --realTime=<bool>                false              Enable experimental feature for (soft) real-time co-simulation
               --resultFile=<arg> [-r]          "<default>"        Specify the name of the output result file
               --skipCSVHeader=<bool>           true               Skip exporting the CSV delimiter in the header
               --solver=<arg>                   "cvode"            Specify the integration method (euler, cvode)
               --solverStats=<bool>             false              Add solver stats to the result file, e.g., step size; not supported for all solvers
               --startTime=<double> [-s]        0                  Specify the start time
               --stepSize=<double>              1e-3               Specify the (maximum) step size
               --stopTime=<double> [-t]         1                  Specify the stop time
               --stripRoot=<bool>               false              Remove the root system prefix from all exported signals
               --suppressPath=<bool>            false              Suppress path information in info messages; especially useful for testing
               --tempDir=<arg>                  "."                Specify the temporary directory
               --timeout=<int>                  0                  Specify the maximum allowed time in seconds for running a simulation (0 disables)
               --tolerance=<double>             1e-4               Specify the relative tolerance
               --version [-v]                                      Display version information
               --wallTime=<bool>                false              Add wall time information to the result file
               --workingDir=<arg>               "."                Specify the working directory
               --zeroNominal=<bool>             false              Accept FMUs with invalid nominal values and replace the invalid nominal values with 1.0

To use flag `logLevel` with option debug (`--logLevel=1`) or debug+trace (`--logLevel=2`) one needs to build OMSimulator with debug configuration enabled. Refer to the OMSimulator README on GitHub for further instructions.

## 2.2. Examples

    OMSimulator --timeout 180 example.lua