Main Content

Entity Output Switch

Output entities

  • Entity Output Switch block

Libraries:
SimEvents

Description

The Entity Output Switch block allows you to select an output port for the departure of an entity among multiple entity output ports. The selected port can change during the simulation and you can choose the criterion for switching between output ports.

Here are some scenarios in which you might use an output switch:

  • Entities advance to one of several queues based on efficiency or fairness concerns. For example, airplanes advance to one of several runways depending on queue length, or customers advance to the first available cashier out of several cashiers.

    Comparing different approaches to efficiency or fairness, by testing different rules to determine the selected output port of the output switch, might be part of your goal in simulating the system. For an example, see Route Vehicles Using an Entity Output Switch Block.

  • Entities advance to a specific destination based on their characteristics. For example, parcels advance to one of several delivery vehicles based on the locations of the specified recipients.

  • Entities use an alternate route in case the preferred route is blocked. For example, a communications network drops a packet if the route to the transmitter is blocked and the simulation gathers statistics about dropped packets.

Alternatively, you can use the Entity Gate block to control the flow of entities on a specific entity path. For more information, see Using Entity Priority to Sequence Departures.

Examples

Ports

Input

expand all

Input entity port for entities entering the block.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | enumerated | bus | fixed point

Input control port for the incoming control entity that determines the output port for the entities departing from the block.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Output

expand all

Output entity port for entities exiting the block.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | enumerated | bus | fixed point

Output entity port for entities exiting the block.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | enumerated | bus | fixed point

Parameters

expand all

Number of output ports for entity departure.

Programmatic Use

Block Parameter: NumberOutputPorts
Type: character vector
Values: '2' | scalar
Default: '2'

Choose the criterion for switching between output ports.

  • To output the entity to the first unblocked port, select First port that is not blocked.

    Assume an example where entities arriving at the Entity Output Switch block depart through the first entity output port that is not blocked, as long as at least one entity output port is not blocked. An everyday example of this approach is a single queue of people waiting for service by one of several bank tellers, cashiers, call center representatives, etc. Each person in the queue wants to advance as soon as possible to the first available service provider without preferring one over another.

  • To output entities in a round robin fashion among the output ports, select Round robin.

  • Select From control port to let the control port determine the selected port for entity departure. A control port will appear to input an anonymous entity carrying data with a value greater than 0 and smaller than or equal to the number of output ports to determine the active port.

  • To specify an attribute that determines the output port, select From attribute. The attribute value is greater than 0 and smaller than or equal to the number of output ports to determine the active port.

    Consider the situation in which parcels are sorted among several delivery vehicles based on the locations of the specified recipients. If each parcel is an entity, then you can attach data to each entity to indicate the location of its recipient.

  • To randomly select an output port for entity departure, select Equiprobable. Set the Seed to generate a random number and to determine the active output port.

Note

The block rounds a double precision value to the nearest integer less than or equal to its value as port selection. For instance, the value 0.3 is rounded of to 0 which is not a valid value for port selection.

Programmatic Use

Block Parameter: SwitchingCriterion
Type: character vector
Values: 'First port that is not blocked' | 'Round robin' | 'From control port' | 'From attribute' | 'Equiprobable'
Default: 'First port that is not blocked'

Select the initial port for the entity departure.

Dependencies

This parameter is visible when Switching criterion is set to Round robin or From control port.

Programmatic Use

Block Parameter: InitialPortSelection
Type: character vector
Values: '1' | scalar
Default: '1'

Specify the attribute name used to switch the output port.

Dependencies

This parameter is visible when Switching criterion is set to From attribute.

Programmatic Use

Block Parameter: SwitchAttributeName
Type: character vector
Values: 'Attribute1' | character vector
Default: 'Attribute1'

Specify the seed for the random number generator to determine the output port.

Dependencies

This parameter is visible when Switching criterion is set to Equiprobable.

Programmatic Use

Block Parameter: Seed
Type: character vector
Values: '34567' | scalar
Default: '34567'

Version History

Introduced in R2016a