Stateflow | ![]() ![]() |
Example: Default Transition in an Exclusive (OR) Decomposition
This example shows a transition from an OR state to a superstate with exclusive (OR) decomposition, where a default transition to a substate is defined.
Initially the Stateflow diagram is asleep. State 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 a valid transition from state A
to superstate B
.
A
exit actions execute and complete (exitA()
).
A
is marked inactive.
A
, is executed and completed.
B
is marked active.
B
entry actions execute and complete (entB()
).
B
detects a valid default transition to state B
.B1
.
B
.B1
is marked active.
B
.B1
entry actions execute and complete (entB1()
).
This sequence completes the execution of this Stateflow diagram associated with event E_one
.
Example: Default Transition to a Junction
This example shows the semantics of a default transition to a connective junction.
Initially the Stateflow diagram is asleep. State B
.B1
is active. An event occurs and awakens the Stateflow diagram. Condition [C_two
] is true. The event is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:
B
checks to see if there is a valid transition as a result of any event. There is none.
B1
during actions execute and complete (durB1())
.
This sequence completes the execution of this Stateflow diagram associated with the occurrence of any event.
Example: Default Transition and a History Junction
This example shows the semantics of a superstate and a history junction.
Initially the Stateflow diagram is asleep. State A
is active. There is a history junction and state B4
was the last active substate of superstate B
. 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 valid transition from state A
to superstate B
.
A
exit actions execute and complete (exitA()
).
A
is marked inactive.
B
is marked active.
B
entry actions execute and complete (entB()
).
B
detects and uses the history junction to determine which substate is the destination of the transition into the superstate. The history junction indicates substate B
.B4
was the last active substate, and thus the destination of the transition.
B
.B4
is marked active.
B
.B4
entry actions execute and complete (entB4()
).
This sequence completes the execution of this Stateflow diagram associated with event E_one
.
Example: Labeled Default Transitions
This example shows the use of a default transition with a label.
Initially the Stateflow diagram is asleep. State A
is active. Event E_one
occurs awakening 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 a valid transition from state A
to superstate B
. A pipe is used to represent that the transition is valid if event E_one
or E_two
occurs.
A
exit actions execute and complete (exitA()
).
A
is marked inactive.
B
is marked active.
B
entry actions execute and complete (entB()
).
B
detects a valid default transition to state B
.B1
. The default transition is valid as a result of E_one
.
B
.B1
is marked active.
B
.B1
entry actions execute and complete (entB1()
).
This sequence completes the execution of this Stateflow diagram associated with event E_one
.
![]() | Condition Actions | Inner Transitions | ![]() |