Stateflow    

Transitioning from a Substate to a Substate with Events Example

This example shows the behavior of a transition from an OR substate to an OR substate.

Initially the Stateflow diagram is asleep. State A.A1 is active. Event E_one occurs and awakens the Stateflow diagram. Condition C_one is true. 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. There is a valid transition from state A.A1 to state B.B1. (Condition C_one is true.)
  2. State A during actions (durA()) execute and complete.
  3. State A.A1 exit actions (exitA1()) execute and complete.
  4. State A.A1 is marked inactive.
  5. State A exit actions (exitA()) execute and complete.
  6. State A is marked inactive.
  7. The transition action, A, is executed and completed.
  8. State B is marked active.
  9. State B entry actions (entB()) execute and complete.
  10. State B.B1 is marked active.
  11. State B.B1 entry actions (entB1()) execute and complete.
  12. 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.


  Transitioning from State to State with Events Example Condition Action Examples