Broadcast Local Events in Parallel States
Directed Event Broadcast Using Send
This example shows the behavior of directed event broadcast using the
send(
syntax on a transition.event_name
,state_name
)
Initially, the chart is asleep. Parallel substates A.A1
and
B.B1
are active, which implies that parallel (AND)
superstates A
and B
are also active. The
condition [data1==1]
is true. The event E_one
belongs to the chart and is visible to both A
and
B
.
After waking up, the chart checks for valid transitions at every level of the hierarchy:
The 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 stateA.A1
to stateA.A2
.The action
send(E_one,B)
executes:The broadcast of event
E_one
reaches stateB
. Because stateB
is active, that state receives the event broadcast and checks to see if there is a valid transition. There is a valid transition fromB.B1
toB.B2
.State
B.B1
exit
actions (exitB1()
) execute and complete.State
B.B1
becomes inactive.State
B.B2
becomes active.State
B.B2
entry
actions (entB2()
) execute and complete.
State
A.A1
exit
actions (exitA1()
) execute and complete.State
A.A1
becomes inactive.State
A.A2
becomes active.State
A.A2
entry
actions (entA2()
) execute and complete.
This sequence completes execution of a chart with a directed event broadcast to a parallel state.
Directed Event Broadcast Using Qualified Event Name
This example shows the behavior of directed event broadcast using a qualified event name on a transition.
The only differences from the chart in Directed Event Broadcast Using Send are:
The event
E_one
belongs to stateB
and is visible only to that state. To assign the eventE_one
in the scope of stateB
, in the Model Explorer select the state and add the event.The action
send(E_one,B)
is nowsend(B.E_one)
.Using a qualified event name is necessary because
E_one
is not visible to stateA
.
After waking up, the chart checks for valid transitions at every level of the hierarchy:
The 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 stateA.A1
to stateA.A2
.The action
send(B.E_one)
executes and completes:The broadcast of event
E_one
reaches stateB
. Because stateB
is active, that state receives the event broadcast and checks to see if there is a valid transition. There is a valid transition fromB.B1
toB.B2
.State
B.B1
exit
actions (exitB1()
) execute and complete.State
B.B1
becomes inactive.State
B.B2
becomes active.State
B.B2
entry
actions (entB2()
) execute and complete.
State
A.A1
exit
actions (exitA1()
) execute and complete.State
A.A1
becomes inactive.State
A.A2
becomes active.State
A.A2
entry
actions (entA2()
) execute and complete.
This sequence completes execution of a chart with a directed event broadcast using a qualified event name to a parallel state.