Professional Documents
Culture Documents
04 DESimulation 1 PDF
04 DESimulation 1 PDF
04 DESimulation 1 PDF
Simulation
14.11.2001
• A definition of simulation:
1. Imitation of the operation of a real-world system
2. Generation of an artificial history of a system
3. Observation of the artificial history
• A model:
– is a set of assumptions about the operation of the
system
A group of objects
that interact
r y
Sy d a
ste u n
m b o
System environment
System
Time of day
Customers
Special events
Cashiers
r y
Sy d a
ste u n
m b o
System environment
System
Pluto?
Earth Sun
Moon Asteroids?
r y
Sy d a
ste u n
m b o
Va
lid
at
io
n
Documentation Production Experimental Create simulation
& report runs & analysis design model
Verification
Va
lid
at
io
n
Create simulation
Verification... model
Input Output
System
variables variables
• How does each event affect the system state and attributes?
Bank Service
Queue
• A typical objective:
– Determine the effect of an additional cashier on the
mean queue length
• Data needed:
– Inter-arrival times of customers
– Service times
6
NQ 5
4
3
2
1
0
T
• (Future) event list... ... A list of event notices for future events
t1 ≤ t2 ≤ t3 ≤ t4
Arrivals of customers
• Primary event:
WHENEVER T >= TArrive
DO
NQueue^ := NQueue + 1;
TArrive^ := T + IArrive;
END
• Conditional event:
WHENEVER (NServer = 0) AND (NQueue > 0)
DO
NQueue^ := NQueue - 1;
NServer^ := NServer + 1;
TService^ := T + IService;
END
# Customer arrives
WHENEVER T >= TArrive
DO
NQueue^ := NQueue + 1;
TArrive^ := T + IArrive;
DISPLAY ("T= %f Customer arrives\n",T);
END
FEL
yes empty?
no
(t1, Arrival)
Simulation clock: 11
12
14
15
7
6
5
0
9
Arrival Customer Begin Service Service
interval arrives service duration complete
5 5 5 2 7
1 6 7 4 11
3 9 11 3 14
3 12 14 1 15
5 5 5 2 7
1 6 7 4 11
3 9 11 3 14
3 12 14 1 15
5 5 5 2 7
1 6 7 4 11
3 9 11 3 14
3 12 14 1 15
5 5 5 2 7
1 6 7 4 11
3 9 11 3 14
3 12 14 1 15
5 5 5 2 7
1 6 7 4 11
3 9 11 3 14
3 12 14 1 15