Many discrete event simulations are interested in the service time of
items, whether in manufacturing, customer service, or other kinds of
situations. When an item is not actually being processed or serviced, it
is usually waiting in line. Thus, the simulation models are usually
Today, we'll look at a few queuing models and some modeling techniques.
To have a more graphical output between a min and max, you can use a
meter. Here's an example:
To use a meter:
- insert one into your model from Models/Controls/Meter
- Set the minimum and maximum values, either by typing them into the
dialog box, or wiring the top connector to the minimum and the bottom
connector to the maximum
- Connect the value to the middle connector.
I didn't build these myself. I got these from the web site of Charles
Winton at the University of North Florida, which is linked from the Extend
- Basic queuing models
- TimedSQSS.mox: basic timed
single queue, single server model
Don't be frightened. There's less here than meets the eye. It uses a
lot cloning. Follow the items through the simulation to see that this is
mostly just a single arrival, single server queue. New features:
- The Status block allows us to notice items passing along. In this
model, one of them finds the interarrival times, the other finds the s
- The Time Unit block converts one time unit to another. You could do
just as well with an equation block, albeit less conveniently.
- The Timer block lets us find the distribution of service times.
- The ReadOut block displays a value. It can also be used to pause the
simulation for a moment, allowing you to keep an eye on things or to pause
the simulation permanently.
- UntimedSQSS.mox: basic single
queue, single server model stopped by a criteria other than time
This model is one that allows customers to arrive until the doors
close, then those customers are allowed to finish, and then the simulation
stops. New stuff:
- The Switch block that produces a yes/no, 1/0 output under user or
- The TimeOut block that produces a yes/no, 1/0 value at a specified
- The Logical AND block, which computes whether both of two computations
- The "Count" input of the Executive block, which stops the input when
that number of events occurs.
- MQMserver.mox: multi-queue,
multi-server model using shortest line criteria. This model has some
important techniques in it, so we'll spend some time on it.
This model has four servers, and the incoming customers go to the
shortest line. It does this by computing the queue with the minimum
length and using a binary tree of select blocks to put the customer in the
correct queue. New stuff:
- Max&Min block. This is pretty intuitive.
- Activity, Delay (Attributes). This is convenient when the delay time
depends on the item and not the server, but there are multiple servers.
- Select DE Output. This can also reject an item if the select input
has the wrong value. This means we only have to deal with the bottom
level of the tree.
- The "active" output of the server block.
- HierBlock.mox: multi-queue,
multi-server model using hierarchical blocks
This uses hierarchy to do an even better job of choosing the shortest
of 8 lines. New stuff:
- a clone of an equation
- a default value for a min computation
- Priority queues, matching queues, suspending a queue
- Using resources and attributes
The W output of the Queue
It would be cool to choose a queue by the minimum average waiting time,
rather than the queue length. After all, if there were two queues, one
with a dozen people, all with 1 or 2 items, and the other with two or
three people with carts full of items, you'd probably choose the long
You might think that the W output of the Queue block would be the way
to go. Alas, it turns out that the W output has several problems. First,
it only produces the waiting time of the last item to leave. While this
might be useful sometimes, it's often not what we want. Here's how we can
Secondly, it often produces no value, rather than a zero. That can be
solved with relatively simple tricks, namely, comparing the value to zero
and taking the larger:
If you really want the minimum mean waiting time, it's best to use
In this last model, notice the fun stuff I did with the plotter: you
can control the colors and textures of the lines.
Here it is with a hierarchical block. I could spend a bunch of time
drawing a cool icon for it, but this is sufficient, though not as pretty.
To practice with these ideas, try the following:
- Build a model that has a single server but which finds the length of
the line including whether there is someone at the server. Just use the
ideas from Winton's model above (the MQMserver.mox) model.
- Build a hierarchical block to encapsulate the queue+server with an
output for the length.
- Replicate that block so that we have 4 servers.
- Have the items go to the server with the shortest line.
- For additional "fun," in the second step, add blocks so that the
actual mean service time is computed. Add an output for that.
- Another interesting thing is how to compute the min of more than 4
things. Winton does it in an effective way, but there's an easier way:
click on the "+5connectors" button in the dialog box for the Min&Max
block. This will add another Min&Max block below and attached to the
first. Use the outputs on the new box.
This work is licensed under a Creative Commons