0% found this document useful (0 votes)
0 views50 pages

Discerete Event System Simulation - Manual Simulation: Prof. Dr. Nezir AYDIN University Industrial Engineering

The document discusses discrete event system simulation, focusing on manual simulation techniques for coin tosses and queueing systems. It provides examples of simulating a coin toss game and a grocery store checkout scenario, detailing the statistical properties and performance measures to analyze the results. Key concepts include system state, events, and the use of simulation tables to record and calculate various performance metrics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views50 pages

Discerete Event System Simulation - Manual Simulation: Prof. Dr. Nezir AYDIN University Industrial Engineering

The document discusses discrete event system simulation, focusing on manual simulation techniques for coin tosses and queueing systems. It provides examples of simulating a coin toss game and a grocery store checkout scenario, detailing the statistical properties and performance measures to analyze the results. Key concepts include system state, events, and the use of simulation tables to record and calculate various performance metrics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

1

CHAPTER 4
DISCERETE EVENT SYSTEM SIMULATION –
MANUAL SIMULATION

Prof. Dr. Nezir AYDIN


Yıldız Technical University
Industrial Engineering
2

HOW TO SIMULATE A COIN TOSS (1/2)


• We want to simulate a sequence of 100 coin tossess,
• The coin is fair (0.5 tail, 0.5 head),
• If head lands, Harry wins $1 and Tom losses 1$.
• If tail lands, Tom wins $1 and Harry losses 1$.
• If you toss 100 times, what are you expecting? Either Harry or
Tom is heading half of game or one of them is heading most of
the time?
• We are not interested in who wins or the average probability of
head or tail. We are interested in which of them is heading
during the game.
A) On average both are heading at the same time of the game.
Specifically, Harry is heading in 45-55 games and Tom is heading
in 45-55 games.
B) Harry heading in 95 or more games.
C) Harry is heading in 5 or less games.
3

HOW TO SIMULATE A COIN TOSS (2/2)


Example2.4CoinTossGame.xls: Review sheet
named “One Trial”,
• Using “experiment” sheet: 400 runs results (Histograms)
analyze results

A) Harry heading in 73 (18.3%) games in 400 trials game and in


5 or less games in 100 trials game.
B) Harry and Tom are almost the same in 28(7%) games in 400
trials, and in 45-55 games one of them is heading in 100 trials
game.
C) Harry heading in 46 (11.5%) games in 400 trials game and in
95 or more games in 100 trials game..
4

Simulation of Queueing Systems(1/6)


• A queueing system is described by its calling population, nature
of arrivals, service mechanism, and the queueing discipline
(details in Chapter 6.)

5

Simulation of Queueing Systems(2/6)


• A queueing system is described by its calling
population, nature of arrivals, service mechanism, and
the queueing discipline (details in Chapter 6.)
• A simple single-channel queuing system:
• In a single-channel queue:
• The calling population is infinite.
• Arrivals for service occur one at a time in a random
fashion, once they join the waiting line, they are
eventually served.
• Arrivals and services are defined by the
distribution of the time between arrivals and service
times.
• No capacity
• FIFO rule is applied.
6

Simulation of Queueing Systems(3/6)


• Key concepts:
• The system state is the number of units in the system and the status of the server (busy
or idle).
• An event is a set of circumstances that causes an instantaneous change in the system
state, e.g., arrival and departure events.
• The simulation clock is used to track simulated time.


7

Simulation of Queueing Systems(4/6)


• Potential unit actions upon arrival:

• Server out comes after the completion of service:

Yes
Yes
8

Simulation of Queueing Systems(5/6)


Event Type Customer Simulation
B,C and E show simulation clock time, and D No Time
shows activity in Table1. Interarrival time:
(The first customer arrives at time 0)
2,4,1,2,6. Service time:2,1,3,2,1,4.
Clock Clock Activity Clock

A B C D E
Customer Arrival Service Service Service
No Time start time completion
time time
1
2
3
4
5
6
Chronologic order of events are shown in Table 2.
Table 1. Table 2
9

Simulation of Queueing Systems(5/6)


Event Type Customer Simulation
B,C and E show simulation clock time, and D No Time
shows activity in Table1. Interarrival time: Arrival 1 0
(The first customer arrives at time 0)
2,4,1,2,6. Service time:2,1,3,2,1,4. Departure 1 2

Clock Clock Activity Clock Arrival 2 2

A B C D E Departure 2 3
Customer Arrival Service Service Service Arrival 3 6
No Time start time completion
time time Arrival 4 7

1 0 0 2 2 Departure 3 9

2 2 2 1 3 Arrival 5 9

3 6 6 3 9 Departure 4 11

4 7 9 2 11 Departure 5 12

5 9 11 1 12 Arrival 6 15

6 15 15 4 19 Departure 6 19

Chronologic order of events are shown in Table 2.


Table 1. Table 2
10

Simulation of Queueing Systems(6/6)


11

Simulation of Queueing Systems (1/12)


Grocery store example: with only one checkout
counter.
• Customers arrive at random times from 1 to 8 minutes
apart, with equal probability of occurrence:
• The generation method for random numbers should
produce a sequence of numbers that have two important
statistical properties:
• The numbers should be uniformly distributed between 0 and 1.
• The subsequent numbers generated should be statistically
independent of all previous numbers generated. Having a
number will not help generating the next one.
12

Simulation of Queueing Systems (2/12)


Grocery store example: with only one checkout counter.
Time between Cumulative Random Digit
Arrivals (minutes) Probability Probability Assignment

1 0.125 0.125 001-125


2 0.125 0.250 126-250
3 0.125 0.375 251-375
4 0.125 0.500 376-500
5 0.125 0.625 501-625
6 0.125 0.750 626-750
7 0.125 0.875 751-875
8 0.125 1.000 876-000
The service times vary from 1 to 6 minutes, with probabilities:
Service Time Probability Cumulative Random digit
(mins) probability assignment
1 0.10 0.10 01-10
2 0.20 0.30 11-30
3 0.30 0.60 31-60
4 0.25 0.85 61-85
5 0.10 0.95 86-95
6 0.05 1.00 96-00
13

Simulation of Queueing Systems (3/12)


• To analyze the system by simulating arrival and
service of 20 customers.
• Chosen for illustration purpose, in actuality, 20
customers is too small a sample size to draw any
reliable conclusions.
• Initial conditions are overlooked to keep calculations
simple.
• Assumption: First customer arrive at time 0 and
the system is empty at the beggining.
14

Simulation of Queueing Systems (4/12)


• Generated time-between-arrivals:
Customer Random Time Customer Random Time
Number between Number between
arrivals arrivals

1 - - 11 109 1
2 913 8 12 093 1
3 727 6 13 607 5
4 015 1 14 738 6
5 948 8 15 359 3
6 309 3 16 888 8
7 922 8 17 106 1
8 753 7 18 212 2
9 235 2 19 493 4
10 302 3 20 535 5
15

Simulation of Queueing Systems (5/12)


• Using the same methodology, service times are generated:

Customer Random Service Customer Random Service


Number Time Number Time
1 84 4 11 32 3
2 10 1 12 94 5
3 74 4 13 79 4
4 53 3 14 05 1
5 17 2 15 89 5
6 79 4 16 84 4
7 91 5 17 52 3
8 67 4 18 55 3
9 89 5 19 30 2
10 38 3 20 50 3
16

Simulation of Queueing Systems (6/12)


For manual simulation, Simulation tables are designed for the problem at
hand, with columns added to answer questions.
What questions? performance measures should be considered

Three model outputs should be recorded. Waiting time in line (for each customer),
time spent in the system (for each customer) and idle time (for each server-1 in this
case).
Performance measures:
1. Average waiting time in the line (mins):
Total waiting time in the line (min)/Number of customers

2. Probability of waiting in the line:


Number of customers waiting in the line/Number of customers

3. Probability of server being idle:


Total idle time of the server (min) /Total simulation duration (min)
17

Simulation of Queueing Systems (7/12)


Performance measures (contd.):
4. Average service time (mins):
Total service duration (min) / Number of customers

5. Average interarrival time:


Total interarrival time / Number of arrivals-1

6. Average waiting time for the customers who wait:


Total waiting time in the line (min) / Number of customers who wait

7. Average time spent in the system :


Total time spent in the system (min) / Number of customers

Or

Average waiting time in the line + Average service time


18

Simulation of Queueing Systems (8/12)


Step Activity Clock Activity Clock Output Clock Output Output
Customer Interarrival Arrival Service Time Waiting Time Time Idle time
Time (min) Time Time Service Time in Service customer of server
(clock) (min) Begins Queue (min) Ends spends in (min)
(clock) (clock) system (min)
1 - 0 4 0 0 4 4 0
2 8 8 1 8 0 9 1 4
3 6 14 4
4 1 15 3
5 8 23 2
6 3 26 4
7 8 34 5
8 7 41 4
9 2 43 5
10 3 46 3
19

Simulation of Queueing Systems (8/12)


Time
Time Waiting Time
Arrival customer Idle time
Interarrival Service Service Time in Service
Customer Time spends in of server
Time (min) Time (min) Begins Queue Ends
(clock) system (min)
(clock) (min) (clock)
(min)

1 - 0 4 0 0 4 4 0
2 8 8 1 8 0 9 1 4
3 6 14 4 14 0 18 4 5
4 1 15 3 18 3 21 6 0
5 8 23 2 23 0 25 2 2
6 3 26 4 26 0 30 4 1
7 8 34 5 34 0 39 5 4
8 7 41 4 41 0 45 4 2
9 2 43 5 45 2 50 7 0
10 3 46 3 50 4 53 7 0
11 1 47 3 53 6 56 9 0
12 1 48 5 56 8 61 13 0
13 5 53 4 61 8 65 12 0
14 6 59 1 65 6 66 7 0
15 3 62 5 66 4 71 9 0
16 8 70 4 71 1 75 5 0
17 1 71 3 75 4 78 7 0
18 2 73 3 78 5 81 8 0
19 4 77 2 81 4 83 6 0
20 5 82 3 83 1 86 4 0
68 56 124 18
20

Simulation of Queueing Systems (9/12)


Performance measures:
1. Average waiting time in the line (mins):
Total waiting time in the line (min)/Number of customers = 56/20 =2.8

2. Probability of waiting in the line:


Number of customers waiting in the line/Number of customers = 13/20 =0.65

3. Probability of server being idle:


Total idle time of the server (min) /Total simulation duration (min) = 18 / 86 =
0.21
21

Simulation of Queueing Systems (10/12)


Performance measures (contd.):
4. Average service time (mins):
Total service duration (min) / Number of customers = 68 / 20 = 3.4 mins

Average service time can be determined through expected value of service time:

1*(0.10)+ 2*(0.20)+ 3*(0.30)+


4*(0.25)+ 5*(0.10)+ 6*(0.05)
=3.2 mins

Increasing simulation duration (number of customers) average service time will


approach to theoretical average service time.
22

Simulation of Queueing Systems (11/12)


Performance measures (contd.):
5. Average interarrival time:
Total interarrival time / Number of arrivals-1 = 82 / 19 = 4.3

Average interarrival time can be compared with the discrete uniform


distribution which has a=1 and b=8 parameters :

E (A) = (a + b) / 2 = (1+8) / 2 = 4.5 mins


Increasing simulation duration (number of customers) average
interarrival time will approach to theoretical average interarrival
time.
23

Simulation of Queueing Systems (12/12)


Performance measures (contd.):
6. Average waiting time for the customers who wait:
Total waiting time in the line (min) / Number of customers who wait = 56 / 13 = 4.3 mins

7. Average time spent in the system :


Total time spent in the system (min) / Number of customers = 124 / 20 = 6.2 mins

Or

Average waiting time in the line + Average service time = 2.8 + 3.4 = 6.2
24

Simulation of Queueing Systems in MS Excel


Example2.5SingleServer.xls: Review « One Trial» sheet.
Using « Experiment» sheet.

Review Histograms after 50 run!

Change number of runs to 400 and 10 and then review


histograms again!
25

Able-Baker Call Center (A Two Servers Queuing System) (1/7)


A computer technical support center with two personnel
taking calls and provide service.
Two support staff: Able and Baker (multiple support channel).
A simplifying rule: Goal: to find how well the current arrangement
works. Able gets the call if both staff are idle.
Random variable:
Arrival time between calls
Service times (different distributions for Able and Baker).
Baker's Service Time
Interarrival Distribution of Calls
Able's Service Time Distribution Distribution
Interarrival
Cumulative Service Service
Time Probability Cumulative Cumulative
Probability Times Probability Times Probability
(Minutes) Probability Probability
(Min.) (Min.)
1 0,25 0,25 2 0,30 0,30 3 0,35 0,35
2 0,40 0,65 3 0,28 0,58 4 0,25 0,60
3 0,20 0,85 4 0,25 0,83 5 0,20 0,80
4 0,15 1,00 5 0,17 1,00 6 0,20 1,00
26

Able-Baker Call Center (A Two Servers Queuing System) (2/7)


Assumptions:
• System is empty at the beggining and first call occurs at t=0.
• If both tellers are empty Able takes the call.
• If both are busy the call is hold on.
Goal:
• Simulating the system for 1 hour for analyzing.
Random numbers for interarrivals Random numbers for service time
26 74 34 38 18 95 38 39 53 01 47
98 80 45 80 51 21 13 53 81 47
90 68 24 42 71 51 61 88 64 75
26 22 34 56 16 92 50 01 01 57
42 48 63 89 92 89 49 81 67 87
27

Able-Baker Call Center (A Two Servers Queuing System) (3/7)

Service
28

Able-Baker Call Center (A Two Servers Queuing System) (3/7)

Service
29

Able-Baker Call Center (A Two Servers Queuing System) (4/7)


30

Able-Baker Call Center (A Two Servers Queuing System) (5/7)

Total Service Total Service Total waiting


Time (ABLE) Time (BAKER) time on phone
31

Able-Baker Call Center (A Two Servers Queuing System) (6/7)

Performance measures:
1. Able worked, approximately, 90% of the time:
= (56/62)*100 = 90%
2. Baker worked, approximately, 69% of the time:
= (43/62)*100 = 69%
3. 35% of the calls have to wait:
= (9/26)*100 = 35%
32

Able-Baker Call Center (A Two Servers Queuing System) (7/7)

Performance measures (contd.):


4. Average waiting time for all customers is 0.42 min. or 25 seconds:
= (11/26)*100 = 0.42mins = 25 seconds
5. Average waiting time for customers who had to wait is 1.22 mins:
= (11/9)*100 = 1.22 mins.
Therefore,
The system is balanced.
1 tellers is not enough to satisfy and 3 tellers would be more than
needed.
If 3 tellers work waiting time will be lesser and will approach to zero.
33

Simulation of Two Servers Queueing Systems in MS Excel

Example2.6AbleBaker.xls: Review « One Trial» sheet.


Use « Experiment» sheet.

Change number of runs to 400 and review histogram!


34

SIMULATION OF INVENTORY SYSTEMS


35

Simulation of Inventory Systems (1/4)


• In the picture below (M,N) inventory system is shown.
• M: Maximum inventory level,
• N: review period
• Inventory level is checked at every N period and the order is given to
increase the level of inventory to M.
• For the sake of simplicity the lead time is taken as 0.
36

Simulation of Inventory Systems (2/4)


Costs in inventory systems:
• Revenue from sales
• Cost of items sold,
• Carrying cost
• Ordering cost
• Shortage cost (lost sales)- backordering
• Scrap cost
• Salvage revenue
37

Simulation of Inventory Systems (3/4)


Total inventory cost is a performance measure. It is inventory
policy dependent. There are several controllable and
uncontrollable parameters.
The ones that are controlled are called decision variables. For
each item in the inventory:
• Maximum inventory level, M
• Review period, N
• Order quantity, Q (lot size)
• Lead time, L (can be random)
38

Simulation of Inventory Systems (4/4)


The events in a (M,N) inventory system:
• Demand for each item
• Order quantity decision (lot size)
• Arrival of order
39

Newspaper seller’s problem (1/5)


• A classical inventory problem concerns the purchase and sale of
newspapers.
• The paper seller buys the papers for 33 cents each and sells them
for 50 cents each. (The lost profit from excess demand is 17 cents
for each paper demanded that could not be provided.)
• Newspapers not sold at the end of the day are sold as scrap for 5
cents each. (the salvage value of scrap papers)
• Newspapers can be purchased in bundles of 10. Thus, the paper
seller can buy 10, 20, …, and so on.
• There are three types of newsdays, “good,” “fair,” and “poor,” with
probabilities of 0.35, 0.45, and 0.20, respectively.
40

Newspaper seller’s problem (2/5)


• The problem is to determine the optimal number of papers the newspaper
seller should purchase.
• This will be accomplished by simulating demands for 20 days and recording
profits from sales each day.
• The profits are given by the following relationship:

 revenue   cost of   lost profit from  salvage from sale


Pofit =   −   −   +  
 from sales  newspapers  excess demand   of scrap papers 

◼ The distribution of papers demanded on each of these days is


given in Tables below.
◼ Tables also provide the random-digit assignments for the types of
newsdays and the demands for those newsdays.
41

Newspaper seller’s problem (3/5)


Newspaper seller’s problem (4/5) 42
43

Newspaper seller’s problem (5/5)

• Assumption: Seller buys 70 newspaper everyday.


• The profit for the first day is determined as follows:
• On day 1 the demand is 60 newspapers. The revenue from the sale of
60 newspapers is $30.00.
• Profit = $30.00 - $23.10 - 0 + $.50 = $7.40
• Ten newspapers are left over at the end of the day.
• The salvage value, at 5 cents each, is 50 cents.
• The profit for the 20-day period is the sum of the daily profits,
$174.90. It can also be computed from the totals for the 20 days of
the simulation as follows:
• Total profit = $645.00 - $462.00 - $13.60 + $5.50 = $174.90
• The policy (number of newspapers purchased) is changed to other
values and the simulation repeated until the best value is found.
44

Newspaper seller’s problem in Ms Excel (4/5)

• Example2.7NewsDealer.xls: Review «One Trial» sheet.


• Review «Experiment» sheet for 400 run.
45

Simulation of Inventory Systems (1/4)


• Simulation of an (M,N) Inventory System
• This example follows the pattern of the probabilistic order-level inventory
system.
• Suppose that the maximum inventory level, M, is 11 units and the
review period, N, is 5 days. The problem is to estimate, by simulation,
the average ending units in inventory and the number of days when a
shortage condition occurs.
• At the end of the 5. day if there are 3 refrigerators in stock, then 8 (11-
3=8) refrigerators are ordered. On the other hand, if there are 2 shortage
in satisfying demand , then 13 (11+2=13) refrigerators are ordered.
• In this example, lead time is a random variable.
• Assume that orders are placed at the close of business and are received
for inventory at the beginning of business as determined by the lead time.
46

Simulation of Inventory Systems (2/4) Random


Digit For
Lead
• Assumption: Time
The simulation has been started with the inventory level at 3 units and an
order of 8 units scheduled to arrive in 2 days' time. 5
• For purposes of this example, only five cycles will be shown.
• The random-digit assignments for daily demand and lead time are shown
0
in the rightmost columns of Tables below. 3
4
8
4
1
47

Simulation of Inventory Systems (3/4)


48

Simulation of Inventory Systems (4/4)

• The simulation has been started with the inventory level at 3 units and
an order of 8 units scheduled to arrive in 2 days' time.

Beginning Inventory of
Ending Inventory of
Third day = + new order
2. day in first cycle

◼ The lead time for this order was 1 day.


◼ Notice that the beginning inventory on the second day of the third cycle was
zero. An order for 2 units on that day led to a shortage condition. The units
were backordered on that day and the next day also.
◼ On the morning of day 4 of cycle 3 there was a beginning inventory of 9
units. The 4 units that were backordered and the 1 unit demanded that day
reduced the ending inventory to 4 units.
◼ Based on five cycles of simulation, the average ending inventory is
approximately 3.5 (88  25) units. On 2 of 25 days a shortage condition
existed.
49

Simulation of Inventory Systems in Ms Excel (M,N)

• Example2.8RefrigInventory.xls: Review «One Trial» sheet (Daily


DSS values fluctuates by alot).
• Review «Experiment» sheet for 100 run (Daily DSS values
fluctuates by a little).
• By changing inventory policy via changing daily demand and lead
times several analysis can be conducted.
See you next lecture ☺

50

You might also like