Two separate when-equations or when-statements in different algorithm sections may not define the same variable. Without this rule a conflict between the equations will occur if both conditions would become true at the same time instant. This would happen for the erroneous model WhenConflictX below if we would have the same condition, e.g. time >= 1, in both when-equations since there are two equations: x = pre(x) + 1.5 and x = pre(x) + 1 that define the same variable x.
The multiple assignment conflict in the above example can be avoided by giving a higher priority to one of the defining equations through the elsewhen construct, as in the same example in converted form below. We have put both equations within the same when-equation and ordered the conditions in decreasing priority.
Eliminating the double definition conflict between equations in different when-equations in the WhenPriority model by giving the event at time = 2 higher priority than the event at
time = 1 through the use of elsewhen in the WhenPriorityX model.
However, note that multiple assignments to the same variable within an algorithm section are allowed since only the last assignment to the same variable in an algorithm section is counted.