Merge Message Connections 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 connections.
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
.
A FIFO queue is used as a message buffer between the components.
Component
1 is linked to the Simulink® behavior model swMergeSend1
that generates messages with value 1
in every 0.1
sample time.
Component2
is linked to the Simulink behavior swMergeSend2
that generates messages with value 2
in every 0.3
sample time.
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
.
Simulate the model. Observe that the Scope block in swMergeReceive
displays the values received from both components.