Skip to Main Content Skip to Search
Product Documentation

Broadcasting Events to Synchronize States

Directed Event Broadcasting

In the action language, you can broadcast events directly from one state to another to synchronize parallel (AND) states in the same chart. The following rules apply:

Using a directed event broadcast provides the following benefits over an undirected broadcast:

For information about avoiding unwanted recursion, see Guidelines for Avoiding Unwanted Recursion in a Chart.

Example of Directed Event Broadcasting Using send

The format of the directed event broadcast with send is:

send(event_name,state_name)

where event_name is broadcast to state_name and any offspring of that state in the hierarchy. The event you send must be visible to both the sending state and the receiving state (state_name).

The state_name argument can include a full hierarchy path to the state. For example, if the state A contains the state A1, send an event e to state A1 with the following broadcast:

send(e, A.A1)

This example of a directed event broadcast uses the send(event_name,state_name) syntax.

In this example, event E_one belongs to the chart and is visible to both A and B. See Directed Event Broadcast Using Send Example for information on the semantics of this notation.

Example of Directed Event Broadcasting Using Qualified Event Names

The format of the direct event broadcast using qualified event names is:

state_name.event_name

where event_name is broadcast to its owning state (state_name) and any offspring of that state in the hierarchy. The event you send is visible only to the receiving state (state_name).

The state_name argument can also include a full hierarchy path to the receiving state. Do not use the chart name in the full path name of the state.

The following example illustrates the use of a qualified event name in a directed event broadcast.

In this example, event E_one belongs to state B and is visible only to that state. See Directed Event Broadcast Using Qualified Event Name Example for information on the semantics of this notation.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS