2 Simulation Examples-2025
2 Simulation Examples-2025
Dr. Pham Huynh Tram & Dr. Tran Duc Vi, Feb 2025
2
Simulation Model (example)
3
Outline
Randomness
4
Simulation examples:
5
1. Simulation of Queueing Systems
6
2.1 Simulation of Queueing Systems
What are the average waiting time, time spent in the grocery, server idle time?
7
Example 1: Single-Channel Queue (cont)
8
Examples of simulating probability of an event
9
Example 1: Single-Channel Queue (cont)
relation? relation?
10
11
Example 1: Single-Channel Queue (cont.)
▪ Generate time-between-arrivals
12
Example 1: Single-Channel Queue (cont.)
▪ Generate service times
13
Example 1: Single-Channel Queue (cont)
14
Example 1: Single-Channel Queue (cont.)
15
1. Simulation of Queueing Systems
▪ 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.
16
Example 2: The Able Baker Carhop Problem (cont)
17
?
18
Example 2: The Able Baker Carhop Problem (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)
19
Example 2: The Able Baker Carhop Problem (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.
– 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, "") 20
Example 2: The Able Baker Carhop Problem (cont)
– 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.
21
Example 2: The Able Baker Carhop Problem (cont)
– 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.
22
2. Simulation of Inventory Systems
A simple inventory system, an (M, N) 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.
– The distribution of the number of units demanded per day is shown in
Table 2.19.
– Lead time is a random variable, as shown in Table 2.20.
– 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.
24
Example 3: Simulation of an (M,N) Inventory System (cont.)
25
26
Example 3: Simulation of an (M,N) Inventory System (cont.)
– 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.
■ 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.
27
2. Simulation of Inventory Systems
28
Example 4: The Newspaper Seller’s Problem (cont.)
29
Example 4: The Newspaper Seller’s Problem (cont.)
30
Can we increase this profit?
31
Example 4: The Newspaper Seller’s Problem (cont.)
32
3. Example of Simulation of Reliability Problem
33
Example 5: A Reliability Problem (cont.)
34
35
Example 5: A Reliability Problem (cont.)
– Table 2.24 represents a simulation of 20,000 hours of operation under the current
method of operation.
– Note that there are instances where more than one bearing fails at the same time.
– This is unlikely to occur in practice and is due to using a rather coarse grid of
100 hours.
– It will be assumed in this example that the times are never exactly the same, and
thus no more than one bearing is changed at any breakdown. Sixteen bearing
changes were made for bearings 1 and 2, but only 14 bearing changes were
required for bearing 3.
36
Example 5: A Reliability Problem (cont.)
– Table 2.25 is a simulation using the proposed method. Notice that bearing
life is taken from Table 2.24, so that for as many bearings as were used in
the current method, the bearing life is identical for both methods.
37
38
Example 5: A Reliability Problem (cont.)
– Since the proposed method uses more bearings than the current method, the second
simulation uses new random digits for generating the additional lifetimes.
– The random digits that lead to the lives of the additional bearings are shown above
the slashed line beginning with the 15th replacement of bearing 3.
– The new policy generates a savings of $1947 over a 20,000-hour simulation. If the
machine runs continuously, the simulated time is about 2 1/4 years. Thus, the
savings are about $865 per year.
39
Summary
● This lesson introduced simulation concepts via examples in
order to illustrate general areas of application and to
motivate the remaining lessons of the course.
40
More Questions to ponder
● How to simulate random events that we cannot come up
with the probability like in the given examples?
41