| Using Stateflow | Search  Help Desk |
Directed Event Broadcasting
Example: Directed Event Broadcast Using send
This example shows the semantics of directed event broadcast usingsend(event_name,state_name) in a transition action.
A.A1 and B.B1 are active. By definition, this implies 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:
..A checks for any valid transitions as a result of the event. Since the
condition [data1==1] is true, there is a valid transition from state A.A1 to
state A.A2.
.A.A1 exit actions execute and complete (exitA1()).
.A.A1 is marked inactive.
.send(E_one,B) is executed and completed.
E_one awakens state B. (This is a nested event
broadcast.) Since 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.
B.B1 executes and completes exit actions (exitB1()).
B.B1 is marked inactive.
B.B2 is marked active.
B.B2 executes and completes entry actions (entB2()).
.
A.A2 is marked active.
.A.A2 entry actions execute and complete (entA2()).
E_one.
Example: Directed Event Broadcasting Using Qualified Event Names
This example shows the semantics of directed event broadcast using a qualified event name in a transition action.
A.A1 and B.B1 are active. By definition, this implies 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:
..A checks for any valid transitions as a result of the event. Since the
condition [data1==1] is true, there is a valid transition from state A.A1 to
state A.A2.
.A.A1 exit actions execute and complete (exitA1()).
.A.A1 is marked inactive.
.E_one to state B
(represented by the notation B.E_one), is executed and completed.
E_one awakens state B. (This is a nested event
broadcast.) Since 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.
B.B1 executes and completes exit actions (exitB1()).
B.B1 is marked inactive.
B.B2 is marked active.
B.B2 executes and completes entry actions (entB2()).
.A.A2 is marked active.
.A.A2 entry actions execute and complete (entA2()).