Stateflow    

Directed Event Broadcasting Using Qualified Event Names Example

This example shows the behavior of directed event broadcast using a qualified event name in a transition action.

Initially the Stateflow diagram is asleep. Parallel substates A.A1 and B.B1 are active. By definition, this implies that parallel (AND) superstates A and B are active. An event occurs and awakens the Stateflow diagram. The condition [data1==1] is true. The event 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 the event. There is no valid transition.
  2. State A checks for any valid transitions as a result of the event. Because the condition [data1==1] is true, there is a valid transition from state A.A1 to state A.A2.
  3. State A.A1 exit actions (exitA1()) execute and complete.
  4. State A.A1 is marked inactive.
  5. The transition action, a qualified event broadcast of event E_one to state B (represented by the notation B.E_one), is executed and completed:
    1. The broadcast of event E_one awakens state B. (This is a nested event broadcast.) Because state B is active, the directed broadcast is received and state B checks to see if there is a valid transition. There is a valid transition from B.B1 to B.B2.
    2. State B.B1 exit actions (exitB1()) execute and complete.
    3. State B.B1 is marked inactive.
    4. State B.B2 is marked active.
    5. State B.B2 entry actions (entB2()) execute and complete.
  6. State A.A2 is marked active.
  7. State A.A2 entry actions (entA2()) execute and complete.

This sequence completes the execution of this Stateflow diagram associated with an event broadcast using a qualified event name to a parallel state.


  Directed Event Broadcast Using send Example Working with Charts