skip to main content
Rule Execution
When a rule executes, or fires, the rule is interpreted and logic of the rule is executed. Firing a rule does not imply that a slot value necessarily will be set. In the example above, if HooverDam.Spill is zero, the RHS evaluates to the Guide Curve Elevation. If, however, the spill is greater than zero, the RHS does not result in a value, and no assignment is made. It is also possible that the HooverDam.Spill slot does not have a value, in which case there is not enough information for the RHS to result in a value.
Firing of a rule only means that the rule’s logical expressions will be evaluated and that the evaluation may result in a slot value being set. There are three possible outcomes when a rule fires.
Early termination
A rule execution which terminates early is one in which there is not enough information to evaluate all of the rule logic. This happens when a referenced slot (a slot on the RHS), is NaN; i.e., it does not currently have a value. If this is the case in at least one of the slot assignments, the rule terminates and no attempt is made to set any slot. This is considered a normal termination and does not stop the run or generate any errors. If you wish the rule to stop the run when a NaN slot is found, use the Stop on NaN functionality; see Stop On NaN in RiverWare Policy Language (RPL) for details.
An ineffective rule execution is one in which the rule logic is completely evaluated (all referenced slot values are known), but no slot values are set. This can happen for the following reasons:
• The logic determines that no slot assignment is necessary because no value is returned by the RHS.
• A value is returned by the RHS, but the slot assignment fails because the slot has already been set by a higher-priority rule. If the rule contains multiple slot assignments and if at least one assignment fails due this reason, then none of the assignments are made.
A successful rule execution is one in which at least one slot value in the model is set by the rule. To be successful requires that all the following conditions are met:
• All the information needed to evaluate all of the assignments is available; i.e., no NaNs are encountered in reference slots.
• At least one of the assignments is effective (evaluates to a number).
• None of the assignments fails due to priorities.
Revised: 08/02/2021