Stateflow    

Default Transition and a History Junction Example

This example shows the behavior of a superstate with a default transition 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:

  1. The Stateflow diagram root checks to see if there is a valid transition as a result of E_one.
  1. There is a valid transition from state A to superstate B.

  1. State A exit actions (exitA()) execute and complete.
  2. State A is marked inactive.
  3. State B is marked active.
  4. State B entry actions (entB()) execute and complete.
  5. State B uses the history junction to determine the substate destination of the transition into the superstate.
  1. The history junction indicates that substate B.B4 was the last active substate, which becomes the destination of the transition.

  1. State B.B4 is marked active.
  2. State B.B4 entry actions (entB4()) execute and complete.
  3. The Stateflow diagram goes back to sleep, waiting to be awakened by another event.

This sequence completes the execution of this Stateflow diagram associated with event E_one.


  Default Transition to a Junction Example Labeled Default Transitions Example