Basic Simulation Modeling: The Nature of Simulation
Basic Simulation Modeling: The Nature of Simulation
Conceptions
Conceptions
Application areas
Academic level
Impediments
MAK_Stat_RU
Application areas
Example
a manufacturing company contemplates building
a large extension onto one of its plants, but is
not sure if the potential gain in productivity would
justify the construction cost.
Academic level
Impediments
MAK_Stat_RU
Continue...
System is defined to be a collection of entities, e.g., people or
machines, which act and interact together toward the
accomplishment of some logical end.
System depends on the objectives of a particular study.
State of a system: collection of variables necessary to describe a
system at a particular time, relative to the objectives of a study.
(the number of busy tellers, the number of customers in the bank,
the time of arrival of each customer in the bank)
10
Example
System
Experiment with
the actual system
Experiment with a
model of the system
Physical model
Mathematical model
Analytical solution
Simulation
11
MAK_Stat_RU
12
Definitions
Logic Organization.
13
14
Time-Advance Mechanism
Example 1.1
15
MAK_Stat_RU
Example 1.2
Notations:
e1
e0
e4
e5
t2
t3
c2
Time
t1
A1
e2 e3
A2
c1
A3
S1
S2
18
17
Continue...
Initialization routine: A subprogram to initialize the
Components (10)
next event from the event list and then advances the
simulation clock to the time when that event is to occur
19
MAK_Stat_RU
Continue...
Start
Initialization routine
Main program
Time routine
1. Set simulation
0. Invoke the initialization routine
0
clock=0
2. Initialize system state
1. Invoke the timing routine
and statistical counters
Repeatedly
2. Invoke event routine
3. Initialize event list
2
Event routine i
1.Update system state
2.Update statistical counters
3.Generate future events and add to
event list
Is
simulation
over?
Library routines
Generate random
variates
No
Report generator
Yes
1. Compute estimates of interest
2. Write report
Stop
21
22
Simulation of A Single-Server
Queueing System
2.
3.
23
MAK_Stat_RU
Arrival process:
Inter-arrivals: Ai
Mean interarrival time: E(A)
Arrival rate: = 1 / E(A)
Service mechanism
Service time: Si
Number of servers: s
Mean service time: E(S)
Service rate: = 1 / E(S)
Queue discipline
FIFO
LIFO
Priority
24
GI/G/s queue
1.
2.
3.
4.
Symbols: M (exponential),
(deterministic times)
. . .
Ek
(k-Erlang),
FIGURE 1.71
A GI/G/s queue
26
25
Server
Customer in service
lim
lim
Customers in queue
lim
MAK_Stat_RU
Q
27
lim
An arrival customer
d and L =
d + E(S)
28
Interarrival times:
: delay in queue of ith customer
Service times:
The expected average number of customers in queue
29
Q(t)
30
0
e1=0.4
Arrivals
e2=1.6
e8=4.0
e3=2.1
e7=3.8
e11=5.8
e10=5.6
e12=7.2
e6=3.3
Departures
e4=2.4 e5=3.1
e9=4.9
e13=8.6=T(6)
FIGURE 1.5
Q(t), arrival times, and departure times for a realization of a single-server queueing system.
MAK_Stat_RU
31
32
B(t)
Intuitive Explanation
1
0
e1=0.4
Arrivals
e2=1.6
e11=5.8
e10=5.6
e8=4.0
e3=2.1
e7=3.8
e12=7.2
e6=3.3
Departures
e4=2.4 e5=3.1
e13=8.6=T(6)
e9=4.9
FIGURE 1.6
B(t), arrival times, and departure times for a realization of a single-server queueing system.
33
Initialization
time = 0
Arrival
time = 0.4
System state
Sever
status
Time
of last
event
0.4
Event list
Number
in
Times
queue
of
arrival
Sever
status
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
Event list
0.4
Number
in
Times
queue
of
arrival
Time
of last
event
Statistical counters
1
Area
Area
Number Total
delayed delay under Q(t) under B(t)
Computer Representation
(b)
(a)
35
MAK_Stat_RU
D 2.4
Clock
1
Statistical counters
0
A 1.6
0.4
Clock
0
System state
A 0.4
0
System
34
36
Arrival
time = 1.6
Arrival
time = 2.1
System state
1.6
0.4
1
1.6
Sever
status
Time
of last
event
0.4
Event list
1.6
Number
in
Times
queue
of
arrival
Statistical counters
1
1.6
1.2
Sever
status
2.1
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
A 3.8
2.1
D 2.4
Clock
System state
A 2.1
1.6
1.6
2.1
D 2.4
Clock
Event list
2.1
Number
in
Times
queue
of
arrival
Time
of last
event
Statistical counters
1
0.5
1.7
Area
Area
Number Total
delayed delay under Q(t) under B(t)
Computer Representation
System
(c)
(d)
37
Departure
time = 2.4
Departure
time = 3.1
System state
2.1
1.6
1
System
Sever
status
2.4
Number
in
Times
queue
of
arrival
Time
of last
event
2.1
Event list
0.8
1.1
Sever
status
2.0
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
(e)
3.1
Number
in
Times
queue
of
arrival
Time
of last
event
Event list
Statistical counters
3
1.8
1.8
2.7
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
(f)
39
MAK_Stat_RU
D 3.3
Clock
1
Statistical counters
2
A 3.8
3.1
D 3.1
Clock
System state
A 3.8
2.4
2.1
38
40
10
Arrival
time = 3.8
Departure
time = 3.3
System state
Sever
status
3.3
Number
in
Times
queue
of
arrival
Time
of last
event
3.8
Event list
1.8
1.8
Sever
status
2.9
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
D 4.9
Clock
1
Statistical counters
3
A 4.0
3.8
Clock
0
System state
A 3.8
3.3
3.8
Number
in
Times
queue
of
arrival
Time
of last
event
Event list
Statistical counters
4
1.8
1.8
2.9
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
(h)
(g)
41
Departure
time = 4.0
Departure
time = 4.9
System state
4.0
3.8
1
System
Sever
status
4.0
Number
in
Times
queue
of
arrival
Time
of last
event
4.0
Event list
1.8
1.8
Sever
status
3.1
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
(i)
4.9
Number
in
Times
queue
of
arrival
Time
of last
event
Event list
Statistical counters
5
2.7
2.7
4.0
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
(j)
43
MAK_Stat_RU
D 8.6
Clock
1
Statistical counters
4
A 5.6
4.9
D 4.9
Clock
System state
A 5.6
4.0
4.0
42
44
11
Arrival
time = 5.6
Arrival
time = 5.8
System state
5.6
4.0
1
5.6
Sever
status
5.6
Number
in
Times
queue
of
arrival
Time
of last
event
4.0
Event list
Statistical counters
5
2.7
2.7
5.6
4.7
Sever
status
5.8
Area
Number Total
Area
delayed delay under Q(t) under B(t)
Computer Representation
System
A 7.2
5.8
D 8.6
Clock
System state
A 5.8
5.6
5.6
5.8
D 8.6
Clock
5.8
Number
in
Times
queue
of
arrival
Time
of last
event
Event list
Statistical counters
5
2.7
2.9
4.9
Area
Area
Number Total
delayed delay under Q(t) under B(t)
Computer Representation
System
(k)
(l)
45
Arrival
time = 7.2
Departure
time = 8.6
System state
4.0
1
5.8
7.2
System
Sever
status
5.6
5.8
7.2
7.2
Time
of last
event
5.6
Event list
Statistical counters
5
2.7
5.7
5.8
6.3
7.2
Area
Area
Number Total
delayed delay under Q(t) under B(t)
Computer Representation
System
(m)
Sever
status
5.8
7.2
D 9.2
Clock
8.6
Number
in
Times
queue
of
arrival
Time
of last
event
Event list
Statistical counters
6
5.7
9.9
7.7
Area
Area
Number Total
delayed delay under Q(t) under B(t)
Computer Representation
(n)
47
MAK_Stat_RU
A 9.1
8.6
D 8.6
Clock
Number
in
Times
queue
of
arrival
System state
A 9.1
7.2
5.6
46
48
12
Comments
Interaction between the simulation clock and the event list
n=1000
Interarrival and service times
Contingencies
Termination conditions
Time ties
49
Arrival
Event
Is
the server
busy?
Write error
Yes
message and stop
simulation
Yes
No
Set delay=0
for this customer
and gather statistics
Add 1 to the
number in queue
Departure
Event
FIGURE 1.8
Flowchart for arrival routine, queueing model
Yes
50
Is
the queue
empty?
No
Subtract 1 from
the number
in queue
Eliminate departure
event from
consideration
Compute delay of
customer entering service
and gather statistics
Add 1 to the
number of customers
delayed
Make the
server busy
Store time of
arrival of this
customer
Schedule a
departure event
for this customer
Schedule a
departure event
for this customer
Return
MAK_Stat_RU
No
Add 1 to the
number of
customers delayed
Is
the queue
full?
FIGURE 1.9
Flowchart for arrival routine, queueing model
51
Return
52
13
External definitions
Main functions
Function initialize
Function timing
Function arrive
Function departure
Function report
Function update_avg_stats
Function expon
1.000 mins
0.500 mins
1000
0.430 mins
0.418
0.460
1027.915 mins
53
54
Event-graph
Stop: fixed run time 480 mins
External definitions
Main functions
Function initialize
Function report
Output report
Arrival
FIGURE 1.38
Event graph, queueing model
55
MAK_Stat_RU
Departure
56
14
Event-graph
Arrival
Arrival
Enter
service
Departure
Departure
End
simulation
FIGURE 1.39
Event graph, queueing model with separate enter-service event
FIGURE 1.40
Event graph, queueing model with fixed run length
57
58
STEPS
MAK_Stat_RU
b. Collect data (if possible) to specify model parameters and input probability distributions
c. Delineate the above information and data in an assumptions document, which is the
conceptual model
d. Collect data (if possible) on the performance of the existing systsem (for validation purpose
in Step 6)
e. The level of model detail should depend on the following:
Project objectives
Performance measures
Data availability
Credibility concerns
Computer constraints
Opinions of SMEs
Time and money constraints
f.
There need not be a one-to-one correspondence between each element of the model and
the corresponding element of the system.
g. Interact with the manager (and other key project personnel) on a regular basis
60
15
STEPS
STEPS
3. Is the conceptual model valid?
Helps ensure that the models assumptions are correct and complete
Promotes ownership of the model
Take place before programming begins to avoid significant
reprogramming later
7. Design experiments.
a. Specify the following for each system configuration of interest:
Length of each run
Length of the warmup period, if one is appropriate
Number of independent simulation runs using different random numbers--facilitates construction of confidence intervals
61
62
Formulate problem
and plan the study
STEPS
Yes
Construct a computer
program and verify
Programmed
Model valid?
No
Yes
Design experiments
c. Results are used in decision-making process if they are both valid and
credible.
63
MAK_Stat_RU
No
FIGURE 1.68
Steps in a simulation study.
64
16
ADVANTAGES OF SIMULATION
DISADVANTAGES OF SIMULATION
65
MAK_Stat_RU
17
Notes
69
MAK_Stat_RU
1.
The time-average number in the system
2.
The average total time in the system
3.
The maximum queue length
4.
The maximum delay in quque
5.
The maximum time in the system
6.
The proportion of customers having a delay in queue in excess of 1 minute
Entegar: report on the simulation including simulation model description, design of
the experiments, results of above measures after the simulation, conclusion on
the simulation, and program code.
Fecha limite: 18 de Febrero de 2005
70
18