Outline
performance
measures for a single-server
station
discrete-event simulation
hand simulation
process-oriented simulation approach
1
A Single-Server Station
Machine
(Server)
incoming
6
5
34
123
out going
Queue (FIFO)
single-server stations …
performance measures
two
types of averages: customer and time
2
Performance Measures Related to
Waiting Time in Queue
N be no. of customers who have ever left the queue
and got (at least some) service
WQi be the time in queue of the ith customer
N
WQi
average waiting time in queue =
maximum waiting time in queue, WQ* =
3
i 1
N
max WQi
i 1,..., N
Performance Measures Related to
Total Time in System
P no. of customers who have completed his
service
TSi = time in system of customer i
P
TSi
average time in system =
i 1
P
maximum time in system, TS* =
4
max TSi
i 1,..., P
Performance Measures Related to
Number in Queue
Q(t)
be the # of customers in queue at t
if we simulate only 20 time units
time-average number in queue =
maximum number waiting in queue,
5
20
0 Q(t )
dt
20
Q*
=
max Q(t )
0t20
Performance Measures Related to
Utilization of Server
1, if the machine is busy at time t ,
B(t )
0, if the machine is idle at time t.
utilization =
20
0 B(t )
20
6
dt
again only for
simulating for
20 time units
An GI/GI/1 Queue
the
simplest single-server station
independent service and arrival processes
inter-arrival times of customers, Tn, i.i.d
service times of customers, Sn, i.i.d
FCFS discipline
infinite buffer
7
The State and the Sample Path
of an GI/G/1 Queue
state:
N(t), number of customers in system
N(t)
t
8
Simulating an GI/GI/1 Queue by Hand
simulate the system for 20 time units to get
total # of customers served (in the time horizon)
average and maximum waiting time in queue
time-average and maximum number in queue
average and maximum total time in system
utilization (proportion of time busy)
9
Input Data
Initially (time 0) empty and idle
Part Number
Arrival Time
Interarrival Time
1
0.00
1.73
2
1.73
1.35
3
3.08
0.71
4
3.79
0.62
5
4.41
14.28
6
18.69
0.70
7
19.39
15.52
8
34.91
3.15
9
38.06
1.76
10
39.82
1.00
11
40.82
.
.
.
.
Stop when 20 minutes of (simulated) time have passed
10
Service Time
2.90
1.76
3.39
4.52
4.46
4.36
2.07
3.36
2.37
5.38
.
.
Performance Measures
simulate
20 time units
performance
average
measures
waiting time in queue
time-average
utilization
number in queue
of drill press
results?
11
Discrete-event Simulation Approach
12
To Simulate the Sample Path
of an GI/G/1 Queue
N(t)
t
state: N(t), number of customers in system
events
state changes
arrivals and departures of customers
13
The Discrete-event
Simulation Approach
after
defining the states and events, the key
is to generate the “locations of points”
“location”:
state
N(t)
How to do that?
t
14
The Sample Path of an GI/G/1 Queue
Sn = the service time of the the nth customer
Tn = the inter-arrival time between the (n-1)st and nth
customers; T0 = 0
possible to deduce Sn and Tn from the sample path?
T3
T2
N(t)
S2
T1
t
S1
15
S3
An Equivalent Representation
of the Sample Path
{Sn}
and {Tn} sample path?
not
necessary, if both {Sn} & {Tn} are discrete
yes otherwise
{Sn}
& {Tn}: always gives a sample path
generate each Sn and Tn when necessary
16
To Simulate the Sample Path
of an GI/G/1 Queue
location of the first
location
of the second point:
point:
trivial
depending
on T1 and
suppose
T1 <SS11
location of the second
location
the fourth point:
and third
points:oftrivial
depending on T2 and S1-T1
N(t)
T1
S1
t
17
To Simulate an GI/GI/1 Queue
by a Computer Program
variables
events: other than initialization and termination
system or simulation variables: TNOW, TTERM
state of the machine
performance variable
an arrival: update performance measures
a departure: update performance measures
general flow of the program
initialization: initialize variables; set first event, etc.
if not stopping yet,
check next event, execute tasks for the event
termination: execute all house keeping tasks
18
To Simulate an GI/G/1 Queue
definition
of variables
definition of events
flow chart of program
program: Java
19
Flow Chart
for Simulating an GI/G/1 Queue
N = L = K = 0; Ta = random interarrival time; Ts = infinity
Yes
Tnow Tmax
No
arrival
next event
ouput L/Tnow and L/K
service
L = L + (Ta - Tnow)N; Tnow = Ta;
N = N + 1; K = K +1;
Ta = Tnow + random inter-arrival time
L = L + (Ts - Tnow)N;
Tnow = Ts;
N=N-1
Yes
No
N=0
N=1
Ts = infinity
Yes
Ts = Tnow + random service time
20
No
Ts = Tnow + random service time
Conceptual Structure
of an Event Calendar
event: (time, type, tasks to do)
event calendar: a link list with scheduled future
events in ascending order of time
example
four events scheduled at epoch 0
event 1: (24.3, type = 4, tasks to do)
event 2: (35.6, type = 1, tasks to do)
event 3: (41.3, type = 2, tasks to do)
event 4: (5000, type = END, tasks to do = end program)
21
Event Calendar
of a Simulation Program
TNOW = 0:
Event. Cal.
1
24.3
type 4
2
35.6
type 1
3
41.3
type 2
4
5000
END
22
tasks to do
tasks to do
tasks to do
End simulation
Event Calendar
of a Simulation Program
suppose
TNOW =that
0: no new event is created by a type 4 event
move time to TNOW = 24.3
execute first event and update event calendar
Event. Cal.
1
35.6
24.3
type 41
taskstasks
to doto do
2
41.3
35.6
type 21
tasks totasks
do to do
3
41.3
5000
type
END2
tasks to do
End simulation
4
5000
END
End simulation
23
Event Calendar
of a Simulation Program
suppose
TNOW =that
0: a new event is created by an type 4 event at 39.1
move time to TNOW = 24.3
execute first event and update event calendar
39.1
Event. Cal.
type 4
1
35.6
24.3
type 14
taskstasks
to doto do
2
39.1
35.6
35.6
type 141
type
taskstasks
to do
doto do
tasks
to
3
41.3
41.3
type
type 22
4
5000
5000
END
END
24
tasks
tasks to
to do
do
End
End simulation
simulation
tasks to do
Operations of the Event Calendar
delete an event that has (just) occurred
after completing all tasks at TNOW, remove the first
event in the event calendar
Describe concept
only; actual
insert a new event
implementation
get the event time of the new event
depends on the data
check where to insert the event
structure used
move backward one rank for events occurring after the
new event
insert the new event
25
A Crude Pseudo-Code of GI/G/1
Queue with Event Calendar
1
initialization
2
3
get next event type
while { next event != termination } {
4
set TNOW = 0; initialize variables; set termination event; set initial
events
get next event time and next event details
set TNOW to next event time
update the Event Calendar
execute next event, including updating variables and possibly adding
new events to Event Calendar
get next event type
}
execute the termination Event
26
Generic Program Structure
for Complex Systems
Initialization Event
while (not stopping (e.g., TNOW < TTERM)) {
switch (Next Event Type) {
case 1:
tasks of type 1 event;
break;
.. .. .. ..
case n:
tasks of type n event;
break;
}
}
Termination Event
27
keep track of
the timing of
events by the
Event Calendar
Process-Oriented Simulation Approach
28
Process-Oriented World View
non-procedural code defining processes of all
types of entities
possible to have artificial entities for logic flow
possibly to have multiple copies of entities at any time
Machine
(Server)
incoming
6
5
34
132
out going
Queue (FIFO)
Simulation with Arena, 5th ed.
30 Simulation
Chapter 2 – Fundamental
Concepts
Slide 30 of 57
Process-Oriented World View
in Arena
common
world view adopted by simulation
software
event-oriented
programs underneath
commonest
world view of Arena, with
everything executed in SIMAN simulation
language underneath
Simulation with Arena, 5th ed.
31 Simulation
Chapter 2 – Fundamental
Concepts
Slide 31 of 57
Pieces of a Simulation Model
entities
queues
attributes
global variables
statistical
accumulators
Arena built-in
events
user-defined
simulation clock
starting and stopping
resources
32
© Copyright 2026 Paperzz