Rulebased Simulation
Due to many changes in the Rulebased Simulation Controller and Rule Processor over the past several releases, an overview is included at the end of these release notes. See the overview for a complete picture of the current Rulesbased Simulation logic.
Maximum Rule Execution Iterations
The Rulebased Simulation controller now keeps track of Rule execution iterations. The iteration count is used to interrupt a run if a Rule executes more than 50 times in a single timestep. Previously, there was no way to interrupt infinite loops in the iteration between Rules and Simulation.
Group Set of Slot Assignments
Checking of dispatch conditions is now delayed until all of a Rule’s slot assignments have been made. Previously, objects checked their dispatch conditions whenever a dispatching slot value was set. For Rules which only set a single slot, this created no ambiguity. For Rules which set multiple slots, however, this allowed objects to be placed on the dispatch queue even if the Rule had other slots yet to be set on this object. In some cases, the slots remaining to be set would have forced a different dispatch method to be selected. To alleviate any ambiguity, dispatch conditions are no longer checked until all of a Rule’s slot assignments have been made.
Simulation Errors During Rule Execution
Errors generated during Rule execution calls to Simulation functions no longer abort the run. Errors are now returned to the Rule Processor for interpretation. Previously, any error generated in a Simulation engineering function which was called during the execution of a Rule automatically posted a message and aborted the run (the Simulation Controller still behaves this way). The Rule Processor, however, now catches simulation errors and terminates the executing rule instead. The rule does not continue, and no slot assignments are made. The rule may re-fire at a later time.
RiverWare Tcl procedures which invoke methods on the Engineering Objects are prevented from aborting the run. Since these functions solve hypothetical problems for the rules only and do not set slots, their failure should only impact the currently executing rule. All Tcl procedures, however, will continue to abort the run if fundamental errors are detected (incomplete arguments, invalid dates/times, etc.). The effects of errors in each of the currently defined Tcl procedures included in RiverWare are as follows:
RiverWare Tcl Procedure | Effect of Error | RiverWare Tcl Procedure | Effect of Error |
---|
C_SolveInflow | Terminate Rule | all C_<Get/Set><Value/List> | Abort Run |
C_SolveOutflow | Terminate Rule | C_IsNaN | Abort Run |
C_SolveStorage | Terminate Rule | all C_Sum<Table/Object>List | Abort Run |
C_TableInterpolate | Terminate Rule | C_Exit | Abort Run |
C_StorageToArea | Terminate Rule | C_GetAllNamedBasins | Abort Run |
C_ElevationToArea | Terminate Rule | C_GetObjectsInBasin | Abort Run |
C_ElevationToStorage | Terminate Rule | all C_AggOver<Obj/Time> | Abort Run |
C_ElevationToMaxRegulatedSpill | Terminate Rule | C_ConvertValue | Abort Run |
C_ElevationToUnregulatedSpill | Terminate Rule | C_FlowToVolume | Abort Run |
C_OperatingHeadToMaxRelease | Terminate Rule | C_VolumeToFlow | Abort Run |
C_GetMaxOutflowGivenInflow | Terminate Rule | all C_CopySlot<s> | Abort Run |
C_GetMaxOutflowGivenStorage | Terminate Rule | all C_ConstrainSlot | Abort Run |
C_GetMaxOutflowGivenHW | Terminate Rule | all C_Get<Date/Time> | Abort Run |
C_NetNonShortDiversionRequirement | Terminate Rule | all C_Incr<Date/Time> | Abort Run |
C_Six02a | Terminate Rule | all C_Decr<Date/Time> | Abort Run |
C_CriticalPeriodUBDepletions | Terminate Rule | all C_<reset>RandDev | Abort Run |
C_TargetSpace | Terminate Rule | C_GetStepSeconds | Abort Run |
C_MaxAllowableStorage | Terminate Rule | C_Min | Abort Run |
C_ReleaseNeeded | Terminate Rule | C_Max | Abort Run |
C_InflowAbove | Terminate Rule | C_Print | Abort Run |
C_ConsumptionAbove | Terminate Rule | C_Trace | Abort Run |
C_PredictedInflow | Terminate Rule | | |
Average Pool Elevation for Max Outflow Tcl Routines
The average Pool Elevation over the current timestep is now used to determine the maximum Release and Spill for C_getMaxOutflowGiven<Inflow/Storage/HW> Custom Tcl Routines. Previously, the Pool Elevation at the end of the current timestep (current Pool Elevation) was used. Now, the Pool Elevation at the beginning of the current timestep (previous Pool Elevation) is averaged with the most recent estimate of the Pool Elevation at the end of the current timestep. This average elevation is used in the Max Release/Max Turbine Q, Unregulated Spill Table, and Regulated Spill Table (if applicable) to determine the maximum Outflow.
getMaxOutflowGivenInflow Tcl Routine
The getMaxOutflowGivenInflow Custom Tcl Routine has been modified to not require a Pool Elevation value as a seed to the iterative solution. The new arguments for this function are as follows:
• C_getMaxOutflowGivenInflow reservoir inflow inflowScale inflowUnits
• outflowReturnScale
• outflowReturnUnits