Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Directly Broadcast Events

Directed Event Broadcast Using Send

This example shows the behavior of directed event broadcast using the send(event_name,state_name) syntax on a transition. The chart uses implicit ordering of parallel states (see Implicit Ordering of Parallel States).

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:

  1. The chart root checks to see if there is a valid transition as a result of the event. There is no valid transition.

  2. 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.

  3. The action send(E_one,B) executes:

    1. 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.

    2. State B.B1 exit actions (exitB1()) execute and complete.

    3. State B.B1 becomes inactive.

    4. State B.B2 becomes active.

    5. State B.B2 entry actions (entB2()) execute and complete.

  4. State A.A1 exit actions (exitA1()) execute and complete.

  5. State A.A1 becomes inactive.

  6. State A.A2 becomes active.

  7. 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 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:

  1. The chart root checks to see if there is a valid transition as a result of the event. There is no valid transition.

  2. 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.

  3. The action send(B.E_one) executes and completes:

    1. 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.

    2. State B.B1 exit actions (exitB1()) execute and complete.

    3. State B.B1 becomes inactive.

    4. State B.B2 becomes active.

    5. State B.B2 entry actions (entB2()) execute and complete.

  4. State A.A1 exit actions (exitA1()) execute and complete.

  5. State A.A1 becomes inactive.

  6. State A.A2 becomes active.

  7. 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.

Was this topic helpful?