Main Content

Broadcast Entities Using Entity Multicasting

This example shows how to broadcast entities using Entity Multicast and Multicast Receive Queue blocks. Use entity multicasting when you want to copy and broadcast entities to a single receiver or multiple receivers in your model. One common application is creating communication networks in which messages are copied and transmitted between network nodes. For more information see Model an Ethernet Communication Network with CSMA/CD Protocol.

Build a Simple Model to Broadcast Entities

In this model, an Entity Generator block generates entities. The entities are then queued in the Entity Queue block with FIFO sorting policy. The entities are sent wirelessly to the receiver and further processed by the Entity Server block.

To broadcast entities:

  • An Entity Multicast block is connected to the output of the Entity Queue block. The broadcasted entities are tagged such that only Multicast Receive Queues with a matching tag A can receive them.

  • The Entity Receive Queue block is configured to receive entities with tag A.

Simulate the Model with Single Receiver and Review Results

Simulate the model. Open the Data Inspector that displays the received and processed entities that depart the Process Entity 1 block.

Use Multicast Tag to Send Entities to Multiple Receivers

You can further modify the model such that the multicast mode enables multiple queues to receive the same set of entities from the Entity Multicast block. You can achieve this behavior by creating multiple Multicast Receive Queue blocks whose Multicast tag parameter is set to A.

To open the model, use this code:

open_system('ParallelEntityQueueServerPairMulticastModel');

Simulate the Model with Multiple Receivers and Review Results

In this case, Broadcast Entities block copies the entity and sends them to the receivers. Simulate the model to observe its behavior. Open the Data Inspector that displays the same set of entities processed by Processed Entities 1 and Processed Entities 2 blocks.

See Also

|

Related Topics