Solution Approaches : Rulebased Simulation : Slot Priorities and Flags
Slot Priorities and Flags
Whenever a slot value is set in rulebased simulation, a priority is assigned to the value. This is termed the slot priority and can be displayed on the slot using the View, then Show Priorities menu. It indicates the priority associated with a specific value in a single timestep of a slot. The slot priority is the controller priority in effect when the slot is set. Thus, slots that are set during simulation have the priority of the last rule that succeeded. Slots that are set by rules have the priority of the rule that set them.

 Slot priority The slot priority at each timestep is the priority associated with the value in the slot. It is the priority of the controller when the slot value is set in simulation, or of the rule that set the slot value, if the slot is set directly by a rule.
In simulating the effects of a rule, the slot priorities propagate the rule priority along with the values which result from the rule’s slot assignment. Slot priorities are used to determine how an object will solve and whether or not the slot value may be overwritten by values at other priorities.
User Input Flags and Priorities.
User input values are assigned the highest priority of 0. These values may never be overwritten during a run. In rulebased simulation, just as in simulation, user inputs are displayed with an I flag. Default slot values set in Beginning of Run and Beginning of Timestep also have a priority of 0, the controller priority when these methods execute. This priority is assigned because default values (usually 0.0) are filled in as a convenience where a user has deliberately chosen not to input a required value.
R Flag
Slot values set by a rule are assigned the priority of the rule which set them (an integer greater than zero). In addition to a numerical priority, slots which are directly set by a rule are displayed with a special flag, the R flag. It is indicated by the letter R next to the slot value in the Open Slot dialog. If a linked slot is set by a rule and gets an R flag, the propagated value on the other side of the link also displays the R flag.
Slots which have an R flag are more important than slots at the same priority without an R flag. This difference is discussed in more detail below.
Equivalent Slots
Some slots in RiverWare have an equivalence relationship with another slot. This means that the values of both slots are related by a function which does not change during the run. For a given value in one slot, there can be only one value in its equivalent slot. Knowing the value of one slot is tantamount to knowing the value of both slots. Pool Elevation and Storage are equivalent slots. The values of Pool Elevation and Storage are related via the Elevation Volume Table.
When a rule sets a value on a slot which is part of an equivalent slot pair, it is essentially determining the value of the equivalent slot as well. For this reason, both slots are assigned the priority of the rule. The slot whose value is being set is assigned an R flag, but the equivalent slot is not. This is because the value of the equivalent slot will not be known until it is solved for during the dispatch. The equivalent slot’s value was not truly set, so it is not assigned an R flag.
When dispatching, if a value is set on a slot which is part of an equivalent slot pair, the slot is assigned the priority of the equivalent slot, regardless of the controller priority. For example, if Pool Elevation is a user input it will have a 0 priority and an I flag. If rule 1 sets Inflow, then the object can dispatch given Inflow (at a priority of 1) and Pool Elevation (at a priority of 0). All slots set as a result of dispatching will receive a priority of 1 because that is the controller priority (the priority of the last rule that successfully fired). However, the Storage slot will not receive a priority of 1. It will receive a priority of 0 because that is the priority of the Pool Elevation slot, which is the equivalent slot.
To summarize, slot priorities and flags are assigned to slot values as follows:
• 0 priority and I flag for slots set by user input.
• 0 priority for equivalent slots of slots set by user input.
• 0 priority for slots set in Beginning of Run and Beginning of Timestep (defaults).
• # priority and R flag for slots set by a rule (where # is the rule’s priority).
• # priority for equivalent slots of a slot set by a rule (where # is the rule’s priority).
• # priority for slots set during a dispatch (where # is the controller priority).
Revised: 08/02/2021