0% found this document useful (0 votes)
56 views

Chap 2

This document discusses simulation modeling and examples of queueing systems. It provides an overview of the simulation process and then presents two examples: [1] a single queue with one server modeling a checkout line, and [2] a queue with two servers modeling a drive-in restaurant. For each example, it describes the problem statement, model, input parameters, simulation algorithm, and metrics. Key steps in simulation include determining input distributions, constructing the simulation, running repetitions to generate output, and analyzing metrics like waiting times and server utilization.

Uploaded by

hafsatamer03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Chap 2

This document discusses simulation modeling and examples of queueing systems. It provides an overview of the simulation process and then presents two examples: [1] a single queue with one server modeling a checkout line, and [2] a queue with two servers modeling a drive-in restaurant. For each example, it describes the problem statement, model, input parameters, simulation algorithm, and metrics. Key steps in simulation include determining input distributions, constructing the simulation, running repetitions to generate output, and analyzing metrics like waiting times and server utilization.

Uploaded by

hafsatamer03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 51

System Simulation and VR

Chap. 2 Simple examples


Overview
 Example 1: one queue one server
 Example 2: one queue two servers
 Parameters, metrics, and measurements
 Conclusions
three steps :
If you already have the proper simulation model, then
 1. Determine the characteristics of each of the
inputs to the simulation. Often 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.
Example 1
 Perform a performance evaluation of a
checkout counter in a store
 Objectives: Determine
 How long do customers have to wait?
 How many customers are in line?

 How much of the time is the cashier busy?


Problem statement (cont’d)

 What are relevant parts?


 The person at the counter
 People waiting in line
 What are relevant parameters?
 How do customers arrive at the queue?
 How long does it take to serve a customer?
 How is the queue organized?
 Metrics = objectives in this example
A simple model

Map the real-world


system parts to
abstract
representations
A simple model - Algorithm
How does such a checkout queue work?
 Server is idle (no customer present)
 If customer arrives, customer is serviced immediately,
until completion
 Server is then busy until customer is completely served
 If no customer in queue, the server becomes idle
Algorithm
 Server is busy
 Ifcustomer arrives, the customer joins the end
of a queue
 When server becomes idle (a customer has
been finished), server checks the queue
 If one or more customer wait in queue, the
first customer leaves the queue and is now
serviced
Algorithm
 The state of the model changed due to
two different kinds of events:
 Arrivalof customers
 Customers finishing service and leaving the
server
 Both kinds of events were
processed/the state was manipulated
according to the algorithm describing
the model
Input modeling
Interarrival time distribution

Interarrival probability Cumulative Random-digit


time probability assignment
1 0.125 0.125 001-125
2 0.125 0.250 126-250
3 0.125 0.375 251-375
4 0.125 0.500 376-500
5 0.125 0.625 501-625
6 0.125 0.750 626-750
7 0.125 0.875 751-875
8 0.125 1.000 876-1000
Input modeling
Interarrival time distribution
Input modeling
Service time distribution

Service probability Cumulative Random-digit


time probability assignment
1 0.10 0.10 01-10
2 0.20 0.30 11-30
3 0.30 0.60 31-60
4 0.25 0.85 61-85
5 0.10 0.95 86-95
6 0.05 1.00 96-100
Input modeling
Service time distribution
Manual simulation
Metrics
 Average waiting time for a customer
 =total
time customers wait in queue/total
numbers of customers
 The probability that a customer has to wait
in the queue
 =number of customers who wait/total number of
customers
 The fraction of idle time of the server
 =totalidle time of server/total run time of
simulation
 The average service time
 =total service time/total number of customers
Metrics (cont’d)
 Average interarrivals
 =total interarrival time/number of customers – 1
 Average waiting time of those who wait
 =total
time customers wait in queue/total
numbers of customers who wait
Metrics (cont’d)
 Average time customer spends in the
system
= total time customers spend in the system/total
number of customers
 =average waiting time + average service time
Example 2
The Able Baker carhop problem

 The problem statements


 Consider a drive-in restaurant where carhops
take oders and bring food to the car
 Car arrival manner

 Two carhops
 Able
 Baker
 If the customer finds Able idle, the
customer begins service immediately with
Able.
 If Able is not idle, but Baker is, then the
customer begins service immediately with
Baker.
 If both are busy, the customer begins service with
the first server to become free
Interarrival distribution of cars

Interarrival probability Cumulative Random-


time probability digit
assignment
1 0.25 0.25 01-25

2 0.40 0.65 26-65

3 0.20 0.85 66-85

4 0.15 1.00 86-100


Service distribution of Able

Service time probability Cumulative Random-


probability digit
assignment
2 0.30 0.30 01-30

3 0.28 0.58 31-58

4 0.25 0.83 59-83

5 0.17 1.00 84-100


Service distribution of Baker

Service time probability Cumulative Random-


probability digit
assignment
3 0.35 0.35 01-35

4 0.25 0.60 36-60

5 0.20 0.80 61-80

6 0.20 1.00 81-100


Manual simulation
Able is better able to do the job and works a bit faster than Baker.
Metrics analysis

 Over the period, Able was busy 90% of


the time
 Baker was busy only 69% of the time.
 Nine of the 26 arrivals(about 35%)had
to wait. The average waiting time for all
customers was only about 0.42, which
is very small.
Metrics analysis
 Those nine who did have to wait only
waited an average of 1.22, which is quit
low
Metrics analysis
 In summary, this system seems well balanced.
 One server cannot handle all the dinners,
 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.
What did we do here
 You got the idea! Generalize?
 We observed the model only at the points
in time when the state of the model
changed
 These points in time were explicitly
represented by the simulation clock
variable
What did we do here (cont'd)
 Two variables were used to determine
which kind of event is the next one (arrival
or departure of customer)
 In a nutshell: we advanced time from one
event to the next, checking to see which
kind of event would be the next one
What did we do here (cont'd)
 This is the essence of the “event-
scheduling time advance algorithm”
 Note: time was increment as necessary, not in
fixed amounts
 Fixed-increment algorithms are also possible,
yet rarely used
 Result: periods of inactivity are skipped with
next-event algorithms
Simulation time and simulated time

 Carefully distinguish between


 Simulated time:
 The time as measured by the simulation

clock,
 Virtualtime within the simulated system.
 Usually does not have any units
Simulation time and simulated time (cont’d)

 Simulation time:
 Time that is necessary to run a given simulation
 Depends on parameters, models, equipment used,

accuracy, …
 Ideally, simulation time should be much shorter than

simulated time
Eg. Simulated time=10 years
Simulation time=1 hour
Simulation time and simulated time (cont’d)

 Do not let the common term “simulation


clock” confuse you: it is measuring
simulated time
And What about parameters?

 In this manual simulation, parameters have


not been taken into account
 Parameters are
 Pattern of customer arrival

 Pattern of service times

 Speed of the server


Pattern of customer arrival
 Deterministic modeling impossible
 Stochastic modeling: consider the time
between customers as a random
variable, choose a suitable distribution
for this variable
 Common case: inter-arrival time of
customers is exponentially distributed
characterized by the distribution’s mean
Parameters
 Pattern of service times
 Similar to arrival patterns
 Service time modeled as a random variable,
e.g. also with an exponential distribution
 Speed of the server
 Can arbitrarily be set to 1 by scaling the time
 Direct representation is simple, too
And what about metrics?
 Initial goal was to investigate
 Utilizationof the server (“what percentage of
time is the server busy”)
 Length of the queue (“how much space do we
need in the store?”)
 What does this mean? At most? On average?
 Waiting time of customers
 Again: At most? On average? Fridays?
And what about metrics? (cont’d)
 How to capture such information from a
simulation?
Meaning of measurements

 What is the correct interpretation of


such simulation-based measurements?
 Look e.g. at waiting time in queue
 Let Di represent the waiting time as
measured for customer i
 This refers to one particular simulation run –
or to observations on one particular day (for
the real system)!
Meaning of measurements (cont’d)

 Fordifferent simulations/on different days, the


Dis will be different
 Dis are averaged over n customers to obtain
aggregate information, here: average waiting
time in queue
 Other possible aggregations: max, min,
proportions, …
Meaning of measurements (cont'd)

 Both Dis and their aggregate will change from


one set of observations to the next!
 Why look at aggregated information of
measurements?
 Aggregated information gives a more
concise representation/description of the
system under study
Meaning of measurements (cont'd)

 It is easier to compare aggregated information


from different system/simulation runs
 The average waiting times in a supermarket on
weekdays as opposed to Saturdays is more
informative than waiting times of individual
customers (which are not really important)
Meaning of measurements (cont'd)

 Succeeding values might not be


distributed in the same way
 In the queuing example, D1 is always 0,
whereas D2, D3, etc. are not
 Hence, the average of such values are not the
usual statistical average which is usually
computed over independent, but identically
distributed observations
Meaning of measurements (cont'd)

 What is the relationship between truly


typical behavior and the result of a
simulation run?

Average Estimates
Dis d̂ n  d(n)

n observations Estimator for Statistically


from one run true behavior typical behavior
Meaning of measurements (cont’d)

 How good is such an estimator? How to


improve the estimation?
 We will look at that in much more detail!
How long to run simulations ?
 Depends on the purpose (again)
 Sometimes (rarely): behavior of system for a
well-defined finite amount of time is of interest
 Sometimes: simulate for a certain fixed amount
of simulated time, or a fixed number of events
 Problem: quality of estimations is variable
How long to run simulations ? (cont’d)

 Often: certain metrics (depending on input


parameters) are of interest
 Simulate as long as it takes for the estimation of these
metrics to have reached a desired quality level
 Amount of simulated time needed can vary
 “Stopping rules” regulate when to stop a
simulation
 We will look at that in much more detail, too.
Conclusions
 Two simple exampled for many
problems in simulation
 Performed a manual simulation of such
a model
 Event-scheduling time advance algorithm
 Difference simulated time and simulation time
 Stopping rules
Conclusions
 Parameters and metrics
 Relationship between statistical properties
of the model as such and estimations of
these properties by simulation
 How to extract measurements from simulations

You might also like