FIFO Queue

Store entities in sequence for undetermined length of time

Library

Queues

Description

This block stores up to N entities simultaneously, where N is the Capacity parameter value. The block attempts to output an entity through the OUT port, but retains the entity if the OUT port is blocked and N>0. If the block is storing multiple entities and no entity times out, then entities depart in a first-in, first-out (FIFO) fashion. If an entity in this block is scheduled to time out, then it might depart prematurely via the optional TO port; see Forcing Departures Using Timeouts for details about timeouts. The length of time that an entity stays in this block cannot be determined in advance.

The IN port is unavailable whenever N>0 and this block stores exactly N entities. In this case, the queue is said to be full.

If N=0, then the availability of the IN port matches the availability of the subsequent block's entity input port to which this block's OUT port is connected. If N=0, all arriving entities depart immediately because this block cannot store entities.

Ports

Entity Input Ports

LabelDescription
INPort for arriving entities, which are stored.

Entity Output Ports

LabelDescription
OUTPort for departing entities that do not time out while in this block.
TOPort for entities that time out while in this block. This port appears only if you select Enable TO port for timed-out entities. This port must not be blocked when an entity attempts to depart here.

Signal Output Ports

LabelDescriptionTime of Update When Statistic Is OnOrder of Update When Entity Departs
#dNumber of entities that have departed from this block via the OUT port since the start of the simulation.After entity departure via the OUT port4
#nNumber of entities currently in the queue.After entity arrival at a nonempty queue and after entity departure3
peA value of 1 indicates when the block tries and fails to output an entity. A value of 0 indicates when the queue is empty or an entity departure is imminent.After entity arrival and when entity departure is imminent1
wSample mean of the waiting times in this block for all entities that have departed via any port.After entity departure2
lenAverage number of entities in the queue over time, that is, the time average of the #n signal.After entity arrival at a nonempty queue and after entity departure2
#toNumber of entities that have timed out from this block since the start of the simulation.After entity departure via the TO port4

Output signals having the same number in the Order of Update column in the table above are updated in an arbitrary sequence relative to each other; you should not rely on a specific sequence for your simulation results.

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

FIFO Queue Tab

Capacity

Determines how many entities the block can store at a time.

Timeout Tab

Enable TO port for timed-out entities

This option becomes relevant if an entity times out while in this block. Selecting this option provides a TO entity output port through which the timed-out entity departs. If you clear this option in a model that uses timeouts, see the If entity has no destination when timeout occurs parameter of the Schedule Timeout block.

Statistics Tab

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.

Number of entities departed

Controls the presence and behavior of the signal output port labeled #d.

Number of entities in queue

Controls the presence and behavior of the signal output port labeled #n.

Status of pending entity departure

Controls the presence of the signal output port labeled pe.

Average wait

Controls the presence and behavior of the signal output port labeled w.

Average queue length

Controls the presence and behavior of the signal output port labeled len.

Number of entities timed out

Controls the presence and behavior of the signal output port labeled #to.

Examples

See Also

LIFO Queue, Priority Queue

Basic Queues and Servers

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS