Note: This is documentation for version 5.4 of Source. For a different version of Source, select the relevant space by using the Spaces menu in the toolbar above

E2CommandLine

Plugin was written by Robin Ellis (Unlicensed) before Source had it's own Command line functionality.  It is still used by some modellers.

General Info

LicenseAs-is, use at your own risk
Typefree
Current version1.0

Plugin Description

E2CmdLine is a non GUI version of Source suitable for running in a DOS batch script
It was developed to allow the fast semi-automated running of hundreds of scenarios to enable better calibration of E2. It has been successfully used withPEST (Parameter Estimator) in this manner

  • E2CmdLine works the same as if you had loaded an e2proj, opened the 1st scenario in it, and clicked on Run.
  • By default it does not save the results of the run to the e2proj file, instead specially selected outputs are written to a text output file.
  • it has 3 required parameters
    • the name and path to the project file
    • the name and path of a configuration file
    • the name and path of an output file
  • It also has several optional parameters, these are described in Advanced Use
  • It ONLY operates the first Scenario in any given project
E2CommandLine.exe  {project_file} {config_file} {output_file} 
 
e.g.
  E2CommandLine.exe D:\data\Scenario1.rsproj D:\data\run15_config.txt D:\data\Scenario1_run15_output.txt
 
Or
  E2CommandLine.exe D:\data\Scenario1.rsproj D:\data\run15_config.txt D:\data\Scenario1_run15_output.txt SAVE/NOSAVE + OTHER COMMANDS
 

project file

This should be a complete ready to run project file, however some parameter settings can be overwritten by information in the configuration file.

output file

Specially selected outputs (set in the configuration file) are written to this file. These outputs may be either TimeSeries or single values

Elem. Type,Elem. Name,Output Property,Constituent,Other Identifier
1/01/1950, 0
2/01/1950, 0.0480043537184739
3/01/1950, 0.218920031290215
4/01/1950, 0.539469365034394
5/01/1950, 0.855194375932109
…
…
Next element,…,…,..
…
…

An alternative (space delimited) output file format is available using the SMPFORMAT trigger, which may facilitate post-model processing. However, it loses reference to the constituent or flow item requested, and as such may be difficult to interpret. This is why the ‘Other Identifier’ key is used in recording statements, so that you may more easily track outputs:

ID1 01/01/2011 12:00:00 0

ID1 02/01/2011 12:00:00 0

ID1 03/01/2011 12:00:00 0.150528112139918

Other Identifier 01/01/2011 0.2014375

Other Identifier 02/01/2011 0.3284236

…

configuration file

The config file has many possible sections. E2CommandLine processes the config file line by line, starting at the first line. Each line is processed according to the methods associated with the most recently processed ‘Flag’ line. This means your config file MUST use a recognised ‘Flag’ command on the first line, and must supply a new Flag each time the user wants to begin processing config file instructions differently.


Each ‘key’ used in a config file is separated by a comma, and white spaces will be ‘trimmed’ before processing of each key supplied.

 

Additionally, the hash symbol (#) identifies a line as containing comments, not to be processed by E2CommandLine.

Available Flag commands are:

  • SET which allows parameters to the rainfall-runoff models to be set
    • overrides the values in the e2proj file
    • one line per variable to be set
    • requires necessary key fields (identifiers)
    • The order and composition of the identifiers is important, and will vary depending on the output type requested, and the element to which it belongs
    • There are also special commands available to apply values to some aspects of Storage models, not outlined in this document.
  • GET turns on the recording and writing of selected outputs to the output file
    • one entry is required per output to be logged
    • works independently of the normal logging methods
    • outputs can be either static or time-series
    • Outputs to record are identified specifically, using comma-separated identifiers
    • The order and composition of the identifiers is important, and will vary depending on the output type requested, and the element to which it belongs
    • Outputs may be recorded from the network element (node, link etc), or from models owned by these elements (eg a Node Model)
    • The properties of a sub-model may be identified for recording by naming the model AND the property, separated by a ‘!’ symbol.
    • Eg, the Downstream Flow of a node may be identified as either of the following
      • ..,…,Downstream Flow,Flow,…,…
      • ..,..,..Node!Downstream Flow,Flow,…,…
    • Alternatively, the output from a Node Model may be identified as
      • ..,..,Loss!Loss Volume,…,..,..

 

  • SUB allows users to ‘substitute’ Time Series from an identified location to a particular network element or model
    • For example, substituting a different rainfall sequence in an identified Rainfall Runoff Model
    • The importer knows nothing of supplied or expected units, it is up to the user to supply values in the correct units.
    • There are also special commands available to apply characteristics to some aspects of Storage models from CSV files, not outlined in this document.

 

  • NEWNODEMODEL allows users to apply new instances of node models
    • It may be necessary to use SET and/or SUB commands to then populate the model

 

  • REMOVENODEMODEL allows users to remove instances of node models

 

  • ALTERROUTING allows user to change the flow routing model assigned to a link

 

Example
SET
# Set the values of parameters you want changed.
# element type, model type, catchmentName, functionalUnitName, modelName, contaminantName, memberName, value
StandardFunctionalUnit,RainfallRunoffModel,SC #213,Residential,SimHyd,Recharge coefficient, 0.11
StandardFunctionalUnit,RainfallRunoffModel,SC #213,Residential,SimHyd,Baseflow coeff., 0.25
StandardFunctionalUnit,IAggregatedConstituentModel,SC #213,Residential,TSS,EMC/DWC,EMC, 320
StandardFunctionalUnit,IAggregatedConstituentModel,SC #213,Residential,TSS,EMC/DWC,DWC, 21
Link,AbstractFlowRouting,Generated link name #213,Laurenson,k, 1.8
Link,AggregatedInstreamProcessingModel,Generated link name #1,Cons. Name,Model NameParam Name,23
Link,AbstractFlowRouting,Generated link name #213,Laurenson,m, 1.1
GET
# Turn on the reporting of selected timeseries
Node,Outlet Node,Downstream Flow,Flow,Out_FLOW
Node,Outlet Node,Downstream Flow,TP,Out_TP
Node,Node on catchment SC #3,Loss!Loss Volume,,N3_LOSS
FunctionalUnit,SC #1,FU1,Quick Flow,Flow,SC1-FU1-QF
FunctionalUnit,SC #1,FU1, SIMHYD!runoff,Flow,SC1FU1RUN
FunctionalUnit,SC #1,FU1,SIMHYD!rainfall,NoConst,SC1FU1RA
FunctionalUnit,SC #1,FU1,EMC/DWC!quickflowConstituent,TSS,SC1QFTSS
Subcatchment,SC #1,Outflow,Flow,SC0-OUTF
Link,link for catchment SC #1,Link!Downstream Flow,Flow,L1_FL
Link,link for catchment SC #1,Link!Downstream Flow,TN,L1_TN
NEWNODEMODEL
Node,NodeModel,Node on catchment SC #177,Time Series Order
REMOVENODEMODEL
Node,NodeModel,Node on catchment SC #177,Time Series Order
ALTERROUTING
Link,AbstractFlowRouting,link for catchment SC #991,Storage
Link,AbstractFlowRouting,link for catchment SC #12,Laurenson Flow Routing
SUB
Node,NodeModel,Node on catchment SC #177,Time Series Order,Order,D:\Path\File.csv
#
# make sure you have a couple of comment lines at the end of the file
# As TIME does not always read the very last line in a file correctly
 

Advanced Use

These options can be applied in any order, AFTER the required executable, project file, config file and output file are given.

Parameter Name

Possible values

Comments

Mode

SINGLE

Project/scenario is opened, config file assessed, scenario runs once before closing (saving if instructed). This is the default option.

 

MULTIPLE

Project/scenario is opened, all config files matching a naming convention are assessed with a model run and an output, then closed (saving last configuration if instructed).

 

STAYALIVE

Project/scenario is opened, all config files matching a naming convention are assessed with a model run and an output, with the program then waiting for new config files matching the naming convention, which will be run if found, finally closing if a config file containg the word HALT is processed.

SaveProject

NOSAVE

This is the default option

 

SAVE

 

 

NEWFILENAME

Operates a ‘Save As’ if used with the SAVE command

NEWFILENAME=X:\Path\NewFile.rsproj

IgnoreRecorded-Properties

IGNORE

Default. Any recording options ‘saved’ into the scenario are ignored.

 

USE

Not guaranteed to work…

RunScenario

RUN

This is the default.

 

DONTRUN

The config file will be processed, but the scenario will not run (although an output file may be created, so be careful not to overwrite results you may have wanted to save)/

Verbose

VERBOSE

Default

 

QUIET

Less messages

Output Format

SMPFORMAT

Changes the output format

Run Period

PERIODSTART

Assigns a different start date for the model run, if the supplied date falls AFTER the automatically assessed start date

PERIODSTART=DD/MM/YYYY

 

PERIODEND

Assigns a different end date for the model run, if the supplied date falls BEFORE the automatically assessed end date

PERIODEND=DD/MM/YYYY

Source Code

Source code available: hg.ewater.com.au/SourcePlugin.E2CommandLine

Â