WSSimObject
WSModelObject > WSBaseNetworkObject > WSNumbatNetworkObject > WSSimObject
A read-only network with simulation results.
Methods:
- gmr_summary_export
- list_results_attributes
- list_results_gis_export_tables
- list_timesteps
- results_binary_export
- results_csv_export
- results_csv_export_ex
- results_gis_export
- status
- success_substatus
- timestep_count
gmr_summary_export
#gmr_summary_export(folder) ⇒ void
EXCHANGE
, UI
In the folder, a CSV file will be written for each summary report that has been configured.
list_results_attributes
#list_results_attributes ⇒ Array<Array>
EXCHANGE
Returns attributes that can be exported using the #results_binary_export method, and returns arrays corresponding to the tabs of the result export dialog in the UI.
[
["Scalar", ["tdemand", "xdemand", "xferin", "xferout"]],
["Node", ["demand", "head", "pressure", "status"]],
["Link", ["flow", "headloss", "status"]]
]
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<Array> |
list_results_gis_export_tables
#list_results_gis_export_tables ⇒ Array<String>
EXCHANGE
Returns an array of the tables that may be exported to GIS using the #results_gis_export
method.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<String> |
list_timesteps
#list_timesteps ⇒ Array<DateTime>
EXCHANGE
Returns an array of the timesteps for the simulation.
results_binary_export
#results_binary_export(selection, attributes, file) ⇒ void
EXCHANGE
Exports the results at each timestep of the simulation in a binary file format - the format is documented elsewhere.
Parameters
Name | Type(s) | Description |
---|---|---|
selection | WSModelObject, String, Integer, nil | A selection list object as a wsmodelobject of the correct type, a scripting path, or a model id. if nil then the whole network will be exported. |
attributes | Array<String>, nil | Attributes to export, e.g. from the #list_results_attributes method, if nil then all attributes are exported. |
file | String | Filepath to export. |
results_csv_export
#results_csv_export(selection, folder) ⇒ void
EXCHANGE
Exports the simulation results in CSV format, corresponding to the CSV results export in the user interface.
Parameters
Name | Type(s) | Description |
---|---|---|
selection | WSModelObject, String, Integer, nil | A selection list object as a wsmodelobject of the correct type, a scripting path, or a model id. if nil then the whole network will be exported. |
folder | String | Folder to export the .csv files. |
results_csv_export_ex
#results_csv_export_ex(selection, folder, options) ⇒ void
EXCHANGE
Similar to #results_csv_export
, with an additional options parameter.
The options hash contains the following key:
Key | Type | Default | Description |
---|---|---|---|
Group By Time | Boolean | false | Results are grouped by time, similar to the option in the UI. |
Parameters
Name | Type(s) | Description |
---|---|---|
selection | WSModelObject, String, Integer, nil | A selection list object as a wsmodelobject of the correct type, a scripting path, or a model id. if nil then the whole network will be exported. |
folder | String | Folder to export the .csv files. |
options | Hash | Options hash, see description. |
results_gis_export
#results_gisexport(format, timesteps, options, folder) ⇒ void
EXCHANGE
Exports simulation results to a GIS data format, similar to the equivalent options in the user interface.
The options for timesteps are:
- nil - this is the equivalent of the 'None' options when selecting timesteps in the UI
- String 'All' - all timesteps, does not include maximum results unless included in the options hash
- Integer - timestep index, where 0 is the first timestep, and the last valid value is the number of timesteps - 1.
- Array<Integer> - array of timestep indexes, which must all be valid and cannot contain duplicates
The options hash contains the following keys:
Key | Type | Description |
---|---|---|
AlternativeNaming | Boolean | If this is set then the subfolders / feature datasets used for the export are given simpler but less attractive names which may be helpful if the aim is process the files with software rather than to have a user select and open them in a GIS package. The simple names are <model object id>_<timestep> with the timesteps numbered from zero as with the timesteps parameter of the method and with <model object id>_Max for the maxima.The default is to use the same naming convention as the UI. |
Feature Dataset | String | For GeoDatabases, the name of the feature dataset. The default is an empty string. |
Tables | Array<String> | Array of table names from #list_results_GIS_exports_table . Must all be valid, and cannot contain duplicates. |
Parameters
Name | Type(s) | Description |
---|---|---|
format | String | Export format, one of shp , tab , mif , or gdb . |
timesteps | String, Integer, Array<Integer>, nil | See description. |
options | Hash, nil | Hash of options (see description) or nil to use defaults. |
folder | String | The base folder for files to be exported, or path to the .gdb if format is gdb . |
status
#status ⇒ String
EXCHANGE
, UI
Returns the status of a simulation.
To monitor for completion of a simulation, the recommended approach is to use the #wait_for_jobs
method.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | String | One of none , active , success , or fail . |
success_substatus
#success_substatus ⇒ String?
EXCHANGE
Returns the simulation substatus if the sim was successful, one of Incomplete
, Warnings
, or OK
. Will be nil
if the sim was unsuccessful.
timestep_count
#timestep_count ⇒ Integer
EXCHANGE
Returns the number of result timesteps in the simulation. This will match the length of the array returned by #list_timesteps
.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Integer |