Model Basic Queuing Systems

Example of a Logical Queue

Suppose that you are modeling a queue that can physically hold 100 entities and you want to determine what proportion of the time the queue length exceeds 10. You can model the long queue as a pair of shorter queues connected in series. The shorter queues have length 90 and 10.

Although the division of the long queue into two shorter queues has no basis in physical reality, it enables you to gather statistics related to one of the shorter queues. In particular, you can view the queue length (n) of the queue having length 90. If the signal is positive over a nonzero time interval, then the length-90 queue contains an entity that cannot advance to the length-10 queue. This means that the length-10 queue is full. As a result, the physical length-100 queue contains more than 10 items. Determining the proportion of time the physical queue length exceeds 10 is equivalent to determining the proportion of time the queue length signal of the logical length-90 queue exceeds 0.

Vary the Service Time of a Server

You can vary the service time of a server using one of the following methods:

  • Constant source, where you vary the constant

  • Randomized source

  • Arbitrary source

  • Time-based source

Use the Service time source parameter of the Entity Server block to apply these methods. You can select from:

  • Dialog

    Enter the constant value in the Service time value parameter.

  • Signal port

    Connect a time source to the resulting signal port.

  • Attribute

    Enter the name of the attribute that contains data to be interpreted as service.

  • MATLAB action

    In the Service time action section, enter MATLAB® code to vary the service time. Assign the variable dt, which the model uses as service time.

Random Service Times

This example is a simple queuing system in which entities arrive at a fixed deterministic rate. They then wait in a queue and advance to a server that services the entities at random intervals. It illustrates use of the Service time from random distribution design pattern.

  1. In a new model, drag the blocks shown in the example and relabel and connect them as shown. For convenience, start with the Service time from random distribution design pattern

  2. To generate entities every .5 seconds, in the Entity Generator block:

    1. In the Entity Generation tab, change the Period to .5.

    2. In the Statistics tab, select Number of entities departed, d.

  3. In the Entity Queue block, select Number of entities in block, n.

  4. In the Entity Server block:

    1. Verify that the server is configured for random service time. If not, copy the Server block from the Service time from random distribution design pattern.

    2. In the Statistics tab, select Number of entities in block, n.

  5. In the Entity Terminator block, in the Statistics tab, select Number of entities arrived, a.

  6. Save and run the model. In particular, observe the pattern of the entities leaving the Entity Generator block and the entities at random service times.

See Also

|

Related Examples

More About