NetLogo User Community Models
by Nick Bennett (Submitted: 02/24/2010)
WHAT IS IT?
This is a simple queueing system model, with a single, unlimited queue and 1-10 homogeneous servers. Arrivals follow a Poisson process, and service times are exponentially distributed.
HOW IT WORKS
This is a discrete-event simulation, which is a type of simulation that advances the clock in discrete, often irregularly sized steps, rather than by very small, regular time slices (which are generally used to produce quasi-continuous simulation). At each step, the clock is advanced to the next scheduled event in an event queue, and that event is processed. In this model, the different events are: customer arrival and entry into the queue (followed, if possible, by start of service); service completion, with the customer leaving the system (followed, if possible, by start of service for a new customer); statistics reset; and simulation end. Since these are the only events that can result in a change of the state of the simulation, there is no point in advancing the clock in smaller time steps than the intervals between the events.
HOW TO USE IT
Use the number-of-servers slider to set the number of servers; then press the Setup button to create the servers and reset the simulation clock.
The mean-arrival-rate and mean-service-time sliders control the arrival and service processes, respectively. These values can be changed before starting the simulation, or at anytime during the simulation run; any changes are reflected immediately in a running model.
The max-run-time and stats-reset-time control the length of the simulation and the time at which all the aggregate statistics are reset, respectively. The latter allows for minimizing the effects of system startup on the aggregate statistics.
The simulation can be run one step at a time with the Next button, or by repeatedly processing events with the Go button.
The aggregate statistics can be reset at any time - without emptying the queue or placing servers in the idle state - with the Reset Stats button.
THINGS TO NOTICE
After the simulation has started, the next scheduled arrival time is always shown in the Next Arrival Time monitor. When any of the servers are busy, the scheduled time of service completion is shown in the label below the server.
In queueing theory notation, the type of system being simulated in this model is referred to as M/M/n - i.e. Poisson arrivals, exponential service times, infinite queue capacity and source population, FIFO queue discipline. When there is a single server, or when all the servers have the same mean service time, the steady state characteristics (if the system is capable of reaching a steady state) can be determined analytically. In this model, these theoretical values are shown in the bottom row of monitors. If the theoretical server utilization - determined by multiplying the arrival rate by the service time, dividing by the number of servers, and taking the lesser the result of the calculation and 1 - is less than 1, then the queueing equations have a defined solution; otherwise, the expected queue length and expected time in the queue are unbounded. In this model, these unbounded values are denoted by "N/A" in the associated monitors.
This model displays servers in a row along the bottom of the NetLogo world; customers are shown in a queue which "snakes" from near the bottom of the NetLogo world to the top. However, these display features are purely for visualization purposes; the positions of the servers and customers, and the colors of the customers, have no functional purpose or impact. The colors of the servers, on the other hand, does have a meaning: an idle server is shown in green, while a busy server is red.
THINGS TO TRY
Run the simulation several times, to get a sense of the effects of the different parameters on the average queue length and average time in the queue. How do these observed statistics compare with the theoretical values? Do the input parameters seem to affect not only the average queue length, but also the variability of the queue length?
EXTENDING THE MODEL
This model could easily be extended to support non-identical mean service times for different servers (possibly through an Add Server button that creates servers one at a time, each with a specified mean service time value); additional service time distributions besides exponential; a capacitated queue; and alternative queue disciplines (random priority and LIFO would be the easiest to add). However, when simulating a system with these complicating factors, the computations for expected queue length and expected time in the queue can become difficult, or even practically impossible. Note, however, that there is a general relationship - known as Little's formula - between expected queue length and expected time in the queue (or, more generally, between expected number of customers/transactions in the entire system, and the expected time a customer/transaction spends in the system), which holds for even very complicated queueing systems.
This model uses the tick-advance primitive to advance the NetLogo ticks value by non-integral amounts. This allows the NetLogo clock to be used as a discrete-event simulation clock. However, the standard ticks display (normally seen in the bar above the NetLogo world) is unable to display non-integral values, so this model uses a separate ticks monitor.
CREDITS AND REFERENCES
Copyright 2010, Nick Bennett, Grass Roots Consulting (http://www.g-r-c.com ). All rights reserved.
Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed: a) this copyright notice is included. b) this model will not be redistributed for profit without permission from Nick Bennett. Contact Nick Bennett (email@example.com) for appropriate licenses for redistribution for profit.
(back to the NetLogo User Community Models)