Send and Receive Messages Carrying Bus Data
This example shows how to send and receive messages carrying bus data between model components.
In the model, there are two components, Send Component and Receive Component that send and receive messages, respectively. This example builds on another example, Establish Message Send and Receive Interfaces Between Software Components, where two software components communicate using messages. The model is modified to send messages carrying bus data.
Prepare the Model for Messages with Bus Data
These steps prepare the model for messages carrying bus data type.
To create messages carrying nonvirtual buses, in the Send Component, in the Bus Creator block, set Output data type to
messageBus
and select Output as nonvirtual bus.
To send messages carrying bus data, in the Send Component, in the Outport block, under the Signal Attributes tab, set Data type to
messageBus
and select Output as nonvirtual bus.
To receive messages carrying bus data, in the Receive Component, in the Inport block, under the Signal Attributes tab, set Data type to
messageBus
and select Output as nonvirtual bus.
Simulate the Model and Visualize the Results
Simulate the model and open the Sequence Viewer block. Observe the transmission of messages carrying bus data.