This example shows the behavior of directed event broadcast using the
send(
syntax on a transition. The chart uses implicit ordering of parallel states (see
Implicit Ordering of Parallel States).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
state A.A1
to state A.A2
.
The action send(E_one,B)
executes:
The broadcast of event E_one
reaches state
B
. Because state B
is
active, that state receives the event broadcast and 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
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.
This example shows the behavior of directed event broadcast using a qualified event name on a transition. The chart uses implicit ordering of parallel states (see Implicit Ordering of Parallel States).
The only differences from the chart in Directed Event Broadcast Using Send are:
The event E_one
belongs to state B
and is visible only to that state.
The action send(E_one,B)
is now
send(B.E_one)
.
Using a qualified event name is necessary because E_one
is not visible to state A
.
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
state A.A1
to state A.A2
.
The action send(B.E_one)
executes
and completes:
The broadcast of event E_one
reaches state
B
. Because state B
is
active, that state receives the event broadcast and 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
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.