| SimEvents® | ![]() |
Routing
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 details about timeout events, see Forcing Departures Using Timeouts.
The Replicate entity when parameter affects the circumstances under which the block accepts an entity to replicate. Choices are in the table below.
| Parameter Value | Description |
|---|---|
| All entity output ports are not blocked | The 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 blocked | The 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.
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 Value | Description | Example |
|---|---|---|
| OUT1 port | Each 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 robin | Each 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. |
| Equiprobable | Each 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 Value | Description |
|---|---|
| Discard entity | The block discards the entity that is supposed to depart through the newly blocked entity output port. |
| Warn and discard entity | The 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. |
| Error | The simulation halts with an error message. |
Entity Input Ports
| Label | Description |
|---|---|
| IN | Port for arriving entities. |
Entity Output Ports
| Label | Description |
|---|---|
| OUT1, OUT2, OUT3, etc. | Port 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
| Label | Description | Time of Update When Statistic Is On | Order of Update |
|---|---|---|---|
| #a | Number of entities that have arrived at this block since the start of the simulation. | After entity arrival | 1 |
| #d | Number of entities that have departed from this block since the start of the simulation. | After each entity departure | 2 |
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.

Determines how many entity output ports the block has; that is, the maximum number of copies the block makes for each arriving entity. This parameter must be a literal value, not a variable or an expression requiring evaluation.
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.
Determines the start of the sequence in which the block outputs the copies, each time the block replicates an entity.
A nonnegative integer that initializes the random number generator used to determine the output sequence. This field appears only if you set Departure port precedence to Equiprobable.
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. This field appears only if you set Replicate entity when to All entity output ports are not blocked.
These parameters determine whether certain ports produce data throughout the simulation, produce data only when you stop or pause the simulation, or are omitted from the block. For descriptions of the affected ports, see the "Signal Output Ports" table above.

Controls the presence and behavior of the signal output port labeled #a.
Controls the presence and behavior of the signal output port labeled #d.
Event-Based Entity Generator, Path Combiner
Replicating Entities on Multiple Paths
![]() | Release Gate | Schedule Timeout | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |