Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > QUEUE Functions

QUEUE FIFO(inflow,outflow,profile,initial,age range) First In First Out QUEUE

Scroll Prev Top Next More

Defines a variable to be a Level with the specified inflow, outflow and initial value.  At the initial time to content of the queue (initial) is distributed over age TIME STEP to age range + TIME STEP with a profile given by the Lookup function profile. profile is effectively a probability distribution function that is automatically renormalized to have an x axis running from 0 to age range and an area of 1.  All of the y values in the Lookup should be greater than or equal to 0.

A queue is the same as a Level defined using an INTEG equation except that you can use the functions QUEUE AGE AVERAGE, QUEUE AGE IN RANGE and QUEUE AGE OLDEST to get information about what is in the queue.  Also, unlike an ordinary Level the value of a queue will never change within a time step so that using Runge-Kutta integration will give different results if queues are used instead of ordinary Levels.

Restrictions: QUEUE FIFO must appear directly after the = sign.  To make sense both inflow and outflow  should be positive and outflow should be controlled so that the queue never goes negative.

Behavioral Notes:  Queues are slower to compute and require more memory than ordinary levels and thus should only be used when you need to apply a QUEUE... function.  If inflow is negative it is treated as a positive outflow.  Similarly, if outflow is negative it is treated as a positive inflow.  If a queue goes negative it is treated as having entries only from the previous time step (both the average and oldest age will be equal to TIME STEP).

Note that because a queue is like a level, the value depends on the inflow and outflow from previous times, not the current inflow and outflow.  This means that if you want to allow the current period's inflow to be used as part of the current period's outflow you need to add it in.  For example:

max outflow = queue/TIME STEP + inflow 

For continuous models this is usually a minor point.  However, for discrete time (difference equation) models this can be significant.

Example

Waiting= QUEUE FIFO(Arriving,Servicing,Init Profile,100,20)

is the same as

Waiting= INTEG(Arriving-Servicing,100)

Availability: Not PLE or PLE Plus

See also: QUEUE FIFO ATTRIB

Sample model: QUEUE functions.mdl in FunctionExamples