Versions Compared

Key

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

The riversystemRiverSystem.commandlineCommandLine.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 RiverSystem.commandlineCommandLine.exe is included with Source.

...

  • Standalone mode – the project loads; the simulation runs with a single line command:
Code Block
RiverSystem.CommandLine.exe -p C:\Temp\ExampleProject.rsproj
  • Client/server mode – 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.

...

Code Block
RiverSystem.CommandLine.exe -m Client -r "Inflow 1/Inflow Volume"

...

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

...

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.CommandLine exe -v "$Folder1.Function1=10"

...

  • Set the values: 

    Code Block
    RiverSystem.CommandLine.exe -m Client -v "$metaParam=2.5" 
  • Set multiple expressions:
Code Block
RiverSystem.CommandLine.exe -m Client -v "$metaParam=2.5" -v "$anotherMetaParam=3.0".

...

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

  • XML file: riversystemRiverSystem.commandlineCommandLine.exe.config - This file contains a section called <system.serviceModel> which can configure hundreds of options for the services and client including transport types, maximum data size, security etc. These are the default options used when running in client or server mode. The location of the server defined in this file, by default, is "localhost" which means the server and client are configured to run on the same machine.
    Option A - A project is loaded when the server starts (first command line) and is run in response to a client call (second command line):
Code Block
RiverSystem.CommandLine.exe -p C:\Temp\ExampleProject.rsproj -m Server
RiverSystem.CommandLine.exe -m Client
  • For testing purposes and ad-hoc configuration, two main command line options are also provided to configure the location/type of the server and message time out. When run in this mode the <system.serviceModel> section of the riversystemRiverSystem.commandlineCommandLine.exe.config file may need to be deleted as creating two servers of the same type is not supported. This means that the net.tcp server on localhost defined in the exe.config file will stop you creating an adhoc server of the same type.
    Option B - In the example below, the server starts without loading any project (first command line). The client then specifies the project, which gets loaded onto the server and runs immediately (second command line):
Code Block
RiverSystem.CommandLine.exe -m Server
RiverSystem.CommandLine.exe -m Client -p C:\Temp\ExampleProject.rsproj

...

 

Display option commands

Function

Example

-a, --address

Address for server to create, or client to connect.-a "net.pipe://localhost/PipeReverse" or "net.tcp://localhost:8523/eWater/Services/RiverSystemService"
-b, -baseSIUnitsIgnore units set within project and output base SI units--baseSIUnits
-c, --recordingFile to load state from when in client mode or file to save state in when in server mode.-c "c:\StateFiles\state.txt"
-d, --directoryDirectory to look for projects in.-d "c:\ProjectFiles"
-e, --timeoutOperation timeout for WCF service in seconds.-e 2000
-f, --settingFileFile to merge command-line settings from.-f "settings.txt"
-g, --getProjectDescriptionWrite the xml description of the project to the specified file name. If the -g parameter exists use the xpath to query and return a subset of the project description. The string arguement is the file name to the write the project details into. If used without the -x arguement all the project details are written-g "projectdescription.xml"
-l, --loadPluginThis option allows a plugin (that the project has been saved with) to be loaded for this run only. The path specified is a relative path to the plugin from the command line. e.g. "Plugins\ExampleRainfallRunoffModel.dll"-l "plugin.dll"
-m, --modeApplication mode Client/Server/InProcess.-m Client or -m Server
-o, --outputFile to save output into. The extension selects the output format based on the standard TIME I/O formats. A directory of the name specified will be created if the format only supports a single time series.-o "output.res.csv" for CSV or -o "output.nc" for NetCDF etc.

-p, --project

Path to project, or project name on server and optional scenario within that project, DateTime values to override the default start and end times of the loaded scenario and data source input set to run.

-p "projectName.rsproj" or -p "c:\somePath\projectName.rsproj;someScena
rioName" or -p "c:\somePath\projectName.rsproj;;1/1/2011;31/12/2011" or -p "c:\s
omePath\projectName.rsproj;;;;inputSetName"

-r, --results

Which results to return. This can appear multiple times.

Info
iconfalse
Note: By default, all recorded results are saved into the specified output file. When this options is used, it only allows you to reduce the number of results saved out. Requested results must be set to record in the project file. To specify the output file name, save the result to a file with a .res.csv extension. Use the column name for the time series.

-r "someResult" -r "someOtherResult"

-s, --stepNumber of time-steps to run.--step 1
-t, --resetReset the loaded project.--reset
-u, --currentReturn only the current time-step's value for the specified results--current

-v, --value

Set value of meta-parameter or internal setting.

-v "$metaparam=25", or -v "$anotherMetaParam=2.3"

-x, --xPathProjectDescription

An optional xpath used to query and return a subset of the project description. The string arguement can be empty in which case the full descripiton is returned. Data is written to file name specified with the -g arguement or a default file (ProjectDescription.xml).

-x "" or -x "//entity@name='Node'"

PEST calibration using the command line

PEST (Parameter ESTimation and uncertainty analysis) allows analysis of complex environmental models, and can be used in Source for calibration of catchments. You can use the command line to do calibration and uncertainty in a catchments model. The steps to do the calibration are as follows:

  • Starting with a Source Catchment project file, use the new calibration tool to set up ‘global expressions’ for the parameters of the rainfall runoff models. When defining the metaparameters in the Calibration Wizard, the list of Existing Metaparameters will be used in the parameter file for invoking riversystemRiverSystem.commandlineCommandLine;
  • Turn on any recorders for the hydrological quantities that will be used in the objective function. In step 4 of the Calibration Wizard, choose Manual optimisation and enable Create global expressions for use from an external tool;
  • Save the project;
  • Set up the RiversystemRiverSystem.Commandline CommandLine input file;
  • Setup the PEST input and template files;
  • Prepare a batch file to invoke the commandline and pre-processors; and
  • Run PEST.

Once the Calibration wizard has been set up, start the command line server (riversystemRiverSystem.commandline CommandLine -p projectname.rsproj -m server) and then PEST (pest pestcontrolfile.pst).

Batch running using the command line

Insert excerpt
SC:Batch running using the command line
SC:Batch running using the command line
nopaneltrue

Refer to this page in the Source community for details and an example.