Professional Documents
Culture Documents
CSC401 Simulation Techniques
CSC401 Simulation Techniques
Discrete event systems simulation is the modeling of systems in which the state
variables changes only at a discrete set of points in time
The simulation models are analyzed by numerical methods rather than by analytical
methods
Analytical methods employ the deductive reasoning of mathematics to solve the
model.
Numerical methods employ computational procedures to solve mathematical
models.
Simulation models which employ numerical models are run rather than
solved.
Artificial history of the system generated from model assumptions and
observations are collected to be analyzed and to estimate the true system
performance measures.
Large amount of data usually requires the aid of a computer
Compare the findings that follow from the simulation to what you might find
using Littles law.
1. The average waiting time for a customer
= total time customers wait / total number of customers
= 174 minutes / 100 customers
= 1.74 minutes / customer
2. The probability that a customer has to wait in the queue
= number of customers who wait / total number of customers
= 46 / 100
= .46
3. The proportion of the time the server is idle
= total time the server is idle / total time of the simulation
= 101 / 418
= .24
so the probability that the server is busy is 1 - .24 = .76
This means the server is utilized 76% of the time.
4. The average service time is
= total service time in minutes / total number of customers
= 317 minutes / 100
= 3.17
This result can be compared with the expected service time by finding the
mean of the servicetime distribution
E (S )
sp ( s)
s 0
probability of the service time. s and p(s) are from table 2.7.
This yields 3.2. If the simulation is run longer the average and expected value
will get closer together.
5. The average time between arrivals
= sum of all times between arrivals in minutes / number of arrivals 1
= 415 minutes / 99
= 4.19 minutes
nothing before 1 or after 100
6. The average waiting time of those who wait
= total time customers wait in queue / total number of customers that wait
= 174 minutes / 54
= 3.22 minutes
7. The average time a customer spends in the system
= total time customers spend in the system / total number of customers
= 491 minutes / 100
= 4.91 minutes
also
= average time customer spends waiting in the queue +
average time customer spends in service
= 1.74 minutes + 3.17 minutes
= 4.91 minutes
In Section 2.3 we worried about the reliability problem.
Came back to reliability in Chapter 5.
We did do a problem from section 2.3 about the project simulation on page 54+
We also spent some time in this secion thinking about random digits, random numbers
and their applicability
Problems Page 83: # 21 - 27, 44 - 47
One of the spreadsheet problems will be part of the take-home.
Section 3.1
The definition of the model components provides a static description of the model. In
addition, a description of the dynamic relationships and interactions between the
components is also needed. Some questions that need answers include:
1. How does each event affect system state, entity attributes, and set contents?
2. How are activities defined (i.e., deterministic, probabilistic, or some other
mathematical equation)? What event marks the beginning or end of each activity?
3. Which events trigger the beginning (and end) of each type of delay? Under what
conditions does a delay begin or end?
4. What is the system state at time 0? What events should be generated at time 0 to
prime the modelthat is, to get the simulation started?
A discrete-event simulation (hereafter called a simulation) proceeds by producing a
sequence of system snapshots (or system images) that represent the evolution of the
system through time.
The mechanism for advancing simulation time and guaranteeing that all events occur in
correct chronological order is based on the future event list (FEL).
Time t is the value of CLOCK, the current value of simulated time.
How is the clock managed?
The length and contents of the FEL are constantly changing as the simulation progresses,
and thus its efficient management in a computerized simulation will have a major impact
on the efficiency of the computer program representing the model.
Event-scheduling / time-advance algorithm
Step1 Remove the event notice for the imminent event (event 3, time t1) from FEL
Step 2 Advance CLOCK to imminent event time (i.e. advance clock from t to t1)
Step 3 Execute imminent event: update system state, change entity attributes and set
membership as needed.
Step 4 Generate future events (if necessary) and place their event notices on FEL,
ranked by event time.
Step 5 Update cumulative statistics and counters
In addition, a service-completion event will be generated and scheduled at the time of an
arrival event provided that, upon arrival, there is at least one idle server in the server
group.
Every simulation must have a stopping event, here called E, which defines how long the
simulation will run. There are generally two ways to stop a simulation:
Chapter 4 examples
In this chapter I expect that you would be able to handle the mechanics of creating a
Java simulation program as well as a spreadsheet, and the mechanics of using Extend.
Using a Spreadsheet,
Programming a simulation with a high-level language such as Java
Using simulation software
There are many examples at the end of the chapter to choose for the take-home
portion. Review your work.
What about problem 12 on page 133, 15, or 27?
Expectation
The expected value of X is denoted by E(X)
If X is discrete
If X is continuous
a.k.a the mean, m, or the 1st moment of X
A measure of the central tendency
The variance of X is denoted by V(X) or var(X) or 2
Definition:
V(X) = E[(X E[X]2]
Also, V(X) = E(X2) [E(x)]2
A measure of the spread or variation of the possible values of X around
the mean
The standard deviation of X is denoted by
Definition: square root of V(X)
Expressed in the same units as the mean
To compute variance of X, we first compute E(X2):
Queueing Systems
In a queueing system, interarrival and service-time patterns can be
probablistic
Sample statistical models for interarrival or service time distribution:
Exponential distribution: if service times are completely random
Normal distribution: fairly constant but with some random variability (either positive or
negative)
Truncated normal distribution: similar to normal distribution but with restricted value.
Gamma and Weibull distribution: more general than exponential (involving location of the
modes of pdfs and the shapes of tails.)
Other areas
- a little much
Binomial Distribution
The number of successes in n Bernoulli trials, X, has a binomial distribution.
Poisson Distribution
Poisson distribution describes many random processes quite well and is
mathematically quite simple.
E(X) = = V(X)
Uniform Distribution
A random variable X is uniformly distributed on the interval (a,b), U(a,b), if its pdf
and cdf are......page 166
P(x1 < X < x2) is proportional to the length of the interval [F(x2) F(x1) = (x2-x1)/(b-a)]
E(X) = (a+b)/2
V(X) = (b-a)2/12
Exponential Distribution
A random variable X is exponentially distributed with parameter > 0 if its pdf
and cdf are.......page 167
Memoryless property
For all s and t greater or equal to 0:
P(X > s+t | X > s) = P(X > t)
Normal Distribution
A random variable X is normally distributed has the pdf......
Mean: please see discussion starting on page 173
Variance:
Special properties:
Weibull Distribution
A random variable X has a Weibull distribution if its pdf has the form...page 180
3 parameters:
Location parameter:
Scale parameter:
Shape parameter.
Lognormal Distribution
A random variable X has a lognormal distribution if its pdf has the form...
Mean E(X) = e+2/2
Variance V(X) = e+2/2 (e2 - 1)
Properties
Pooling:
Poisson Process without the stationary increments, characterized by (t), the arrival rate at time t.
Chapter 6
Queueing Models
Sections 1, 2, 3, and 4 are important. We will return to 6.6 you are still
responsible for it.
Queueing models provide the analyst with a powerful tool for designing and
evaluating the performance of queueing systems.
Typical measures of system performance:
Server utilization, length of waiting lines, and delays of customers
For relatively simple systems, compute mathematically
For realistic models of complex systems, simulation is usually required.
Most important model: Poisson arrival process (with rate ), where An represents the interarrival
time between customer n-1 and customer n, and is exponentially distributed (with mean 1/).
Scheduled arrivals: interarrival times can be constant or constant plus or minus a small
random amount to represent early or late arrivals.
e.g., patients to a physician or scheduled airline flight arrivals to an airport.
At least one customer is assumed to always be present, so the server is never idle, e.g.,
sufficient raw material for a machine.
Queue discipline: the logical ordering of customers in a queue that determines which
customer is chosen for service when a server becomes free, for example:
First-in-first-out (FIFO)
Last-in-first-out (LIFO)
Service in random order (SIRO)
Shortest processing time first (SPT)
Service according to priority (PR).
M/M/1 Queues
Suppose the service times in an M/G/1 queue are exponentially distributed with
mean 1/, then the variance is 2 = 1/2.
M/M/1 queue is a useful approximate model when service times have standard
deviation approximately equal to their means.
Multiserver Queue
The real question is what happens if we add another server?
Are things linear as in the Poisson split of section 5.4?
M/M/c// queue: c channels operating in parallel.
Each channel has an independent and identical exponential service-time distribution, with
mean 1/.
To achieve statistical equilibrium, the offered load ( ) must satisfy < c, where /(c) =
is the server utilization.