Stateflow | ![]() ![]() |
Processing Events with an Inner Transition in an Exclusive (OR) State Example
This example shows what happens when processing three events using an inner transition in an exclusive (OR) state.
Processing One Event in an Exclusive (OR) State
This example shows the behavior of an inner transition.
Initially the Stateflow diagram is asleep. State 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 (durA()
) execute and complete.
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.
This sequence completes the execution of this Stateflow diagram associated with event E_one
.
Processing a Second Event in an Exclusive (OR) State
Using the previous example, this example shows what happens when a second event E_one
occurs.
Initially the Stateflow diagram is asleep. State 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 with the following steps:
A
exit actions (exitA()
) execute and complete.
A
is marked inactive.
A_one
is executed and completed.
B
is marked active.
B
entry actions (entB()
) execute and complete.
This sequence completes the execution of this Stateflow diagram associated with event E_one
.
Processing a Third Event in an Exclusive (OR) State
Using the previous example, this example shows what happens when a third event, E_two
, occurs.
Initially the Stateflow diagram is asleep. State 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:
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 (exitB()
) execute and complete.
B
is marked inactive.
A_four
, executes and completes.
B
is marked active.
B
entry actions (entB()
) execute and complete.
This sequence completes the execution of this Stateflow diagram associated with event E_two
. This example shows the difference in behavior between inner and self-loop transitions.
![]() | Inner Transition Examples | Processing Events with an Inner Transition to a Connective Junction Example | ![]() |