Entity ID for Entity Multicast
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Altaïr
2025년 5월 16일
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'))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!