| Using Stateflow | Search  Help Desk |
Inner Transitions
Example: Processing One Event Within an Exclusive (OR) State
This example shows the semantics of an inner transition.
A is active. Event E_one occurs and awakens the Stateflow diagram. Condition [C_one] is false. Event E_one is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
.E_one. A potentially valid transition from state A to state B is
detected. However the transition is not valid because [C_one] is false.
.A during actions execute and complete (durA()).
.A checks its children for a valid transition and detects a valid inner
transition.
.A remains active. The inner transition action, A_two, is executed and
completed. Because it is an inner transition, state A's exit and entry actions
are not executed.
.E_one.
Example: Processing a Second Event Within an Exclusive (OR) State
Using the same example, what happens when a second event,E_one, occurs?
A is still active. Event E_one occurs and awakens the Stateflow diagram. Condition [C_one] is true. Event E_one is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
.E_one. The transition from state A to state B is now valid because
[C_one] is true.
.A exit actions execute and complete (exitA()).
.A is marked inactive.
.A_one is executed and completed.
.B is marked active.
.B entry actions execute and complete (entB()).
.E_one.
Example: Processing a Third Event Within an Exclusive (OR) State
Using the same example, what happens when a third event,E_two, occurs?
B is now active. Event E_two occurs and awakens the Stateflow diagram. Condition [C_two] is false. Event E_two is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
.E_two. A potentially valid transition from state B to state A is
detected. The transition is not valid because [C_two] is false. However,
active state B has a valid self loop transition.
.B exit actions execute and complete (exitB()).
.B is marked inactive.
.A_four, executes and completes.
.B is marked active.
.B entry actions execute and complete (entB()).
.E_two. This example shows the difference in semantics between inner transitions and self loop transitions.
Example: Processing One Event with an Inner Transition to a Connective Junction
This example shows the semantics of an inner transition to a connective junction.
A1 is active. Event E_one occurs and awakens the Stateflow diagram. Condition [C_two] is true. Event E_one is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
.E_one. There is no valid transition.
.A during actions execute and complete (durA()).
.A checks itself for valid transitions and detects there is a valid inner
transition to a connective junction. The conditions are evaluated to
determine if one of the transitions is valid. The segments labeled with a
condition are evaluated before the unlabeled segment. The evaluation starts
from a twelve o'clock position on the junction and progresses in a clockwise
manner. Since [C_two] is true, the inner transition to the junction and then
to state A.A2 is valid.
.A.A1 exit actions execute and complete (exitA1()).
.A.A1 is marked inactive.
.A.A2 is marked active.
.A.A2 entry actions execute and complete (entA2()).
.E_one when condition C_two is true.
Example: Processing a Second Event with an Inner Transition to a Connective Junction
This example shows the semantics of an inner transition to a junction when a second event,E_one, occurs.
A2 is active. Event E_one occurs and awakens the Stateflow diagram. Neither [C_one] nor [C_two] is true. Event E_one is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
.E_one. There is no valid transition.
.A during actions execute and complete (durA()).
.A checks itself for valid transitions and detects a valid inner transition
to a connective junction. The segments labeled with a condition are
evaluated before the unlabeled segment. The evaluation starts from a twelve
o'clock position on the junction and progresses in a clockwise manner. Since
neither [C_one] nor [C_two] is true, the unlabeled transition segment is
evaluated and is determined to be valid. The full transition from the inner
transition to state A.A3 is valid.
.A.A2 exit actions execute and complete (exitA2()).
.A.A2 is marked inactive.
.A.A3 is marked active.
.A.A3 entry actions execute and complete (entA3()).
.E_one when neither [C_one] nor [C_two] is true.
Example: Inner Transition to a History Junction
This example shows the semantics of an inner transition to a history junction.
A.A1 is active. There is history information since superstate A is active. Event E_one occurs and awakens the Stateflow diagram. Event E_one is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
.E_one. There is no valid transition.
.A during actions execute and complete (durA()).
.A checks itself for valid transitions and detects there is a valid inner
transition to a history junction. According to the semantics of history
junctions, the last active state, A.A1, is the destination state.
.A.A1 exit actions execute and complete (exitA1()).
.A.A1 is marked inactive.
.A.A1 is marked active.
.A.A1 entry actions execute and complete (entA1()).
.E_one when there is an inner transition to a history junction and state A.A1 is active.