Stateflow    

Condition and Transition Actions Example

This example shows the behavior of a simple condition and transition action specified on a transition from one exclusive (OR) state to another.

Initially the Stateflow diagram is asleep. State A 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. A valid transition from state A to state B is detected. The condition C_one is true. The condition action A_one is detected on the valid transition and is immediately executed and completed. State A is still active.
  2. State A exit actions (ExitA()) execute and complete.
  3. State A is marked inactive.
  4. The transition action A_two is executed and completed.
  5. State B is marked active.
  6. State B entry actions (entB()) execute and complete.
  7. 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 when state A is initially active.


  Condition Action Example Condition Actions in For Loop Construct Example