Simulation

To describe the general setup of a simulation in jasima we will use the example of a single server queue model.

M/M/1 queuing system
Figure 1. Schematics of a M/M/1 single server queue (source Wikipedia)

In this model there is a single server processing incoming jobs/service requests. The server can process at most one job at a time, if it is busy, incoming requests have to wait in a queue (of unlimited capacity) until they can be served. Service times and also the arrival process of new jobs are characterized by an exponential distribution.

Exponential distributions are characterized by a single parameter, hence our model is characterized by the two parameters μ for the service time and λ for the interarrival times, i.e., the time between the arrival of two consecutive jobs.

To explain the most important aspects of creating a simulation in jasima we use this M/M/1 model as an example. In the project_template_standalone there are two versions of this model. A first version in the package examples.simulation.events uses a purely event-based approach. Process-oriented simulation features are used in the example available in the package examples.simulation.process. Both modelling styles are supported in jasima and can be freely mixed, i.e., certain simulated components can use event-oriented, others process-oriented modelling. The two styles can even be mixed in a certain component: an event-oriented SimComponent can activate its own SimProcesses if it wants to and still react to plain simulation events.

Both versions of the model do the same thing, both have two parameters. One is the number of jobs to be created, defining the simulation length. After the last job was created, the simulation is stopped. The second parameter is the so-called traffic intensity. We don’t parameterize the model using μ and λ. Instead we fix μ at 1 and use the traffic intensity to specify λ. The traffic intensity is a value in the interval (0, 1). A traffic intensity of say 0.85 will lead to a server that is utilized 85% of the time in the long run. For shorter simulation runs server utilization can deviate considerably from this value due to the random influences in the model.

The following topics are demonstrated in the examples and further explained on separate pages:

Additional concepts not used in the simple M/M/1 example but frequently used in simulation models are explained on separate pages:

  • waiting on certain conditions, also known as state-base events

  • collecting statistics with jasima.core.statistics.SummaryStat and jasima.core.statistics.TimeWeightedSummaryStat

Experiments

Besides simulations, experiments are usually an important component in a jasima project. An experiment is basically a function: it has parameters, gets executed and produces results. Experiments can be used independently of simulations; there is a SimulationExperiment, but this is just one particular type of experiment.

The most important types and uses of Experiments are explained in Running Experiments. Creating custom experiments is also explained using the example of a very simple Monte-carlo simulation.