You are on page 1of 46

Industrial Systems Engineering - International University – VNU-HCM

General Principles in Discrete- Event


Simulation
Book: Jerry Bank’s chapter 3
Kelton’s chapter 2

Dr. Pham Huynh Tram & Dr. Tran Duc Vi


Mar 2022

Discrete-Event System Simulation


1
Review Questions
What does it mean "discrete, stochastic, dynamic" simulation
modeling?

How to solve real problem by "Spread Sheets" Model?

● Inputs: how to simulate “randomness”?


● Conceptual Model: Logical transformation of “inputs” into
“outputs”
● Outputs (responses): descriptive statistics

2
3
Today’s questions

● What are the Concepts in discrete-event simulation?

● World Views of Simulation Modeling:


– Event Scheduling/Time Advance Algorithms:
Mechanisms for advancing simulation over time?

● Example: How to do Manual Simulation using Event


Scheduling?

4
Example: Single-Channel Queue

5
Example Single-Channel Queue (cont)

Grocery store with only one checkout counter.


▪ Customers arrive at random times from
1 to 8 minutes apart, with equal ▪ The service times vary from 1 to 6
probability of occurrence: minutes,
with probabilities:

relation? relation?

6
Example 1: Single-Channel Queue (cont)

7
1. Concepts in Discrete-Event Simulation

● System state: A collection of variables that contain all the


information necessary to describe the system at any time.

What are the system state variables in the Single-Channel Queue?


- ..
- ..

8
1. Concepts in Discrete-Event Simulation

● Entities:
- dynamic objects in the simulation, which move around in
the system, affect the state of the system
- all entities have to be created.
- most entities represent real things in a simulation, but you
also can create “fake” ones

What are the entities in the Single-Channel Queue?

9
1. Concepts in Discrete-Event Simulation

● Attributes:
- a common characteristic of all entities, but with a specific
value that can differ from one entity to another
- attribute values are tied to specific entities

10
1. Concepts in Discrete-Event Simulation

● Events:
- An instantaneous occurrence that changes the state of a
system
What events may take place in the Example of Single-Channel Queue?
……
…..

- Every simulation must have a stopping event . There are


generally two ways to stop a simulation:
+ at t=0, schedule a stop simulation event at a specified future
time
+ Run length TE is determined by the simulation itself.
Generally, TE is the time of occurrence of some specified
event E. 11
1. Concepts in Discrete-Event Simulation

● Activities:
- A duration of time of specified length, which is known
when it begins (although it may be specified deterministic or
in statistical distribution)
- This duration is characterized and defined by the modeler

What activities we may consider in the Example of Single-Channel


Queue?

12
1. Concepts in Discrete-Event Simulation

an end of inspection event


event time = 105

Event notice

100 105 time

current simulated time Inspection time (=5)

● The duration of an activity is computable from its specification at the instant it


begins.
● To keep track of activities and their expected completion time, at the simulated
instant that an activity duration begins, an event notice is created having an event
time equal to the activity's completion time.

13
1. Concepts in Discrete-Event Simulation

● Delay:
- A duration of time of unspecified indefinite length, which is not
known until it ends
- Not specified by the modeler ahead of time, but rather
determined by system conditions.
- Quite often, a delay's duration is measured and is one of the
desired outputs of a model run.

A customer's waiting time in the line may be dependent on the


number and duration of service of other customers ahead in line
as well as the availability of servers and equipment.
14
Example: Single-Channel Queue (cont.)

15
16
17
18
19
Concepts in Discrete-event Simulation

20
A snapshot at simulation time t

*Set = list

21
2. World views for developing a model

● A system is modeled in terms of


○ its state at each point in time
○ the entities that pass through the system and the entities
that represent system resources
○ the activities and events that cause system state to
change.

● Event-scheduling world view


● Process-interaction world view

22
Event Scheduling/Time Advance Algorithm

● The sequence of actions that a simulator must perform to


advance the clock and build a new system snapshot (Fig
3.1)

23
Event-Scheduling (2)

● Event notice: A record of an event to occur at the current or some


future time, along with any associated data necessary to execute
the event; at a minimum, the record includes the event type and
the event time.
Example:
- (A, t ), representing an arrival event to occur at future time t
- (D, t ), representing a customer departure at future time t
- (E, 60), representing the simulation-stop event at future time 60

● Future Event list (Event calendar): A list of event notices for


future events, ordered by time of occurrence

● Clock: A variable representing simulated time, called CLOCK


24
Example: Single-Channel Queue (cont.)

25
Effect of
Departure
and Arrival
event on
system

26
27
28
B: Total Busy Time
MQ: Maximum Queue Length
a*, s*: generated interarrival and service time
29
Event scheduling
mechanism

t1: “imminent
event”: next event
that will occur

Removal and
addition of
events from
the FEL list

30
● List processing: the
management of the FEL.
– the removal of the
imminent event.
– the addition of a new
event to the list, and
– occasionally removal
of some event
( cancellation of an
event).

● Scheduling a future
event: at the instant an
activity begins, its
duration is computed or
drawn as a sample from a
statistical distribution

● efficiency of searching
of the list depends on the
logical organization of
the list and on how the
search is conducted 31
2.1. Event Scheduling

Example: The Dump Truck Problem

Traveling

Loading

Scale
Loader Weighing
queue queue

First-Come
First-Come First-Served
First-Served

■ The distributions of loading time, weighing time, and travel time are
given in Tables 3.3, 3.4, and 3.5, respectively, from Table A.1.

■ The purpose of the simulation is to estimate the loader and scale


utilizations (percentage of time busy).
32
3.1.3. Manual Simulation Using Event Scheduling (9)

Table 3.3 Distribution of Loading Time for the Table 3.4 Distribution of Weighing Time for the
Dump Trucks Dump Trucks

Table 3.5 Distribution of Travel Time for the


Dump Trucks
– The activity times are taken from the
following list as needed:

33
3.1.3. Manual Simulation Using Event Scheduling (10)

Example The Dump Truck Problem (Cont.)


– System state [LQ(t), L(t), WQ(t), W(t)]
● LQ(t) = number of trucks in loader queue
● L(t) = number of trucks (0, 1, or 2) being loaded
● WQ(t) = number of trucks in weigh queue
● W(t) = number of trucks (0 or 1) being weighed, all at simulation time t

– Event notices :
● (ALQ, t, DTi ), dump truck i arrives at loader queue (ALQ) at time t
● (EL, t, DTi), dump truck i ends loading (EL) at time t
● (EW, t, DTi), dump truck i ends weighing (EW) at time t

– Entities : The six dump trucks (DT 1, … , DT 6)

34
3.1.3. Manual Simulation Using Event Scheduling (11)

Example (Cont.)
– Lists:
● Loader queue: all trucks waiting to begin loading, ordered on a first
come, first served basis
● Weigh queue : all trucks waiting to be weighed, ordered on a first come,
first served basis

– Activities: Loading time, weighing time, and travel time

– Delays: Delay at loader queue, and delay at scale

– It has been assumed that five of the trucks are at the loaders and one is at the
scale at time 0.

– The simulation table is given in Table 3.6.

35
Table 3.6 Simulation Table for Dump Trucks
Operation
Truck 4 begins to load,
Truck 3 joins the weigh queue
schedule an EL event for future
(because the scale is occupied.)
time 10

At time 0,
5 trucks at
the loaders
and 1 is at
the scale

The imminent
event is an EL
event with
time 5, hence
clock is
advanced to
time t=5

36
Table 3.6 Simulation Table for Dump Trucks
Operation

37
3.1.3. Manual Simulation Using Event Scheduling (12)

Example
(Cont.)
– This logic for the occurrence of the end-loading event
● When an end-loading (EL) event occurs, say for truck j at time t , other events
may be triggered.
● If the scale is idle [W(t)=0], truck j begins weighing and an end-weighing
event (EW) is scheduled on the FEL.
● Otherwise, truck j joins the weigh queue.
● If at this time there is another truck waiting for a loader, it will be removed
from the loader queue and will begin loading by the scheduling of an end-
loading event (EL) on the FEL.

– In order to estimate the loader and scale utilizations, two cumulative statistics are
maintained:
● BL = total busy time of both loaders from time 0 to time t
● BS = total busy time of the scale from time 0 to time t
38
3.1.3. Manual Simulation Using Event Scheduling (13)

Example 3.5 (Cont.)


– The utilizations are estimated as follows:

⬥ average loader utilization

⬥ average scale utilization

■ These estimates cannot be regarded as accurate estimates of the long-run


“steady-state” utilizations of the loader and scale.
■ A considerably longer simulation would be needed to reduce the effect of
the assumed conditions at time 0 (five of the six trucks at the loaders) and
to realize accurate estimates.

39
2.1. Event-Scheduling

● Advantages:
- allow us to control everything; have complete flexibility
with regards to attributes, variable and logic flow; know the
state of everything anytime
- easily to be coded up in any programming language or with
macros in a spreadsheet

● Disadvantages:
- become very complicated for large models with lots of
different kinds of events, entities and resources

40
2.2. Process-interaction World View

● Instead of keeping track of all events, entities, attributes,


variables, statistical accumulators all the time as in the event-
scheduled, it’s more ore natural way to take the viewpoint of
an entity as it works its way through the model.
● The process-interaction approach focuses on the processes
that entities undergo
● Analogous to flowcharting

41
2.2. Process-interaction World View

Event-scheduling approach

42
2.2. Process-interaction World View

Process-oriented approach

Figure 3.4 Two interesting customer processes in a single-server queue

43
2.2. Process-interaction World View

● Example of Single-channel Queue


(you may put yourself in a position of a typical part entity)
- Create yourself (a new entity arrives)
- Write down what time it is now on one of your attributes (for
other computations later)
- Wait in the Q until the server is free
- Seize the server (and take yourself out of the Q)
- Compute your waiting time in the Q
- Stay with the server for a duration that the service requires
- Release the server so other entities can seize it
- Compute your total time in system
- Dispose of yourself and go away

44
2.2. Process-interaction World View

- This approach is employed when using a process-oriented


simulation language (eg. SIMAN) or a simulation software (eg.
ARENA)
- Most discrete-event simulation are actually executed in the event
orientation even though we cannot see it. ARENA’s hierarchical
nature allows us to get down into the event orientation to regain
the control to model something peculiar. In that case, we have to
think and code with event-oriented logic

→ we’ll take the process-oriented approach because of its ease


and power, but it’s good to have some understanding of what’s
going under the hood.

45
3.3 Summary

● Introduced the major concepts and building blocks in simulation:


– Entities and attributes.
– Events and activities.

● 2 major world views:


– Event-scheduling.
– Process interaction.

46

You might also like