Stateflow User's Guide Previous page   Next Page

Directed Event Broadcasting

You can specify a directed event broadcast in actions. Using a directed event broadcast, you can broadcast a specific event to a specific receiver state in the same chart. The receiving state must be active at the time the broadcast is executed to receive and potentially act on the directed event broadcast.

Directed event broadcasting is a more efficient means of synchronization among parallel (AND) states. Using directed event broadcasting improves the efficiency of the generated code. As is true in event broadcasting, recursive event broadcasts can lead to definition of cyclic behavior.

Directed Event Broadcasting Using send

The format of the directed event broadcast with send is as follows:

where event_name is broadcast to state_name and any offspring of that state in the hierarchy. The event sent 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:

This is an example of a directed event broadcast using the send(event_name,state_name) transition action as a transition action.

In this example, event E_one must be visible in both A and B. See Directed Event Broadcast Using send Example for information on the semantics of this notation.

Directed Event Broadcasting Using Qualified Event Names

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

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

The state_name argument can also include a full hierarchy path to the receiving state. Again, 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 is visible only to state B. See Directed Event Broadcasting Using Qualified Event Names Example for information on the semantics of this notation.


Previous page  Event Broadcasting Using Temporal Logic in Actions Next page

© 1994-2005 The MathWorks, Inc.