This builds on the work in PR #3 and adds a new subcommand: run-single. It works pretty much as specified in Confluence, but with slightly more comprehensive documentation printed by help.
Some of its implementation is shared with run, so I've extracted those things into a separate header and based this PR on #3 instead of #1. ~I'll retarget it on master once #3 is merged.~
Here is some example output:
> cse help run-single
NAME
cse run-single - Runs a simulation with a single subsimulator
SYNOPSIS
cse run-single <uri_or_path> <initial_value...> [options...]
DESCRIPTION
This command runs a simulation consisting of a single subsimulator. This is
mainly meant for testing and debugging. The simulator is therefore run directly,
without the overhead and extra machinery of a full co-simulation.
The model to simulate can be specified with a URI, or, if it's a local FMU, by its
path. Using a path is equivalent to using a 'file' URI.
Initial variable values may be specified after the model URI/path, by supplying a
list of name=value pairs as individual command-line arguments.
The simulation can be synchronised with real time by using the '--real-time'
option, optionally specifying a target real-time factor (RTF). The RTF is defined
as 'elapsed logical time divided by elapsed real time in seconds'. In other
words:
* RTF < 1 means slower than real time
* RTF = 1 means real time
* RTF > 1 means faster than real time
Whether the target RTF can actually be reached depends on the simulation setup,
most importantly the models being simulated, and the machine(s) on which the
simulation is being executed.
If '--real-time' is not specified, the default is to run as fast as possible,
unconstrained by real time.
PARAMETERS
uri_or_path A model URI or FMU path.
initial_value Initial values for model variables, on the form
<name>=<value>. Allowed values for boolean variables are
'true' or 'false'.
OPTIONS
-b [ --begin-time ] arg (=0) The logical time at which the simulation
should start.
-d [ --duration ] arg (=1) The duration of the simulation, in
logical time. Excludes -e/--end-time.
-e [ --end-time ] arg The logical end time of the simulation.
Excludes -d/--duration.
--real-time [=target_rtf(=1)] Enables real-time-synchronised
simulations. A target RTF may optionally
be specified, with a default value of 1.
--output-file arg (=./model-output.csv) The file to which simulation results
should be written.
-s [ --step-size ] arg (=0.01) The co-simulation step size.
--help Display a help message and exit.
--version Display program version information and
exit.
Warning: I've rebased this branch on master to resolve conflicts. (I know I said I wouldn't do that anymore, but due to the dependency of #4 on #3 it was the cleanest way.)
This builds on the work in PR #3 and adds a new subcommand:
run-single
. It works pretty much as specified in Confluence, but with slightly more comprehensive documentation printed byhelp
.Some of its implementation is shared with
run
, so I've extracted those things into a separate header and based this PR on #3 instead of #1. ~I'll retarget it onmaster
once #3 is merged.~Here is some example output: