4 SIMULATION AND MODELLING 4
4 SIMULATION AND MODELLING 4
1 INTRODUCTION
Real world phenomenon are very dynamic thus difficult to exactly predict. To make decisions in such
circumstances, we need a tool or verifiable procedures that guide decision makers to an informed and
provable decision and action. In this unit we will look at one such tool; simulation which has become
cornerstone to many probabilistic projects.
2 OBJECTIVES
At the end of this unit you should be to:
Say what simulation is about
State why we need simulation
Describe how simulations are done
Describe various types of Simulations
Give examples of Simulation
Show areas of applications of Simulation
3.0 WHAT IS SIMULATION?
The term simulation is used in different ways by different people. As used here,
simulation is defined as the process of creating a model (i.e., an abstract representation or exact copy)
of an existing or proposed system (e.g., a project, a business, a mine, a forest, the organs in your body,
etc.) in order to identify and understand those factors which
control the system and/or to predict (forecast) the future behaviour of the system. Almost any system
which can be quantitatively described using equations and/or rules can be simulated.
The underlying purpose of simulation is to shed light on the underlying mechanisms that control the
behaviour of a system. More practically, simulation can be used to predict (forecast) the future
behaviour of a system, and determine what you can do to influence that future behaviour. That is,
simulation can be used to predict the way in which the system will evolve and respond to its
surroundings, so that you can identify any necessary changes that will help make the system perform
the way that you want it to. For example, a fisheries biologist could dynamically simulate the salmon
population in a river in order to predict changes to the population, and quantitatively understand the
impacts on the salmon of possible actions (e.g., fishing, loss of habitat) to ensure that they do not go
extinct at some point in the future. Also flight simulator on PC is also a computer model of some aspect
of the flight; it shows on the screen the controls and what the pilot is supposed to see from the
“cockpit” (his armchair).
Simulation therefore, is a technique (not a method) for representing a dynamic real world system by a
model and experimenting with the model in order to gain information about the system and hence take
appropriate decision. Simulation can be done by hand or by a computer. Simulation is a powerful and
important tool because it provides a way in which alternative designs, plans and/or policies can be
evaluated without having to experiment on a real system, which may be prohibitively costly, time-
consuming, or simply impractical to do. That is, it allows you to ask "What if?" questions about a
system without having to experiment on the actual system itself (and hence incur the costs of
field tests, prototypes, etc.).
3.1 When to Use simulation
Simulation is used in systems that change with time, such as a gas station, where cars come and go
(called dynamic systems) and involve randomness. In such a system nobody can guess at exactly which
time the next car should arrive at the station. Modelling
complex dynamic systems theoretically need too many simplifications and the emerging
2|Page
models may not therefore be valid. Simulation does not require many simplifying
assumptions, making it the only tool even in absence of randomness.
Simulation is used to observe the dynamic behaviour of a model of real or imaginary
system. Indeed, by simulating a complex system we are able to understand the behavior at low cost.
Otherwise we would have to carry out a complicated theoretical research or to build a device (an
electric heater, a building or a plane), and observe how it changes to get hints for improvements in the
design. If you run a shop, an hospital or a bank, then computer simulation may show you bottlenecks,
service time, flows, and queues of clients and provide important information on how to improve your
business.
Note that often we describe a real world system by:
1. A physical model
2. A mathematical or analytic model
3. An analogue model.
What happens when a system is not amenable to treatment using the above model?
Constructing a real physical system could be very expensive and what more testing it with live human
beings and observing what happens could be fatal. Training a new pilot using an airplane is suicidal.
This is why simulation is designed and utilized.
Thus simulation is the answer to our question. Many operations Research analysts consider simulation
to be a method of last resort. This is because it may be useful when other approaches cannot be used,
for example when a real world situation is complex.
Note that nothing prevents you from using simulation approach to analytic problem. Results can at least
be compared! Thus, before designing and implementing a real life system, it is necessary to find out via
simulation studies whether the system will work otherwise the whole exercise will be a
wild goose chase. Inevitably huge sums of money might have been wasted.
Unlike the situation in mathematical programming, so far there are no clear cut underlying principles
guiding the formulation of simulation models. Each application is ad-hoc to a large extent. In general
there are three basic objectives of simulation studies:
1. To Describe a Current System – Suppose that a manufacturing company has suddenly observed a
marked deterioration in meeting due-dates of customers order. It may be necessary to build a
simulation model to see how the current procedures for estimating due dates, scheduling production
and ordering raw materials are giving rise to observed delays.
2. To explore a Hypothetical System – such as installing a new system, which will cost a lot of money,
it might be better to build a hypothetical model of the system and learn from its behaviour.
3. To Design an Improved System – for example consider a supermarket that has one payment counter.
Due to increase in patronage, it is considering to increase the number of pay points. A simulation
experiment may identify if one, two or more additional points are needed or not needed.
3.2 Types of Simulations
Computer models can be classified according to several criteria including:
Stochastic or deterministic (and as a special case of deterministic, chaotic)
Steady-state or dynamic
Continuous or discrete (and as an important special case of discrete, discrete event or DE models)
Local or distributed.
For example:
Steady-state models use equations defining the relationships between elements of the modelled
system and attempt to find a state in which the system is in equilibrium. Such models are often used in
simulating physical systems, as a simpler modelling case before dynamic simulation is attempted.
3|Page
Dynamic simulations model changes in a system in response to (usually changing) input signals.
Stochastic models use random number generators to model the chance or random events; they are
also called Monte Carlo simulations.
There are two basic types of simulation for which models are built, and the process of choosing the
subset of characteristics or features is different for each. The distinctionbetween the two types is based
on how time is represented; either as a continuous variable or as a discrete variable.
3.2.1 Continuous simulation
Continuous simulations treat time as continuous and express changes in terms of a set of differential
equations that reflect the relationships among the set of characteristics. Thus the characteristics or
features chosen to model the system must be those whose behavior is understood mathematically.
Continuous simulation is used in systems where the state changes all the time, not just at the time of
some discrete events. For example, the water level in a reservoir due to in and outflow changes all the
time. In such cases continuous simulation is more appropriate, although discrete events simulation can
serve as an approximation.
A meteorological modelling falls is another example in this category. The characteristics of weather
models are wind components, temperature, water vapour, cloud formation, precipitation, and so on.
The interaction of these components over time can be modeled by a set of partial differential equations,
which measure the rate of change of each component over some three-dimensional region.
A continuous dynamic simulation performs numerical solution of differential-algebraic equations or
differential equations (either partial or ordinary). Periodically, the simulation program solves all the
equations, and uses the numbers to change the state and output of the simulation. Applications include
flight simulators, racing-car games, chemical process modelling, and simulations of electrical circuits.
Originally, these kinds of simulations were actually implemented on analog computers, where the
differential equations could be represented directly by various electrical components such as
operational amplifiers.
By the late 1980s, however, most "analogue" simulations were run on conventional digital computers
that emulate the behaviour of an analog computer.
A typical Continuous (stochastic) system has a large number of control parameters that can have a
significant impact on the performance of the system. To establish a basic knowledge of the behaviour
of a system under variation of input parameters, sensitivity analysis is usually performed, which applies
small changes from one state to the nominal values of input parameters. For such simulation, variations
of the input parameter cannot be made infinitely small. The sensitivity of the performance measure
with respect to an input parameter is therefore defined as (partial) derivative.
Sensitivity analysis is concerned with evaluating sensitivities (gradient) of performance measures with
respect to parameter of interest. It provides guidance for design and operational decisions and plays a
pivotal role in identifying the most significant system parameters, as well as bottleneck of subsystems.
In designing, analysing and operating such complex systems, one is interested not only in performance
evaluation but also in sensitivity analysis and optimisation.
3.2.2 Discrete-event simulation,
Discrete event models are made up of entities, attributes, and events. An entity represents some object
in the real system that must be explicitly defined. That is, the characteristic or feature of the system or
an object. For example, if we were modelling a manufacturing plant, the different machines, and the
product being created, would be entities. An attribute is some characteristic of a particular entity. The
identification number, the purchase date, and the maintenance history would be attributes of a
particular machine.
4|Page
An event is an interaction between entities. For example, the sending of the output from one machine
as input to the next machine would be an event.
Suppose we are interested in a gas station. We may describe the behaviour of this system graphically
by plotting the number of cars in the station; the state of the system. Every time a car arrives the graph
increases by one unit while a departing car causes the graph to drop by one unit. This graph (called
sample path), could be obtained from observation of real station, but could also be artificially
constructed. Such artificial construction and analysis of the resulting sample path (or more sample
paths in more complex cases) consists of the simulation.
The path consists of only horizontal and vertical lines, as cars arrivals and departures occurred, at
distinct points in time, what we refer to as events. Between two consecutive events, nothing happens –
the graph is horizontal. When the number of events are finite, we call the simulation discrete event.
Discrete event systems (DES) are dynamic systems, which evolve in time by the occurrence of events
at possible irregular time intervals. DES abound in real-world applications. Examples include traffic
systems, flexible manufacturing systems, computer communication systems, production lines, flow
networks etc. Most of these systems can be modelled in terms of discrete events whose occurrence
causes the system to change from one state to another.
Simulations may be performed manually. Most often, however, the system model is written either as a
computer program or as some kind of input into simulator software.
A discrete event simulation (DE) manages events in time. Most computer, logic-test and fault-tree
simulations are of this type. In this type of simulation, the simulator maintains a queue of events sorted
by the simulated time they should occur. The simulator reads the queue and triggers new events as each
event is processed. It is not important to execute the simulation in real time. It's often more important to
be able to access the data produced by the simulation, to discover logic defects in the design, or the
sequence of events.
A special type of discrete simulation which does not rely on a model with an underlying equation, but
can nonetheless be represented formally, is agent-based simulation. In agent-based simulation, the
individual entities (such as molecules, cells, trees or consumers) in the model are represented directly
(rather than by their density or concentration) and possess an internal state and set of behaviours or
rules which determine how the agent's state is updated from one time-step to the next.
3.3 Steps In Constructing A Simulation Model.
1. Formulate the model (see modelling)
2. Design the Experiment – Workout details of experimental procedures before running the model
subsystems, parameters, relationships, data structures, etc.
3. Develop the Computer Programs – Each historical evolution of the model, including generation of
random events and generation of objects, will take place within the computer.
If a model has a simple structure, you can use BASIC, FORTRAN, PASCAL or C and so on to
develop the computerized version. However, it is better to use a simulation language such as
SIMULATIONSCRIPT, GPSS, SIMULATIONULA (SIMULA), SIMULATIONNET (SIMNET)
II, QMS, etc.
3.3.1 To Extract the terms in Simulation
Let us consider building a simulation of gas station with a single pump served by a single ser vice man.
Assumptions: Arrivals of cars as well as their times are random.
At first identify the:
State: number of cars waiting for service and number of cars served at any moment.
Event: arrival of cars, start of service, end of service.
Entities: these are the cars.
5|Page
Queue: the queue of cars in front of the pump waiting for service.
Random realization: interval times, service times.
Distribution: we shall assume exponential distributions for the interval time and service time.
Next, specify what to do at each event. The above example would look like this:
At event of entity arrival: Create next arrival. If the server is free, send entity for start of service.
Otherwise it joins the queue. At event of service start: Server becomes occupied. Schedule end of
service for this entity. At event of service end: Server becomes free. If any entity is waiting in the
queue: remove the first entity from the queue; send it for start of service. Some initiation is still
required, for example, the creation of the first arrival. Lastly Lastly, the above is translated into code.
This is easy with appropriate library function, which has subroutine for creation, scheduling, proper
timing of events, queue manipulations, randomvariate generation and statistics collection.
3.3.2 Simulation terminologies:
State – A variable characterizing an attribute in the system such as level of stock in
inventory or number of jobs in waiting for processing.
Event: - An occurrence at a point in time which may change the state of the system, such
as arrival of a customer or start of work on a job.
Entity: An object that passes through the system, such as cars in an intersection or orders
in a factory. Often an event (e.g., arrival) is associated with an entity (e.g., customer).
Queue: A queue is not only a physical queue of people, or cars, etc it can also be a task
list, a buffer of finished goods waiting for transportation or any place where entities are
waiting for something to happen for any reason.
Creating: Is causing an arrival of new entity into the system at some point in time.
Scheduling: is the act of assigning a new future event to an existing entity.
Random variable: is a quantity that is uncertain, such as interval time between two
incoming flights or number of defectives parts in a shipment.
Random Variate: is an artificially generated random variable.
Distribution: is the mathematical law, which governs the probabilistic features of a
random variable.
3.4 Applications of Computer Simulation
Computer simulation has become a useful part of modelling many natural systems in physics,
chemistry and biology, and human systems in economics and social science (the computational
sociology) as well as in engineering to gain insight into the operation of those systems. A good
example of the usefulness of using computers to simulate can be
found in the field of network traffic simulation. In such simulations the model behavior will change
each simulation according to the set of initial parameters assumed for the
environment. Computer simulations are often considered to be human out of the loop Simulations.
Computer graphics can be used to display the results of a computer simulation.
Animations can be used to experience a simulation in real-time e.g. in training simulations. In some
cases animations may also be useful in faster than real-time or even slower than real-time modes. For
example, faster than real-time animations can be useful in visualizing the build up of queues in the
simulation of humans evacuating a building.
There are many different types of computer simulation; the common feature they all share is the
attempt to generate a sample of representative scenarios for a model in which a complete enumeration
of all possible states of the model would be prohibitive or impossible. Several software packages also
exist for running computer-based simulation modelling that makes the modelling almost effortless and
simple.
6|Page
based components are reproduced by haptic feedback devices combined with physical simulation
routines computed in response to the user's actions. Medical simulations of this sort will often use
3D CT or MRI scans of patient data to enhance realism.
Another important medical application of a simulator -- although, perhaps, denoting a slightly different
meaning of simulator -- is the use of a placebo drug, a formulation which simulates the active drug in
trials of drug efficacy.
e. City Simulators / Urban Simulation
A City Simulator is a tool used by urban planners to understand how cities are likely to evolve in
response to various policy decisions. UrbanSim. The City Simulator developed at the University of
Washington and ILUTE developed at the University of Toronto are examples of modern, large-scale
urban simulators designed for use by urban planners.
City simulators are generally agent-based simulations with explicit representations for land use and
transportation.
f. Flight simulators
A flight simulator is used to train pilots on the ground. It permits a pilot to crash his simulated
"aircraft" without being hurt. Flight simulators are often used to train pilots to operate aircraft in
extremely hazardous situations, such as landings with no engines, or complete electrical or hydraulic
failures. The most advanced simulators have high-fidelity visual systems and hydraulic motion
systems. The simulator is normally cheaper to operate than a real trainer aircraft.
g. Marine simulators
This bears resemblance to flight simulators. The marine simulators are used to train ship personnel.
Simulators like these are mostly used to simulate large or complex vessels, such as cruise ships and
dredging ships. They often consist of a replication of a ships' bridge, with operating desk(s), and a
number of screens on which the virtual surroundings are projected.
Simulation in Engineering (Technology) Process
Simulation is an important feature in engineering systems or any system that involves many processes.
For example in electrical engineering, delay lines may be used to simulate propagation delay and phase
shift caused by an actual transmission line.
Similarly, dummy loads may be used to simulate impedance without simulating propagation, and is
used in situations where propagation is unwanted. A simulator may imitate only a few of the operations
and functions of the unit it simulates. Contrast with: emulate.
Most engineering simulations entail mathematical modelling and computer assisted investigation.
There are many cases, however, where mathematical modelling is not reliable. Simulation of fluid
dynamics problems often requires both mathematical and physical simulations. In these cases the
physical models require dynamic similitude.
Physical and chemical simulations have also direct realistic uses, rather than research uses; in chemical
engineering, for example, process simulations are used to give theprocess parameters immediately used
for operating chemical plants, such as oil refineries.
Discrete Event Simulation is often used in industrial engineering, operations management and
operational research to model many systems (commerce, health, defence, manufacturing, logistics,
etc.); for example, the value-adding transformation processes in businesses, to optimize business
performance. Imagine a business, where each person could do 30 tasks, where thousands of products or
services involved dozens of tasks in a sequence, where customer demand varied seasonally and
forecasting was inaccurate- this is the domain where such simulation helps with business decisions
across all functions.
h. Simulation and games
8|Page
Strategy games - both traditional and modern - may be viewed as simulations of abstracted decision-
making for the purpose of training military and political leaders. In a narrower sense, many video
games are also simulators, implemented inexpensively. These are sometimes called "sim games". Such
games can simulate various aspects of reality, from economics to piloting vehicles, such as flight
simulators (described above).
i. The "classroom of the future"
The "classroom of the future" will probably contain several kinds of simulators, in addition to textual
and visual learning tools. This will allow students to enter school better prepared, and with a higher
skill level. The advanced student or postgraduate will have a more concise and comprehensive method
of retraining -- or of incorporating new academic contents into their skill set -- and regulatory bodies
and institution managers will find it easier to assess the proficiency and competence of individuals.
In classrooms of the future, the simulator will be more than a "living" textbook; it will become an
integral a part of the practice of Education and training. The simulator environment will also provide a
standard platform for curriculum development in educational institutions.
CONCLUSION
Simulation is used to shed light on the underlying mechanisms that control the behavior of a system. It
can be used to predict (forecast) the future behaviour of a system, and determine what you can do to
influence that future behaviour. We simulation when we require information to solve bottlenecks,
service time, flows, and queues of clients and provide important information on how to improve your
business. We simulate when a system is not amenable to treatment using any of the physical model,
mathematical or analogue models. Other reasons to resort to simulation include when it is very
expensive to construct a real physical system and what more testing it with live human beings and
observing what happens could be fatal. Training a new pilot using an airplane is suicidal. These are
where and when simulations are designed and utilized.and Training.