Entity ID for Entity Multicast

I am working on a model that needs to print out the entity ID every time an entity enters a server. I am using entitySys.id to get the entity id, but it seems like when it goes through the 'Entity Multicast', the Entity Muticast is generating two new entities, so the input entity and the two output entitys' id is different (if input entity's ID = 1, output entity IDs are 2 and 3). Is there a way to fix this?

3 Comments

Router identify that a packet is multicast by it's class of IP address (the starting bits). If a multicast is received, however, they will just do nothing.
You have to configure multicast routing. In other words, you have to tell the router to convert the multicast into unicast, and send it to remote subnets. Routers on the other side will convert it back to multicast and deliver to devices in the subnet.
Routers joins a multicast group, meaning they will listen to a specific address of multicast and convert it to unicast. There are potocols that can partially automate that, but the network engineer will have to do the heavy lifting.
Multicast routing is a complex topic, and I hope this gave you an idea.
For a person who just started using simevents, that sounds very difficult, but I'll definitely look into it. Thank you.
Hey @Yarthe,
Thank you for your input, but the original question is about entity ID handling in a SimEvents modeling environment, not about network multicast routing.

Sign in to comment.

Answers (1)

The Entity Multicast block is used to broadcast entities by cloning them and sending each copy with a specified Multicast tag. Any Entity Queue block set to receive entities via Multicast with the same tag will receive these cloned copies. Since the entities are cloned, each will have a unique ID different from the original entity's ID. More details about the Entity Multicast block can be found in the documentation using:
web(fullfile(docroot, 'simevents/ref/entitymulticast.html'))
To keep track of the original entity's ID, an attribute can be added to the entity. For example, attributes such as original_ID and new_ID can be included. The original_ID can be set as entitySys.id in the Entity Generator, and new_ID can be set as entitySys.id in the Entity Queue. This approach ensures that both the original and cloned entity IDs are tracked as the entities move through the model. Here's how the Entity Generator and Entity Queue event actions would look like:
Entity Generator:
Entity Queue:
For an overview of how queues and servers function, the following documentation page can be accessed:
web(fullfile(docroot, 'simevents/gs/role-of-queues-in-simevents-models.html'))

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Asked:

on 19 Jul 2022

Commented:

on 16 May 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!