skip to main content
Rules and Rulesets
A single rule consists of one or more logical statements which assign values to one or more slots in the model. The rule is written in a special language, the RiverWare Policy Language (RPL). The rule’s logic may reference the current state of the model—determined from the values in slots—to decide if, and to what value, slots are assigned.
 
Rule
A rule is a statement, formulated in the RiverWare Policy Language, which assigns values to one or more series slots in the model based on logic within the statement and possibly based on the values of slots in the model.
Note:  Rules can assign values on series slots only. If you wish to set values on table slots, use Initialization Rules; see Initialization Rules Set in RiverWare Policy Language (RPL) for details.
Rules are designed and constructed by modelers to mimic policy and decisions which would normally be implemented in scheduling river and reservoir operations. Ideally, each rule represents a specific operating policy. The set of rules represents the entire operating policy for the basin. In order to resolve conflicting policy in rules, the modeler gives each rule a unique priority relative to the other rules. Higher priority is indicated by a smaller number; i.e., priority #1 is higher than priority #2.
 
Ruleset
A ruleset is a set of prioritized rules which together constitute the operating policy for the modeled basin and which, along with user inputs, provide the information needed to solve the simulation.
A simple guide curve rule for a reservoir is shown below. This rule looks at the Spill slot on the Hoover Dam object at the current timestep. If there is no spill, the rule reads the Guide Curve Elevation from a data slot and sets Hoover Dam’s Pool Elevation equal to it. If, however, Hoover Dam is spilling, then the rule has no effect.
 
Example 2.1   
HooverDam.Pool Elevation = IF (HooverDam.Spill = 0.0 [cfs]) THEN
HooverDamData.Guide Curve Elevation[]
The format of the rule may look unusual if you are accustomed to programming in languages such as FORTRAN and C++. In those languages, it is normal to put the assignment statement within the logic (inside the THEN clause of the IF statement). In RPL, all slot value assignments are made at the top level of the rule. The slot being assigned a value appears on the left-hand side (LHS). The right-hand side (RHS) is a logical construct which evaluates to a single value or to nothing.
Revised: 01/05/2024