Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The riversystem.commandline.exe provides a mechanism to run existing projects without the Source interface. It is possible to modify or change the behaviour of the project from the command line, by changing the values of global expressions. Results can be returned for recorded items or global expressions within the project.

 riversystem.commandline.exe is included with Source.

...

  • For batch runs, where Source is run many times with a range of different parameter values; or
  • Optimisation scenarios and when ; and 
  • When integrating Source with other models or business systems.

The command line can be used in either a standalone (in-process) mode or in a client/server configuration. When run in client/server mode, the Source project is loaded and run at the server side, with parameters provided by and results returned through a separate the client. In this way, the server can be used for many runs of the same project, without needing to reload the project file each time.

...

Figure 1. Manipulating global expressions

The Metaparameter MetaParameter Explorer) can  can be used to attach global expressions directly to model variables for situations where the Function Editor has not been enabled by default.

...

You can run a project in the following modes:

  • Standalone mode - the – the project loads; the simulation runs with a single line command:
Code Block
RiverSystem.CommandLine -p C:\Temp\ExampleProject.rsproj
  • Client/server mode - one – one command line runs projects. It does anything except for loading a project until a second command line is run in client mode. In this way, multiple runs can be completed with the server loading the project only once. It also enables the server to run on a different machine to the client. The examples provided assume a client/server mode, illustrating the calls made by the client. They could also work in standalone mode. Refer to Advanced configuration options for two options available in this mode.
Info
iconfalse
Note: When working with functions in the command line, ensure that functions are referenced by their full name to avoid errors or run failures. The syntax for referencing a function by its full name is $Folder.Function. For example, use Riversystem.CommandLine.exe -v "$Folder1.Function1=10.

Retrieving results

...

Retrieving results

By default, all recorded items are returned, as configured from within the Source application (Running scenarios). Alternatively, you can specify specific items to record by using a command line argument:

...

In client/server mode, results are always computed on the server, but returned through the client. By default, results are displayed on the console (in both standalone and client modes), but it is possible to save the results directly to a file using the following command (file name is resultsfilename.csv):

Code Block
RiverSystem.CommandLine -m Client -o resultsfilename.csv

Modifying parameters

To modify parameters in the model, they need to be set up as functions. This can be done in one of three ways:

...

name is resultsfilename.csv):

Code Block
RiverSystem.CommandLine -m Client -o resultsfilename.csv

Modifying parameters

To modify parameters in the model, they need to be set up as functions. This can be done in one of three ways:

Info
iconfalse

Note: When working with functions in the command line, ensure that functions are referenced by their full name to avoid errors or run failures. The syntax for referencing a function by its full name is $Folder.Function. For example, use:

RiverSystem.CommandLine -v "$Folder1.Function1=10"

Use the -v argument to assign parameter values:

...

Code Block
RiverSystem.CommandLine -m Client -v "$metaParam=2.5" -v "$anotherMetaParam=3.0".

Examples

The following set of examples indicate the type of commands used to run projects in the two modes.

...

Additional examples of running Source using a DOS batch file, a Python script or an R script can be found here.

Anchor
AdvancedConfiguration
AdvancedConfiguration
Advanced configuration options

In the client/server mode, there are two command line windows and riversystem.commandline.exe is run twice:

...