Stateflow | ![]() ![]() |
Default Transition Examples
The following examples show the use of default transitions in Stateflow diagrams:
Default Transition to a State Example
This example shows a use of default transitions.
When the Stateflow diagram is first awakened, it must decide whether to activate state S
or state B
since they are exclusive (OR) states. The answer is given by the default transition to superstate S
, which is taken if valid. Because there are no conditions on this default transition, it is taken.
State S
, which is now active, has two substates, A
and D
. Which substate becomes active? Only one of them can be active because they are exclusive (OR) states. The answer is given by the default transition to substate D
, which is taken if valid. Because there are no conditions on this default transition, it is taken.
Suppose at a different execution point the Stateflow diagram is awakened by the occurrence of event d
and state B
is active. The transition from state B
to state S
is valid. When the system enters state S
, it enters substate D
because the default transition is defined.
See Default Transition Examples for more information on the semantics of this notation.
The default transitions are required for the Stateflow diagram to execute. Without the default transition to state S
, when the Stateflow diagram is awakened, none of the states becomes active. You can detect this situation at run-time by checking for state inconsistencies. See Animation Controls for more information.
Default Transition to a Junction Example
This example shows a default transition to a connective junction.
In this example, the default transition to the connective junction defines that upon entering the Counting
state, the destination is determined by the condition on each transition segment.
See Default Transition to a Junction Example for more information on the semantics of this notation.
Default Transition with a Label Example
The following example shows the labeling of default transitions.
If state A
is initially active and either e1
or e2
occurs, the transition from state A
to superstate B
is valid. The substates B1
and B2
both have default transitions. The default transitions are labeled to specify the event that triggers the transition. If event e1
occurs, the transition A
to B1
is valid. If event e2
occurs, the transition A
to B2
is valid.
See Labeled Default Transitions Example for more information on the semantics of this notation.
![]() | Default Transitions | Connective Junctions | ![]() |