Stella Simulator Arguments

Stella Simulator takes the full set of arguments available when Stella is called from the command line as described in Running Models Using the Command Line (except -s as Stella Simulator will not change a model file it is given). It also takes a number of arguments specific to Stella Simulator to help with programmatic interaction. For completeness, all of the arguments and their meaning are described here.

Note If you specify arguments that Stella Simulator can't parse, you will receive an error message and a full list of valid arguments.

 

-r Run the model once

For consistency with desktop Stella this command is recognized, but does not change behavior so can be omitted. In desktop Stella you can omit the -r and have the use the command line simply open a model, but such behavior is not meaningful for Stella Simulator.

-rn arg Run specified number of times

This will run the model the number of times specified in arg (which should be a positive integer). If combined with the -h argument a handshake file will be used between each run (but not before the first run).

-ro Optimize the model

This will run the model using optimization (the equivalent of O-Run in the desktop software). This will only work if optimization has been set up in the model (see Outcome Optimization). It is not consistent with any of the pause options which will simply be ignored. If you want to use optimization results in a subsequent simulation you will need to call Stella Simulator a second time with different options.

-rs Run Sensitivity on the model

This will run sensitivity on the model. This will only work if sensitivity has been set up in the model (see Sensitivity Analysis). It is not consistent with any of the pause options which will simply be ignored.

-d arg Seconds to delay between successive runs

This will delay Simulator by arg seconds (should be a positive number) after each run. Use this for timed execution of runs that are tied to animation or another presentation based requirement or to allow other processes to be completed. By default, there is no delay between run executions.

This argument can also be used to set the timeout for the handshake file interaction (the -h option). When used in combination this way it represents the maximum wait time before proceeding even if the handshake file is not updated.

-h arg Name of file to use for handshakes

Causes Simulator to wait for a handshake confirmation at the end of each run. The handshake is done by updating the file named by arg. This file must exist or this option will be ignored.

At the end of each run Simulator will empty the content of the file (leave a file of size 0) and wait for the file to change to a nonzero size before proceeding.

Writing anything into the handshake file (for example, 1) will cause the next run to occur.

Note Writing a value of **#** (and nothing else such as a new line) will stop the current run (and continue with the next if multiple runs have been specified).

If the -d option is used then Simulator will wait no more than that amount of time before proceeding. If the -d option is not specified there is no timeout, Simulator will simply wait till the file is updated, or the process is killed.

-p arg Pause at the given interval

Cause the run progress to be paused at the interval specified by arg. You can use 0 to cause a pause every DT or any other value. If -p is not given the simulation will not pause (except based on -pe as noted below).

Note The pause interval set in the run specifications for the model is ignored by Simulator.

Note If you set a pause interval but not the -pd or -ph arguments the run will continue without actual pausing. The only effect of the pause will be to have exports executed during the model run instead of at the end of the run.

-pi Pause immediately after initialization

Causes the run to be paused after values have been initialized, but before time has moved forward from the start time. If, for example, the model has a DT of 0.5 then a pause interval of 0 will pause at time 0.5, 1.0, 1.5 and so on. Using -pi in addition will cause the pauses to occur at 0, 0.5, 1.0, 1.5 and so on.

-pir Pause immediately after initialization then restart on resume

Causes the run to be paused after values have been initialized, but then restarts (instead of resuming) after the handshake occurs or pause wait time elapses. This allows, for example, the initial values of stocks to be set after the pause occurs. In other respects it behaves the same as the -pi option.

-pd arg Seconds to delay before resuming after a pause

This will delay Simulator by arg seconds (should be a positive number) after each pause. Use this for timed execution of runs that are tied to animation or another presentation based requirement or to allow other processes to be completed. By default, there is no delay after a pause (effectively no pause) unless the -ph argument is used.

This argument will most commonly be used to set the timeout for the pause handshake file interaction (the -ph option). When used in combination this way it represents the maximum wait time before proceeding even if the handshake file is not updated.

-pe arg Off|Model|Interface Observe pause events from the model or interface

This will cause events defined in Stella to pause (or stop) the simulation. Use an argument of Model (or m) to trigger events with model based actions and Interface (or i) to trigger events with interface based actions. Of Off (or o) to not trigger any events.

By default, Stella Simulator will not make use of pause information in the model, this includes the pause interval and any events that might case the simulation to pause, or to stop.

-ph arg Name of file to use for pause/resume handshakes

Causes Simulator to wait for a handshake confirmation before continuing after a pause. The handshake is done by updating the file named by arg. This file must exist or this option will be ignored.

Each time a run is paused, Simulator will empty the content of the file (leave a file of size 0) and wait for the file to change to a nonzero size before proceeding.

Writing anything into the handshake file (for example, 1) will cause the run to resume. Writing a value of **#** (and nothing else such as a new line) will stop the current run.

If the -pd option is used then Simulator will wait no more than that amount of time before proceeding. If the -d option is not specified there is no timeout, Simulator will simply wait till the file is updated, or the process is killed.

By default, Simulator will proceed directly after a pause waiting only if -d is specified.

-ps arg Name of the status file

Use this to have Simulator write out a Status file every time a run pauses or is completed. Provide the name of the status file in arg.

The status file is a tab delimited file containing information about the state of the simulation. For example:

State: Paused
Time: 5.25
RunCount: 0
Event1: From: varname Text: pause at 5 from model

 

State: specifies the state the model is in. The value will be either Paused or Stopped.

Time: shows the time at which the simulation paused or stopped.

RunCount: show the number of runs the preceded the current run (the same as the RUNCOUNT Builtin).

Event1: shows the action for the simulation event that was triggered. This will only be present if the simulation paused or stopped because of a simulation event. If there are multiple actions there may be an Event2, Event3 and so on. Following the event number is From: followed by the name of the variable that triggered the event. After that the event action type is displayed. This will be one of Text, Image or Video.

Text indicates that the action is a text display. The text that would be displayed will follow.

Image indicates that the action is the display of a picture. The name (usually with path) of the image file that would be displayed will follow.

Video indicates that the action is the display of a video. The name (usually with path) of the video file that would be displayed will follow.

 

-i Import now before each run

If -i is specified than imported files that are enabled, but marked On Demand (see Import Data dialog box) will be imported before each run. This would have the same effect as marking the links Dynamic.

-x Export now after each run

If -x is specified than exported files that are enabled, but marked On Demand (see Export Data dialog box) will be exported after each run. This would have the same effect as marking the links Dynamic.

-ld filename(sheetname) Load Data from the file as a run

If -ld is specified, data from filename will be loaded as a run. If the file is an Excel file specify a sheet by enclosing its name in parentheses(e.g. mydata.xlsx(Sheet1)). If the sheet name is omitted the first sheet will be used. The data will be loaded as a run and given the same name as the file name. If a run with that name already exists, it will be overwritten. This option can be quite useful when performing calibration as it allows you to update the calibration data without reopening the model in Stella Professional or Architect.

-0 arg Set specified variable to 0 before first run

Set the variable specified in arg to the value of 0 in all model runs. This value will take precedence over any change that might occur in import files, unless the import file is marked Set Parameters and the variable is a constant.

You can specify multiple variables using -0 but each must be preceded by -0 (for example, -0 a -0 b -0 c).

-1 arg Set specified variable to 1 before first run

Set the variable specified in arg to the value of 1 in all model runs. This value will take precedence over any change that might occur in import files, unless the import file is marked Set Parameters and the variable is a constant.

You can specify multiple variables using -1 but each must be preceded by -1 (for example, -1 a -1 b -1 c).

-q Quiet mode

Minimize the amount of output that is sent to the console. Error messages will still be shown.

For examples of using some of these arguments see Stella Simulator Use Examples.