Simulator of Queueing Networks
Introduction
Simulation methodology
Simulation control
Generator
Service station
System results
Saving & loading
Random generators
Example/tutorial
Introduction
This interactive simulator supports simulation based analysis of queueing
networks made of interconnected Generators of customers and Service stations.
There can be practically any number of both. The implementation platform (HTML & JavaScript)
does not support graphics (at least in a feasible way). That's why the simulator does not
visualize the network topology automatically, but you can display a file with network block diagram.
There can be a lot of data
for each generator and service station. So the simulator always shows one generator, one
service station, and global simulation results. For the selected generator and service station the
simulator displays both distributions (see later), parameters, and simulation results.
There are selection lists in the Control panel, so it is very easy to switch among
generators and service stations. Optional report in a separate browser window contains
summary of all results. The first version of the simulator is based on these assumptions:
- There is only one class of customers. After generation a customer can randomly enter any
service station. After each service a customer can randomly enter another service station
including the one where the service just ended or
leave the network.
- Unlimited population is supposed (random intervals between arrivals do not depend on the number
of customers in the network).
- Simulation starts in time 0 by scheduling first arrivals for all generators. Initially
all service stations are empty.
- Service stations can have limited capacity. Customer entering a full station is lost.
- Service stations are made of a possibly limited queue and any number of parallel
identical channels. Service duration is random, state independent. Queue discipline is either
FIFO or LIFO. Load among channels is distributed evenly (no results are available for
individual channels).
- Routing of customers is represented by random destination that exists for each
generator and each service station. Destination is the service station number or 0
for the environment respectively.
- Simulation experiment either takes a certain time or it can be terminated by some
number of generated and/or served (departed) customers. Out of these three conditions
the one that comes first is applied.
All typical simulation results are supplied. Tables of user defined
random distributions, individual generators and service stations, and the whole network
can be saved to cookies and loaded within one year. Next chapters describe the details.
Simulation methodology
- Prepare a chart with numbered generators and service stations together with their
interconnection. This is not necessary, but useful for bigger networks. You can also
create a file (like net.gif), store it in your computer and display it in the help
window. To do this, press the Show button in the Network group in the
Control panel. (In some browsers
it is necessary to re-enter the file location in the Location Toolbar of the
help window.)
- Create the generators and the service stations. These objects are created by simply
entering the required numbers in the Control panel. After (re)loadig the simulator, one
of each is created automatically. Increasing the number adds more objects, decreasing
the number has to be confirmed because data can be lost. Objects are generated with these
default properties:
- Generator: exponential interval with mean=1, all customers directed to station 1.
- Service station: unlimited FIFO queue, one server with exponential service
time with mean=1, all customers directed to the environment.
So without any further settings after (re)loading, an M/M/1 system is simulated.
- Modify all objects that includes random routing on arrival and after service. So the only
global parameters except simulation control are the number of generators and the number of
servers. Save longer user defined distribution tables or alternatively whole generators
and/or stations. The whole network can also be saved.
- Set simulation control. Start with a short experiment length and smaller numbers of
generated and served customers (if used). Do not generate report until all works well.
Speed of simulation depends on your computer and your browser. Typical PCs can simulate even
medium complexity networks with reasonable speed. For longer experiments uncheck the
status in the Control panel (updating the status bar takes a lot of time).
- Create reports for selected experiments. Generated documents can be saved, but
Copy-Paste to other documents with subsequent editing is probably the fastest way to use
the simulation results.
Simulation control
The window is divided into two panels. The Control panel
is used for simulation control, the Network panel displays properties of network
objects and all results. The Control panel contains the following inputs
organized into groups. For more details read the corresponding paragraphs.
Control
- Button Run starts a simulation experiment. To start simulation all user defined distribution
tables must be confirmed.
- Button Help displays this text.
- Selection Generator is used to select the generator displayed in the network panel.
After increasing/decreasing the number of generators the selection list is updated.
- Selection Server is used to select the service station displayed in the network panel.
After increasing/decreasing the number of stations the selection list is updated.
Experiment
- Input Duration is used to enter the experiment length. Time is expressed in abstract
units interpreted by the user.
- Input Arrivals is used to terminate the experiment by the number of
generated customers. Enter 0 to ignore this number.
- Input Departures is used to terminate the experiment by the number of
served (departed) customers. Enter 0 to ignore this number.
- Check the box Report if you want a summary report in a separate browser window.
- Uncheck the box Status to turn off updating of the status bar (experiments will run much faster).
Random generators
- Button Randomize initializes the seeds of all random generators.
- Button Record stores the current values of seeds in RAM.
- Button Restore restores the seeds from the values recorded in
RAM.
Network
- Button Show prompts for the network diagram file location and displays it in this
help window. To display local files in some browsers, the file location has to be entered
manually.
- Button Save saves the whole network in a cookie.
- Button Load loads the network from a cookie.
- Input Generators is used to enter the total number of generators. New objects are
created with default properties, deleting has to be confirmed.
- Input Servers is used to enter the total number of service stations. New objects are
created with default properties, deleting has to be confirmed.
Cookies
- Button Show displays the content of a cookie.
- Button Delete removes a cookie.
Generator
Generators have two parameters:
- Distribution of Intervals is the distribution of random times between two adjacent
arrivals. Select either a theoretical distribution with appropriate parameters or enter a table
of general (user defined) distribution. Help on entering a table is available. Table can also
be loaded.
- Routing of Arrivals is a user defined distribution with discrete generation. The
values are numbers of target service stations (rounded and checked for range). Customers sent
to non-existing stations are lost without any notice.
Number 0 means the environment - leaving the network.
Generator results are accompanied by Note buttons displaying a detailed explanation.
Service station
Service stations have these parameters:
- Distribution of Service Duration is the distribution of random service times.
Select either a theoretical distribution with appropriate parameters or enter a table
of general (user defined) distribution. Help on entering a table is available. Table can also
be loaded. Note that all channels of the station have the same distribution.
- Routing of Departures is a user defined distribution with discrete generation. The
values are numbers of target service stations (rounded and checked for range). Customers sent
to non-existing stations are lost without any notice.
Number 0 means the environment - leaving the network.
- Number of channels is the number of equal parallel servers.
- Select unlimited or limited queue length with maximum length for the
second case. Note that maximum queue can be zero. Note also that system
capacity is interpreted as the maximum queue plus the number of
channels.
- Queue organization can be selected (FIFO or LIFO).
Server results are accompanied by Note buttons displaying a detailed explanation.
System results
System (global) results are displayed at the end of each simulation experiment. They try
to assess the network as such, but due to different paths through network some figures
like for example "Average time in network" are not necessarily meaningful.
Anyway use Note buttons that display a detailed explanation. Check Report in the
Control panel to generate a summary of all results in a separate browser window.
Saving & loading
You can save tables of user defined distributions, individual generators and/or
service stations and the whole network. The Save buttons save the objects to a
cookie. All saved objects are given unique names. Confirm this default name
or enter any other. So for example you can save a long table
both under the default name and another short name. Then it can be fast loaded for all
tables with the same distribution. Loading also offers the default name that can be
modified. Table status and generation mode (continuous/discrete)
are also saved. If possible, save confirmed consistent tables.
The cookie expiration is one year, then the cookie will be deleted by the browser.
Check (save and immediately load) whether your browser does not disable cookies.
Unfortunately browsers limit the cookie size (4KB) and the number of cookies per server
or domain (maximum 20). So it can happen that some cookies are deleted during a session
(if more than 20 cookies are saved) or truncated during one saving operation (when saving
a large network). Distribution tables, generators and service stations are saved in distinct
cookies. The whole network is saved in two cookies. If the network name is "n1", the two
cookies are "n1g" and "n1s" for generators and stations respectively. To check whether
the network has been saved:
- save the network
- modify slightly the last generator and the last service station
- load the network and check whether the last objects have been restored.
Note that sometimes browsers behave strange with respect to processing cookies.
In the Control panel there is a section Cookies where you can view and delete
cookies of this document. Ignore the values of cookies, just note the names that are
followed by "=". Deleting is implemented by setting expiration time to
yesterday - cookie is then deleted by the browser.
Random generators
There are two separate underlying random generators for each
generator of customers, one for the intervals between arrivals and one for output
routing. Similarly there are two separate underlying random generators for each
service station, one for service times and one for output routing. All seeds are
initialized (randomized) at document loading and after entering the number of
servers and/or generators (even the same numbers as the current ones). You can also randomize the
seeds manually. The current values of the two
seeds are saved with the generator of customers and with the service station, all seeds are saved with the network. Loading
of course includes the seeds. So after loading a network you obtain identical
results as with the experiment performed just after saving the network. When
starting the experiments the seeds are not updated. So if the seeds are neither
restored nor randomized, each experiment starts
with the seeds left by the previous one.
You can also
record the seeds in RAM. The values are first recorded at document loading and after entering the number of
servers and/or generators (even the same numbers as the current ones). Then you can record and
restore the seeds at any time. Use this facility especially if there are
problems with cookies.
So unless the seeds are restored,
repeated experiments provide various results. Reduce the
variance by increasing the experiment duration.
Note that the native JSSim generator is the so-called Linear
Congruential Generator (LCG) known by the name MINSTD (Minimum Standard) that
passed all usual tests. See the code for the values of the constants. You can change the
values assigned in the head code of jssim.js if you prefer another
generator.
Example/tutorial
Let's consider the following practical situation: Customers of a certain bank are first served by tellers.
If all tellers are busy, customers wait in one not limited FIFO queue. Teller's service time is random,
let's assume that the distribution is uniform in the range from 2 to 13 minutes for all tellers.
After being served by a teller, customers either leave the bank or proceed to cashiers.
It has been observed that 80% of customers proceed to cashiers. Cashier's service time is random,
it is assumed that the distribution is normal with mean value 4 minutes and standard deviation 2 minutes.
If all cashiers are busy, customers wait again in one not limited FIFO queue. The arrival to the bank
is supposed to be approximately Poisson (with exponential intervals).
The management wants to know the necessary numbers of tellers and cashiers during peak hours
(mean interval between arrivals 2 minutes) and during less busy periods (mean interval between arrivals 5 minutes).
The criteria are queue lengths whose average values should not be more than 2 customers.
In both cases find also the mean time a customer spends at tellers and the mean time a customer spends at cashiers
together with utilization of both.
Outline of the solution:
After (re)loading, there is one generator directing all customers to station 1 and one station directing
all customers out of network. Let's assume, that station 1 represents the tellers, station 2 the cashiers.
So regarding the generator just change the mean of its exponential intervals from 1 to 5 (let's start with
less busy periods). Let one time unit be one minute.
In the Control panel enter 2 as the number of servers, that will create two service stations.
Both queues are by default unlimited with FIFO organization, so modify only these:
- Numbers of channels: these will in fact be parameters to be changed. Start with three tellers
and two cashiers.
- Set the service times (both are theoretical, so just select the proper distribution and
enter the two parameters).
- By default served customers leave the network. This has to be changed for the 1st station
(tellers). Enter a user defined distribution with two values: 0 with probability 0.2
(20% of customers leave the bank) and 2 with probability 0.8 (80% of customers proceed to cashiers).
In particular do the following:
- Leave the default simulation controls (or possibly start with a shorter experiment like 480 - 8 hours)
and press the Run button.
- Analyze the results and repeat the experiment with various numbers of tellers and cashiers. You will
find that during less busy periods two tellers and two cashiers will probably be enough.
Then change the arrival rate and analyze busy periods with different numbers of tellers and cashiers.
You will find that probably five tellers and three cashiers are necessary. Results also show the other required
parameters. Try longer experiments to avoid random fluctuations and to test capabilities of your browser.
These are the results of one particular experiment:
- Experiment length 48000 (100 shifts), busy mode - average 2 minutes between
arrivals,
- Configuration: 5 tellers and 3 cashiers. Service time as specified above,
- 24086 customers arrived, 19258 of them proceeded to cashiers,
- Average tellers queue: 0.894, average cashiers queue: 0.142,
- Average time spent at tellers: 9.25,
- Average time spent at cashiers: 4.48,
- Utilization of tellers: 0.750, utilization of cashiers: 0.552,
- Maximum time spent in the bank: 40.18.