send

Broadcast message or event

Description

example

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.

Examples

expand all

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

M.data = 3;
send(M);

Send an output event E.

send(E);

Send a local event E to state A.A1 and any of its substates.

send(E,A.A1);

Send a local event E to its parent state A and any of its substates.

send(A.E);

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 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.

Introduced in R2018b