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
Open the model.
In this model, message-based communication is constructed between three software components: two send components,
Component2 create messages and send them to a receive component,
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.
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
Simulate Model and Review Results
Simulate the model. Observer that the Scope block in
swMergeReceive displays the values received from both components.