skip to main content
Rulebased Simulation
Calling DMIs from rules
It is now possible to execute DMI groups from rules. The user can associate one or two DMI groups with a rule. Whenever the rule is executed, the DMI groups are executed, one as the first step of rule execution, one as the last. Values imported by the pre-execution DMI group are available for use by the rule’s statements. To add the execution of a DMI group, select rule --> add pre-/post-execution DMI group. (See the General RiverWare section above for an example application of this new feature.)
Flags set by rules
Whenever a rule sets the Drift, Max Capacity or Best Efficiency flag on a slot, RiverWare now requires that object to dispatch immediately. If it does not, RiverWare will post an error message and abort. Users should be able to resolve this error by reordering rules or restructuring the rule logic.
Check Iterations
‘Check Iterations’ is now always enabled during rulebased simulation. ‘Check Iterations’ checks the number of times a slot is set during one timestep and is used to detect infinite loops. Previously, having check iterations turned on slowed down model performance. Now there is no decrease in performance when Check Iterations is turned on.
Rules Palette Predefined Functions
Following is a brief description of new predefined functions and changes to existing predefined functions available for use in the RiverWare Policy Language. Details on the use of these functions and the syntax involved are available in the Rulebased Simulation Documentation in the RiverWare help.
RunStartDate()
RunEndDate()
These functions return the start or end date of the currently active controller.
NumColumns (SLOT tableSlot/periodicSlot)
NumRows (SLOT tableSlot/periodicSlot)
These functions return the number of columns or rows in a table slot or periodic slot. If the slot is not a table slot or periodic slot, the run is aborted with an error message.
TableLookup (SLOT tableSlot, NUMERIC lookupColumn, NUMERIC returnColumn, NUMERIC lookupValue, DATETIME referenceDate, BOOLEAN roundDown)
This function looks up a value in a specified column of a TableSlot, finding the row whose value is closest to the lookup value and smaller/larger as specified by an argument, and returns the value in that row of the specified column.
SovleMonthlyStorageAnnualTimestep(OBJECT reservoir, SLOT res inflow, SLOT res outflow, SLOT res previous storage, DATETIME month at which to do the calculation)
This function solves for a monthly storage value in an annual timestep model. The function was developed for use with the CRSS-Lite model but is general enough for use in any annual timestep model.
SolveMonthlyOutflowAnnualTimestep(OBJECT reservoir, SLOT res inflow, SLOT res storage, SLOT res previous storage, DATETIME month at which to do the calculation)
This function solves for a monthly outflow value in an annual timestep model. The function was developed for use with the CRSS-Lite model but is general enough for use in any annual timestep mode.
MeadFloodFontrol(STRING name of subbasin, DATETIME current timestep, SLOT previous Powell storage, SLOT current Powell storage, SLOT previous Mead storage, NUMERIC flood control release month index)
This function invokes the Mead Flood Control user method on the computational subbasin and returns the current storage in Mead. The function can only be used with the CRSS-Lite model because it requires that certain objects and slots, identified by name, be part of the model and computational subbasin.
SupplySlotsFrom (LIST object account pairs, STRING release type, STRING destination)
SupplySlotsFrom1to1(LIST object account pairs, STRING release type, STRING destination)
These functions return a list of Supply slots of Supplies which represent outflows from given Accounts and which have the indicated ReleaseType and Destination. The 1 to 1 version is used to return exactly one supply slot for each account. If there is more than or less than one supply for each account, the function will produce an error message and abort.
SupplySlotsFromIntra (LIST object account pairs, STRING release type, STRING destination)
SupplySlotsFromIntra1to1(LIST object account pairs, STRING release type, STRING destination)
These functions return a list of Supply slots of Supplies which represent internal flows from given Accounts and which have the indicated ReleaseType and Destination.The 1 to 1 version is used to return exactly one supply slot for each account. If there is more than or less than one supply for each account the function will produce an error message and abort.
SupplySlotsTo (LIST object account pairs, STRING release type, STRING destination)
SupplySlotsTo1to1(LIST object account pairs, STRING release type, STRING destination)
These functions return a list of Supply slots of Supplies which represent inflows to given Accounts and which have the indicated ReleaseType and Destination.The ‘1 to 1’ version is used to return exactly one supply slot for each account. If there is more than or less than one supply for each account the function will produce an error message and abort.
SupplySlotsToIntra(LIST object account pairs, STRING release type, STRING destination)
SupplySlotsToIntra11o1(LIST object account pairs, STRING release type, STRING destination)
These functions return a list of Supply slots of Supplies which represent internal flows to given Accounts and which have the indicated ReleaseType and Destination.The ‘1 to 1’ version is used to return exactly one supply slot for each account. If there is more than or less than one supply for each account, the function will produce an error message and abort.
Hypothetical Simulation
Diagnostic message changes
The diagnostic message format for HypSim has changed slightly. Previously the messages for a hypothetical simulation object were preceded by “object_HpySim:”. Now the messages are preceded by “HypSim:subbasin:object”.
Performance improvements
There have been significant performance improvements to the execution of hypothetical simulation. This is achieved by saving clones of subbasins and the recycling memory allocated to the subbasins’ series slots.
Revised: 07/05/2022