Stateflow | ![]() ![]() |
Ordering Single Source Transitions
Transitions from a single source are ordered for testing according to the following three sorting guidelines, which appear in order of their precedence (first step is highest priority):
Ordering by Hierarchy
Transitions are evaluated in a top-down manner based on hierarchy. In the following example, an event occurs while state A1
is active.
Because state B
is a sibling of state A
and at a higher hierarchical level than state A2
, a sibling of A1
, the transition from state A1
to state B
takes precedence over the transition from state A1
to state A2
.
Ordering by Label
Transitions of equal endpoint hierarchical level are evaluated based on their labels, in the following order of precedence:
The following example demonstrates ordering of single source transitions by the angular surface position of the source.
Ordering by Angular Surface Position of Source
Equivalent transitions (based on their labels and the hierarchy of their source and endpoints) are ordered based on the angular position on the surface of the source object for the outgoing transitions.
Multiple outgoing transitions from states that are of equivalent label and source and end point hierarchy priority are evaluated in a clockwise progression starting at the upper left corner of the source state.
In this example, the transitions are of equivalent label priority. The conditions [C_two
== 2] and [C_three
== 3] are both true and [C_one
= = 1] is false. Also, the hierarchical level of the endpoint of each transition is the same because all the states in the example are siblings.
The outgoing transitions from state A in the preceding diagram are evaluated in the following order:
The angular position of the source point for the transition from state A
to state D
is 6 o'clock. This transition, even though it is valid, is not evaluated since the previous transition was taken.
Multiple outgoing transitions from junctions that are of equivalent label priority are evaluated in a clockwise progression starting from a twelve o'clock position on the junction.
In this example, the transitions are of equivalent label priority. Also, the conditions [C_three
== 3]and [C_four
== 4] are both true. Given that, the outgoing transitions from the junction are evaluated in this order:
C_one
== 1] is false, this transition is not valid.
C_two
== 2] is false, this transition is not valid.
C_three
== 3] is true, this transition is valid and is taken.
![]() | Executing a Set of Flow Graphs | Executing a State | ![]() |