A queuing network simulator written in Kotlin. Part of the Computer Simulation course at IUST (Fall 2021).
Networks of queues are systems in which a number of queues are connected by what's known as customer routing. When a customer is serviced at one node it can join another node and queue for service, or leave the network.
In order to build the application and its components you need GraalVM, which is a high-performance JDK.
KueueNetworkSimulator (KNS) allows for defining your own queue networks using the QueueNetworkDescription
class. A queue network description is described in a very similar fashion to describing graphs using adjacency lists. Kotlin's idiomatic syntax allows for defining network descriptions very easily, in some cases using less code than well-known graph DSLs.
Example:
val sampleNetwork = QueueNetworkDescription(
startNodes = listOf(
StartNodeDescription(
id = 1,
serviceRate = 2.0,
arrivalRate = 1.0
)
),
queueNodes = listOf(
QueueNodeDescription(
id = 2,
serviceRate = 4.0
),
QueueNodeDescription(
id = 3,
serviceRate = 3.0
)
),
edges = listOf(
EdgeDescription(1, 2, 0.4),
EdgeDescription(1, 3, 0.6)
)
)
The above code corresponds to the following queue network:
Under the hood, there are three main steps to each KNS app.
KNS uses the NetworkCreator
class to convert a QueueNetworkDescription
object to a QueueNetwork
object, which is the runtime representation of the queue network, and is used in Step 2 and Step3.
KNS offers a GUI which automatically displays the corresponding queue network using its graph representation. The '''GraphvizGenerator''' class is a mapper that converts '''QueueNetwork''' objects to their standard GraphViz representations. Next, the graphviz-java library is used to draw the input graph.
Finally the QueueNetworkSimulator
class is used to perform the simulation on the QueueNetwork
object. KNS uses the standard Discrete-time Event Simulation paradigm. The simulator uses an event queue which is filled with both arrival and departure events. As the events are executed the simulation clock progresses and logs are recorded for future reporting.