| Stateflow® | ![]() |
| On this page… |
|---|
Directed Event Broadcast Using Send Example Directed Event Broadcasting Using Qualified Event Names Example |
This example shows the behavior of directed event broadcast using the send(event_name,state_name) function in a transition action.

Initially, the Stateflow® chart is asleep. Parallel substates A.A1 and B.B1 are active, which implies that parallel (AND) superstates A and B are also active. An event occurs and awakens the chart. The condition [data1==1] is true. The event is processed from the root of the chart down through the hierarchy of the chart:
The Stateflow chart root checks to see if there is a valid transition as a result of the event. There is no valid transition.
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.
The transition action send(E_one,B) is executed and completed:
The broadcast of event E_one is a nested event that awakens state B. 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.
State B.B1 exit actions (exitB1()) execute and complete.
State B.B1 is marked inactive.
State B.B2 is marked active.
State B.B2 entry actions (entB2()) execute and complete.
This sequence completes the execution of this Stateflow chart associated with an event broadcast and the directed event broadcast to a parallel state of event E_one.
This example shows the behavior of directed event broadcast using a qualified event name in a transition action.

Initially, the Stateflow chart is asleep. Parallel substates A.A1 and B.B1 are active, implying that parallel (AND) superstates A and B are also active. An event occurs and awakens the chart. The condition [data1==1] is true. The event is processed from the root of the chart down through the hierarchy of the chart:
The Stateflow chart root checks to see if there is a valid transition as a result of the event. There is no valid transition.
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.
The transition action, a qualified broadcast of event E_one to state B ( represented by the notation B.E_one), is executed and completed:
The broadcast of event E_one is a nested event broadcast that awakens state B. 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.
State B.B1 exit actions (exitB1()) execute and complete.
State B.B1 is marked inactive.
State B.B2 is marked active.
State B.B2 entry actions (entB2()) execute and complete.
This sequence completes the execution of this Stateflow chart associated with an event broadcast using a qualified event name to a parallel state.
![]() | Parallel (AND) State Examples | Creating Stateflow® Charts | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |