主要内容

本页采用了机器翻译。点击此处可查看英文原文。

合并使用 Adapter 模块的架构的消息连接

此示例展示了如何在 System Composer™ 架构模型中使用 Adapter 模块合并多个消息连接。

打开模型。

systemcomposer.openModel('mSysArchMessageMerge');

此模型在三个组件之间构建基于消息的通信:由两个发送组件 SAC1SAC2 创建消息,并将它们发送给一个接收组件 SAC3

  • 组件 SAC1 链接到 Simulink® 行为模型 mBottomupMsg1,在每个 0.1 的采样时间间隔生成值为 1 的消息。

  • 组件 SAC2 链接到 Simulink 行为模型 mBottomupMsg2,在每个 0.2 的采样时间间隔生成值为 8 的消息。

  • 组件 SAC3 链接到 Simulink 行为模型 mBottomupMsg3,在每个 0.5 的采样时间间隔使用基于速率的模块 Subsystem 接收合并的消息。

先入先出 (FIFO) 队列作为组件之间的消息缓冲区。

The output connections for the SAC1 component and SAC2 component are merged using an Adapter block to the input connection to the SAC3 component.

您可以双击 Adapter 模块以查看 接口适配器 对话框。确认接口转换选择为 Merge。映射功能已禁用。

The Interface Adapter dialog box shows the Apply interface conversion choice Merge.

仿真模型,将 Simulink 行为产生的发送组件 SAC1SAC2 的消息合并到一个目标,即接收组件 SAC3

sim('mSysArchMessageMerge');

启动 仿真数据检查器,在同一张图上同时查看三条消息。

Simulink.sdi.view

The Simulation Data Inspector shows when messages are sent and received for different components in the architecture model as simulation continues.

另请参阅

| | |

主题