Discrete Event (time) Simulation 2011.10.26 Kenneth.
-
Upload
lauren-stow -
Category
Documents
-
view
219 -
download
1
Transcript of Discrete Event (time) Simulation 2011.10.26 Kenneth.
![Page 1: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/1.jpg)
Discrete Event (time) Simulation
2011.10.26 Kenneth
![Page 2: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/2.jpg)
2
What is a simulation?
• “Simulation is the process of designing a model of a real system and conducting experiments with this model for the purpose either of understanding the behavior of the system or of evaluating various strategies (within the limits imposed by a criterion or set of criteria) for the operation of a system.”
-Robert E Shannon 1975
• “Simulation is the process of designing a dynamic model of an actual dynamic system for the purpose either of understanding the behavior of the system or of evaluating various strategies (within the limits imposed by a criterion or set of criteria) for the operation of a system.”
-Ricki G Ingalls 2002
![Page 3: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/3.jpg)
3
What types of simulation are there?
![Page 4: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/4.jpg)
4
Simulation Types
1. Static or dynamic models
2. Stochastic or deterministic
models
3. Discrete or continuous models
![Page 5: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/5.jpg)
5
Static vs. Dynamic
• Dynamic• State variables change over time
(System Dynamics, Discrete Event)
• Static• Snapshot at a single point in time
(optimization models, etc.)
![Page 6: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/6.jpg)
6
Deterministic vs. Stochastic
• Deterministic model • The behavior is entire predictable. The
system is perfectly understood, then it
is possible to predict precisely what will
happen.
• Stochastic model • The behavior cannot be entirely
predicted.
![Page 7: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/7.jpg)
7
Discrete vs. Continuous
• Discrete model• The state variables change only at a
countable number of points in time. These points in time are the ones at which the event occurs/change in state.
• Continuous• The state variables change in a
continuous way, and not abruptly from one state to another (infinite number of states).
![Page 8: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/8.jpg)
8
Discrete Event Simula-tion
Dynamic Stochastic Discrete
![Page 9: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/9.jpg)
9
How to Implement a Discrete Event Simulation?
• Consider an example: Airport System• A certain airport contains a single runway on which arriving aircrafts must land. • Once an aircraft is cleared to land, it will use the runway, during which time no other aircraft can be cleared to land. • Once the aircraft has landed, the runway is available for use by other aircraft. The landed aircraft remains on the ground for a certain period of time before departing.
![Page 10: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/10.jpg)
10
An Example: Airport System Single Server Queue
Customer (aircraft) Entities utilizing the system/resources
Server (runway) Resource that is serially reused; serves one customer at a time
Queue Buffer holding aircraft waiting to land
CustomersQueueServer
Ground
![Page 11: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/11.jpg)
An Example: Airport System Single Server Queue
Performance metrics• Average waiting time: average time that an aircraft
must wait when arriving at an airport before they are allowed to land.
• Maximum number of aircraft on the ground: helps to determine the required space of the parking area.
CustomersQueueServer
Ground
11
![Page 12: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/12.jpg)
12
Simulation Development
• Events• Stochastic model and system at-
tributes• System States• Relationship among events• Time handling• Output statistics
![Page 13: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/13.jpg)
An Example: Airport System Single Server Queue
Events: an instantaneous occurrence that changes the state of a system
CustomersQueueServer
Ground
Departure (D)
ASsSfD
Arrival (A) Start Service (Ss)
Finish Service (Sf)
13
![Page 14: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/14.jpg)
14
Stochastic Model and System At-tributes
• Customers• Arrival process: schedule of aircraft arrivals
• Real trace• Probability model: distribution of inter-arrival time
• i.i.d.• Uniform, normal, exponential …
• Servers• How much service time is needed for each
customer?• Probability model: i.i.d. and exponential
distribution• How many servers?
• Single
![Page 15: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/15.jpg)
15
Stochastic Model and System At-tributes
• Queue• Service discipline - who gets service next?
• First-in-first-out (FIFO), Last-in-first-out (LIFO), Priority, Weighted-fairness (WFQ), random …
• Preemption?• Queue capacity?
• k or infinite• Ground
• Park time• Probability model: i.i.d. and exponential
distribution
![Page 16: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/16.jpg)
16
Stochastic Model and System At-tributes
• Uniform• Given max and min• 0 ≦ random() < 1• = min + random() × (max - min)
• Exponential• Given rate λ• @p.30 of lec1.ppt
• Normal• Asking Google
![Page 17: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/17.jpg)
17
How to verify the correctness of distribution generator?
ANS: you can verity it by using a program, Excel, Matlab, …
![Page 18: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/18.jpg)
18
How to verify the correctness of distribution generator via
Excel?• Inputting or generating sample data
• Generating pdf• Applying “Histogram” of “Data Analysis”
• “Data Analysis” is in “Analysis Toolpack” (分析工具箱 )
![Page 19: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/19.jpg)
How to verify the correctness of distribution generator via
Excel?• Generating Broken-line graph for cdf of xi
• Generating ground truth of cdf
19
![Page 20: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/20.jpg)
20
Simulation Development
• Events• Stochastic model and system at-
tributes• System States• Relationship among events• Time handling• Output statistics
![Page 21: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/21.jpg)
System States
State 1
State 2
State 3
Event X
Event YEvent X
Event Y
• System state• A collection of variables in any time that
describe the system• Event
• An instantaneous occurrence that changes the state of a system
21
![Page 22: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/22.jpg)
22
An Example: Airport System Single Server Queue
System States (Q:3 G:2 B:y) Q: # of aircrafts waiting for landing G: # of aircrafts on the ground B: y/n; y if the runway is busy
CustomersQueueServer
GroundASsSfD
![Page 23: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/23.jpg)
23
SsSfD
An Example: Airport System Single Server Queue
CustomersQueueServer
GroundA
Q:3 G:2 B:y
Q:4 G:2 B:y
Q:3 G:3 B:n
Q:3 G:1 B:yA
Sf
D
Q:2 G:3 B:y
IF Q>0Ss
![Page 24: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/24.jpg)
24
Simulation Development
• Events• Stochastic model and system at-
tributes• System States• Relationship among events• Time handling• Output statistics
![Page 25: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/25.jpg)
Relationships among Events
• Each Event has a timestamp indicating when it occurs
Arrival Event A@ t
B?N Start Service Event
Ss
@ tB=Y
Finish Service Event Sf
@ t+ServiceTime()
Arrival Event A@ t+ArrivalTime()
Y
Q+ +
System States Q: # of aircrafts waiting for land-
ing G: # of aircrafts on the ground B: y/n, y if the runway is busy
25
![Page 26: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/26.jpg)
26
Relationships among Events
Departure Event D
@ t+ParkTime()
Q > 0?
Y Start Service Event Ss
@ t
Finish Service Event Sf
@ t
B=N
N
Q--
Finish Service Event Sf
@ t+ServiceTime()
G+ +
System States Q: # of aircrafts waiting for land-
ing G: # of aircrafts on the ground B: y/n, y if the runway is busy
![Page 27: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/27.jpg)
27
Relationships among Events
Departure Event D
@ tG--
System States Q: # of aircrafts waiting for land-
ing G: # of aircrafts on the ground B: y/n, y if the runway is busy
![Page 28: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/28.jpg)
28
Simulation Development
• Events• Stochastic model and system at-
tributes• System States• Relationship among events• Time handling• Output statistics
![Page 29: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/29.jpg)
29t = 00:00
Time Handling
• How to progress Simulation time?• Time-slices Approach
Simulation time
Arrival Event A
@ 00:02:19A time-slice=5 min
Finish Service Event Sf
@ 00:17:49Finish Service
Event Sf
@ 01:22:11
Arrival Event A
@ 00:48:37
Departure Event D
@ 00:59:06Processing
Processing
Do NothingDoDo Do
Processing
t = 00:05t = 00:10t = 00:15t = 00:20t = 00:25t = 00:30t = 00:35t = 00:40t = 00:45t = 00:50Do NothingDoDo Nothing Inefficient Inaccurate
![Page 30: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/30.jpg)
30
Time Handling
• How to progress Simulation time?• Event-driven Approach
Simulation time
Arrival Event A
@ 00:02:19
Finish Service Event Sf
@ 00:17:49Finish Service
Event Sf
@ 01:22:11
Arrival Event A
@ 00:48:37
Departure Event D
@ 00:59:06Processing
Processing
Processing
t = 00:02:19t = 00:17:49t = 00:48:37
![Page 31: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/31.jpg)
31
Simulation Development
• Events• Stochastic model and system at-
tributes• System States• Relationship among events• Time handling• Output statistics
![Page 32: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/32.jpg)
Output statistics
Simulation time
Arrival Event A
@ 00:02:19
Finish Service Event Sf
@ 00:17:49Finish Service Event
Sf
@ 01:22:11Arrival Event
A@ 00:48:37
QGB
00N Y
00:02:19 00:17:49
N1
00:48:37
Y00:59:06
0
Departure Event D
@ 00:59:06
01:22:11
1
Arrival Event A
@ 01:12:28
00:48:37
1 0
32
![Page 33: Discrete Event (time) Simulation 2011.10.26 Kenneth.](https://reader036.fdocuments.in/reader036/viewer/2022081518/551a29ab550346cb358b4dbc/html5/thumbnails/33.jpg)
33
Simulation Flow Chart