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

Chapter 3

ENGR502 lecture

Uploaded by

jtflag
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Chapter 3

ENGR502 lecture

Uploaded by

jtflag
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter 3

Simulation basics—random numbers and random topics…

1
Static vs. Dynamic Simulation
• Static -- not based on time.
• Dynamic -- includes the passage of time.

3-2
Stochastic vs. Deterministic
Simulation
• Stochastic -- at least one random input variable. This
makes the output also random so multiple
replications are needed to estimate model
performance.
• Deterministic -- no randomness. Only one replication
is needed since outcome is always the same.

3-3
Constant Constant Random Random
Inputs Outputs Inputs Outputs

7
12.3
Simulation Simulation
3.4
106
5
(a) (b)

Deterministic Stochastic

3-4
Discrete
vs.
Continuous Simulation
 Discrete-event simulation -- state
changes at discrete points in time
as triggered by events.
 Continuous simulation -- state
changes continuously with respect
to time.

3-5
What is a simulation
event?
An occurrence triggered by a lapse
of time, a condition, or some other
event.
Examples:
 the arrival of an entity
 the start of a downtime
 the start or completion of an activity

3-6
What is a model state?

The state of a model is really the collective result of


all the state variables in the system.

Example: Machine A is busy, Operator 1 is moving,


and 3 items are in Queue B.

3-7
DES processes events one at a time.
Events change the model state.
State 1 State 2 State n
...
time

Start Event 1 Event 2 Event n


Simulation

3-8
Continuous vs. Discrete
Simulation

Continuous-Change
State Variable

Value
Discrete-Change
State Variable

Time

3-9
Many simulations require both
discrete and continuous modeling.

• Food and beverage industries.


• Cosmetic and pharmaceutical industries.
• Petroleum and chemical industries.

3-10
The Discrete-Change State Variable can become discontinuous if the Continous-Change
State Variable hits a certain value or values. Similarly, vice-versa can happen.

Continuous AND Discrete


Simulation

Continuous-Change
State Variable

Value
Discrete-Change
State Variable
Discrete value changes as the Continuous
variable hits values (rise and fall could be
different, too). Continuous value changes as the Discrete
variable hits values.
Time

3-11
Modeling Random Variables
• Identify the random variables in the system.
• Understand the nature of the random variable.
• Define the random variable in the model.

3-12
Typical Random Variables
 Activity times -- Operation times, repair times, setup
times, move times
 Outcomes -- The success of an operation, the decision
of which activity to do next
 Quantities -- Lot sizes, arrival quantities, number of
workers absent.
 Event intervals -- Time between arrivals, time between
equipment failures
 Classifications -- Customer type, part size, skill level

3-13
Simple Probabilities (e.g. outcomes,
decisions)

incoming parts .80 pass


Inspection

.20

fail

3-14
Probability Distributions
1.0

Discrete .75

(a)
(quantities, probability .50

classifications) .25

0
0 1 2 3 4 5 6
value

Continuous
(b)
fx
(activity times,
event intervals)

0 1 2 3 4 5 6
value
3-15
Typical Continuous
Probability
Distributions

3-16
A value for a random variable is
generated by first generating a
real random number between 0
and 1, exclusive of 1.

0≤ x<1

This is done using a


random number generator .
3-17
Uniform probability distribution for
random number generation

18
Random Number Generators
 Generates a sequence of pseudorandom numbers that
are uniformly distributed and look statistically
independent.
 Should be efficient, repeatable and have a long period.
 Examples
◦ Prime Modulus Multiplicative Linear Congruential Generator
◦ Mixed Prime Modulus Multiplicative Linear Congruential
Generator
◦ Combined Multiple Recursive Generator
◦ Mersenne Twister

3-19
Look at example for Table 3.1, pretty
easy
• You need a leap of faith in the mathematics, note that these generators are
integer-based:
• a =2
• Say we want the generating integers to fall between 0 and 16
• Then, we need a starting integer, called the random number seed
• Z0 = 13 in the example
1. Calculate First the numerical value (aZi-1 +3)
2. Do division with the mod(value), or max integer value, which is 16
3. Lop off the decimal value (TRUNC[ (aZi-1 +3)/ (16)]
4. (aZi-1 +3) – (TRUNC[ (aZi-1 +3)/ (16)](16) gives you remainder, Zi
5. Scale the remainder Zi between 0 and 16
20
There are rules for these generators
• Based upon the bit-processing of computer of use
• Most today are b = 64-bit – 1 (not 32-bit as noted in text)
• Also looking c and m to not have common factors
• The larger these numbers get, the harder it is to find such numbers

• Leave this to the in-depth mathematicians, but realize that the


numbers start repeating themselves after m = 2b
• That’s a big number, but it gets used up after long simulation with lots
of replications and lots of random numbers generated.

21
Limits on the example from Table
3.2
• Do any of the numbers show up in stream 1 verses stream 2?
• How long before the random numbers start again in a stream (1 or 2)?
• Look at Z2 for i = 25 and then think on Lab 3.8, 11

• Use a spreadsheet in class as needed here

22
ProModel uses a Prime Modulus
Multiplicative Linear Congruential Generator

Zi = 630,360,016 X ZI-1 X mod(231 – 1)

Period = 2^31-1 = 2147483648

3-23
For discrete and continuous
probability distributions, once a
random number is generated, it
is transformed to produce a
sample value (random variate)
that fits the desired distribution
defining the random variable.

3-24
Transforming a Random
Number to a Random Variate

Random Variate

0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1.0
Random Number

3-25
Generating Random Variates
• Inverse transformation method
• Acceptance/rejection method
• Composition method
• Composition method
• Methods employing special properties

3-26
ATM Spreadsheet Simulation
Arriving ATM ATM Departing
Customers Queue Server Customers

8 7 6 5 4 3 2 1
Interarrival
time
4.8 minutes
7th customer 6th customer
arrives at arrives at
21.0 min. 16.2 min.

3-27
ATM Simulation Objectives
• Average time in the queue
• Average time in the system

3-28
Pros & Cons of Spreadsheet
Simulation
 Pros
◦ Readily available.
◦ Random variate generator.
◦ Can set up a template or UI.

 Cons
◦ Doesn’t capture complex interdependencies.
◦ Doesn’t provide full range of distributions.
◦ Doesn’t produce long random number cycles

3-29
Let’s assume Wednesday:
• Be ready to show off your post office simulation (first lab 3.8 exercise)
• Prove the number of postal clerks to ensure that there are no more
than 15 customers (maximum) waiting in line at the post office at any
time
• Recommended:
• Need to find the closest number of clerks first
• Then, run several replications to check

30
Hint on doing problems
• Look at the Locations help in the Promodel website
• In particular, go to the “Units” and “multi-units” information

• This information could help you reduce the amount of time you spend on the
“post office” problem…

31

You might also like