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
The following steps are used to prepare the model for messages carrying bus data type.
To create messages carrying non-virtual buses, in the Send Component, in the Bus Creator block, set the Output data type to
messageBus
and select the Output as nonvirtual bus check box.
To send messages carrying bus data, in the Send Component, in the Outport block, under the Signal Attributes tab, set the Data type to
messageBus
and select the select the Output as nonvirtual bus check box.
To receive messages carrying bus data, in the Receive Component, in the Inport block, under the Signal Attributes tab, set the Data type to
messageBus
and select the select the Output as nonvirtual bus check box.
Simulate the Model and Visualize the Results
Simulate the model and open the Sequence Viewer block. Observe the transmission of messages carrying bus data.