Main Content

send

广播消息或事件

描述

示例

send(message_name) 发送局部消息或输出消息。

示例

send(event_name) 发送局部事件或输出事件。

示例

send(local_event_name,state_name)state_name 以及层次结构中该状态的任何后代广播局部事件。

示例

send(state_name.local_event_name) 向其父状态 state_name 以及层次结构中该状态的任何后代广播局部事件。

示例

全部展开

发送数据值为 3 的局部消息或输出消息 M

M.data = 3;
send(M);

Stateflow chart that uses the send operator in a state.

发送输出事件 E

send(E);

Stateflow chart that uses the send operator in a state.

将局部事件 E_one 发送到状态 B 及其任何子状态。

send(E_one,B);

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

将局部事件 E_one 发送到其父状态 B 及其任何子状态。

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.

提示

  • 如果图发送的消息超出接收队列的容量,就会发生队列溢出。队列溢出的结果取决于接收队列的类型。

    • 当内部队列中发生溢出时,Stateflow® 图会丢弃新消息。您可以通过设置消息的队列溢出诊断属性来控制诊断操作的级别。请参阅Queue Overflow Diagnostic

    • 当外部队列中发生溢出时,Queue (Simulink) 模块或者丢弃新消息,或者覆盖队列中最早的消息,具体取决于模块的配置。请参阅Overwrite the oldest element if queue is full (Simulink)。外部队列中的溢出始终会导致警告。

  • 避免使用无向局部事件广播。无向局部事件广播会导致在图中产生不必要的递归行为。请改为使用有向广播发送局部事件。有关详细信息,请参阅广播局部事件以同步并行状态

  • 使用 send 运算符将事件发送到调度编辑器。调度编辑器使您能够调度非周期性分区的执行。有关在调度编辑器中使用 send 运算符的详细信息,请参阅Events in Schedule Editor (Simulink)

版本历史记录

在 R2006a 之前推出