7/31/2019 Set5 Simulation
1/183
System Simulation
Dr. Dessouky
7/31/2019 Set5 Simulation
2/183
Description
Simulation is a very powerful and widely used management
science technique for the analysis and study of complex systems.
Simulation may be defined as a technique that imitates theoperation of a real-world system as it evolves over time. This is
normally done by developing a simulation model. A simulation
model usually takes the form of a set of assumptions about the
operation of the system, expressed as mathematical or logical
relations between the objects of interest in the system.
Simulation has its advantages and disadvantages. We will focus
our attention on simulation models and the simulation technique.
7/31/2019 Set5 Simulation
3/183
Simulation
What is simulation:
The process of designing a mathematical orlogical model of a real-system and then
conducting computer-based experiments
with the model to describe, explain, andpredict the behavior of the real system.
7/31/2019 Set5 Simulation
4/183
Simulation
Where simulation fits in
SimulationProgramming
Analysis
Modeling
Probability &
Statistics
7/31/2019 Set5 Simulation
5/183
Basic Terminology
In most simulation studies, we are concerned with
the simulation of some system.
Thus, in order to model a system, we must
understand the concept of a system. Definition: A system is a collection of entities that
act and interact toward the accomplishment of some
logical end.
Systems generally tend to be dynamictheir status
changes over time. To describe this status, we use
the concept of the state of a system.
7/31/2019 Set5 Simulation
6/183
Example Simulation Model
Ford - # of Panels per day (throughput)
Emergency Room(beds, doctors, nurses), (minor, moderate, major,
critical)
TRWBallistic Missile Survivability against Soviet Threat
Paramount FarmsPistachio
Miami University Parking
HMTDisks Throughput
Christopher RanchGarlic Capacity
Power IntegrationSemiconductor Capacity, and random machinedown times
7/31/2019 Set5 Simulation
7/183
Value of Simulation
Empirical Method verses mathematical
model
Allow you to calculate the extreme values
not just the expected value
7/31/2019 Set5 Simulation
8/183
Simulation
What is simulation
Simulation is the actual running of themodel system to gain insight into its
performance.
7/31/2019 Set5 Simulation
9/183
Simulation
Why use simulation
Simulation is used to better understand theexpected performance of the real system
and to test the effectiveness of the system
design.
7/31/2019 Set5 Simulation
10/183
Simulation
Why use simulation
Without building them
experimental systemnew concepts
Without disturbing themcostly experimentation
unsafe experimentation.
Without destroying themDetermine limits of stress
7/31/2019 Set5 Simulation
11/183
Queuing systems
Performance measures (output)
Data requirements (input)
Uses of model
Kendalls notation
7/31/2019 Set5 Simulation
12/183
Queuing systems
System Performance measures (outputs)
Expected number of customers in system
Expected number of customers in queueExpected time in system
Expected time in queue
Server utilizationProbability of n customers in system
Throughput
7/31/2019 Set5 Simulation
13/183
Queuing systems
Data requirements (Inputs)
Interarrival time distribution
Service time distributionNumber of servers
Queue discipline
System capacitySize of input population
Kendalls notation (M/M/s/FCFS/K/M)
7/31/2019 Set5 Simulation
14/183
Alternative to simulation
Simulation
Analytic models
Physical experimentation Visit other sites
7/31/2019 Set5 Simulation
15/183
Simulation vs. analytic modeling
Advantage:
various performance measures
greater realismeasier to understand
model the steady-state as well as the transit
behavior.
Disadvantage:
May not provide you with the optimal solution
time to construct model will be longer.
7/31/2019 Set5 Simulation
16/183
Simulation vs. Physical
Advantage:
High Speed
Not disruptiveReplication easy
Control variations
Generally less costly
Disadvantage:
Realism
Validity
7/31/2019 Set5 Simulation
17/183
Simulation vs. Alternatives
V A S P
Realism
V A
V A S PCost
7/31/2019 Set5 Simulation
18/183
Representing system
System:
a collection of mutually interacting objects
designed to accomplish a goal (machines
repair system)
Entities:
denotes an element/object within boundary of
system (machines, operators, repairman)
Entitywork being performed on object
Resourceperforming the work
7/31/2019 Set5 Simulation
19/183
Representing system
Attribute:
Characteristic or property or an entity
(machine ID, Type of breakdown, time that
machine went down)
Activity:
transforms the state of an object usually over
some time (repairman service time, machinerun time)
7/31/2019 Set5 Simulation
20/183
Representing system
State of the system:
Numeric values that contain all the
information necessary to describe the system
at any time.
Delays:
Processes that take a conditional length of
time in the system
7/31/2019 Set5 Simulation
21/183
Representing system
Events:
Change the state of the system(end of service
of machine,machine breaks down)
Queue:
it is set, used to model waiting
7/31/2019 Set5 Simulation
22/183
Ex. Elevator systems
Entities
Elevators, people
SetsPeople waiting at each floor
Attributes
Elevatorscapacity, speed, destination,current location of each elevator
Peopleinter-arrival time at each floor,
destination of each people
7/31/2019 Set5 Simulation
23/183
Ex. Elevator systems
State of system:
# of people on each elevator
# of people in each floor Activities
Load/Unloading passenger
Travel to next floor (speed and distance)Persons travel to elevator
7/31/2019 Set5 Simulation
24/183
Ex. Elevator systems
Delays:
Persons waiting for elevator
Events:Elevator arrival
End unloading
End LoadingPerson Arrival
7/31/2019 Set5 Simulation
25/183
Static Simulation vs. Dynamic
Simulation
There are two types of simulation models,
static and dynamic.
Definition: A static simulation model is arepresentation of a system at a particular
point in time.
We usually refer to a static simulation as aMonte Carlo simulation.
7/31/2019 Set5 Simulation
26/183
Static Simulation vs. Dynamic
Simulation Definition: A dynamic simulation is a
representation of a system as it evolvesover time.
Within these two classifications, asimulation may be deterministic orstochastic.
A deterministic simulation model is onethat contains no random variables; astochastic simulation model contains oneor more random variables.
7/31/2019 Set5 Simulation
27/183
Discrete Event vs. Continuous
Event Simulation
Discrete event:
state of system changes only at discrete points
in time(events)
ex. Machine repair problem
Programming
Look at system only when events occur; time isadvanced from event to event.
7/31/2019 Set5 Simulation
28/183
Discrete Event vs. Continuous
Event Simulation
Continuous event:
state of system changes continuously over
time
Ex. Level of fluid in tank
Programming:
Advances time in small intervals. Use differentialequations to represent flows.
7/31/2019 Set5 Simulation
29/183
An Example of a Discrete-Event
Simulation
To simulate a queuing system, we first have todescribe it.
We assume arrivals are drawn from an infinite
calling population. There is unlimited waiting room capacity, and
customers will be serve in the order of theirarrival (FCFS).
Arrivals occur one at a time in a random fashion. All arrivals are eventually served with the
distribution of service teams as shown in thebook.
7/31/2019 Set5 Simulation
30/183
Service times are also assumed to be random.After service, all customers return to the callingpopulation.
For this example, we use the following variablesto define the state of the system: (1) the numberof customers in the system; (2) the status of theserverthat is, whether the server is busy or idle;
and (3)the time of the next arrival. An event is defined as a situation that causes the
state of the system to change instantaneously.
7/31/2019 Set5 Simulation
31/183
All the information about them is maintained in alist called the event list.
Time in a simulation is maintained using a
variable called the clock time. We begin this simulation with an empty system
and arbitrarily assume that our first event, anarrival, takes place at clock time 0.
Next we schedule the departure time of the firstcustomer.Departure time = clock time now + generated service
time
7/31/2019 Set5 Simulation
32/183
Also, we now schedule the next arrival into thesystem by randomly generating an interarrival timefrom the interarrival time distribution and setting
the arrival time asArrival time = clock time now + generated interarrival time
Both these events are their scheduled times aremaintained on the event list.
This approach of simulation is called the next-eventtime-advance mechanism, because of the way theclock time is updated. We advance the simulationclock to the time of the most imminent event.
7/31/2019 Set5 Simulation
33/183
As we move from event to event, we carry out theappropriate actions for each event, including anyscheduling of future events.
The jump to the next event in the next-eventmechanism may be a large one or a small one; thatis, the jumps in this method are variable in size.
We contrast this approach with the fixed-incrementtime-advance method.
With this method, we advance the simulation clockin increments ofttime units, where tis someappropriate time unit, usually 1 time unit.
7/31/2019 Set5 Simulation
34/183
For most models, however, the next eventmechanism tends to be more efficientcomputationally.
Consequently, we use only the next-eventapproach for the development of the models forthe rest of the chapter.
To demonstrate the simulation model, we need to
define several variables: TM= clock time of the simulation
AT= scheduled time of the next arrival
7/31/2019 Set5 Simulation
35/183
DT= scheduled time of the next departure
SS= status of the server (1=busy, 0=idle)
WL = length of the waiting line
MX= length (in time units) of a simulation run
We now begin the simulation by initializingall the variables. This simple example
illustrates some of the basic concepts insimulation and the way in which simulationcan be used to analyze a particular problem.
7/31/2019 Set5 Simulation
36/183
World ViewThe Structure concepts and views
under which the simulation is guided for the
development of the simulation model
Event Orientationdefines the changes in state that occur
at each event time
Process Orientationdescribes the process throughwhich the entities in the system flow
Activity Scanning Orientationdescribes the activities in
which the entities in the system engage
7/31/2019 Set5 Simulation
37/183
Discrete Event Simulation
Event scheduling
Write modules that describe changes in the
state of the system at each event
Main program advances time
One subprogram for each event
General purpose programming language
7/31/2019 Set5 Simulation
38/183
Discrete Event Simulation
Process interaction
Write modules that describe the progress of
entities through the system
As entities move the systems changes state
Entities are held to represent activities and
delays
Promodel programming language
7/31/2019 Set5 Simulation
39/183
Event scheduling
Time is advanced from event to event
Future events listordered list of
upcoming eventsAs events are scheduled, they are added to the
list
As events occur they are removed from list
Activities in event ( one / event type)
7/31/2019 Set5 Simulation
40/183
Event scheduling
List is required to keep track of entities in a
set
StatisticsTwo typesSample statisticsaverage of some values (W)
W = (W1 +W2+ +Wn)/n = Total Wait / # of wait
Time average statisticstime weighted (L)
L = (0(t1) + 1(t2-t1) + 2(t3-t2) + 1(t4-t3)) / t4
7/31/2019 Set5 Simulation
41/183
Activity scanning
Activity scanning
Time is modeled in fixed time increments to
check if activity occurred
Small time increments is inefficient
Large time increments may miss activity
describes the activities in which the entities in
the system engage.
7/31/2019 Set5 Simulation
42/183
Process Oriented
Process oriented:
Many simulation models include elementswhich occur in defined patterns
The logic associated with such a system orevents can be generalized and defined by asingle statement
A simulation language could then translate
such statement into the appropriate sequenceof events
describes the processes through which theentities in the system flow.
7/31/2019 Set5 Simulation
43/183
Process Oriented
Process oriented:
These statements, define a sequence of events
which are automatically executed by the
simulation language as the entities move
through the process
Create arrival entities every t time units
However, since we are normally restricted to aset of standardized statement, provided by the
simulation language, our model flexibility is
not as great as with the event condition
7/31/2019 Set5 Simulation
44/183
Feature provided by a language
Conceptual framework(entities, attributes,resource, queues)
Maintenance of event list
Random variable generation
Animation
Debugging function
Output analysis
Input analysis
Report generation
7/31/2019 Set5 Simulation
45/183
Simulation Languages
One of the most important aspects of a simulationstudy is the computer programming.
Several special-purpose computer simulation
languages have been developed to simplifyprogramming.
The best known and most readily availablesimulation languages, including GPSS, GASP IV
and SLAM. Most simulation languages use one of two different
modeling approaches or orientations; eventscheduling or process interaction.
7/31/2019 Set5 Simulation
46/183
GPSS uses the process-interaction approach.
SLAM allows the modeler to use either approach
or even a mixture of the two, whichever is the
most appropriate for the model being analyzed.
Of the general-purpose languages, FORTRAN is
the most commonly used in simulation.
In fact, several simulation languages, includingGASP IV and SLAM, use a FORTRAN base.
7/31/2019 Set5 Simulation
47/183
To use GASP IV we must provide a mainprogram, an initialization routine, and the eventroutines.
For the rest of the program, we use the GASProutines.
Because of these prewritten routines, GASP IVprovides a great deal of programming flexibility.
GPSS, in contrast to GASP, is a highly structuredspecial-purpose language.
GPSS does not require writing a program in theusual sense.
7/31/2019 Set5 Simulation
48/183
Building a GPSS model then consist of
combining these sets of blocks into a flow
diagram so that it represents the path an
entity takes as it passes through the system.
SLAM was developed by Pritsket and
Pegden (1979). It allows us to develop
simulation model as network models,
discrete-event models, continuous models, or
any combination of these.
7/31/2019 Set5 Simulation
49/183
The decision of which language to use is one of
the most important that a modeler or an analyst
must make in performing a simulation study.
The simulation language offer severaladvantages.
The most important of these is that the special-
purpose languages provide a natural frameworkfor simulation modeling and most of the features
needed in programming a simulation model.
7/31/2019 Set5 Simulation
50/183
The Simulation Modeling Steps
We now discuss the process for a completesimulation study and present a systematicapproach of carrying out a simulation.
A simulation study normally consists of severaldistinct stages. (See Figure in the book)
However, not all simulation studies consist of allthese stages or follow the order stated here.
On the other hand, there may even beconsiderable overlap between some of thesestages.
7/31/2019 Set5 Simulation
51/183
Problem/Model Formulation
State the objective of the study.
Identify the Problem. Determine any underlying
causes if possible.
Determine the input variables.
Controllable Variables.
Uncontrollable Variables.
Make assumptions / boundaries that were used tosimplify the model.
Determine Performance measures used to
measure the objective. (Output)
7/31/2019 Set5 Simulation
52/183
Data collection/acquisition
Determine the Data Collection System orEstimates to be used. Observe the system
Historical or Similar Systems Theoretical Estimates
Engineering Estimates
Operator Estimates
Vendor Estimates Identify the data collected.
How it was collected.
How it was represented in the model.
7/31/2019 Set5 Simulation
53/183
Model Construction or
Development
Identify The Real System
Determine Conceptual Model -Activities
and Events Develop the Logical Model.
Identify the Programming Language used.
Computer Implementation (Promodel,Arena, Slam Systems).
d l C i
7/31/2019 Set5 Simulation
54/183
Model Construction or
Development
Modeling Tips
Art vs. ScienceOver Simplification vs. Unnecessary Detail
Start Simple
Add stronger assumptions
M d l V ifi i d
7/31/2019 Set5 Simulation
55/183
Model Verification and
Validation
Verification: Determining whether
simulation model works as intended.
Verifying the Model.
Structure: Walk Through of the Model
Debugger.
Trace = print or writing in process calculations.
Animation. Model testing
Analytical Model.
M d l V ifi i d
7/31/2019 Set5 Simulation
56/183
Model Verification and
Validation Verification.
Logical Model. Are events represented correctly?
Are mathematical formulas and relationshipscorrect?
Are statistical measures formulated correctly?
Computer Model/Simulation Model.
Does the code contain all aspects of the logicalmodel?
Are the statistics and formulas calculated correctly?
Does the model contain coding errors?
M d l V ifi i d
7/31/2019 Set5 Simulation
57/183
Model Verification and
Validation
Validation:Determine whether Simulation
of The Model is a credible representation
of a Real System.
Compare the model with the actual systems
by performing statistical tests. T-Test &
C.I.
Conceptual Model.
Does the model contain all relevant elements,
events and relationships?
Will the model answer the questions of concern?
M d l V ifi i d
7/31/2019 Set5 Simulation
58/183
Model Verification and
ValidationLogical Model.
Does the model contain all events included in theconceptual model?
Does the model contain all the relationships of theconceptual model?
Computer Model/Simulation Model. Is the computer model a valid representation of the
real system?
Can the computer model duplicate the performanceof the real system?
Does the computer model output have credibilitywith system experts and decision makers?
7/31/2019 Set5 Simulation
59/183
Experimentation and Analysis of
Results
ExperimentationThe execution of the
simulation model to obtain output values
Analysis of ResultsThe process of analyzing
the simulation outputs to draw inferences and
make recommendations for problem resolution
7/31/2019 Set5 Simulation
60/183
Implementation and Documentation
The process of implementing decisions
resulting from the simulation and
documenting the model and its use.
7/31/2019 Set5 Simulation
61/183
Manual Simulation Example
Given the following arrival times for a singleserver system what will be the average numberin the queue, average number in the system,average time in system, average time in queue,the number of completed jobs, number in thequeue, number in the system, and serverutilization at time 15 if the service time is 3 timeunits for each entity.
1, 3, 5, 9,13,15,17
7/31/2019 Set5 Simulation
62/183
Data Collection
Activities may be represented as
Constants
Random variables
Collection of data
Design a data collection form
Record more than single attribute in case you
need to use data in a different way.
Use several session to get representative data
Use control charts
7/31/2019 Set5 Simulation
63/183
Data Collection
Machine Begin Repair End Repair Time
Elapsed
7/31/2019 Set5 Simulation
64/183
Data Collection
Testing data
Independence
Randomness
Homogeneity
7/31/2019 Set5 Simulation
65/183
Data Collection
Test of Independence
Ho: Measure A is independent of measure B
H1: Measure A is not independent of measure
B.
Inventory and day of week
7/31/2019 Set5 Simulation
66/183
Data Collection
Test of Randomness
Ho: f(xi/xj) = f(xi) =Independent
Hi: f(xi/xj) f(xi) : Dependent
For example, when simulation a production
process in which the items can be defective or
good, it would be important to know if
successive items are randomly distributed withreputation good items followed by some of
defective items.
7/31/2019 Set5 Simulation
67/183
Data Collection
Test of Homogeneity
Tests for whether multiple sets of data can be
considered as coming from statistical
population are generally referred to as tests ofhomogeneity distribution free.
Ho : G(x) =H(x)
H1 : G(x) H(x)Two different workers working on the same
machine.
7/31/2019 Set5 Simulation
68/183
Random Variable
Two types
Discrete
Continuous
7/31/2019 Set5 Simulation
69/183
Random Variable
Probability mass function
Discrete
P(X = xi) = p(xi)
p(xi) = 1
7/31/2019 Set5 Simulation
70/183
Random Variable
Probability density function
Continuous
f(x) = ex
x > 0 P(X = a) = 0
-f(x) dx = 1
P(a < x < b) = ab f(x) dx
7/31/2019 Set5 Simulation
71/183
Random Variable
Cumulative distribution function (CDF)
F(X) = P(X
7/31/2019 Set5 Simulation
72/183
Random Variable
Expected value
= E(x) = xi p (xi)
= x f(x) dx
7/31/2019 Set5 Simulation
73/183
Random Variable
Variance
))((
))((22
22
22
2
)(
]2[
])[()(
xpxx
xEx
iixip
E
xxE
xExV
i
7/31/2019 Set5 Simulation
74/183
Random Variable
Standard deviation
Sums of R.V.
)()( XVXSD
)()()(
)()()(
2
2
21
2
1
2211
2211
xVaxVaYV
xEaxEayE
xaxaY
7/31/2019 Set5 Simulation
75/183
Random Variable
n
XXSampleMean
i
11
)(222
2
n
n
n
XXanceSampleVari xxS
ii
7/31/2019 Set5 Simulation
76/183
Poisson Probability Distribution
Consider a discrete r.v. which is often useful
when dealing with the number of occurrences
of an event over a specified interval of time.
Suppose we want to find the probability
distribution of the accidents at the intersection
of Rural and Apache during a one week
period.
The R.V. we are interested in is the number of
accidents.
7/31/2019 Set5 Simulation
77/183
Poisson Probability Distribution
i. The Poisson Distribution provides a good model for the probability
distribution of the number of rare events that occur in space, time,
and volume where is the average at which events occur.
ii. Define: A r.v. is said to have a Poisson distribution if the p.m.f of
X is
P(x) = f(x) =!x
ex
, x = 0,1,
where is the rate per unit time or per unit areaiii.
)(
][
XV
XE
7/31/2019 Set5 Simulation
78/183
Exponential Distribution
Previously, we discussed the Poisson random variable,
which was the number of events occurring in a given
interval. This number was a discrete r.v. and the
probabilities associated with it could be described by the
Poisson Probability Distribution.
Not only is the number of events a r.v., but the waiting
time between event is also a random variable. This r.v. is a
continuous r.v. for it can assume any positive value.
This r.v. is an exponential r.v. which can be described by
the exponential distribution.
7/31/2019 Set5 Simulation
79/183
Exponential Distribution
i. Pdf:
otherwise
xexf
x
0
0&0)(
where = rate at which events occur
ii. Correspondingly,
2
0
1)(
1][
0,1)()(
XV
XE
xedxexXPxF xx
x
iii. An important application of the exponential distribution is to
model the distribution of component lifetime. A reason for its
popularity is because of the memory-less property of the
Exponential Distribution
7/31/2019 Set5 Simulation
80/183
The Uniform Distribution
o The simplest distribution is the one in which a continuous r.v. can assume
any value within a interval [a, b]
Def:
A continuous r.v. X is said to have a uniform distribution on the
interval [a,b] if the probability distribution (pdf) of X is:
otherwise
bxaabxf
0
1
)(
7/31/2019 Set5 Simulation
81/183
The Uniform Distribution
The cumulative distribution is
12
)()(
2)
1()(][
)(
)()()(
2ab
XV
abdx
abxdxxxfXE
abax
aba
abx
ax
abxdxxf
dxxfxXPXF
xx
x
x
7/31/2019 Set5 Simulation
82/183
The Uniform Distribution
Note:
An important uniform distribution is
that for when a = 0 and b = 1, namelyU(0, 1)
A U(0,1) r.v. can be used to simulate
observation of other random variablesof the discrete and continuous type.
7/31/2019 Set5 Simulation
83/183
The Triangular Distribution
Continuous Distribution
elsewhere
cxbacbc
xc
bxaacab
ax
xf
0
))((
)(2
))((
)(2
)(
7/31/2019 Set5 Simulation
84/183
The Triangular Distribution
cx
cxbacbc
xc
bxaacab
axxF
axxF
1
))((
)(1
))((
)()(
0)(
2
2
7/31/2019 Set5 Simulation
85/183
The Triangular Distribution
caxb
xxc
xxa
bcacabcbaxV
cbaxE
axxF
n
n
3
}max{
}min{
18)(
3
)(
0)(
1
1
222
7/31/2019 Set5 Simulation
86/183
Normal Distribution
It is a fact that measurements on many random variables will follow a bell-
shaped distribution.
Random variable of this type are closely approximated by a Normal
Probability Distribution.
A continuous r.v. X is said to have a normal distribution if the pdf of X is
,,0,2
1)(
2
2
2
)(
xexf
x
The distribution contains 2 parameters ( and ). These are the expectedvalue and the variance and hence locate the center of the distribution and
measure its spread.
7/31/2019 Set5 Simulation
87/183
Normal Distribution
The Standard Normal Distribution
To compute P(a x b) when X ~ N(, 2), we must evaluate
dxedxxf
b
a
xb
a
2
2
2
)(
2
1
)(
Note: None of the standard integration techniques can be used
to evaluate this pdf. Instead, for = 0, and 2 = 1, the pdf hasbeen evaluated and values have been computed. Using the
table, probabilities for any other values of and 2 can bedetermined
7/31/2019 Set5 Simulation
88/183
Normal Distribution
The normal distribution for parameters values
= 0, and 2 = 1 is called the standard normaldistribution. A r.v. that has a standard
distribution is called a standard normal random
variable (denoted by Z). The pdf of Z is:
zezf
z
,2
1
)(2
2
7/31/2019 Set5 Simulation
89/183
Normal Distribution
The cumulative distribution of Z is
(Z)bydenotedisand)()(
z
dyyfzZP
Note: The N(0,1) Table returns the cumulative
probability up to z or (z)
7/31/2019 Set5 Simulation
90/183
Normal Distribution
Non-standard Normal Distribution
The table only provides probabilities for r.v.
following the N(0,1) distribution. Thus, when X~ N(, 2), (i.e. not = 0, 2 = 1), probabilitiesinvolving X are computed by standardizing
the r.v. to N(0,1) scale.
7/31/2019 Set5 Simulation
91/183
7/31/2019 Set5 Simulation
92/183
Data Collection
Little variability model as a constant.
Variability model as a random variable.
Empirical vs. Theoretical, Select aDistribution, Estimate Parameter of
distribution, goodness or fit test.
2
7/31/2019 Set5 Simulation
93/183
X2 goodness of fit test
Compare observed versus theoretical
density
A collection of data can be as a sample
from a specified p.d.f
H0: Xis are IID r.v. with density f(x)
H1: Xis are not IID r.v. with density f(x)
2
7/31/2019 Set5 Simulation
94/183
X2 goodness of fit test
Critical value
If H0 is true, TS ~ X2
k-1-(# of par estimated),
A large T.S.would cause rejection of H0
Reject Ho if T.S. > X2critical
k
i i
iiTS1
2
2
7/31/2019 Set5 Simulation
95/183
X2 goodness of fit test
Issuestest is an art
Number of intervals > 2
Size of intervals: Ei ~ same > 5 Requires relatively large amount of data
7/31/2019 Set5 Simulation
96/183
K-S test
Compare observed with theoretical CDF
Limited to continuous distribution, known
parameters
H0: Xi are IID r.v. with CDF F(x)
H1: Xi are not IID r.v. with CDF F(x)
Test statisticFrom table
K S
7/31/2019 Set5 Simulation
97/183
K-S test
Critical value
A large T.S would cause rejection
Critical value
))(max(),1
)(max(max^
XiFn
i
n
iXiFTS
n
nn
/22.110.0
/36.105.0/63.101.0
P i i
7/31/2019 Set5 Simulation
98/183
Parameter estimation
Set of data x1, x2, xm
Methods of moments => equate E(X),
V(X) to x and S2
1
22
2
n
xnxs
n
xx
ii
P i i
7/31/2019 Set5 Simulation
99/183
Parameter estimation
Maximum likelihood => find parameter
that max the likelihood of obtaining the
given sample
Produces efficient and consistent estimates
Not always unbiased
Superior properties to methods of moments
Common sense.
St ti ti l A l i f Si l ti
7/31/2019 Set5 Simulation
100/183
Statistical Analysis of Simulations
As previously mentioned, output data fromsimulation always exhibit random variability,since random variables are input to the simulationmodel.
We must utilize statistical methods to analyzeoutput from simulations.
The overall measure of variability is generally
stated in the form of a confidence interval at agiven level of confidence.
Thus, the purpose of the statistical analysis is toestimate this confidence interval.
O l i
7/31/2019 Set5 Simulation
101/183
Output analysis
Need multiple observations to estimate
variability
Y1, Y2, Y3, . Yn
Estimate a confidence interval for the
measure of performance
Estimate the number of observations
required to obtain the desired precision
O t t l i
7/31/2019 Set5 Simulation
102/183
Output analysis
What is an observation?
Is observation a sample statistic or time
average statistic?
Is this a steady state simulation or
terminating simulation?
Are the observations independent or
correlated?
T i ti St d St t Si l ti
7/31/2019 Set5 Simulation
103/183
Terminating vs Steady State Simulation
Often, the type of model determines whichtype of output analysis is appropriate for aparticular simulation.
However, the system or model may notalways be the best indicator of whichsimulation would be the most appropriate.
It is quite possible to use the terminatingsimulation approach for systems moresuited to steady-state simulations, and viceversa.
Ob ti Ti B d
7/31/2019 Set5 Simulation
104/183
Observation vs Time Based
Observation (Sample) Average Time In System
Average Time In Queue
Time Based Average Number in System Average Number in Queue
Machine Utilization
T i ti i l ti
7/31/2019 Set5 Simulation
105/183
Terminating simulation
Simulation in which the output measure of
performance is defined over a specific
interval of time with a specific starting
condition and a specific ending conditionRetail sales during a business day
Project network
Time to produce a batch of parts in a work cell
Military Simulations
T i ti i l ti
7/31/2019 Set5 Simulation
106/183
Terminating simulation
Has a specified starting and ending
condition.
Each observation must have the same
starting and ending.
Observations are obtained by replication.
Use a different seed for random number
generation.
St d t t i l ti
7/31/2019 Set5 Simulation
107/183
Steady state simulation
Simulation in which the output measure of
performance is defined over an infinite
interval of time independent of the initial
state of the system and stopping conditionAverage production from an assembly line of
well trained employees
Inventory simulation
Stead state sim lation
7/31/2019 Set5 Simulation
108/183
Steady state simulation
Independent of starting and ending
condition.
Remove initial condition bias
Specify warm-up period (transient period) .
Set initial condition too steady state.
Have a very long run length
Steady state simulation
7/31/2019 Set5 Simulation
109/183
Steady state simulation
1. Individual Yi average of individuals.
2. Replication Yi average of each one.
3. Batch means batch by time, by number.
Terminating vs Steady state simulation
7/31/2019 Set5 Simulation
110/183
Terminating vs. Steady state simulation
Terminating
Observations are obtained by replication
Each observation must reflect the specified
starting and ending condition
Use a different seed for each replication
Y1, Y2, , Yr => one independent
observation per replication
Confidence interval for steady state
7/31/2019 Set5 Simulation
111/183
y
simulation
Y1, Y2, . Yn
Trying to estimate a long run performance
measure independent of starting and
ending conditions
Two problems
Initial condition bias
Dependent observations
Confidence interval for steady state
7/31/2019 Set5 Simulation
112/183
simulation
Outline
Removing initial condition bias
Creating independent observation
Replication/ deletion
Batch means
Confidence interval for replication
7/31/2019 Set5 Simulation
113/183
Confidence interval for replication
Let Y1, Y2, and Y3YR be measures of
performance from R independent
replication.
Independent -> different seed for each run
1
)(
2,
22
2
2
1
R
R
RY YYsSti
r
Confidence interval for replication
7/31/2019 Set5 Simulation
114/183
Confidence interval for replication
Approximate due to need for Yi ~ Normal
(1-) Confidence Interval => Probabilityof containing true mean
RS
RRS
YVarYVarR
YYVarYVar
R
RRR
2
2
2
12
1
1
1
1
))(...)((
)...()(
Number of replication needed
7/31/2019 Set5 Simulation
115/183
Number of replication needed
Suppose we desire a confidence interval
Based on a preliminary run of R0replication, we have an estimate of S2 and
confidence interval
HalfLengthIY
0
2
211
0RStY
,R
Number of replication needed
7/31/2019 Set5 Simulation
116/183
Number of replication needed
Find R such that
If R is large,
R
StI
,R
2
21
1
2
2
2
2
1
*
I
SR
RI
Z
ZsZ
tr
Test for comparing two means
7/31/2019 Set5 Simulation
117/183
H0: 12 = 0 H1: 12 0Two approaches:
Form a (1) confident on 12 :)( 21,2/21 YYVtYY r
Reject H0 if confident does not contain 0.
Perform a t test )(0)(
21
21
YYV
YY
t
Reject if \t\ > tr,/2
Assumptions
Case 1: Y1, Y2 YR12
11 , sY
Case 2: Y1, Y2 YR22
22 , sY
Observations are independent
Observation are normally distributed
Variances are unknown/known.
Variances are equal/unequal
Observations are paired/unpaired.
Test for comparing two means
7/31/2019 Set5 Simulation
118/183
Equal Variance
1. Assumptions: independent, normal, unknown, unpaired, equalvariance.
2.2
)1()1(
2
)()(
21
2
22
2
11
21
2
2
2
12
RR
SRSR
RR
YYYYS ii
p
3.2
2
1
2
2121)()()(
R
S
R
SYVarYVarYYVar
pp
4.2
2
1
2
2,2/21 21:)1(
R
S
R
StYYconfident
pp
RR
5. t-test:
2
1
1
1
21)(
RRp
S
yyt
t-crit =2
,221
RRt
6. Note: Many simulations do not have equal variance.
Test for comparing two means
7/31/2019 Set5 Simulation
119/183
Test for comparing two means
One sided test
Need to make hypothesis in advance
Use t test, adjust critical value
7/31/2019 Set5 Simulation
120/183
Test for comparing two means
7/31/2019 Set5 Simulation
121/183
Unequal Variance
1. Assumptions: independent, normal, unknown variance,
unpaired, unequal variance.
2.2
2
2
1
2
1
2121 )()()(
R
S
R
SYVarYVarYYVar
3.2
2
2
1
2
1
,2/21:)1(
R
S
R
StYYconfident
12
2
22
11
1
21
2
22
1
21
22
2
R
R
S
R
R
S
R
S
R
S
Test for comparing two means
7/31/2019 Set5 Simulation
122/183
Test for comparing two means
Paired Test
Assumptions: independent, normal, unknown variance,equal # of replications
Case 1: Y1, Y2 YRCase 2: Y1, Y2 YR
Different: d1, d2 dR , where di = yi yi
1
)(2
2
R
ddS
R
dd id
i
H0: 12 = 0 d = 0H1: 12 0 d 0
R
SdVtdconfident dR
2
1,2/ )(:)1(
R
Sd
dt
2
Test for comparing two variances
7/31/2019 Set5 Simulation
123/183
Test for comparing two variances
F-test for equal variance1.
2
2
2
11
2
2
2
10
H
H
2. Test statistics = F =2
2
2
1
S
S =
3. Critical Value =2
,1,1 21
RRF
4. Example
F =5.4/2.55 = 2.12
= .10, Fcritical = F9,9,. 05 = 3.18, can not reject Ho
Common Random Number
7/31/2019 Set5 Simulation
124/183
Common Random Number
The process of comparing cases with thesame set of random numbers creating identical condition
Observation Confident Interval
Use the paired test
),(2)()()(
)()(
212121
212/,121
YYCovYVYVYYV
YYVtYY R
Random Numbers
7/31/2019 Set5 Simulation
125/183
Random Numbers
Generation of U(0,1) random number
algorithm used by the RND function
Generation of random variates from
various distributionsalgorithm used by
EXPONENTIAL, UNIFORM, and so on
(these algorithms use U(0,1) randomnumbers.
Random Number Generation
7/31/2019 Set5 Simulation
126/183
Random Number Generation
Desirable properties
Fast and efficient
Capable of repeating same sequence
Statistically equivalent to U(0,1)
Independent and dense
Large cycle length or period
Low storage requirements
Old methodtables
Random Number Generation
7/31/2019 Set5 Simulation
127/183
Random Number Generation
Pseudo random number generators
A non random sequence of numbers each
completely determined by its predecessor, the
algorithm, and initially, the seed.
Linear Congruential Generator
7/31/2019 Set5 Simulation
128/183
Linear Congruential Generator
Zi = ( a * Zi-1 + C ) mod m
Z0 = seed
Ui= Z
i/ m (Random Number)
If we choose a, C, and m correctly, => then
we achieve a maximum period 0
7/31/2019 Set5 Simulation
129/183
Linear Congruential Generator
Rule For Full Period :
C is relatively prime to m.
other than 1, hence there is no integer that exactly
divides C and mEvery prime factor of M is also a prime factor
of A-1
If m is exactly dividable by 4, then A-1 must
be exactly dividable by 4
Linear Congruential Generator
7/31/2019 Set5 Simulation
130/183
Linear Congruential Generator
A full period does NOT mean always a
good random number generator
Multiplicative Generators
7/31/2019 Set5 Simulation
131/183
Multiplicative Generators
Zi = a * Zi-1 mod m
Z0 = seed
Saves an addition, more popular
Multiplicative Generators
7/31/2019 Set5 Simulation
132/183
u t p cat ve Ge e ato s
C=0
M divides both m and c
Condition (a) is violated
Not full period
P = m1 is largest available period
Multiplicative Generators
7/31/2019 Set5 Simulation
133/183
p
2b is not a good choice for m
only possible numbers
Let m = 2b - 1
Testing a random number generator
7/31/2019 Set5 Simulation
134/183
g g
Testing the distribution
Generate 1000 or more observations
X2 test or K-S test for U(0, 1)
Use 100 intervals
Test for independence
Runs up
Tests designed to compare observed and
expected distribution
E(x) = .5 V(X) = 1/12, where a = 0, b=1
Random variate generation
7/31/2019 Set5 Simulation
135/183
g
Assume a random number generator is
available to generate Ui ~ U(0, 1)
Goal: Generate Xi from a specified
distribution f(x) or p(x) of F(x)
Three methods
Inverse transformation method
Convolution method
Acceptance\Rejection method
Random variate generation
7/31/2019 Set5 Simulation
136/183
g
Apply these methods to the five
distributions we are using in this class
Uniform
Triangular
Exponential
Normal
Poisson
Inverse transformation method
7/31/2019 Set5 Simulation
137/183
General ideause CDF
Select Ui
Find corresponding xi
That is xi = F-1(Ui)
Advantage of inverse transformation
method
One Ui per xi
Disadvantage
CDF may not always exist
Inverse transformation method
7/31/2019 Set5 Simulation
138/183
Exponential distribution
f(x) = e -x x 0
F(X) = 1 - e -x x 0
Ui = F(Xi) = 1 - e-xi
(1- Ui) = e-xi
ln(1- Ui) = - XiXi = - (1/) ln(1- Ui) = - (1/) ln(Ui)
Inverse transformation method
7/31/2019 Set5 Simulation
139/183
Triangular distribution
cxb
acbc
xcbxa
acab
axF x ,
))((
)(1,
))((
)(22
)(
acab
iu
ac
ab
iu
ac
ab
iu
ux ii acaba ))((
)1)()(( ux ii acbcc
ui
Yes
No
Convolution Method
7/31/2019 Set5 Simulation
140/183
Applicable to situation where the random
variable of interest can be expressed as a
sum of other random variables that are IID
(independent identical distributed)
X=Y1+Y2+Y3. +Yn
Idea: Generate Y1. Yn and add these up
to calculate X
Convolution Method
7/31/2019 Set5 Simulation
141/183
Normal distribution
Focus: Generating Zi ~ N(0, 1)
Generating Zi
Inverse transformation: F(x) does not exist
Acceptance\Rejection: Not bounded
),(~
NZx
x
Z iii
i
2
2
1
2
1)(
z
eZf
7/31/2019 Set5 Simulation
142/183
Acceptance\Rejection Method
7/31/2019 Set5 Simulation
143/183
p j
Applicable to distribution functions that
are hard to integrate
IdeaFind a majoring function t(x) where t(x) > f(x)
Sample values of x from t(x) call it x*
Sample Ui < f(x*) / t(x*), accept x*
Simplification for this classwe will
always use a rectangular majoring function
9.3 Random Numbers and Monte
Carol Simulation
7/31/2019 Set5 Simulation
144/183
Carol Simulation
The procedure of generating these times from thegiven probability distributions is known assampling from probability distributions, orrandom variate generation, or Monte Carlo
sampling. We will discuss several different methods of
sampling from discrete distributions.
The principle of sampling from discretedistributions is based on the frequencyinterpretation of probability.
7/31/2019 Set5 Simulation
145/183
In addition to obtaining the right frequencies, the
sampling procedure should be independent; that is,each generated service time should be independentof the service times that precede it and follow it.
This procedure of segmentation and using a roulette
wheel is equivalent to generating integer randomnumbers between 00 and 99.
This follows from the fact that each random numberin a sequence has an equal probability of showing
up, and each random number is independent of thenumbers that precede and follow it.
7/31/2019 Set5 Simulation
146/183
Random Number Generators Since our interest in random numbers is for use
7/31/2019 Set5 Simulation
147/183
Since our interest in random numbers is for usewithin simulations, we need to be able to generate
them on a computer. This is done by using mathematical functions called
random number generators.
Most random number generators use some form of acongruential relationships. Examples of suchgenerators include linear congruential generator, themultiplicative generator, and the mixed generator.
The lineal congruential generator is by far the mostwidely used.
7/31/2019 Set5 Simulation
148/183
Each random number generated using thismethods will be a decimal number between 0and 1.
Random numbers generated using congruential
methods are called pseudorandom numbers.
Random number generators must have theseimportant characteristics:
1. The routine must be fast
2. The routine should not require a lot of core storage
3. The random numbers should be replicable; and
4. The routine should have a sufficiently long cycle
7/31/2019 Set5 Simulation
149/183
Most programming languages have built-inlibrary functions that provide random (or
pseudorandom) numbers directly.
Computer Generation of Random
Numbers
7/31/2019 Set5 Simulation
150/183
Numbers
We now take the method of Monte Carlosampling a stage further and develop a procedureusing random numbers generated on a computer.
The idea is to transform the U(0,1) random
numbers into integer random numbers between00 and 99 and then to use these integer randomnumbers to achieve the segmentation bynumbers.
We now formalize this procedure and use it togenerate random variates for a discrete randomvariable.
7/31/2019 Set5 Simulation
151/183
The procedure consists of two steps:
1. We develop the cumulative probability
distribution (cdf) for the given random
variable, and2. We use the cdf to allocate the integer random
numbers directly to the various values of the
random variables.
9.4 An Example of Monte Carlo
Simulation
7/31/2019 Set5 Simulation
152/183
Simulation
The book uses a Monte Carlo simulation tosimulate a news vendor problem.
The procedure in this simulation is different from
the queuing simulation, in that the presentsimulation does not evolve over time in the same
way.
Here, every day is an independent simulation.
Such simulations are commonly referred to asMonte Carlo simulations.
9.5 Simulations with Continuous
Random Variables
7/31/2019 Set5 Simulation
153/183
Random Variables
In many simulations, it is more realistic andpractical to use continuous random variables.
We present and discuss several procedures forgenerating random variates from continuous
distributions. The basic principle is similar to the discrete case.
We first generate U(0,1) random number andthen transform it into a random variate from thespecified distribution.
7/31/2019 Set5 Simulation
154/183
The selection of a particular algorithm willdepend on the distribution from which we want
to generate, taking into account such factors as
the exactness of the random variables, the
computations and storage efficiencies, and the
complexity of the algorithm.
The two most common used algorithms are the
inverse transformation method (ITM) and theacceptance-rejection method (ARM).
Inverse Transformation Method
7/31/2019 Set5 Simulation
155/183
The inverse transformation method is generallyused for distribution whose cumulativedistribution function can be obtained in closedform.
Examples include the exponential, the uniform,the triangular, and the Weibull distributions.
For distributions whose cdf does not exist inclosed form, it may be possible to use some
numerical method, such as a power-seriesexpansion, within the algorithm to evaluate thecdf.
7/31/2019 Set5 Simulation
156/183
The ITM is relatively easy to describe andexecute.
It consists of the following steps: Step1: Given the probability density formulaf(x) for a
random variable X, obtain the cumulative distributionfunction F(x) as
Step 2: Generate a random number r. Step 3: Set F(x) = rand solve forx.
x
dttfxF )()(
We consider the distribution given by the function
7/31/2019 Set5 Simulation
157/183
We consider the distribution given by the function
A function of this type is called a ramp function. To obtain random variates from the distribution
using the inverse transformation method, we first
computer the cdf as
0
2)(
x
xf 0 x 2otherwise
4
2)(
2
0
x
dttxFx
In Step 2, we generate a random number r.
7/31/2019 Set5 Simulation
158/183
Finally, in Step 3, we set F(x) =rand solve forx.
Since the service time are defined only for positive
values ofx, a service time of as thesolution forx. This equation is called a randomvariate generator or a process generator.
Thus, to obtain a service time, we first generate a
random number and then transform it using thepreceding equation.
rx
rx
2
4
2
rx 2
7/31/2019 Set5 Simulation
159/183
As this example shows, the majoradvantage of the inverse transformation
method is its simplicity and ease of
application.
AcceptanceRejection Method
7/31/2019 Set5 Simulation
160/183
There are several important distributions,including the Erlang (used in queuing models)and the beta (used in PERT), whose cumulativedistribution functions do not exist in closed form.
For these distributions, we must resort to othermethods of generating random variates, one ofwhich is the acceptancerejection method(ARM).
This method is generally used for distributionswhose domains are defined over finite intervals.
7/31/2019 Set5 Simulation
161/183
Given a distribution whose pdf,f(x), is definedover the interval ax b, the algorithm consistsof the following steps: Step 1: Select a constantMsuch thatMis the largest
value off(x) over the interval [a, b]. Step 2: Generate two random numbers, r1 and r2.
Step 3: Computerx* = a + (ba)r1. (This ensuresthat each member of [a, b] has an equal chance to be
chosen asx
*.) Step 4: Evaluate the functionf(x) at the pointx*. Letthis be f(x*).
7/31/2019 Set5 Simulation
162/183
7/31/2019 Set5 Simulation
163/183
There are several ways by which the method canbe made more efficient.
One of these is to use a function in Step 1 insteadof a constant.
We now give an intuitive justification of thevalidity of the ARM.
In particular, we want to show that the ARMdoes generate observations from the givenrandom variable X.
Direct and Convolution Methods for
the Normal Distribution
7/31/2019 Set5 Simulation
164/183
the Normal Distribution
Both the inverse transformation method and theacceptancereject method are inappropriate forthe normal distribution, because (1) the cdf doesnot equal in closed form and (2) the distribution
is not defined over a finite interval. Other methods such asan algorithm based on
convolution techniques, and then a directtransformation algorithm that produces two
standard normal variates with mean 0 andvariance 1.
7/31/2019 Set5 Simulation
165/183
The Direct Method
7/31/2019 Set5 Simulation
166/183
The direct methods for the normal distributionwas developed by Box and Muller (1958).
Its not as efficient as some of the newer
techniques, it is easy to apply and execute. The algorithm generates two U(0,1) random
numbers, r1andr2, and then transforms them into
two normal variates, each with mean 0 and
variance 1, using the direct transformation.
1
7/31/2019 Set5 Simulation
167/183
It is easy to transform these standardized normal
variates intro normal variates X1 and X2 fromthe distribution with mean and variance 2,using the equations
22
1
12
22
1
11
2cos)ln2(
2sin)ln2(
rr
rr
22
11
9.6 An Example of a Stochastic
Simulation
7/31/2019 Set5 Simulation
168/183
Simulation
Cabot Inc. is a large mail order firm in Chicago. Orders arrive into the warehouse via telephones.
At present, Cabot maintains 10 operators on-line24 hours a day.
The operators take the orders and feed themdirectly into a central computer, using terminals.
Each operator has one terminal. At present, thecompany has a total of 11 terminals.
That is, if all terminals are working, there will be1 spare terminal.
Cabot managers believe that the terminal systemneeds evaluation because the downtime of
7/31/2019 Set5 Simulation
169/183
needs evaluation, because the downtime of
operators due to broken terminals has beenexcessive.
They feel that the problem can be solved by thepurchase of some additional terminals for the spares
pool. It has been determined that a new terminal will cost
a total of $75 per week.
It has also been determined that the cost of terminal
downtime, in terms of delays, lost orders, and so onis $1000 per week.
Given this information, the Cabot managers would liketo determine how many additional terminals they
7/31/2019 Set5 Simulation
170/183
to determine how many additional terminals they
should purchase. This model is a version of the machine repair problem.
It is easy to find an analytical solution to the problemusing the birth-death processes.
However, in analyzing the historical data for theterminals, it has been determined that although thebreakdown times can be represented by theexponential distribution, the repair times can be
adequately represented only by the exponentialdistribution.
This implies that analytical methods cannot be used
7/31/2019 Set5 Simulation
171/183
p yand that we must use simulation.
To simulate this system, we first require theparameters of both the distributions.
The data show that the breakdown rate is
exponential and equal to 1 per week per terminal. In other words, the time breakdowns for a terminal
is exponential with a mean equal to 1 week.
Analysis for the repair times shows that this
distribution can be represented by the triangulardistribution which has a mean of 0.075 week.
0750025040010 xx
7/31/2019 Set5 Simulation
172/183
The repair stuff on average can repair 13.33terminals per week.
To find the optimal number of terminals, wemust balance the cost of the additional terminalsagainst the increased revenues generated as aresult of the increase in the number of terminals.
In this simulation we increase the number ofterminals in the system, n, from the present totalof 11 in increments of 1.
125.0075.040050
075.0025.040010)(
xx
xxxf
7/31/2019 Set5 Simulation
173/183
7/31/2019 Set5 Simulation
174/183
Once we have a value ofELn, we cancomputer the expected weekly downtime
costs, given by 1000(10-ELn).
Then the increase in revenue as a result ofincreasing the number of terminals from 11
to n is 1000(ELnEL11). Mathematically,
we computeELn T
A
T
dttN
EL
m
i
iT
n
10
)(
h
7/31/2019 Set5 Simulation
175/183
where
T= length of simulation
N(t) = number of terminals on-line at time t (0tT)
Ai = area of rectangle under N(t) between ei-1 and ei
(where ei is the time of the ith event)m = number of events that occur in the interval [0,T]
Between time 0 and time e1, the time of the firstevent, the total on-line time for all the terminals is
given by 10ei, since each terminal is on-line for aperiod ofe1 time units.
If we now run this simulation over T time units and
7/31/2019 Set5 Simulation
176/183
If we now run this simulation over Ttime units and
sum up the areasA1,A2, A3,, we can get anestimate forEL10 by dividing this sum by T. Thisstatistic is called a time-average statistic.
We would like to set up the process in such way that
it will be possible to collect the statistics tocomputer the areasA1,A2, A3,.
That is, as we move from event to event, we wouldlike to keep track of at least the number of terminals
on-line between the events and the time betweenevents.
7/31/2019 Set5 Simulation
177/183
We first define the state of the system as thenumber of terminals in the repair facility.
The only time the state of the system will changeis when there is either a breakdown or a
completion of a repair. Therefore, there are two events in this simulation:
breakdown and completion of repairs.
To set up the simulation, our first task is todetermine the process generators for both thebreakdown and the repair times.
We use the ITM to develop the process generators.
7/31/2019 Set5 Simulation
178/183
For the exponential distribution the processgenerator is simplyx = -log r
In case of the repair times, applying the ITM givesus
and
as the process generators.
)5.00(005.0025.0 rrx
)0.15.0()1(005.0125.0 rrx
7/31/2019 Set5 Simulation
179/183
For each n, we start the simulation in the statewhere there are no terminals in the repair facility.
In this state, all 10 operators are on-line and anyremaining terminals are in the spares pool.
Our first action is the simulation is to schedulethe first series of events, the breakdown times forthe terminals presently on-line.
Having scheduled these events, we nextdetermine the first event, the first breakdown, bysearching through the current event list.
7/31/2019 Set5 Simulation
180/183
We then move the simulation clock to the timeof this event and process this breakdown.
To process a breakdown, we take two separateseries of actions
1. Determine whether a spare is available.2. Determine whether the repair staff is idle.
These actions are summarized in the systemflow diagram showed in the book in Figure 17.
Otherwise, we process a completion of a repair.
To process the completion of a repair we also
7/31/2019 Set5 Simulation
181/183
To process the completion of a repair, we also
undertake two series of actions.1. At the completion of a repair, we have an additional
working terminal, so we determine whether the terminalgoes directly to an operator or to the spares pool.
2. We check the repair queue to see whether any terminalsare waiting to be repaired.
We proceed with the simulation by moving fromevent to event until the termination time T.
At this time, we calculate all the relevant measuresof performance from the statistical counters.
7/31/2019 Set5 Simulation
182/183
Our key measure is the net revenue for thecurrent value ofn.
If this revenue is greater than the revenue for asystem with n-1 terminals, we increase the value
ofn by 1 and repeat the simulation with n +1terminals in the system.
Otherwise, the net revenue has reached a peak.
The simulation outlined in this example can beused to analyze other policy options thatmanagement may have.
7/31/2019 Set5 Simulation
183/183