Skip to content

Commit 9769e5a

Browse files
authored
update cse-cli, cmd & help response to v 0.2.0 (#15)
* update cse-cli cmd & help response to v 0.2.0 * update cse-cli cmd & help response * update cse-cli * update cse-cli * update cse-cli
1 parent a49085b commit 9769e5a

File tree

1 file changed

+145
-159
lines changed

1 file changed

+145
-159
lines changed

cse-cli.md

+145-159
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,30 @@
11
---
22
layout: default
3-
title: "cse-cli"
3+
title: "CSE CLI"
44
permalink: /cse-cli
55
---
66

77
## CSE CLI
8-
For the cases where a graphical user interface is not available or needed, the CSE comes as a command line application. CSE CLI is a command-line interface (CLI) to the Core Simulation Environment (CSE). It facilitates for running co-simulations of systems configured with SSP or MSMI.
8+
CSE CLI is a command-line interface (CLI) to CSE for the cases where a graphical user interface is not available or needed. It facilitates for running co-simulations of systems configured with SSP or MSMI.
99
It has three primary use cases:
1010

1111
- Running simulations from other programs or scripts
1212
- FMU testing and debugging
1313
- Users who simply prefer to work from the command line
1414

15-
The command line application is suitable when multiple sets of simulations can be executed in parallel. An example for such use case could be in design, where there typically are multiple system variants and parametrizations of the system.
16-
It can simulate single FMUs and show the model descriptions. Besides being a necessary simulation tool, the CSE command line interface also serves as a demonstration for how client applications can make use of the CSE co-simulation library.
17-
With the command-line interface, the co-simulation library is used to enable co-simulation from the command-line.
15+
The CLI is especially suitable when multiple sets of simulation to be executed in parallel. An example for such use case could be in design, where there typically are multiple system variants and parameterization of the system.
16+
It can simulate a single FMU and show the model description. Besides being a necessary simulation tool, the CLI also serves as a demonstration for how client applications can make use of the CSE co-simulation library.
17+
With the CLI, the co-simulation library is used to enable co-simulation from the command-line.
1818

19-
This page collects design ideas for the CSE command-line interface (CLI).
20-
21-
### Functionality and design
19+
### Functional specification
2220

23-
CSE-CLI should be able to perform the following tasks:
21+
CSE CLI is able to perform the following tasks:
2422

2523
- Run a simulation, where the system to simulate is specified as an SSP file.
2624
- Provide information about a model (usually an FMU).
2725
- Do a "test run" with a single model (FMU).
28-
The following is an unsorted list of loose design ideas and desirable features. A more detailed specification is given in the form of "help texts" in the next section.
29-
30-
- Ability to access both local and remote models, using paths or URIs.
31-
- Logging of simulation results to disk.
32-
- Git-like CLI
33-
--Subcommands for main operations
34-
--GNU-style long options (--option) with one-letter short forms (-o) for the most commonly used ones
35-
--Built-in help/documentation.
36-
37-
### Functional specification
3826

39-
Here, we specify the functionality of the software in the form of imagined interactions with a user. This includes a somewhat formal specification given by the output of the cse help commands.
27+
Detailed specifications are given in the form of "help texts" as follows.
4028

4129
#### General usage
4230

@@ -48,72 +36,57 @@ Error: Missing command-line arguments. Run "cse help" to get help.
4836
```shell
4937
> cse help
5038
NAME
51-
cse - Command line interface to the Core Simulation Environment.
52-
39+
cse - Command-line interface to the Core Simulation Environment
40+
5341
SYNOPSIS
54-
cse [--version] [--help] [--log-level=<level>] <command> [<args>]
55-
42+
cse <subcommand> <args...> [options...]
43+
5644
DESCRIPTION
57-
The Core Simulation Environment is free and open-source software for
58-
running distributed co-simulations.
59-
60-
OPTIONS
61-
--version
62-
Prints the CSE version number.
63-
64-
--help
65-
Prints help on using CSE. Include a subcommand to get detailed
66-
help on that command. The following are equivalent:
67-
cse --help [<command>]
68-
cse [<command>] --help
69-
cse help [<command>]
70-
71-
--log-level=<level> (default: --log-level=warning)
72-
Sets the detail/severity level of diagnostic program output.
73-
Valid <level> values, in order of increasing detail (and decreasing
74-
severity) are: error, warning, info, debug, trace.
75-
76-
COMMANDS
77-
78-
help
79-
Shows documentation. Run "cse help <command>" for detailed
80-
information on one of the above commands.
81-
82-
inspect
83-
Shows information about a model.
84-
85-
run
86-
Runs a simulation.
87-
88-
run-single
89-
Runs a simulation with a single subsimulator.
90-
```
45+
The Core Simulation Environment is free and open-source software for running distributed co-simulations.
9146

92-
```shell
93-
> cse --version
94-
CSE CLI 0.2.0
95-
```
47+
SUBCOMMANDS
48+
help Shows documentation
49+
inspect Shows information about a model
50+
run Runs a simulation
51+
run-single Runs a simulation with a single subsimulator
52+
53+
OPTIONS
54+
--help Display a help message and exit.
55+
--log-level arg (=warning) Sets the detail/severity level of diagnostic program output. Valid argument values, in
56+
order of increasing detail (and decreasing severity), are: error, warning, info, debug,
57+
trace.
58+
-v [ --verbose ] Shorthand for --log-level=info.
59+
--version Display program version information and exit.
60+
```
9661

9762
#### Getting information about a model
9863
```shell
9964
> cse help inspect
10065
NAME
101-
cse inspect - Shows information about a model
102-
66+
cse inspect - Shows information about a model
67+
10368
SYNOPSIS
104-
cse inspect <uri>
105-
106-
cse inspect <path>
107-
69+
cse inspect <uri_or_path> [options...]
70+
10871
DESCRIPTION
109-
This command shows information about a model, such as its name,
110-
description, author, version, and so on. It also lists information
111-
about the model's variables, like their names, types, causalities,
112-
variabilities, etc.
113-
114-
The model can be specified with a URI, or, if it's a local FMU, by its
115-
path. Using a path is equivalent to using a `file` URI.
72+
This command shows information about a model, such as its name, description, author, version, and so on. It also lists
73+
information about the model's variables, like their names, types, causalities, variabilities, etc.
74+
75+
The model 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`
76+
URI.
77+
78+
PARAMETERS
79+
uri_or_path A model URI or FMU path.
80+
81+
OPTIONS
82+
--help Display a help message and exit.
83+
--log-level arg (=warning) Sets the detail/severity level of diagnostic program output. Valid argument values, in order of
84+
increasing detail (and decreasing severity), are: error, warning, info, debug, trace.
85+
--no-vars Do not print information about variables.
86+
-v [ --verbose ] Shorthand for --log-level=info.
87+
--version Display program version information and exit.
11688
```
89+
11790
```shell
11891
> cse inspect models/relativistic_energy.fmu
11992
name: physics.relativity.energy
@@ -156,56 +129,60 @@ variables:
156129
```shell
157130
> cse help run
158131
NAME
159-
cse run - Runs a simulation.
160-
132+
cse run - Runs a simulation
133+
161134
SYNOPSIS
162-
cse run <ssp file> [-a <algorithm>] [-b <number>]
163-
[-d <number> | -e <number>] [-s <number>] [--rtf=<number>]
164-
[--output-dir <directory>]
165-
135+
cse run <system_structure_path> [options...]
136+
166137
DESCRIPTION
167-
This command runs a simulation based on an SSP file that specifies
168-
which models to include and the connections between them.
169-
170-
OPTIONS
171-
-a <algorithm>, --algorithm=<algorithm> (default: fixed-stepsize)
172-
Which co-simulation algorithm to use. Available algorithms are:
173-
fixed-stepsize.
174-
175-
-b <number>, --begintime=<number> (default: 0)
176-
The logical time at which the simulation should start.
177-
178-
-d <number>, --duration=<number> (default: 1)
179-
The duration of the simulation, in logical time. Excludes -e.
180-
181-
-e <number>, --endtime=<number>
182-
The logical end time of the simulation. Excludes -d.
183-
184-
--output-dir=<directory> (default: .)
185-
Where to write log files with simulation results.
186-
187-
--rtf
188-
The desired real-time factor. 1 means real time. The default if
189-
not specified is to run as fast as possible.
190-
191-
-s <number>, --stepsize=<number> (default: 0.01)
192-
The step size.
193-
```
138+
This command runs a simulation based on a configuration file that specifies the system structure, i.e., which models to
139+
include and the connections between them.
194140

195-
```shell
196-
> cse run sea_trial.ssp -d 3600 --output-dir=sim/results --log-level=info
197-
[info] Initialising models
198-
[info] Starting simulation, t = 0
199-
[info] 10% complete, t = 360
200-
[info] 20% complete, t = 720
201-
[info] 30% complete, t = 1080
202-
[info] 40% complete, t = 1440
203-
[info] 50% complete, t = 1800
204-
[info] 60% complete, t = 2160
205-
[info] 70% complete, t = 2520
206-
[info] 80% complete, t = 2880
207-
[info] 90% complete, t = 3240
208-
[info] Simulation complete, t = 3600
141+
The simulation can be synchronised with real time by using the the '--real-time' option, optionally specifying a target
142+
real-time factor (RTF). The RTF is defined as 'elapsed logical time divided by elapsed real time in seconds'. In other
143+
words:
144+
145+
* RTF < 1 means slower than real time
146+
* RTF = 1 means real time
147+
* RTF > 1 means faster than real time
148+
149+
Whether the target RTF can actually be reached depends on the simulation setup, most importantly the models being simulated,
150+
and the machine(s) on which the simulation is being executed.
151+
152+
If '--real-time' is not specified, the default is to run as fast as possible, unconstrained by real time.
153+
154+
PARAMETERS
155+
system_structure_path The path to the system structure definition file/directory. If this is a file with .xml
156+
extension, or a directory that contains a file named OspSystemStructure.xml, it will be
157+
interpreted as a OSP system structure definition. Otherwise, it will be interpreted as an SSP
158+
system structure definition.
159+
160+
OPTIONS
161+
-b [ --begin-time ] arg (=0) The logical time at which the simulation should start.
162+
-d [ --duration ] arg (=1) The duration of the simulation, in logical time. Excludes -e/--end-time.
163+
-e [ --end-time ] arg The logical end time of the simulation. Excludes -d/--duration.
164+
--help Display a help message and exit.
165+
--log-level arg (=warning) Sets the detail/severity level of diagnostic program output. Valid argument values, in
166+
order of increasing detail (and decreasing severity), are: error, warning, info, debug,
167+
trace.
168+
--mr-progress [=resolution(=10)] Enables printing of machine-readable progress indicator lines on the form '@progress n t
169+
d'. Here, n indicates the progress in 1/N-ths of the total time, where N is the resolution
170+
given as an argument to this option. t is the current logical time and d is the amount of
171+
logical time that has passed since the start of the simulation. t and d are floating-point
172+
numbers while n is an integer.
173+
--output-config arg (=auto) The path to an XML file that contains configuration settings for simulation output, or one
174+
of the special values 'auto', 'all' and 'none'. The default is 'auto', which causes the
175+
program to look for a file named 'LogConfig.xml' in the same directory as the system
176+
structure definition file. If no such file is found, the effect is the same as for 'all',
177+
meaning that the values of all variables are stored for each time step. 'none' disables
178+
file output altogether.
179+
--output-dir arg (=.) The path to a directory for storing simulation results.
180+
--real-time [=target_rtf(=1)] Enables real-time-synchronised simulations. A target RTF may optionally be specified, with
181+
a default value of 1.
182+
--scenario arg The path to a scenario file to run. By default, no scenario is run.
183+
--scenario-start arg (=0) The logical time at which the scenario will start. Only used if --scenario is specified.
184+
-v [ --verbose ] Shorthand for --log-level=info.
185+
--version Display program version information and exit.
209186
```
210187
211188
#### Running a single model
@@ -216,44 +193,53 @@ NAME
216193
cse run-single - Runs a simulation with a single subsimulator.
217194

218195
SYNOPSIS
219-
cse run-single (<uri> | <path>) [<variable>=<value> ...] [-b <number>]
220-
[-d <number> | -e <number>] [-s <number>] [--rtf=<number>]
221-
[--output-file=<path>]
222-
196+
cse run-single <uri_or_path> <initial_value...> [options...]
197+
223198
DESCRIPTION
224-
This command runs a simulation consisting of a single subsimulator.
225-
This is mainly meant for testing and debugging. The simulator is
226-
therefore run directly, without the overhead and extra machinery of
227-
a full co-simulation.
228-
229-
The model to simulate can be specified with a URI, or, if it's a local
230-
FMU, by its path. Using a path is equivalent to using a `file` URI.
231-
232-
Initial variable values may be specified after the model URI/path, by
233-
supplying a list of name=value pairs as individual command-line
234-
arguments
235-
199+
This command runs a simulation consisting of a single subsimulator. This is mainly meant for testing and debugging. The
200+
simulator is therefore run directly, without the overhead and extra machinery of a full co-simulation.
201+
202+
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
203+
a 'file' URI.
204+
205+
Initial variable values may be specified after the model URI/path, by supplying a list of name=value pairs as individual
206+
command-line arguments.
207+
208+
The simulation can be synchronised with real time by using the '--real-time' option, optionally specifying a target real-time
209+
factor (RTF). The RTF is defined as 'elapsed logical time divided by elapsed real time in seconds'. In other words:
210+
211+
* RTF < 1 means slower than real time
212+
* RTF = 1 means real time
213+
* RTF > 1 means faster than real time
214+
215+
Whether the target RTF can actually be reached depends on the simulation setup, most importantly the models being simulated,
216+
and the machine(s) on which the simulation is being executed.
217+
218+
If '--real-time' is not specified, the default is to run as fast as possible, unconstrained by real time.
219+
220+
PARAMETERS
221+
uri_or_path A model URI or FMU path.
222+
initial_value Initial values for model variables, on the form <name>=<value>. Allowed values for boolean variables
223+
are 'true' or 'false'.
224+
236225
OPTIONS
237-
-b <number>, --begintime=<number> (default: 0)
238-
The logical time at which the simulation should start.
239-
240-
-d <number>, --duration=<number> (default: 1)
241-
The duration of the simulation, in logical time. Excludes -e.
242-
243-
-e <number>, --endtime=<number>
244-
The logical end time of the simulation. Excludes -d.
245-
246-
--output-file=<path> (default: model-output.csv)
247-
The file to which simulation results will be written.
248-
249-
--rtf
250-
The desired real-time factor. 1 means real time. The default if
251-
not specified is to run as fast as possible.
252-
253-
-s <number>, --stepsize=<number> (default: 0.01)
254-
The step size.
226+
-b [ --begin-time ] arg (=0) The logical time at which the simulation should start.
227+
-d [ --duration ] arg (=1) The duration of the simulation, in logical time. Excludes -e/--end-time.
228+
-e [ --end-time ] arg The logical end time of the simulation. Excludes -d/--duration.
229+
--help Display a help message and exit.
230+
--log-level arg (=warning) Sets the detail/severity level of diagnostic program output. Valid argument values,
231+
in order of increasing detail (and decreasing severity), are: error, warning, info,
232+
debug, trace.
233+
--mr-progress [=resolution(=10)] Enables printing of machine-readable progress indicator lines on the form '@progress
234+
n t d'. Here, n indicates the progress in 1/N-ths of the total time, where N is the
235+
resolution given as an argument to this option. t is the current logical time and d
236+
is the amount of logical time that has passed since the start of the simulation. t
237+
and d are floating-point numbers while n is an integer.
238+
--output-file arg (=./model-output.csv) The file to which simulation results should be written.
239+
--real-time [=target_rtf(=1)] Enables real-time-synchronised simulations. A target RTF may optionally be
240+
specified, with a default value of 1.
241+
-s [ --step-size ] arg (=0.01) The co-simulation step size.
242+
-v [ --verbose ] Shorthand for --log-level=info.
243+
--version Display program version information and exit.
255244
```
256245
257-
```shell
258-
> cse run-single powerplant.fmu -d 3600 --output-dir=sim/results
259-
```

0 commit comments

Comments
 (0)