Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Replicate

Output copies of entity

Library

Routing

Description

This block outputs a copy of the arriving entity through each entity output port that is not blocked. You specify the number of copies that the block makes, using the Number of entity output ports parameter.

When the block replicates an entity that is subject to a timeout, all departing entities share the same expiration time; that is, the timeout events corresponding to all departing entities share the same scheduled event time. Logistically, the block cancels the timeout event of the arriving entity and schedules new timeout events for the departing entities. For more details about timeout events, see Role of Timeouts in SimEvents Models and Use Timeouts to Limit Entity Queueing Time.

Complete or Partial Replication

The Replicate entity when parameter affects the circumstances under which the block accepts an entity to replicate. Choices are in the table below.

Parameter ValueDescription
All entity output ports are not blockedThe block accepts an entity to replicate only when all entity output ports are connected to available ports of subsequent blocks.
Any entity output port is not blockedThe block accepts an entity to replicate when at least one entity output port is connected to an available port of a subsequent block.

If you connect multiple copies of this block, you can implement logical combinations of the parameter values in the table.

Departure of Copies

Each time the block replicates an entity, the copies depart in a sequence whose start is determined by the Departure port precedence parameter. Choices are in the table below.

Parameter ValueDescriptionExample
OUT1 portEach time the block replicates an entity, the copies depart via entity output ports OUT1, OUT2, OUT3,..., in that sequence.The sequence of departures is always OUT1, OUT2, OUT3,... throughout the simulation.
Round robinEach time the block replicates an entity, the first copy departs via the port after the one that received preference on the last such occasion. The remaining copies depart via the subsequent ports in turn.On a block with three entity output ports, the first time the block replicates an entity, the copies depart in the sequence OUT1, OUT2, OUT3. The second time, the copies depart in the sequence OUT2, OUT3, OUT1. The third time, the copies depart in the sequence OUT3, OUT1, OUT2. The fourth time is analogous to the first time, and so on.
EquiprobableEach time the block replicates an entity, the first copy departs via a randomly selected entity output port. All entity output ports are equally likely to be selected and the Initial seed parameter initializes the random number generation process. The remaining copies depart via the subsequent ports in turn.On a block with four entity output ports, if the random number is three, then the copies depart in the sequence OUT3, OUT4, OUT1, OUT2. If the random number is two on the next such occasion, then the copies depart in the sequence OUT2, OUT3, OUT4, OUT1.

An example in which the choice of Departure port precedence parameter is relevant is a model that sets an attribute on each replicated entity based on its departure port and then advances all replicated entities along a merged path to a FIFO Queue block. At each replication occurrence during the simulation, the Departure port precedence parameter determines the sequence of the replicated entities in the queue.

In some cases, a departure through one entity output port causes another entity output port to become newly blocked. For example, this could happen if two entity output ports connect to a Path Combiner block, which in turn connects to a Single Server block whose service time is nonzero. Use the If an output port becomes blocked during replication parameter to determine how the block responds. Choices are in the table below.

Parameter ValueDescription
Discard entityThe block discards the entity that is supposed to depart through the newly blocked entity output port.
Warn and discard entityThe block issues a warning message in the MATLAB® Command Window, and discards the entity that is supposed to depart through the newly blocked entity output port.
ErrorThe simulation halts with an error message.

Ports

Entity Input Ports

LabelDescription
INPort for arriving entities.

Entity Output Ports

LabelDescription
OUT1, OUT2, OUT3, and so onPort for departing entities, which are copies of the arriving entity. The Number of entity output ports parameter determines how many of these entity input ports the block has.

Signal Output Ports

LabelDescriptionTime of Update When Statistic Is OnOrder of Update
#aNumber of entities that have arrived at this block since the start of the simulation.After entity arrival1
#dNumber of entities that have departed from this block since the start of the simulation.After each entity departure2

The initial output value, which is in effect from the start of the simulation until the first update by the block, is 0 for all signals.

Dialog Box

Replicate Tab

Number of entity output ports

Determines how many entity output ports the block has; that is, the maximum number of copies the block makes for each arriving entity.

Replicate entity when

Determines whether the block is available to arriving entities whenever at least one entity output port is not blocked, or only when all entity output ports are not blocked.

Departure port precedence

Determines the start of the sequence in which the block outputs the copies, each time the block replicates an entity.

Initial seed

A nonnegative integer that initializes the random number generator used to determine the output sequence. You see this field only if you set Departure port precedence to Equiprobable.

If an output port becomes blocked during replication

Determines whether the block issues a message when a replicated entity is unable to depart because an output port becomes blocked during the replication process. You see this field only if you set Replicate entity when to All entity output ports are not blocked.

Statistics Tab

These parameters determine whether the block produces data at signal output ports or omits those ports. For descriptions of the data and ports, see the preceding table, "Signal Output Ports".

Number of entities arrived

Allows you to use the signal output port labeled #a.

Number of entities departed

Allows you to use the signal output port labeled #d.

Was this topic helpful?