Chapter 1
Chapter 1
Introduction to Simulation
1. Simulation enables the study of and experimentation with, the internal interactions of a
complex system or of a subsystem within a complex system.
2. Informational, organizational, and environmental changes can be simulated, and the
effect of these alterations on the model's behaviour can be observed.
3. The knowledge gained during the designing of a simulation model could be of great
value toward suggesting improvement in the system under investigation.
4. Changing simulation inputs and observing the resulting outputs can produce valuable
insights about which variables are the most important and how variables interact.
5. Simulation can be used to experiment with new designs or policies before
implementation, so as to prepare for what might happen.
6. Simulation can be used to verify analytic solutions.
7. Animation can show a system in simulated operation so that the plan can be visualized.
8. A modern system (factory, wafer fabrication plant, service organization, etc.) is so
complex that its internal interactions can be treated only through simulation.
Advantages of Simulation
1. Model building requires special training. It is an art that is learned over time and
through experience. Furthermore, if two models are constructed by different competent
individuals, they might have similarities, but it is highly unlikely that they will be the
same.
2. Simulation results can be difficult to interpret. Most simulation outputs are essentially
random variables (they are usually based on random inputs), so it can be hard to
distinguish whether an observation is the result of system interrelationships or of
randomness.
3. Simulation modelling and analysis can be time consuming and expensive. Skimping on
resources for modelling and analysis could result in a simulation model or analysis that
is not sufficient to the task.
4. Simulation is used in some cases when an analytical solution is possible, or even
preferable.
Areas of Application:
1. Manufacturing Applications
2. Business Processing
3. Construction Engineering and Project Management
4. Logistics, Transportation, and Distribution
5. Military Applications
6. Health Care
Types of Simulations
Among the variety of simulations available, those that would be of interest to computer
scientists are Emulation, Monte Carlo Simulation, Trace-Driven Simulation, and Discrete-
Event Simulation.
A simulation using hardware or firmware is called emulation. A terminal emulator, for
example, simulates one kind of terminal on another. A processor emulator emulates an
instruction set of one processor on another. Even though emulation is a type of simulation, the
design issues for emulation are mostly hardware design issues.
Monte Carlo Simulation:
A static simulation or one without a time axis is called a Monte Carlo simulation.
Such simulations are used to model probabilistic phenomenon that do not change
characteristics with time. Like a dynamic simulation they require the generation of pseudo-
random numbers. Monte Carlo simulations are also used for evaluating non probabilistic
expressions using probabilistic methods.
Discrete-Event System Simulation:
Discrete-event system simulation is the modelling of systems in which the state variable
changes only at a discrete set of points in time. The simulation models are analysed by
numerical rather than analytical methods. Analytical methods employ the deductive reasoning
of mathematics to "solve" the model. Numerical methods employ computational procedures to
"solve" mathematical models.
All discrete-event simulations have a common structure. Regardless of the system being
modelled, the simulation will have some of the components described below. If a general-
purpose language is used, all components have to be developed by the analyst. A simulation
language provides some of the components and leaves others for the analyst. The components
are as follows:
1. Event Scheduler: It keeps a linked list of events waiting to happen. The scheduler allows
the events to be manipulated in various ways. Some of these manipulation activities are
as follows:
(a) Schedule event X at time T.
(b) Hold event X for a time interval dt.
(c) Cancel a previously scheduled event X.
(d) Hold event X indefinitely (until it is scheduled by another event).
(e) Schedule an indefinitely held event.
Event scheduler is one of the most frequently executed components of the simulation.
It is executed before every event, and it may be called several times during one event
to schedule other new events.
2. Simulation Clock and a Time-advancing Mechanism: Each simulation has a global
variable representing simulated time. The scheduler is responsible for advancing this
time. There are two ways of doing this. The first way, called the unit time approach,
increments time by small increment and then checks to see if there are any events that
can occur. The second approach, called the event-driven approach, increments the time
automatically to the time of the next earliest occurring event. The unit time approach is
not generally used in computer simulations.
3. System State Variables: These are global variables that describe the state of the system.
For example, in the CPU scheduling simulation, the system state variable is the number
of jobs in the queue. This is a global variable that is distinct from local variables such
as CPU time required for a job, which would be stored in the data structure representing
the job.
4. Event Routines: Each event is simulated by its routine. These routines update the system
state variables and schedule other events. For example, in simulating a CPU scheduling
mechanism, one might need routines to handle the three events of job arrivals, job
scheduling, and job departure.
5. Input Routines: These get the model parameters, such as mean CPU demand per job,
from the user. It is better to ask for all input at the beginning of a simulation and then
free the user, since simulations generally take a long time to complete. The input
routines typically allow a parameter to be varied in a specified manner.
6. Report Generator: These are the output routines executed at the end of the simulation.
They calculate the final result and print in a specified format.
7. Initialization Routines: These set the initial state of the system state variables and
initialize various random-number generation streams. It is suggested that there be
separate routines to initialize the state at the beginning of a simulation, at the beginning
of an iteration, and at the beginning of a repetition.
8. Trace Routines: These print out intermediate variables as the simulation proceeds. They
help debug the simulation program. It is advisable that the trace have an on/off feature
so that it can be turned off for final production runs of the model. A model may even
allow the ability to interrupt the execution of the model from the keyboard and turn the
trace on or off.
9. Dynamic Memory Management: The number of entities in a simulation changes
continuously as new entities are generated and old ones are destroyed. This requires
periodic garbage collection. Most simulation languages and many general-purpose
languages provide this automatically.
10. Main Program: This brings all the routines together. It calls input routines, initializes
the simulation, executes various iterations, and finally, calls the output routines.
Steps in a Simulation Study
1. Problem formulation: Every study should begin with a statement of the problem. If the
statement is provided by the policymakers or those that have the problem, the analyst
must ensure that the problem being described is clearly understood. If a problem
statement is being developed by the analyst, it is important that the policymakers
understand and agree with the formulation.
2. Setting of objectives and overall project plan: The objectives indicate the questions to
be answered by simulation. At this point, a determination should be made concerning
whether simulation is the appropriate methodology for the problem as formulated and
the objectives as stated.
3. Model conceptualization: The construction of a model of a system is probably as much
art as science. Although it is not possible to provide a set of instructions that will lead
to building successful and appropriate models in every instance, there are some general
guidelines that can be followed. The art of modelling is enhanced by an ability to
abstract the essential features of a problem, to select and modify basic assumptions that
characterize the system, and then to enrich and elaborate the model until a useful
approximation result.
4. Data collection: There is a constant interplay between the construction of the model and
the collection of the needed input data. As the complexity of the model changes, the
required data elements can also change. Also, since data collection takes such a large
portion of the total time required to perform a simulation, it is necessary to begin as
early as possible, usually together with the early stages of model building.
5. Model translation: Most real-world systems result in models that require a great deal of
information storage and computation, so the model must be entered into a computer-
recognizable format. We use the term program even though it is possible, in many
instances, to accomplish the desired result with little or no actual coding.
6. Verified: Verification pertains to the computer program that has been prepared for the
simulation model. With complex models, it is difficult, if not impossible, to translate a
model successfully in its entirety without a good deal of debugging; if the input
parameters and logical structure of the model are correctly represented in the computer,
verification has been completed.
7. Validated: Validation usually is achieved through the calibration of the model, an
iterative process of comparing the model against actual system behaviour and using the
discrepancies between the two, and the insights gained, to improve the model.
This process is repeated until model accuracy is judged acceptable.
8. Experimental design: The alternatives that are to be simulated must be determined.
Often, the decision concerning which alternatives to simulate will be a function of runs
that have been completed and analysed.
9. Production runs and analysis: Production runs and their subsequent analysis, are used
to estimate measures of performance for the system designs that are being simulated.
10. More runs: Given the analysis of runs that have been completed, the analyst determines
whether additional runs are needed and what design those additional experiments
should follow.
11. Documentation and reporting: There are two types of documentation: program and
progress. Program documentation is necessary for numerous reasons. If the program is
going to be used again by the same or different analysts, it could be necessary to
understand how the program operates.
12. Implementation: The success of the implementation phase depends on how well the
previous eleven steps have been performed. It is also contingent upon how thoroughly
the analyst has involved the ultimate model user during the entire simulation process.
If the model user has been involved during the entire model-building process and if the
model user understands the nature of the model and its outputs, the likelihood of a
vigorous implementation is enhanced.
Figure 1.1 Steps in Simulation study
SIMULATION SOFTWARES
Software used to develop simulation models can be divided into three categories. First,
there are the general-purpose programming languages, such as C, C++, and Java. Second, there
are simulation programming languages, examples being GPSS/Hand SIMAN V®. Third, there
are the simulation environments. This category includes many products that are distinguished
one way or another (by, for example, cost, application area, or type of animation), but have
common characteristics, such as a graphical user interface and an environment that supports all
(or most) aspects of a simulation study. Many simulation environments contain a simulation
programming language, but some take a graphical approach similar to process-flow
diagramming.
Systems and System Environment
A system is defined as a group of objects that are joined together in some regular interaction or
interdependence toward the accomplishment of some purpose.
A system is often affected by changes occurring outside the system. Such changes are
said to occur in the system environment. In modelling systems, it is necessary to decide on the
boundary between the system and its environment. This decision may depend on the purpose
of the study.
Components of a System
An event is defined as an instantaneous occurrence that might change the state of the system.
The term endogenous is used to describe activities and events occurring within a system, and
the term exogenous is used to describe activities and events in the environment that affect the
system.
Types of Systems
Systems can be categorized as discrete or continuous. "Few systems in practice are
wholly discrete or continuous, but since one type of change predominates for most systems, it
will usually be possible to classify a system as being either discrete or continuous".
A discrete system is one in which the state variable(s) change only at a discrete set of
points in time. The bank is an example of a discrete system: The state variable, the number of
customers in the bank, changes only when a customer arrives or when the service provided a
customer is completed. Figure 1.2 shows how the number of customers changes only at discrete
points in time.
Figure 1.2 Discrete-system state variable
A continuous system is one in which the state variable(s) change continuously over
time. An example is the head of water behind a dam. During and for some time after a rain
storm, water flows into the lake behind the dam. Evaporation also decreases the water level.
Figure 1.3 shows how the state variable head of water behind the dam changes for this
continuous system.
A model is defined as a representation of a system for the purpose of studying that system. For
most studies, it is only necessary to consider those aspects of the system that affect the problem
under investigation. These aspects are represented in a model of the system; the model, by
definition, is a simplification of the system. On the other hand, the model should be sufficiently
detailed to permit valid conclusions to be drawn about the real system.
Types of Models
In modelling real-world phenomena, there are few situations where the actions of the
entities within the system under study can be predicted completely. The world the model
builder sees is probabilistic rather than deterministic. There are many causes of variation. The
time it takes a repairperson to fix a broken machine is a function of the complexity of the
breakdown, whether the repairperson brought the proper replacement parts and tools to the site,
whether another repairperson asks for assistance during the course of the repair, whether the
machine operator receives a lesson in preventive maintenance, and so on. To the model builder,
these variations appear to occur by chance and cannot be predicted.
An appropriate model can be developed by sampling the phenomenon of interest. Then,
through educated guesses (or using software for the purpose), the model builder would select
a known distribution form, make an estimate of the parameter(s) of this distribution, and then
test to see how good a fit has been obtained. Through continued efforts in the selection of an
appropriate distribution form, a postulated model could be accepted.
Mean: p
Variance: p(1-p)
The Bernoulli distribution and its derivative distributions can be used only if the trials are
independent and identical so that the probability of success in each trial is p and is not affected
by the outcomes of the past trials.
Binomial Distribution
The number of successes x in a sequence of n Bernoulli trials has a binomial
distribution. The key characteristics of the binomial distribution.
Mean: n p
Variance: n p(1-p)
Poisson Distribution
The Poisson distribution is a limiting form of the binomial distribution, and it is used
extensively in queueing models i.e. it describes many random processes quite well. The Poisson
distribution is used to model the number of arrivals over a given interval; for example:
1. Number of requests to a server in a given time interval t
2. Number of component failures per unit time
3. Number of queries to a database system over t seconds
Mean = Variance = λ
Continuous random variables can be used to describe random phenomena in which the variable
of interest can take on any value in some interval-for example, the time to failure or the length
of a rod.
Uniform Distribution
A random variable X is uniformly distributed on the interval [a, b] if its pdf is given by
a≤x≤b
Mean:
Variance:
Exponential Distribution
The exponential distribution has been used to model interarrival times when arrivals
are completely random and to model service times that are highly variable. In these instances,
λ is a rate: arrivals per hour or services per minute. The exponential distribution has also been
used to model the lifetime of a component that fails catastrophically (instantaneously), such as
a light bulb; then λ is the failure rate.
Mean:
Variance: