| Stateflow | ![]() |
www.kxcad.net Home > CAE Software Index > MATLAB Index >
| On this page… |
|---|
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 Name for more information.
Broadcasting an event in the action language is most useful as a means of synchronization AND (parallel) states. Recursive event broadcasts can lead to definition of cyclic behavior. Cyclic behavior can be detected only during simulation.
The following is an example of the state action notation for an event broadcast:

See Event Broadcast State Action Example for information on the semantics of this notation.
The following is an example of transition action notation for an event broadcast.

See Event Broadcast Transition Action with a Nested Event Broadcast Example for information on the semantics of this notation.
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.
Note An action in one chart cannot broadcast events to states defined in another chart. |
The format of the directed event broadcast with send is as follows:
send(event_name,state_name)
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:
send(e, A.A1)
Note Do not use the chart name in the full hierarchy path to a state. Formal chart names include the subsystem they are in. For example, in the demo model fuelsys the chart control logic is in the subsystem fuel rate controller. This means that the formal name for the chart control logic is fuel rate controller/control logic. This name includes the forward slash character ('/'), which is not a valid character in Stateflow identifiers. |
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.
The format of the direct event broadcast using qualified event names is as follows:
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 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.
| Using Arrays in Actions | Using Temporal Logic in Actions | ![]() |
© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments