02 20110314-simulation
description
Transcript of 02 20110314-simulation
Introduction to Simulation and Modeling4th Undergraduate Level
Academic Year 2010/2011, 1st Term
Dr. Mohammed Abdel-Megeed SalemScientific Computing Department
Faculty of Computer and Information SciencesAin Shams University
Lecture 2
Ain Shams University in CairoFaculty of Computer and Information
Sciences Scientific Computing Department
Outline
Dr. Mohammed Abdel-Megeed Salem Lecture 2 2Introduction to Simulation and Modeling
System Definition• “A collection of elements that function together to achieve
a desired goal” – (Blanchard 1991)• Key Points:
– A system consists of multiple elements– Elements are interrelated and work in cooperation– Exists for the purpose of achieving specific objectives
• Examples: – Traffic Systems– Political Systems– Economic Systems– Manufacturing Systems– Service Systems
Dr. Mohammed Abdel-Megeed Salem Lecture 1 3Introduction to Simulation and Modeling
System Analysis and Simulation
System
Real Exp. Exp. with Model
Physical Model
Mathematical Model
Analytical Solution Simulation
Dr. Mohammed Abdel-Megeed Salem Lecture 2 4Introduction to Simulation and Modeling
System Analysis and Simulation
System
Real Exp. Exp. with Model
Physical Model
Mathematical Model
Analytical Solution Simulation
Dr. Mohammed Abdel-Megeed Salem Lecture 2 5Introduction to Simulation and Modeling
System Analysis and Simulation
• Example 1:– System: Banking– Entities: Customers– Attributes: Account balance– Activities: Making deposits– Events: Arrival and departure– State: No# busy tellers, No# waiting customers
System Analysis and Simulation
• Example 2:– System: Cafeteria– Entities: Diners– Attributes: Size of appetite– Activities: selecting food and paying for food– Events: Arrival and departure– State: No# diners in waiting line, No# servers
working
System Analysis and Simulation
• Systems Types: We categorize systems to be of two types, discrete and continuous. A discrete system :is one for which the state variables change instantaneously at separated points in time. A bank is an example of a discrete system (number of customers changes only when customer arrives or departs).
System Analysis and Simulation
• Systems Types: • We categorize systems to be of two types,
discrete and continuous. A continuous system:is one for which the state variables change continuously with respect to time. An airplane moving through the air is an example of a continuous system, since state variables such as position and velocity can change continuously with respect to time.
System Analysis and Simulation
• System vs Model– It may be impractical to experiment with it. For
example, it may not be wise or possible to double the unemployment rate to determine the effect of employment on inflation.
– A model is a representation of a system for the purpose of studying the system.
SystemInput output
ModelInput output
• Types of Models• Mathematical or Physical– A simulation model is a particular type of
mathematical model of a system.• Simulation Models may be further classified
as being – Static or Dynamic, – Deterministic or Stochastic, – Discrete or Continuous.
System
Real Exp. Exp. with Model
Physical Model
Mathematical Model
Analytical Solution Simulation
Static Dynamic
Deterministic Stochastic
Continous Discrete
System Analysis and Simulation
• A storehouse with n loading berths• There are several 100 trucks daily to serve• Loading time of a truck is 50 minutes
StorehouseGoal• Cost-effective loading and short waiting timeUsually 2 types• Type 1: Full load with only one product• Type 2: Load consisting of several productsProposals• Fast loading berth for Type 1 customers• Special berth for Type 2 customersProblem• Cannot experiment, changes are expensive!
Simulation Model• Physical Model: useful to build physical models to study
engineering systems.• Mathematical Model: representing a system in terms of
logical and quantitative relationships that are then manipulated and changed to see how the model reacts, and thus how the system would react.
• Static Simulation Model: is a representation of a system at a particular time.
• Dynamic Simulation Model: represents a system as it evolves overtime.
• Deterministic Simulation Model: If a the simulation model does not contain any probabilistic (i.e.,random) components, it is called deterministic
Simulation Model• Stochastic Simulation Models: Having at least some
random input components produce output that is itself random, and model therefore be treated as only an estimate of the true characteristics of the model.
• Continuous vs. Discrete Simulation Models: a discrete simulation model is not always used to model a discrete system and vice versa. Thus a communication channel could be modeled discretely (continuously) if the characteristics and movement of each message (the flow of the messages in aggregate) were deemed important.
Discrete-Event Simulation
• Definition of Discrete-Event Simulation• Event• Barbershop example
Dr. Mohammed Abdel-Megeed Salem Lecture 2 16Introduction to Simulation and Modeling
Time Advanced Mechanisms
• Simulation Clock• Next-event time advance– Intializied by 0– Advnced to the time of next event– Update the state variables– Time of next event is updated– Continued untill a prespecified stopping condition
• Fixed-increment time advance
Example
• Single Server- single queue (Vodafone shop) problem
• SOLVED ON WHITE BOARD
Event Simulation Components• System State• Simulation Clock• Events list• Statistical Counters• Intialization Routine• Timing Routine• Event Routine• Library Routines• Report Generator• Main Program
ContactsIntroduction to Simulation and Modeling, 4th Undergraduate Level, 2009/2010
Dr. Mohammed Abdel-Megeed M. Salem
Faculty of Computer and Information Sciences,Ain Shams University
Abbassia, Cairo, EgyptTel.: +2 011 727 1050
Email: [email protected]://cis.shams.edu.eg/Mohammed.Salem/indexEn.htmlhttp://www.informatik.hu-berlin.de/~salem