Stateflow    

Event Broadcast Transition Action with a Nested Event Broadcast Example

This example shows the behavior of an event broadcast transition action that includes a nested event broadcast in a parallel state.

Start of Event E_one Processing

Initially the Stateflow diagram is asleep. Parallel substates A.A1.A1a and A.A2.A2a are active. 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. There is no valid transition.
  2. State A during actions (durA()) execute and complete.
  3. State A's children are parallel (AND) states. They are evaluated and executed from left to right and top to bottom. State A.A1 is evaluated first. State A.A1 during actions (durA1()) execute and complete.
  4. State A.A1 checks for any valid transitions as a result of event E_one. There is a valid transition from state A.A1.A1a to state A.A1.A1b.
  5. State A.A1.A1a executes and completes exit actions (exitA1a).
  6. State A.A1.A1a is marked inactive.

Event E_two Preempts E_one

  1. Transition action generating event E_two is executed and completed:
    1. The transition from state A1a to state A1b (as a result of event E_one) is now preempted by the broadcast of event E_two.
    2. The broadcast of event E_two awakens the Stateflow diagram a second time. The Stateflow diagram root checks to see if there is a valid transition as a result of E_two. There is no valid transition.
    3. State A during actions (durA()) execute and complete.
    4. State A' s children are evaluated starting with state A.A1. State A.A1 during actions (durA1()) execute and complete. State A.A1 is evaluated for valid transitions. There are no valid transitions as a result of E_two within state A1.
    5. State A.A2 is evaluated. State A.A2 during actions (durA2()) execute and complete. State A.A2 checks for valid transitions. State A.A2 has a valid transition as a result of E_two from state A.A2.A2a to state A.A2.A2b.
    6. State A.A2.A2a exit actions (exitA2a()) execute and complete.
    7. State A.A2.A2a is marked inactive.
    8. State A.A2.A2b is marked active.
    9. State A.A2.A2b entry actions (entA2b()) execute and complete.

Event E_two Processing Ends

  1. The Stateflow diagram activity now looks like this.

Event E_one Processing Resumes

  1. State A.A1.A1b is marked active.
  2. State A.A1.A1b entry actions (entA1b()) execute and complete.
  3. Parallel state A.A2 is evaluated next. State A.A2 during actions (durA2()) execute and complete. There are no valid transitions as a result of E_one.
  4. State A.A2.A2b during actions (durA2b()) execute and complete.
  1. State A.A2.A2b is now active as a result of the processing of the transition action event broadcast of E_two.

  1. 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 and the transition action event broadcast to a parallel state of event E_two. The final Stateflow diagram activity now looks like this.


  Event Broadcast State Action Example Event Broadcast Condition Action Example