skip to main content
Solution Approaches : Rulebased Simulation : Resetting Slot Values
Resetting Slot Values
In simulation, if a slot is reset, the value must come from the same source as the previous value. (The three possible sources are user input, link propagation, or the object’s dispatch method.) This is required in simulation because when objects resolve due to inter-object iterations, they must solve for the same set of known and unknowns each time. Violation results in an over-determination error.
In rulebased simulation, however, the objects need the flexibility to solve with different sets of inputs and outputs in response to new values which may be set by the rules. To accomplish this, slot values in rulebased simulation may be reset from any source.
There are, however, restrictions on the setting of a slot value in rulebased simulation. The criteria used to determine whether a slot assignment can be made are as follows:
• Values with an I flag (user input) can never be overwritten.
• Values that have neither an I flag nor an R flag can always be overwritten.
• Values that have an R flag but not an I flag can be overwritten depending on the new value and new priority.
– If the new value does not have an R flag, the existing value can be overwritten if the priority of the new value is higher than the existing one.
– If the new value has an R flag, the existing value can be overwritten if the priority of the new value is higher than or equal to the existing priority.
Note:  If the slot is part of an equivalent slot pair, the equivalent slot must also satisfy the requirement. If either slot fails the logical test, the new value is not assigned.
Table 2.1 summarizes this logic, and Table 2.2 provides examples.
 
Table 2.1  Rules for resetting an existing value in a slot
Existing Value Rules Flag = I
Existing Value Rules Flag = R
Slot Can be Reset
Rule Logic
Yes
No
Never
Never reset slot IF:
old value rules flag* = I
No
No
Always
Always reset slot IF:
old value rules flag* !=R
No
Yes
Depends on new value and priority
Reset slot IF:
old value rules flag* = R AND
new value rules flag !=R AND
new value priority is higher than old value priority
No
Yes
Depends on new value and priority
Reset slot IF:
old value flag* = R AND
new value flag = R AND
new value priority is higher than or equal to old value priority
Example 2.4   
 
Table 2.2  Example slot value reset attempts
Existing Value Priority
Proposed Value Priority
Result of Attempted Assignment
3
1
Successful
1
3
Successful
6R
4
Successful
4R
6
Unsuccessful
4R
4
Unsuccessful
6R
4R
Successful
4R
6R
Unsuccessful
4R
4R
Successful
0
7
Unsuccessful
0
7R
Unsuccessful
Multi Slot Behavior
In addition to the Series Slot logic described above, Multi Slots have special logic for handling the solution of their subslots. Remember that a multislot adds a subslot for each link and that the multislot is always the total of the subslots, as in the diagram below. A single unknown, either the multislot or one of the subslots, may be solved for from the known information.
In the sample multislot in Table 2.3, the Total column could be solved for if both of the Link columns have values. Likewise, either of the Link columns could be solved for if the Total column and the other Link column have values.
 
Table 2.3   
Total (Multislot)
Link #1 (Subslot 1)
Link #2 (Subslot 2)
NaN
15
NaN
NaN
NaN
10
25
15
10
When there is only one unknown among the multislot and the subslots, it is solved. Once all subslots and the multislot are known and one of them gets a new value, a decision must be made as to which values to retain and what value to recalculate. That decision is based on which slot was solved for the last time and the priorities of each subslot:
1. If the subslot which receives a new value is not the subslot which was solved for the last time, the multislot resolves for the same subslot as the last time.
2. If the subslot which receives a new value is the subslot which was solved for the last time, the multislot resolves for the subslot with the lowest priority.
3. If there are several subslots at the lowest priority, and these slots cannot be further prioritized by the presence of R flags, the multislot is overdetermined. In this case, an error is posted and the run stops.
In all cases where a subslot is solved for, this subslot is assigned the same priority and R flag status as the subslot which originally received a new value.
Example 2.5   
Consider the following multislot, with priorities of values in parentheses.
 
Total (Multislot)
Link #1 (Subslot 1)
Link #2 (Subslot 2)
NaN
15 (3)
NaN
Rule #2 sets a new value on the other side of link #2. The new value propagates across the link to Subslot 2.
 
Total (Multislot)
Link #1 (Subslot 1)
Link #2 (Subslot 2)
NaN
15 (3)
10 (2R)
There is only one unknown (the Total column), so the multislot solves and sets the same priority on the solved-for slot as the slot which received a new value.
 
Total (Multislot)
Link #1 (Subslot 1)
Link #2 (Subslot 2)
25 (2R)
15 (3)
10 (2R)
If a new value were to come across either Link #1 or Link #2, the multislot would simply solve for a new value in the Total column and assign it the same priority and R flag status as the new value.
Imagine instead, that Rule #1 sets a new value on the multislot Total column.
 
Total (Multislot)
Link #1(Subslot 1)
Link #2 (Subslot 2)
20 (1R)
15 (3)
10 (2R)
Since the new value is on the slot which was last solved for, the multislot must solve for the lowest priority subslot. In this case, Subslot 1 would be solved for, and the priority and R flag status of the Total would be assigned to it.
 
Total (Multislot)
Link #1 (Subslot 1)
Link #2 (Subslot 2)
20 (1R)
10 (1R)
10 (2R)
Link Behavior
Priorities and R flags are maintained across links. Whenever a value is set on one end of a linked slot, the value, priority, and R flag (if present) are assigned to the slot on the other side of the link. Likewise, multislots propagate their priorities and R flags across their links when they solve.
Revised: 08/02/2021