Products & Services Industries Academia Support User Community Company

Learn more about Stateflow   

Broadcasting Events in Actions

About Events in Actions

You can specify an event to be broadcast in the action language. Events have hierarchy (a parent) and scope. The parent and scope together define a range of access to events. It is primarily the event's parent that determines who can trigger on the event (has receive rights). See How Events Work in Stateflow Charts for more information.

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.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS