You are on page 1of 46

CS 664

MODELLING
AND
SIMULATION
COURSE OUTLINE
 Introduction to Simulation
 Simulation Examples
 General Principles
 Simulation Software
 Statistical Models in Simulation
 Queuing Models
 Random Number Generation
 Verification and Validation of Simulation Model
 Output Analysis for a Single Model
 Comparison and Evaluation of Alternative System Design
INTRODUCTION TO
SIMULATION
 System and System Environment
 Components of System
 Type of Systems
 Type of Models
 Simulation and Steps in simulation study
 Advantages and Disadvantages of Simulation.
SYSTEM AND SYSTEM
ENVIRONMENT
 System

 Generally, a system is an object or a collection of objects whose properties we want to study.

 Specifically, is an organized relationship among functioning units or components

 A Real or Virtual environment that serves as source of observational data or behavior


 Can contains subsystems that are System in themselves
 Natural or Artificial
 Has input and Output
SYSTEM AND SYSTEM
ENVIRONMENT
 System

 It is studied for understanding, to build it


 System exists because it is designed to achieve one or more objectives.

 System environment has


 Represents everything that is important in understanding the function of a system,
 But not part of the system
 is primarily the set of variables that define or control certain aspects of process execution. 
 Boundary is what defines the difference between system and Environment
SYSTEM AND SYSTEM
ENVIRONMENT
System environment has
 Represents everything that is important in understanding the function of a system,
 But not part of the system
 is primarily the set of variables that define or control certain aspects of process
execution. 
 Boundary is what defines the difference between system and Environment
SYSTEM AND SYSTEM
ENVIRONMENT
 System Components

Input
Process/state
Output

Input State Output


SYSTEM AND SYSTEM
ENVIRONMENT
 Type of System
 There two majors types of Systems

From the make


 Nature System
 Ecological System, Human Body system, Cosmic system
Artificial/ Designed
Transportation, Information System
From appearance
Physical : tangible that may be static or dynamic
Abstract: conceptual and non-physical
SYSTEM AND SYSTEM
ENVIRONMENT
 Model
 Simplified Representation of a Real or Theoretical System
 at some particular point of time and space
 intended to provide the understanding of the system
 Is anything an “Experiment” can be applied on to answer some questions
 All the models are simplification of reality.
SYSTEM AND SYSTEM
ENVIRONMENT
 Type of Models
 From system operation
 Discrete Models – Changes to the system occur at specific times.
 Continuous Models – The state of the system changes continuously over time.
 Mixed Models – Contains both discrete and continuous elements.

 From Technology
 concrete models,
 mathematical models,
 computational models.
SIMULATION
 Simulation

 Definitions:
 Discipline of understanding and evaluating the interaction of parts of a real or theoretical system.
 Accurate Depiction of Reality Parts of the system may not be observable (e.g., internals of a silicon chip or biological
system)
 It may be too difficult,
 hazardous, or
 expensive to observe a real,
 operational system
 Uses of Simulations
 1. Analyze systems before they are built
 2. Reduce number of design mistakes
 3.Optimize design
 4. Analyze operational systems
SIMULATION
 Simulation
 Simulation is very useful for experiments with the internal interactions of a complex system, or of a
subsystem within a complex system.

 Simulation can be employed to experiment with new designs and policies, before implementing
 Simulation can be used to verify the results obtained by analytical methods and reinforce the
analytical techniques.
 Simulation is very useful in determining the influence of changes in input variables on the output of
the system.
 Simulation helps in suggesting modifications in the system under investigation for its optimal
performance.
SIMULATION
 The Basic Steps of a Simulation Study
 Problem Definition
 defining the goals of the study
 and determining what needs to be solved.
 objective observations of the process to be studied.
 determine if simulation is the appropriate tool for the problem under investigation
 Project Planning
 The tasks for completing the project are broken down into work packages with a responsible party assigned to
each package.
 Milestones are indicated for tracking progress.
 determine if sufficient time and resources are available for completion
SIMULATION
 The Basic Steps of a Simulation Study
 System Definition
 identifying the system components to be modeled
 and the performance measures to be analyzed.
 defining the system requires an experienced simulator with appropriate level of detail and flexibility
 Model Formulation
 Understanding how the actual system behaves
 determining the basic requirements of the model are necessary in developing the right model.
 Creating a flow chart of how the system operates facilitates the understanding of what variables are involved
and how they interact.
SIMULATION
 The Basic Steps of a Simulation Study
 Input Data Collection & Analysis
 The type of data to collect is determined.
 New data is collected and/or existing data is gathered.
 Data is fitted to theoretical distributions.
 For example, the arrival rate of a specific part to the manufacturing plant may follow a normal distribution
curve.

 Model Translation
 The model is translated into programming language.
 Choices range from general purpose languages such as C++, JAVA, Python or simulation programs such as
Arena, Ansys. MATLAB. Etc.
SIMULATION
 The Basic Steps of a Simulation Study
 Verification & Validation
 Verification is to ensuring that the model behaves as intended
 usually by debugging or through animation.
 Verification is necessary but not sufficient for validation, that is a model may be verified but not valid.
 Validation ensures that no significant difference exists between the model and the real system
 The model reflects reality.
 Validation can be achieved through statistical analysis.
 Additionally, face validity may be obtained by having the model reviewed and supported by an expert.
SIMULATION
 The Basic Steps of a Simulation Study
 Experimentation & Analysis
 Experimentation involves developing the alternative model(s),
 executing the simulation runs,
 statistically comparing the alternative(s) system performance with that of the real system.
 Documentation & Implementation
 Documentation consists of the written report and/or presentation.
 The results and implications of the study are discussed.
 The best course of action is identified, recommended, and justified
SIMULATION
SIMULATION
 Decisions for Simulating
 To recognize if simulation is the correct approach to solving a particular problem, the
following should be evaluated before embarking on simulation:
1. Type of Problem
2. Availability of Resources
3. Costs
4. Availability of Data
SIMULATION
 Type of Problem
 When Simulation is Not Appropriate
 Simulation should not be used when the problem can be solved using common sense.
 Not, if the problem can be solved analytically.
 Not, if it is easier to perform direct experiments.
 Not, if the costs exceeds savings.
 Not, if the resources or time are not available.
 No data is available, not even estimate simulation is not advised.
 If there is no enough time or the people are not available, simulation is not appropriate.
 If managers have unreasonable expectation say, too much soon – or the power of simulation is over
estimated, simulation may not be appropriate.
 If system behavior is too complex or cannot be defined, simulation is not appropriate.
SIMULATION
 Availability of Resources
 People and time are the determining resources for conducting a simulation study.
 An experienced analyst determine both the model's appropriate level of detail and how to verify and
validate the model.
 Without a trained simulator, the wrong model may be developed which produces unreliable results.
 The allocation of time should not be so limited so as to force the simulator to take shortcuts in
designing the model.
 Enough time should allowed for:
 the implementation of any necessary changes
 verification and validation to take place if the results are to be meaningful.
SIMULATION
 Costs:
 Cost considerations should be given for each step in the simulation process,
 purchasing simulation software if not already available, and computer resources.
 Obviously if these costs exceed the potential savings in altering the current system, then
simulation should not be pursued.
SIMULATION
 Availability of Data:
 The necessary data should be identified and located,
 if the data does not exist, then the data should be collectible.
 If the data does not exist and cannot be collected,
 continuing with the simulation study will eventually yield unreliable and useless results.
 The simulation output cannot be compared to the real system's performance, which is vital for
verifying and validating the model.
SIMULATION
 Simulation
 Advantages of Simulation
 New policies, operating procedures, decision rules, information flow, etc. can be explored without
disrupting the ongoing operations of the real system.
 New hardware designs, physical layouts, transportation systems can be tested without committing
resources for their acquisition.
 Hypotheses about how or why certain phenomena occur can be tested for feasibility.
 Time can be compressed or expanded allowing for a speedup or slowdown of the phenomena under
investigation.
SIMULATION
 Simulation
 Advantages of Simulation
 Insight can be obtained about the interaction of variables.
 Insight can be obtained about the importance of variables to the performance of the system.
 Bottleneck analysis can be performed indication where work-in process, information materials and so
on are being excessively delayed.
 A simulation study can help in understanding how the system operates rather than how individuals
think the system operates. “what-if” questions can be answered.
 Useful in the design of new systems.
SIMULATION
 Simulation
 Disadvantages of Simulation
 Model building requires special training.
 It is an art that is learned over time and through experience.
 If two models are constructed by two competent individuals, they may have similarities, but it is
highly unlikely that they will be the same.
 Simulation results may be difficult to interpret.
 Since most simulation outputs are essentially random variables (they are usually based on random
inputs), it may be hard to determine whether an observation is a result of system interrelationships or
randomness.
 Simulation modeling and analysis can be time consuming and expensive.
 Skimping on resources for modeling and analysis may result in a simulation model or analysis that is
not sufficient for the task.
 Simulation is used in some cases when an analytical solution is possible, or even preferable.
SIMULATION EXAMPLES
 Examples
 Areas of Applications Manufacturing:
 Design analysis and optimization of production system, materials management, capacity planning,
layout planning, and performance evaluation
 Business: Market analysis, prediction of consumer behaviour, and optimization of marketing strategy
and logistics, comparative evaluation of marketing campaigns.
 Military: Testing of alternative combat strategies, air operations, sea operations, simulated war
exercises, practicing ordinance effectiveness, inventory management.
 Healthcare applications: such as planning of health services, expected patient density, facilities
requirement, hospital staffing , estimating the effectiveness of a health care program.
SIMULATION EXAMPLES
 Examples
 Communication Applications:
 Such as network design, and optimization, evaluating network reliability, manpower planning, sizing of
message buffers.
 Computer Applications:
 Such as designing hardware configurations and operating system protocols, sharing networking. Client/Server
system architecture
 Economic applications:
 such as portfolio management, forecasting impact of Govt.
 Policies and international market fluctuations on the economy.
 Budgeting and forecasting market fluctuations.
SIMULATION EXAMPLES
 Examples
 Transportation applications: Design and testing of alternative transportation policies, transportation
networks-roads, railways, airways etc.
 Evaluation of timetables, traffic planning.
 Environment application: Solid waste management, performance evaluation of environmental
programs, evaluation of pollution control systems.
 Biological applications: Such as population genetics and spread of epidemics.
 Business process Re-engineering: Integrating business process re-engineering with image –based
work flow, using process modelling and analysis tool.
GENERAL PRINCIPLES IN SIMULATION
 Concepts In Discrete-Event Simulation
 System
 A collection of entities (people and machines..) that interact together over time for one or more goals

 Model
 abstract representation of a system, usually containing structural, logical or mathematical relationship that
describe a system in term of state, entities and their attributes , sets, processes,…
 System state
 A collection of variables in any time that describe the system
 Entity
 Any object or component in system that require explicit representation (server, customer,...)

 Attributes
 The properties of a given customer
 List
 A collection of associated entities , ordered in some logical fashion (FIFO, priority,…)
GENERAL PRINCIPLES IN SIMULATION
 Event
 An instantaneous occurrence that changes the state of a system
 Event Notice
 A record of a event to occur at the current or future time (type and time)
 Event List
 FEL (future event list)
 Activity (unconditional wait)
 A duration time of specified length (service time or interarrival time,… )
 Deterministic, Statistical and functional
 Delay (conditional wait)
 A duration of time of unspecified indefinite length, which is not known until it ends (customer delay in
waiting line)
 Clock A variable representing simulated time
GENERAL PRINCIPLES IN SIMULATION
 Able-Baker Call center
 System state
 LQ(t): the number of callers waiting to serve
 LA(t):0 or 1 indicate Able is idle or busy
 LB(t):0 or 1 indicate Baker is idle or busy
 Entities
 Caller
 Events
 Arrival event, service completion by Able or Baker
 Activities
 Service time by Able/Baker and Inter-arrival time
 Delay
 A caller wait in queue until Able or Baker becomes free
GENERAL PRINCIPLES IN
SIMULATION
 Event Scheduling Flow Chart

 First, we need a main program that supervises everything else. Most importantly, this program invokes three
routines:
 the initialization routine,
 the timing routine, and
 the event routine.

 initialization routine first


 set the clock to zero and initialize the system state,
 statistical counters, and the FEL. Usually, the FEL initially contains the first arrival event and the event marking
the end of the simulation.
GENERAL PRINCIPLES IN
SIMULATION
 Event Scheduling Flow Chart

 Then, we invoke the timing routine. This routine


 determines when the next event is,
 what type of event it is
 - arrival, departure,
 end of simulation - and then
 advances the clock to the next event.
GENERAL PRINCIPLES IN
SIMULATION
 event routine itself.
 update the system state along with our statistical counters,
 update the FEL appropriately given the event.
 For example, if the routine is processing an arrival,
 generate another arrival and append or insert it into the FEL.

 If we are processing the event marking the end of the simulation,


 generate any output and end the program;

 otherwise, we return to the timing routine.


GENERAL PRINCIPLES IN
SIMULATION
 Arrival Event

 is schedule the next arrival.

 Next, we examine the server and see if they are busy.

 If the server is not busy,


 set the waiting time for the arrived customer to zero,
 update the appropriate statistics
 - for example, the average customer waiting time.

 increment the number of customers who have gone through the line,

 make the server busy.

 Finally, we return to the main program.

 If the server is busy, we add the customer to the queue and increment the number of customers enqueued. If the queue is full, we
might have to adjust some parts of the system to accommodate this capacity. Perhaps we kick the customer out. If the queue isn't
full, we store the customer arrival time - we will need this later to compute their waiting time. Finally, we return to the main
program.
GENERAL PRINCIPLES IN
SIMULATION
 Arrival Event
 is schedule the next arrival.
 Next, we examine the server and see if they are busy.
 If the server is busy,
 add the customer to the queue
 increment the number of customers enqueued.
 If the queue is full,
 we might have to adjust some parts of the system to accommodate this capacity.

 If the queue isn't full,


 we store the customer arrival time –
 later to compute their waiting time.
 Finally, we return to the main program.
GENERAL PRINCIPLES IN
SIMULATION
 Process Interaction
 is one of the greatest achievements of modern simulation
 because it lets us model and program much more seamlessly.

 It concentrate on a generic customer or entity


 the sequences of events and activities it undergoes as it progresses through the system.
 The simulation language keeps track of how one generic entity interacts with all the
other generic entities.
 At any time during the simulation, there may be many customers competing with each
other for resources.
GENERAL PRINCIPLES IN
SIMULATION
 Process Interaction
 Modeling the generic customer,
 No dealing with the event bookkeeping,
 It’s handle by simulation package handles deep inside its core.

 The dirty little secret is that the simulation language is doing event scheduling in
its implementation but exposes an API that allows us to model using process
interaction.
GENERAL PRINCIPLES IN
SIMULATION
 In queueing simulations, a customer is generated, eventually gets served, and then
leaves. How do we perform these actions in a language like Arena? Arena exposes
functionality for 
 creating, 
 processing and 
 disposing of entities.

 With Arena, we generate customers every once in a while.


 We process/serve the customers after they wait in line for zero or more time units.
 Finally, we dispose of the customers after we finish processing them.
GENERAL PRINCIPLES IN
SIMULATION
 There are more than 100 commercial simulation languages out in the ether.

 The lower-level languages - FORTRAN, SIMSCRIPT, and GPSS/H - require more


programmer work.

 In contrast, the higher-level languages like Extend, Arena, Simio, Automod, and
AnyLogic require a lot less programming effort to get up and running.
GENERAL PRINCIPLES IN
SIMULATION
 There are 5-10 major simulation players in Education as mentioned above

 In industry, the price for simulation packages can range from under $1,000 to more than
$100,000.

 Thankfully, freeware is also available: simulation packages exist in Java and Python
(SimPyl).

 Though they might contain a learning curve, these packages can be powerful and enjoyable
to work with.
GENERAL PRINCIPLES IN
SIMULATION
 What factors should we take into account when selecting a language?
 We can examine the various costs. For example,
 we can look at the cost of purchasing the licenses,
 the cost of specialized programmers,
 as well as certain run-time costs.

 Additionally, we can look at the ease of learning.


 Different packages may have different learning curves,
 may vary with respect to documentation, syntax, and flexibility.
GENERAL PRINCIPLES IN
SIMULATION
 Furthermore, we can compare packages based on their worldviews.
 We already discussed why we like process interaction better than event
scheduling.
 If we are looking at continuous systems, we will need a language with continuous
modeling capabilities.
 Often, we need a language that supports a combination of different approaches.
GENERAL PRINCIPLES IN
SIMULATION
 Finally, we have to think about which features we need. Different packages have
different random variate generators, statistics collection capabilities, debugging
aids, graphics packages, and user communities.
 Where can you learn about simulation languages?
 A simulation class (like this!)
 Textbooks, especially in conjunction with a course
 Online courses e.g. Coursera, Udumy, Standford etc.
 Courses offered by vendors e.g. For Arena https://www.arenasimulation.com
GENERAL PRINCIPLES IN
SIMULATION
 For Arena https://www.arenasimulation.com
 Student version is available for free download @
https://www.arenasimulation.com
 There are tutorial videos on YouTube and Getting started with Arena

Intro to Arena

 Assignment: Using Arena Simulate the most common system/process in your


work place.

You might also like