0% found this document useful (0 votes)
21 views32 pages

Ch2 SIM

Uploaded by

Mina Kashi
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)
21 views32 pages

Ch2 SIM

Uploaded by

Mina Kashi
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/ 32

Ch2.

Simulation Examples
• Three steps of the simulations

• Determine the characteristics of each of the inputs to the simulation. Quite often, these may be
modeled as probability distributions, either continuous or discrete.

• Construct a simulation table. Each simulation table is different, for each is developed for the problem at
hand.

• For each repetition i, generate a value for each of the p inputs, and evaluate the function, calculating a
value of the response yi. The input values may be computed by sampling values from the distributions
determined in step 1. A response typically depends on the inputs and one or more previous responses.
2.1 Simulation of Queueing Systems (1)

Server
Waiting Line
Calling population

Fig. 2.1 Queueing System


• A queueing system is described by its calling population, the nature of
the arrivals, the service mechanism, the system capacity, and the
queueing discipline.
2.1 Simulation of Queueing Systems (2)

• In the single-channel queue, the calling population is infinite.


• If a unit leaves the calling population and joins the waiting line or enters
service, there is no change in the arrival rate of other units that may need
service.
• Arrivals for service occur one at a time in a random fashion.
• Once they join the waiting line, they are eventually served.
• Service times are of some random length according to a probability
distribution which does not change over time.
• The system capacity has no limit, meaning that any number of units can
wait in line.
• Finally, units are served in the order of their arrival (often called FIFO:
First In, First out) by a single server or channel.
2.1 Simulation of Queueing Systems (3)

• Arrivals and services are defined by the distribution of the time between arrivals and the
distribution of service times, respectively.

• For any simple single- or multi-channel queue, the overall effective arrival rate must be less than
the total service rate, or the waiting line will grow without bound.

• In some systems, the condition about arrival rate being less than service rate may not guarantee
stability
2.1 Simulation of Queueing Systems (4)

• System state : the number of units in the system and the status of the server(busy or idle).

• Event : a set of circumstances that cause an instantaneous change in the state of the system.

• In a single-channel queueing system there are only two possible events that can affect the state of the
system.

• the arrival event : the entry of a unit into the system


• the departure event : the completion of service on a unit.

• Simulation clock : used to track simulated time.


2.1 Simulation of Queueing Systems (5)

• If a unit has just completed service, the simulation proceeds in the manner shown in the flow
diagram of Figure 2.2.
• Note that the server has only two possible states : it is either busy or idle.

Departure
Event

Begin server No Another unit Yes Remove the waiting unit


idle time waiting? from the queue

Begin servicing the unit

Fig. 2.2 Service-just-completed flow diagram


2.1 Simulation of Queueing Systems (6)

• The arrival event occurs when a unit enters the system.


• The unit may find the server either idle or busy.
• Idle : the unit begins service immediately
• Busy : the unit enters the queue for the server.

Arrival
Event

Unit enters No Server Yes Unit enters queue


service busy? for service

Fig. 2.3 Unit-entering-system flow diagram


2.1 Simulation of Queueing Systems (9)

• Pseudo-random numbers : the numbers are generated using a


procedure  detailed in Chapter 7.
• Table 2.2. Interarrival and Clock Times
• Assume that the times between arrivals were generated by rolling a die
five times and recording the up face.
2.1 Simulation of Queueing Systems (10)

• Table 2.3. Service Times


• Assuming that all four values
are equally likely to occur, these
values could have been
generated by placing the
numbers one through four on
chips and drawing the chips
from a hat with replacement,
being sure to record the
numbers selected.
• The only possible service times
are one, two, three, and four
time units.
2.1 Simulation of Queueing Systems (11)

• The interarrival times and service times must be meshed to simulate the
single-channel queueing system.
• Table 2.4 was designed specifically for a single-channel queue which serves
customers on a first-in, first-out (FIFO) basis.
2.1 Simulation of Queueing Systems (12)

• Table 2.4 keeps track of the clock time at


which each event occurs.
• The occurrence of the two types of
events(arrival and departure event) in
chronological order is shown in Table 2.5
and Figure 2.6.
• Figure 2.6 is a visual image of the event
listing of Table 2.5.
• The chronological ordering of events is the
basis of the approach to discrete-event
simulation described in Chapter 3.
2.1 Simulation of Queueing Systems (13)

• Figure 2.6 depicts the number of customers in the system at the various clock times.
2.1 Simulation of Queueing Systems (14)

• Example 2.1 Single-Channel Queue


A rrival D ep arture

 Assumptions C hecko ut C o unter


• 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.
2.1 Simulation of Queueing Systems (15)
2.1 Simulation of Queueing Systems (16)

• 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.
• The rightmost two columns of Tables 2.6 and 2.7 are used to generate
random arrivals and random service times.
2.1 Simulation of Queueing Systems (17)

• 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.
2.1 Simulation of Queueing Systems (18)

• 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
2.1 Simulation of Queueing Systems (20)

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)
2.1 Simulation of Queueing Systems (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

E ( S )  1(0.10)  2(0.20)  3(0.30)  4(0.25)  5(1.10)  6(0.05)  3.2 (min)

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 )
2.1 Simulation of Queueing Systems (22)

Example 2.1 (Cont.)


• The average time between arrivals : 4.3 minutes

sum of all times between arrivals 82


average time between arrivals    4.3 (min)
numbers of arrivals  1 19
 This result can be compared to the expected time between arrivals by finding the
mean of the discrete uniform distribution whose endpoints are a=1 and b=8.

a  b 1 8
E ( A)    4.5 (min)
2 2
The longer the simulation, the closer the average will be to E ( A)
 The average waiting time of those who wait : 4.3 minutes
total time customers wait in queue 56
average waiting time of those who wait    4.3 (min)
total numbers of customers who wiat 13
2.1 Simulation of Queueing Systems (23)

Example 2.1 (Cont.)


• The average time a customer spends in the system : 6.2 minutes
total time customers spend in system 124
average time customer spends in the system    6.2 (min)
total numbers of customers 20

average time average time average time


customer spends = customer spends + customer spends
in the system waiting in the queue in service

 average time customer spends in the system = 2.8 + 3.4 = 6.2 (min)
2.1 Simulation of Queueing Systems (24)

• Example 2.2 The Able Baker Carhop Problem

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.
2.1 Simulation of Queueing Systems (25)

• 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.
2.3 Other Examples of Simulation (1)
• Example 2.5 A Reliability Problem M illing M achine

B earing B earing B earing

R ep airp erso n

 Downtime for the mill is estimated at $5 per minute.


 The direct on-site cost of the repairperson is $15 per hour.
 It takes 20 minutes to change one bearing, 30 minutes to change two
bearings, and 40 minutes to change three bearings.
 The bearings cost $16 each.
 A proposal has been made to replace all three bearings whenever a
bearing fails.
2.3 Other Examples of Simulation (2)
• Example 2.5 (Cont.)

 The delay time of the


repairperson's arriving at the
milling machine is also a random
variable, with the distribution
given in Table 2.23.

 The cumulative distribution function of


the life of each bearing is identical, as
shown in Table 2.22.
2.3 Other Examples of Simulation (3)

• Example 2.5 (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.
• 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.
2.3 Other Examples of Simulation (4)

• Example 2.5 (Cont.)


• The cost of the current system is estimated as follows:
• Cost of bearings = 46 bearings  $16/bearing = $736
• Cost of delay time = (110 + 125 + 95) minutes  $5/minute = $1650
• Cost of downtime during repair =
46 bearings  20 minutes/bearing  $5/minute = $4600
• Cost of repairpersons =
46 bearings  20 minutes/bearing  $15/60 minutes = $230
• Total cost = $736 + $1650 + $4600 + $230 = $7216
• 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.
2.3 Other Examples of Simulation (5)

• Example 2.5 (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 total cost of the new policy :
• Cost of bearings = 54 bearings  $16/bearing = $864
• Cost of delay time = 125 minutes  $5/minute = $625
• Cost of downtime during repairs = 18 sets  40 minutes/set  $5/minute = $3600
• Cost of repairpersons = 18 sets  40 minutes/set  $15/60 minutes = $180
• Total cost = $864 + $625 + $3600 + $180 = $5269
• 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.

You might also like