Skip to content

DUPLICATE

Makes copies of an entity, for example to model one job spawning several; the original goes on unchanged. All copies leave by the one output link: follow it with a DECIDE to send them down different branches.

Forwards the original entity unchanged, then forwards number_of_duplicates - 1 shallow copies, each a fresh Entity with its own id and name (never a deepcopy: that used to clone the entity manager and any live resource requests).

Family: group. Python builder: m.duplicate(...).

Typical uses

Use DUPLICATE when one entity must become several that carry on independently. Examples are an order that spawns picking tasks, a job that needs work in two places, and a message for several recipients. It differs from SEPARATE, which splits a batch back into the entities that formed it. To send the copies down different branches, follow DUPLICATE with a DECIDE.

Behaviour and rules

number_of_duplicates is the total number of entities that leave, the original included, and must be at least 2. The original goes first, unchanged. The copies follow in the same instant, each as a new entity with its own id.

All of them leave by the block's single outgoing link. A copy takes the original's attribute values as they are at that moment, in a shallow copy. A copy does not take the original's name, id or resource holds. A list of batch members is copied into its own list.

Each copy is announced as a new entity, so it counts in the entities created and in the work in progress until it is disposed. The block takes no time.

Ports

  • Inputs: any number of incoming links.
  • Outputs: one outgoing link.

Parameters

Parameter Type Default Required Quantity Unit key Description
number_of_duplicates int 2 count Total number of entities leaving this block, original included (>= 2).

Statistics

Every run fills system and entity_summary (see the KPI reference). The example below also fills:

Frame Columns
material_flow_summary Run, From, To, Entities

Problem codes

No check names this block type.

Example

The snippet seeds itself; its output is from a run made when this page was generated.

from nagasim import build as nb

m = nb.Model(time_limit=100)
m.create(distribution=nb.Constant(value=5), max_arrivals=10) >> m.duplicate(number_of_duplicates=3) >> m.dispose()

results = m.run(seed=1)
print(int(results.kpi("system/Total Entities Completed")), "entities left: 10 arrivals, each leaving as 3 (the original and 2 copies)")
30 entities left: 10 arrivals, each leaving as 3 (the original and 2 copies)

Used in

Bundled models: Hub day: electrifying the ground support equipment, Hub day: turnaround workload (crews, ground equipment, on-time departures).

Guides: How do I turn one order into several jobs?, Batching and matching, Coming from Arena, Entities and attributes.

See also