Simulation of Queing System
Simulation of Queing System
Simulation of Queing System
A rrival D ep arture
C hecko ut C o unter
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.
Simulation of Queueing Systems
Simulation of Queueing Systems
Example (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.
The rightmost two columns of Tables 2.6 and 2.7 are used to
generate random arrivals and random service times.
Simulation of Queueing Systems
Example (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.
Simulation of Queueing Systems
Example (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
probability ( wait ) 0.65
total numbers of customers 20
The fraction of idle time of the server : 0.21
total idle time of server 18
probability of idle server 0.21
total run time of simulation 86
Example (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 )
Simulation of Queueing Systems
Example (Cont.)
The average time between arrivals : 4.3 minutes
Example (Cont.)
The average time a customer spends in the system : 6.2 minutes
total time customers spend in system 124
averagetime customer spends in the system 6.2 (min)
total numbers of customers 20
average time customer spends in the system = 2.8 + 3.4 = 6.2 (min)
Simulation of Queueing Systems
A b le
B aker
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.
Simulation of Queueing Systems
Example: (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.
Simulation of Queueing Systems
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
completed?
No No
Yes
Yes
Store clock time (column H or K)
Generate random digit for
Is Able idle?
service (column E)
Yes
Convert random digit to random
number for service time
(column G)
No
Able service begin (column F)
Generate random digit for
Is Baker idle?
service (column E)
Yes
Convert random digit to random
No
number for service time
(column J)
Nothing Baker service begin (column I)
Simulation of Queueing Systems
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
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.