Documentation

Input Switch

Accept entities from selected entity input port

Library

Routing

Description

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 ValueDescription
Round robinAt 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.
EquiprobableAt 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 pSelecting 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.

Ports

Entity Input Ports

LabelDescription
IN1, IN2, IN3, and so onPorts 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

LabelDescription
pIndex of the entity input port that is available. Values are 1, 2, 3,..., Number of entity input ports. This signal must be an event-based signal. You see this port only if you set Switching criterion to From signal port p.

Entity Output Ports

LabelDescription
OUTPort for departing entities.

Signal Output Ports

LabelDescriptionTime of Update When Statistic Is OnOrder of Update
#dNumber of entities that have departed from this block since the start of the simulation.After entity departure2
lastIndex 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 departure1

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

Input Switch Tab

Number of entity input ports

Determines how many entity input ports the block has.

Switching criterion

The rule that determines which entity input port is selected for receiving entities.

Initial seed

A nonnegative integer that initializes the random number generator used to select an entity input port. You see this field only if you set Switching criterion to Equiprobable.

Resolve simultaneous signal updates according to event priority

Select this option to prioritize the port-selection event explicitly, 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 Resolve Simultaneous Signal Updates. You see this field only if you set Switching criterion to From signal port p.

Event priority

The priority of the port-selection event, relative to other simultaneous events in the simulation. For details, see Specify Event Priorities to Resolve Simultaneous Signal Updates. You see this field only if you set Switching criterion to From signal port p and select Resolve simultaneous signal updates according to event priority.

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 departed

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

Last entity arrival port

Allows you to use the signal output port labeled last.

Was this topic helpful?