Stateflow    

Labeling Default Transitions

In some circumstances, you may want to label default transitions. You can label default transitions as you would other transitions. For example, you may want to specify that one state or another should become active depending upon the event that has occurred. In another situation, you may want to have specific actions take place that are dependent upon the destination of the transition.

Example: Use of Default Transitions

This example shows a use of default transitions.

When the Stateflow diagram is first awakened, the default transition to superstate S defines that of states S and B; the transition to state S is valid. State S has two substates, A and D. Which substate does the system transfer to? It cannot transfer to both of them since A and D are not parallel (AND) states. Again, this kind of ambiguity is cleared up by defining a default transition to substate D.

Suppose at a different execution point, the Stateflow diagram is awakened by the occurrence of event d and state B is active. The transition BS is valid. When the system enters state S, it enters substate D because the default transition is defined.

See Default Transitions 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 become active. You can detect this situation at runtime by checking for state inconsistencies. See Animation Controls for more information.

Example: Default Transition to a Junction

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 Example: Default Transition to a Junction for more information on the semantics of this notation.

Example: Default Transition with a Label

This example shows a use of labeling 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 AB1 is valid. If event e2 occurs, the transition AB2 is valid.

See Example: Labeled Default Transitions for more information on the semantics of this notation.


 Default Transitions What Is an Inner Transition?