Discussion papers

CPM-17-241 - 6 February 2018

Queue -- a NetLogo Extension

Ruth Meyer

Queue is a new extension for NetLogo offered by the CPM. It introduces a new data type to NetLogo: a queue (with statistics).

What is it?

Queue is an extension for NetLogo version 5.x that introduces a new data type: a queue, which is a commonly used component in discrete-event simulation, in particular for modelling queueing systems. Objects can be inserted into a queue at a particular point in simulated time according to a specified queueing strategy (default is “first in, first out” (FIFO), but “last in, first out” (LIFO) is also supported). Requests to remove an element from a queue always returns the top-most object.

Queues can be questioned as to their current status (length, empty?) and time-weighted statistics are calculated (mean length, max length, mean waiting time, max waiting time). Trying to insert an object with an associated simulation time lying in the past (i.e. a simulation time smaller than the last access time of the queue) throws an exception.

To make writing discrete-event simulations in NetLogo easier, we recommend using the queue extension together with the time extension, which provides a discrete-event scheduler amongst other things.

How to use it

Download the archive queue.zip, un-zip it and place the resulting folder queue inside the extensions directory of the NetLogo directory. The queue extension comes with a brief documentation of all its primitives.

The source code is provided on github.

Acknowledgements

Extension developed under the DiDIY Project funded from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 644344. The views expressed in this article do not necessarily reflect the views of the EC.

Downloads