Replicating Entities


This example shows how to copy entities in a flexible way, where the number of copies is parameterized rather than a constant.


In this model, although the Replicate block requires a constant value for the Number of entity output ports parameter, an iterative process can vary the number of copies.

Each entity has an attribute called RepCount that indicates how many copies are required. The Replicate block initially creates one copy. If more copies are required, the Output Switch block routes the entity back to the same Replicate block for another iteration.

To determine whether more copies are required, the Entity Departure Counter block counts the number of copies so far, while the Compare subsystem compares the number of copies made to the number of copies required.

Results And Displays

Was this topic helpful?