Chapter 1
Introduction to
Simulation and Modeling
October 2019
Pre-Requisites
• Probability
• MS-Excel
• Programming skills
Textbook
• Author: Averill M. Law
• Title: “Simulation Modeling and Analysis”, Fourth Edition
• Publisher: McGraw-Hill Higher Education
• Year: 2007
Notes:
- The codes in this book are written in C++. However, simulations throughout
the course will be done using Excel. Ideas from this book will be used
-
Course Outline
• Introduction to simulation
• Simulation examples in Excel spreadsheets
• General principles of simulation
• Statistical models in simulation
• Queuing models
• Random number generation
• Random variate generation
• Monte-Carlo simulation
Lecture (1)
Introduction to
Systems and
Simulation
Introduction to Simulation
Simulation is the imitation of a real-world process or
system over time [Banks et al.]
It is used for analysis and study of complex systems
Simulation requires the development of a simulation
model and then conducting computer-based experiments
with the model to describe, explain, and predict the
behaviour of the real system
What is Simulation
• The SIMULATION is the process of designing a mathematical or
logical model of the real system and then conducting computer-
based experiments with the model to describe, explain, and predict
the behavior of the real system.
System Environment
• A system is affected by changes that occur outside its boundaries.
Such changes are said to occur in the system environment
• The boundary between the system and its environment
depend on the purpose of the study
• Example: Bank System
- There is a limit on the maximum interest rate that can
be paid
- For a study of a single bank, this would be an example of a constraint
imposed by the environment
- For a study of the effect of monetary laws on the banking industry.
Systems
Systems: a group of objects joined together in some
regular interaction or interdependence towards the
accomplishment of some purpose
Example: A production system
manufacturing automobiles.
Machines, components and
workers operate jointly to
produce vehicles
System Components
Object of interest
in the system
Entity
An instantaneous
occurrence that may Property of an
Event Attribute entity
change the state of
the system
System
An action that takes place The collection of variables
over a period of specified necessary to describe the system
Activity State
length and changes the at a particular time, relative to the
state of the system objectives of the study [Law]
System Components
Exogenous:
Activities and events occurring outside the system
Endogenous:
Activities and events occurring
within a system
Attribute:
State Variables:
# busy tellers, # customers
waiting in line or being served,
Example Balance in the customers’ accounts
arrival time of next customer
Object:
Customers
Activity:
Making deposits
Events:
Arrival, departure
Examples
System Entities Attributes Activities Events State Variables
Arrival at station,
Number of passengers
Railway Passengers Origin, destination Traveling arrival at
waiting at each station
destination
Speed, capacity, Welding, Status of machines
Production Machines Breakdown
breakdown rate stamping (busy, idle, shutdown)
Number of packets
Arrival at
Communications Messages Length, destination Transmitting waiting to be
destination
transmitted
Inventory Warehouse Capacity Withdrawal Demand Level of inventory
Models
• A model is a representation of a system for the purpose of
studying that system
• It is only necessary to consider those aspects of the system
that affect the problem under investigation
• The model is a simplified representation of the system
• The model should be sufficiently detailed to permit valid
conclusions to be drawn about the actual system
• Different models of the same system may be required as the
purpose of the investigation changes
Ways to Study a System [Law]
System
Experiment
with a Model
of the System
Mathematical
Physical Model
Model
Analytical
Simulation
Solution
Why are Models Used?
• It is not possible to experiment with the actual system, e.g.: the
experiment is destructive
• The system might not exist, i.e. the system is in the design stage
Example: Bank
- Reducing the number of tellers to study the effect on the length of
waiting lines may annoy the customers such that they will move their
accounts to a competitor
Types of Models
• A Mathematical Model utilizes symbolic notations and equations to
represent a system
- Example: current and voltage equations are mathematical models of
an electric circuit
• A Physical Model is a larger or smaller version of an object
- Example: enlargement of an atom or a scaled version of the solar
system
Classifications of Simulation
Static ModelsDynamic
Deterministic Stochastic
Discrete Continuous
Static and Dynamic Models
Static Dynamic
• i.e. Monte Carlo • Represents systems as
Simulation – Represents they change over time
a system at a particular • Example: The
point in time simulation of a bank
• Example: Simulation of from 9:00am – 4:00pm
a coin toss game
Deterministic and Stochastic
Models
Deterministic Stochastic
• Contain no random variables • Has one or more random variables
• Has a known set of inputs that • Random inputs lead to random
outputs. The behaviour of a model
will result in a unique set of cannot be entirely predicted.
outputs. It is possible to • Random outputs only estimates of
predict what will happen. the true characteristics of the system
• Example: Patients arriving at • Example: random arrivals at a bank.
the dentist’s office exactly at Output may be average number of
their scheduled appointments waiting customers, average waiting
time. This output is only a statistical
estimate of the system
Discrete Vs Continuous
Discrete Continuous
State variables change State variables change
instantaneously at constantly with respect to
separated points in time time
Example: Bank Example: Airplane flight
Number of customers Position and velocity are
changes only when constantly changing with
customer arrives or departs respect to time
Discrete and Continuous Models
Continuous Discrete
• Continuous model: the state
variables change in a continuous • Discrete model: the state variables
way, and not abruptly (( فجائيfrom change only at a countable number
one state to another (infinite of points in time. These points in
number of states). time are the ones at which the
event occurs/change in state.
• The choice of whether to use a discrete or continuous model depends
on the characteristics of the system and the objectives of the study
When is Simulation Appropriate
Simulation enables the study of, and interaction
with, the internal actions of a real system
The effects of changes in state variables on the
model’s behaviour can be observed
The knowledge gained from the simulation
model can be used to improve the design of the
real system under investigation
When is Simulation Appropriate
Changing inputs and observing outputs can produce
valuable insights ()رؤىabout the importance of
variables and how they interact
Simulations can be used to experiment with different
designs and policies before implementation so as to
prepare for what might happen
Simulations can be used to verify analytic solutions
Advantages of Simulation
Effects of variations in the system parameters can be observed
without affecting the real system
New system designs can be tested without resources acquisition
Hypotheses on how or why certain phenomena occur can be
tested for feasibility
Time can be expanded or compressed to allow for speed up or
slow down of the phenomenon under investigation
conclusions can be obtained about the interactions of variables
and their importance
Bottleneck analysis can be performed in order to discover where
work processes are being delayed excessively()مفرط
When is Simulation not
Appropriate
The problem can be solved by common sense
The problem can be solved analytically
It is less expensive to perform direct experiments
Costs of modeling and simulation exceed savings
Resources or time are not available
Lack of necessary data
System is very complex or cannot be defined
Disadvantages of Simulation
Model building requires special training
Simulation results are often difficult to interpret.
Most simulation outputs are random variables - based
on random inputs – so it can be hard to distinguish
whether an observation is the result of system inter-
relationship or randomness
Simulation modeling and analysis can be time
consuming and expensive
Simulation Packages
Utilize simulation packages that only need input for
their operation, e.g.: SIMULINK, MS-Excel
Many simulation packages have output analysis
capabilities, e.g. MATLAB, Excel
Simulation has become faster due to advances in
hardware
Doc
• Model
runs umand
conceptualizati
analysis:
ent to
on: abstract
estimate
atio the
Ph
essential
measures of
n ase
features
performance
• of the IV
Imp
problem,
for the select
lem
and modify
system ent
basic
designsatiothat
assumptions
havenbeen Phase
that
simulated.
• Probl III
characterize
Measures
em of
the system,
performance
form
start with a
may depend
ulati
simple model,
on statistical
on:
describe
analysis, e.g.:
statethe
model
average,
ment Phase
probability,
• Data collection:
of II
frequency,
start early
the
because
etc. probl it may
• take
More aemlot
runs?
of a
time
sufficient
• Setti
number is
• Model ng of Ph
needed
translation:
objecto ase
guarantee
programming
tives I
statistical
• Verification:
and is
accuracy
the computer
over
programall
functioning
desig
properly
n:
Steps in a Simulation Study
• Validation:
quest does
ions
the model
1 Problem Formulation
Setting of Objectives and
2
Overall Project Plan
3 4
Model Conceptualization Data Collection
5
Model Translation
No 6
Verified
Yes
No 7 No
Validated
8 Yes
Experimental Design
9
Production Runs and Analysis
11 12
Yes 10 No Documentation
More Runs and Reporting Implementation