| SimEvents® | ![]() |
Routing
This block selects exactly one entity input port for potential arrivals. The selected entity input port can change during the simulation. When one entity input port becomes selected, all others become unavailable.
The possible rules the block uses for selecting an entity input port, as well as the corresponding values of the Switching criterion parameter in the dialog box, are listed in the table below.
| Switching criterion Value | Description |
|---|---|
| Round robin | At the beginning of the simulation, IN1 is selected. After each departure, the block selects the entity input port next to the last selected port. After exhausting all entity input ports, the block returns to the first one, IN1. |
| Equiprobable | At the beginning of the simulation and after each departure, the block randomly chooses which entity input port is selected for the next arrival. All entity input ports are equally likely. The Initial seed parameter initializes the random number generation process. |
| From signal port p | Selecting this option creates an additional signal input port, labeled p. The signal at this port must have integer values between 1 and the Number of entity input ports parameter value. The block detects changes in this integer value and selects the corresponding entity input port for future arriving entities. |
Tip If multiple entity input ports of the Input Switch block are on entity paths that come from a single block having multiple entity output ports, then you should include a storage block in each of those paths. For example, instead of connecting two entity output ports of an Entity Splitter block directly to two entity input ports of an Input Switch block, you should insert a storage block in each of the two paths. |
Entity Input Ports
| Label | Description |
|---|---|
| IN1, IN2, IN3, etc. | Ports for potential entity arrivals. At any given time, one input port is selected and the others are unavailable. The Number of entity input ports parameter determines how many of these entity input ports the block has. |
Signal Input Ports
| Label | Description |
|---|---|
| p | Index of the entity input port that is available. Values are 1, 2, 3,..., Number of entity input ports. This port appears only if you set Switching criterion to From signal port p. |
Entity Output Ports
| Label | Description |
|---|---|
| OUT | Port for departing entities. |
Signal Output Ports
| Label | Description | Time of Update When Statistic Is On | Order of Update |
|---|---|---|---|
| #d | Number of entities that have departed from this block since the start of the simulation. | After entity departure | 2 |
| last | Index of the input port that was available the last time an entity departed. The initial value is 0. After an entity has departed, values are 1, 2, 3,..., Number of entity input ports. | After entity departure | 1 |
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 input ports the block has. This parameter must be a literal value, not a variable or an expression requiring evaluation.
The rule that determines which entity input port is selected for receiving entities.
A nonnegative integer that initializes the random number generator used to select an entity input port. This field appears only if you set Switching criterion to Equiprobable.
Select this option to explicitly prioritize the port-selection event, relative to other simultaneous events in the simulation. If you do not select this option, the event has priority SYS1 on the event calendar. For details, see Choosing How to Resolve Simultaneous Signal Updates. This field appears only if you set Switching criterion to From signal port p.
The priority of the port-selection event, relative to other simultaneous events in the simulation. For details, see Specifying Event Priorities to Resolve Simultaneous Signal Updates. This field appears only if you set Switching criterion to From signal port p and select Resolve simultaneous signal updates according to event priority.
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 #d.
Controls the presence of the signal output port labeled last.
![]() | Initial Value | Instantaneous Entity Counting Scope | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |