|On this page…|
A default transition specifies which exclusive (OR) state to enter when there is ambiguity among two or more neighboring exclusive (OR) states. A default transition has a destination but no source object. For example, a default transition specifies which substate of a superstate with exclusive (OR) decomposition the system enters by default, in the absence of any other information, such as a history junction. A default transition can also specify that a junction should be entered by default.
Click the Default transition button in the toolbar, and click a location in the drawing area close to the state or junction you want to be the destination for the default transition. Drag the mouse to the destination object to attach the default transition. In some cases, it is useful to label default transitions.
A common programming mistake is to create multiple exclusive (OR) states without a default transition. In the absence of the default transition, there is no indication of which state becomes active by default. Note that this error is flagged when you simulate the model using the Debugger with the State Inconsistencies option enabled.
In some circumstances, you might want to label default transitions. You can label default transitions as you would other transitions. For example, you might want to specify that one state or another should become active depending upon the event that has occurred. In another situation, you might want to have specific actions take place that are dependent upon the destination of the transition.
The following examples show the use of default transitions in Stateflow® charts:
This example shows a default transition to a state.
Without the default transition to state PowerOff, when the Stateflow chart wakes up, none of the states becomes active. You can detect this situation at run-time by checking for state inconsistencies. See Animate Stateflow Charts in Normal Mode for more information.
See Control Chart Execution Using Default Transitions for information on the semantics of this notation.
This example shows a default transition to a connective junction.
The default transition to the connective junction defines that upon entering the chart, the destination depends on the condition of each transition segment.
See Default Transition to a Junction for information on the semantics of this notation.
This example shows a default transition with a label.
When the chart wakes up, the data p and v initialize to 10 and 15, respectively.
See Labeled Default Transitions for more information on the semantics of this notation.