Stateflow    

Transitions to and from Exclusive (OR) Superstates

This example shows transitions to and from an exclusive (OR) superstate and the use of a default transition.

This is an expansion of the soda machine Stateflow diagram that includes the initial example of the On and Off exclusive (OR) states. On is now a superstate containing the Waiting and soda choices states. The transition OffOn is valid when state Off is active and event Switch_on occurs. Now that On is a superstate, this is an explicit transition to the On superstate.

For a transition to a superstate to be a valid, the destination substate must be implicitly defined. The destination substate for On is implicitly defined by making the Waiting substate the destination state of a default transition. This notation defines that the resultant transition is made from the Off state to the state On.Waiting.

The transition from On to Off is valid when state On is active and event Switch_off occurs. However, when the Switch_off event occurs, a transition to the Off state must take place no matter which of the substates of On is active. This top-down approach simplifies the Stateflow diagram by looking at the transitions out of the superstate without considering all the details of states and transitions within the superstate.

See Default Transition Examples for more information on the semantics of this notation.


  Transitions to and from Junctions Transitions to and from Substates