Entity Input Switch
Switch input entities
Libraries:
SimEvents
Description
A typical scenario in which you might use an input switch is when multiple sources of entities feed into a single queue, where the sequencing follows specific rules. For example, users of terminals in a time-shared computer submit jobs to a queue that feeds into the central processing unit, where an algorithm regulates access to the queue so as to prevent unfair domination by any one user.
Note
If you want to merge message or entity paths and generate code for your component
interface, use the Simulink®
Message
Merge block. Message Merge block's behavior is the same
as the Entity Output Switch block with Active port
selection parameter set to All
.
For an example, see Generate Entities When Events Occur.
Combine Entity Paths
You can merge multiple paths into a single path using the Entity Input
Switch block with the Active port selection
parameter set to All
. Merging entity paths does not
change the entities themselves, just as merging lanes on a road does not change the
vehicles that travel on it. In particular, the Entity Input Switch
block does not create aggregates or batches.
Here are some scenarios in which you might combine entity paths:
Attaching different data — Multiple entity generator blocks create entities having different values for a particular attribute. The entities then follow a merged path but might be treated differently later based on their individual attribute values.
Merging queues — Multiple queues merge into a single queue.
Connecting a feedback path — A feedback path enters the same queue as an ordinary path.
Sequence Simultaneous Pending Arrivals
The Entity Input Switch block does not experience any collisions, even if multiple entities attempt to arrive at the same time. The categories of behavior are as follows:
If the entity output port is not blocked when the entities attempt to arrive, then the sequence of arrivals depends on the sequence of departure events from blocks that precede the Entity Input Switch block.
Even if the departure time is the same for multiple entities, the sequence might affect the system's behavior. For example, if the entities advance to a queue, the departure sequence determines their positions in the queue.
If pending entities are waiting to advance to the Entity Input Switch block when its entity output port changes from blocked to unblocked, then the entity input ports are notified of the change sequentially. The change from blocked to unblocked means that an entity can advance to the Entity Input Switch block.
If at least two entities are waiting to advance to the Entity Input Switch block via distinct entity input ports, then the notification sequence is important because the first port to be notified of the change is the first to advance an entity to the Entity Input Switch block.
Select Arrival Path
The Entity Input Switch block allows arrival of entities at its ports. The selected entity input port can change during the simulation.
You can also select the criterion for switching between input ports.
Select
Round robin
to select ports in a round robin fashion.Select
From control port
to let the control port determine the selected port.Select
Equiprobable
to let the block randomly select any port with equal probability.
Examples
Ports
Input
Output
Parameters
Version History
Introduced in R2016a