Lecture 3
Lecture 3
Simulation
Simulation Examples
LECTURE 3
BY DR. SAMAH A . Z. HASSAN
Recap
Three steps of the simulations
1. Determine the characteristics of each of the inputs to the simulation. Quite often, these may be
modeled as probability distributions, either continuous or discrete.
2. Construct a simulation table. Each simulation table is different, for each is developed for the
problem at hand.
3. 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.
Simulation Table
The simulation table provides a systematic method for tracking system state over time.
Inputs Response
1
2
·
·
n
2.1 Simulation of Queueing Systems (1)
Server
Waiting Line
Calling population
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 (24)
Example 2.2 The Able Baker Carhop Problem
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.
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.1 Simulation of Queueing Systems (26)
◦ 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)
2.1 Simulation of Queueing Systems (27)
◼ 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.
2.1 Simulation of Queueing Systems (28)
◼ The distribution of papers demanded on each of these days is given in Table 2.15.
◼ Tables 2.16 and 2.17 provide the random-digit assignments for the types of
newsdays and the demands for those newsdays.
2.2 Simulation of Inventory Systems (5)
2.2 Simulation of Inventory Systems (6)
Any
Questions