Main Content

Merge Message Lines Using Adapter Block

This example shows how to use a Merge block to route messages between software components in a software architecture. A Merge block is an Adapter block preconfigured to merge message and signal lines.

Open the model.

systemcomposer.openModel('MergeMessagesfromSoftwareComponents');

In this model, message-based communication is constructed between three software components: two send components, Component1 and Component2 create messages and send them to a receive component, Component3.

merge-messages-from-software-components-model.png

A FIFO queue is used as a message buffer between the components.

Component1 is linked to the Simulink® behavior model swMergeSend1 that generates messages with value 1 in every 0.1 sample time.

merge-messages-from-software-components-send1.png

Component2 is linked to the Simulink behavior swMergeSend2 that generates messages with value 2 in every 0.3 sample time.

merge-messages-from-software-components-send2.png

Component3 is linked to the Simulink behavior swMergeReceive that receives messages and converts them to signals. The In Bus Element port block is used to configure the queue outside the component as a FIFO queue of capacity 100.

merge-messages-from-software-components-receive.png

Simulate the model. Observe that the Scope block in swMergeReceive displays the values received from both components.

merge-messages-from-software-components-scope.png

See Also

| |

Related Topics