Main Content

send

Broadcast message or event

Description

send(message_name) sends a local or output message.

example

send(event_name) sends a local or output event.

example

send(local_event_name,state_name) broadcasts a local event to state_name and any offspring of that state in the hierarchy.

example

send(state_name.local_event_name) broadcasts a local event to its parent state state_name and any offspring of that state in the hierarchy.

example

Examples

expand all

Send a local or output message M with a data value of 3.

M.data = 3;
send(M);

Stateflow chart that uses the send operator in a state.

Send an output event E.

send(E);

Stateflow chart that uses the send operator in a state.

Send a local event E_one to state B and any of its substates.

send(E_one,B);

Stateflow chart that uses a directed event broadcast to synchronize the substates of two parallel (AND) states.

Send a local event E_one to its parent state B and any of its substates.

send(B.E_one);

Stateflow chart that uses a directed event broadcast to synchronize the substates of two parallel (AND) states. The broadcast uses the qualified event name B.E_one.

Tips

  • If a chart sends a message that exceeds the capacity of the receiving queue, a queue overflow occurs. The result of the queue overflow depends on the type of receiving queue.

    • When an overflow occurs in an internal queue, the Stateflow® chart drops the new message. You can control the level of diagnostic action by setting the Queue Overflow Diagnostic property for the message. See Queue Overflow Diagnostic.

    • When an overflow occurs in an external queue, the Queue (Simulink) block either drops the new message or overwrites the oldest message in the queue, depending on the configuration of the block. See Overwrite the oldest element if queue is full (Simulink). An overflow in an external queue always results in a warning.

  • Avoid using undirected local event broadcasts. Undirected local event broadcasts can cause unwanted recursive behavior in your chart. Instead, send local events by using directed broadcasts. For more information, see Broadcast Local Events to Synchronize Parallel States.

  • Use the send operator to send events to the Schedule Editor. The Schedule Editor enables you to schedule the execution of aperiodic partitions. For more information on using the send operator with the Schedule Editor, see Events in Schedule Editor (Simulink).

Version History

Introduced before R2006a