4.discrete Event Simulation 2
4.discrete Event Simulation 2
Materi:
Spreadsheet DES
Simple DES Examples
Presents several examples of simulations that
can be performed by devising a simulation
table either manually or with a spreadsheet
In real world, simulation are rather large, and
the amount of data stored and manipulated is
vast, so such runs are usually conducted with
the aid of a computer
We try to gain insight how DES works in small
scale using spreadsheet
Checkout Counter
Assumptions
Only one checkout counter.
Customers arrive at this checkout counter at random
from 1 to 8 minutes apart. Each possible value of
interarrival time has the same probability of
occurrence, as shown in Table 2.6.
The service times vary from 1 to 6 minutes with the
probabilities shown in Table 2.7.
The problem is to analyze the system by simulating the
arrival and service of 20 customers.
CSH3H2-Dasar Pemodelan dan
7 1/6/2017
Simulasi
Example 2.1 (Cont.)
A simulation of a grocery store that starts with an empty
system is not realistic unless the intention is to model the
system from startup or to model until steady-state operation
is reached.
A set of uniformly distributed random numbers is needed to
generate the arrivals at the checkout counter. Random
numbers have the following properties:
The set of random numbers is uniformly distributed between 0
and 1.
Successive random numbers are independent.
Random digits are converted to random numbers by placing
a decimal point appropriately.
Table A.1 in Appendix or RAND() in Excel.
The rightmost two columns of Tables 2.6 and 2.7 are used to
generate random arrivals and random service times.
Example 2.1 (Cont.) Table 2.8
The first random digits are 913. To obtain
the corresponding time between arrivals,
enter the fourth column of Table 2.6 and
read 8 minutes from the first column of the
table.
Example 2.1 (Cont.) Table 2.9
The first customer's service time is 4 minutes
because the random digits 84 fall in the
bracket 61-85
Example 2.1 (Cont.)
The essence of a manual simulation is the simulation
table.
The simulation table for the single-channel queue,
shown in Table 2.10, is an extension of the type of table
already seen in Table 2.4.
Statistical measures of performance can be obtained
form the simulation table such as Table 2.10.
Statistical measures of performance in this example.
Each customer's time in the system
The server's idle time
In order to compute summary statistics, totals are
formed as shown for service times, time customers
spend in the system, idle time of the server, and time
the customers wait in the queue.
Example 2.1 (Cont.)
The average waiting time for a customer : 2.8 minutes
total time customers wait in queue 56
average waitng time 2.8 (min)
total numbers of customers 20
The probability that a customer has to wait in the queue : 0.65
number of customers who wait 13
probabilit y ( wait ) 0.65
total numbers of customers 20
The fraction of idle time of the server : 0.21
total idle time of server 18
probabilit y of idle server 0.21
total run time of simulation 86
The probability of the server being busy: 0.79 (=1-0.21)
Example 2.1 (Cont.)
The average service time : 3.4 minutes
total service time 68
average service time 3.4 (min)
total numbers of customers 20
This result can be compared with the expected service time by finding the
mean of the service-time distribution using the equation in table 2.7.
E ( S ) sp ( s )
s 0
The expected service time is slightly lower than the average service time in
the simulation. The longer the simulation, the closer the average will be to
E (S )
Example 2.1 (Cont.)
The average time between arrivals : 4.3 minutes
average time customer spends in the system = 2.8 + 3.4 = 6.2 (min)
EXAMPLE 2
Able
Baker
A drive-in restaurant where carhops take orders and bring food to the car.
Assumptions
Cars arrive in the manner shown in Table 2.11.
Two carhops Able and Baker - Able is better able to do the job and works a
bit faster than Baker.
The distribution of their service times is shown in Tables 2.12 and 2.13.
Example 2.2 (Cont.)
A simplifying rule is that
Able gets the customer if
both carhops are idle.
If both are busy, the
customer begins service
with the first server to
become free.
To estimate the system
measures of performance,
a simulation of 1 hour of
operation is made.
The problem is to find how
well the current
arrangement is working.
Example 2.2 (cont.)
The row for the first customer is filled in manually, with the random-
number function RAND() in case of Excel or another random function
replacing the random digits.
After the first customer, the cells for the other customers must be
based on logic and formulas. For example, the Clock Time of Arrival
(column D) in the row for the second customer is computed as follows:
D2 = D1 + C2
The logic to computer who gets a given customer can use the Excel
macro function IF(), which returns one of two values depending on
whether a condition is true or false.
IF( condition, value if true, value if false)
clock = 0
Is there the service
Is it time of arrival? Increment clock
N completed? N
o o
Ye
s
Ye
s
Store clock time (column H or K)
Generate random digit for
Is Able idle?
Ye service (column E)
s
Convert random digit to random
number for service time
(column G)
N
o
Able service begin (column F)
Generate random digit for
Is Baker idle?
Ye service (column E)
s
N Convert random digit to random
o
number for service time
(column J)
Nothing Baker service begin (column I)
Example 2.2 (cont.)
The logic requires that we compute when Able and Baker will
become free, for which we use the built-in Excel function for
maximum over a range, MAX().
If the first condition (Able idle when customer 10 arrives) is true, then the
customer begins immediately at the arrival time in D10. Otherwise, a second
IF() function is evaluated, which says if Baker is idle, put nothing (..) in the
cell. Otherwise, the function returns the time that Able or Baker becomes
idle, whichever is first [the minimum or MIN() of their respective completion
times].
A similar formula applies to cell I10 for Time Service Begins for Baker.
Example 2.2 (Cont.)
For service times for Able, you could use another IF() function to
make the cell blank or have a value:
G10 = IF(F10 > 0,new service time, "")
H10 = IF(F10 > 0, F10+G10, "")
The analysis of Table 2.14 results in the following:
Over the 62-minute period Able was busy 90% of the time.
Baker was busy only 69% of the time. The seniority rule keeps
Baker less busy (and gives Able more tips).
Nine of the 26 arrivals (about 35%) had to wait. The average
waiting time for all customers was only about 0.42 minute (25
seconds), which is very small.
Those nine who did have to wait only waited an average of
1.22 minutes, which is quite low.
In summary, this system seems well balanced. One server
cannot handle all the diners, and three servers would probably
be too many. Adding an additional server would surely reduce
the waiting time to nearly zero. However, the cost of waiting
would have to be quite high to justify an additional server.
EXAMPLE 3: INVENTORY
Milling Machine
Repairperson