Skip to Main Content Skip to Search
Product Documentation

Output Switching to Select a Departure Path

Role of the Output Switch

The Output Switch block in the Routing library selects one among a number of entity output ports. The selected port can change during the simulation. You have several options for criteria that the block uses to select an entity output port.

When the selected port is not blocked, an arriving entity departs through this port.

Sample Use Cases

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

The topics listed below illustrate the use of the Output Switch block.

TopicFeatures of Example
Example: Selecting the First Available ServerFirst port that is not blocked switching criterion
Example: Using an Attribute to Select an Output PortAttribute-based switching, where the attribute value is random
Example: A Packet SwitchAttribute-based switching in conjunction with a Path Combiner block
Example: Choosing the Shortest QueueSwitching according to a computation that occurs upon entity arrivals

To learn about design considerations when you switch according to an input signal, see Output Switching Based on a Signal. To learn about all supported switching criteria, see the reference page for the Output Switch block.

Example: Selecting the First Available Server

In this example (open model), entities arriving at the 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.

You can implement this approach by setting the Switching criterion parameter in the Output Switch block to First port that is not blocked.

This deterministic model creates one entity every second and attempts to advance the entity to one of two servers. The two servers have different service times, both greater than 1 second. The server with the longer service time becomes available less frequently and has a smaller throughput. The FIFO Queue block stores entities while both servers are busy. After any server becomes available, an entity in the queue advances to the Output Switch, which outputs that entity to that server.

The Output Switch block also outputs a signal containing the index of the entity output port through which the most recent entity departure occurred. The Signal Scope block plots the values of this signal. You can see from the plot that, compared to the first server, the second server processes more entities because its service time is shorter.

Example: Using an Attribute to Select an Output 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 implement the sorting, set the Switching criterion parameter in the Output Switch block to From attribute.

The example below (open model) illustrates the sorting process (but not the delivery process itself), partitioning the delivery area into three geographic zones. An entity generator represents sources of parcels addressed to one of the zones. After being marked with a randomly chosen zone 1, 2, or 3 via the Set Attribute block, the parcels advance to the queue to wait for sorting. The Single Server block models the small delay incurred in the sorting process and sends each parcel through the Output Switch block to one of three entity output ports. From there, the example merely counts the sorted entities destined for each zone, but your own simulation might do something interesting with the outputs from the switch.

  


Free SimEvents Evaluation Kit

Learn how you can use SimEvents discrete-event simulation capabilities through these technical resources.

Get free kit

Trials Available

Try the latest version of discrete-event simulation products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS