...
...
...
...
...
...
...
...
...
...
...
...
...
...
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.
...
...
...
...
...
...
...
...
...
Server
This command starts a basic server on the same machine as the client:
Code Block |
---|
>RiverSystem.CommandLine.exe --mode server |
...
In this command, a basic server runs on the same machine as the client. This server will look for project files passed from the client in the directory "C:\ProjectDir":
Code Block |
---|
>RiverSystem.CommandLine.exe --mode server --d "C:\ProjectDir" |
...
The following command will start up a server, load a project from the directory C:\Users\man25n\Documents\eWater Source Projects using the address specified (net.tcp://192.168.1.5:8080/myWaterService/):
Code Block |
---|
>RiverSystem.CommandLine.exe --mode server -d "C:\Users\man25n\Documents\eWater Source Projects" -a "net.tcp://192.168.1.5:8080/myWaterService/" |
...
The address consists of the communication protocol (net.tcp) and the name of the end-point. For a machine that runs both the client and server, the address of the end-point must match.
Client
The following command assumes that the server is already running from the previous example:
Code Block |
---|
> RiverSystem.CommandLine.exe --mode client --d "C:\ProjectDir" |
...
Additional examples of running Source using a DOS batch file, a Python script or an R script can be found here.
...
In the client/server mode, there are two command line windows and RiverSystem.CommandLine.exe is run twice:
- XML file: RiverSystem.CommandLine.exe.config – This file contains a section called <system.serviceModel> that 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 RiverSystem.CommandLine.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 |
Option descriptions
Notice in the examples that the command line contains various options, which result in different outputs. The function of these options is provided in Table 1. Note that these are optional extras.
...
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, --baseSIUnits | Ignore units set within project and output base SI units | --baseSIUnits | |||||
-c, --recording | File to load state from when in client mode or file to save state in when in server mode. | -c "c:\StateFiles\state.txt" | |||||
-d, --directory | Directory in which to look for projects. | -d "c:\ProjectFiles" | |||||
-e, --timeout | Operation timeout for WCF service in seconds. | -e 2000 | |||||
-f, --settingFile | File to merge command-line settings from. | -f "settings.txt" | |||||
-g, --getProjectDescription | Write 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 argument is the file name to write the project details into. If used without the -x argument all the project details are written. | -g "projectdescription.xml" | |||||
-l, --loadPlugin | This 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. eg. "Plugins\ExampleRainfallRunoffModel.dll" | -l "plugin.dll" | |||||
-m, --mode | Application mode Client/Server/InProcess. | -m Client or -m Server | |||||
-o, --output | File 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 the 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 | |||||
-r, --results | Which results to return. This can appear multiple times.
| -r "someResult" -r "someOtherResult" | |||||
-s, --step | Number of time-steps to run. | --step 1 | |||||
-t, --reset | Reset the loaded project. | --reset | |||||
-u, --current | Return 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 argument can be empty, in which case the full description is returned. Data is written to the file name specified with the -g argument or a default file (ProjectDescription.xml). | -x "" or -x "//entity@name='Node'" |
...
...
...
...
...