Sunteți pe pagina 1din 67

SIMULATION TOOL AND TECHNIQUE, INPUT MODELLING

5/5/2013

Presented by
PRAGATI RANA 112008 PRAKASH CHANDRA BHARTI 112009 SOHAIL KHAN 112016

M.Tech. 3rd Semester


1

Jaypee University of Engineering And Technology


Guna 2012

OUTLINE
Exordium Historical Background Simulation Tools and Techniques Application Areas of Simulation Classification of Simulation Discrete Event Simulation Features Provided by Language Simulation Language Verification and Validation Input Modelling

2
5/5/2013

CONTENT COVERAGE
5/5/2013

PRAGATI RANA

P. C. BHARTI

Input Modelling

Exordium Historical Background Simulation Tools and Techniques Application Areas of Simulation Classification of Simulation

Discrete Event Simulation Features Provided by Language Simulation Language Verification and Validation

SOHAIL KHAN

EXORDIUM
5/5/2013

o What is Mathematical Modelling? Models describe our belief, how the real world functions. In mathematical modelling we translate those beliefs into the language of beliefs.

Advantage:

Mathematics is very precise language. This helps us to formulate ideas and identify underlying assumptions.

Mathematics is a concise language with well defined rules for manipulation.

All results that mathematics have proved over hundreds of year are at our disposal.
4

Computers can be used to perform numerical calculation.

... EXORDIUM CONTD.


Steps For Mathematical Modelling

5/5/2013

Identify the real problem


Formulate the Mathematical Problem Obtain the Mathematical Solution of the Model Interpret the Mathematical Solution Compare with reality

Write a report and / or present the result.


5

NEED FOR SIMULATION

Motivation: An organisation realised that for the improvement in the performance of the system they have to see and experiment with the real system, through the observation and aid to statistics to reach valid conclusion towards future system improvements.

5/5/2013

Improvement can be done by the help of system modelling equations through analytical or numerical methods but the model may be too difficult for the complex system.

In this extreme situation people use simulation technique for the improvement, and now it has become common practice .
6

ESSENTIALLY SIMULATION CONSISTS OF


5/5/2013

o Building a computer model that consist of or that describes the behaviour of system. o Experimenting with this model to reach conclusions that support decisions.

o Once we have a computer simulation model of the actual system, we need to generate values for the random quantities that are part of the system input (to the model).

HISTORICAL BACKGROUND
5/5/2013

Simulation has come a long way since 1964, started at

Sperry Gyroscope Co. at its site at Bracknell, Berkshire,


England.

The main activity was military simulation using valve

analog simulator.

Followed by a progression from analog to digital simulator via hybrid analog and digital systems, followed

by application in digital signal processing and the design


of several computers and back to simulation.
8

CHALLENGES OF SIMULATION FOR QUANTUM SYSTEM AN EXAMPLE


What approximation come in. Computer time is limited > few particles for short periods of time. (space-time is 4d. Moores Law implies lengths and times will double every 6 years if O(N).) Systems with many particles and long time scales are problematical. Hamiltonian is unknown, until we solve the quantum many-body problem! How do we estimate errors? Statistical and systematic. How do we manage ever more complex codes?

5/5/2013

APPLICATION AREAS OF SIMULATION


o o o o

o
o o o o

Designing and analyzing manufacturing systems Evaluating military weapons systems or their logistics requirements Determining hardware requirements or protocols for communications networks Determining hardware and software requirements for a computer system Designing and operating transportation systems such as airports, freeways, ports, and subways Evaluating designs for service organizations such as call centers, fast-food restaurants, hospitals, and post offices Reengineering of business processes Determining ordering policies for an inventory system Analyzing financial or economic systems

10

5/5/2013

SYSTEM, MODEL AND SIMULATION

System:

A collection of entities (people, parts, messages,

5/5/2013

machines, servers, ) that act and interact together toward

some end (Schmidt and Taylor, 1970)


In practice, depends on objectives of study Might limit the boundaries (physical and logical) of the system Judgment call: level of detail (e.g., what is an entity?) Usually assume a time element dynamic system

State of a system:

Collection of variables and their values

necessary to describe the system at that time


Might depend on desired objectives, output performance measures Bank model: Could include number of busy tellers, time of arrival of each customer, etc.
11

... CONTD.
5/5/2013

Types of systems

Discrete
State variables change instantaneously at separated points in time Bank model: State changes occur only when a customer arrives or departs

Continuous
State variables change continuously as a function of time Airplane flight: State variables like position, velocity change continuously

Many systems continuous

are

partly

discrete,

partly
12

... CONTD.

Ways to study a system


System

5/5/2013

Experiment with the actual System

Experiment with the Model of the System

Physical model

Mathematical model

Analytical Solution

Simulation

13

CLASSIFICATION OF SIMULATION
5/5/2013

Classification of simulation models


Static vs. dynamic Deterministic vs. stochastic Continuous vs. discrete

Most operational models are dynamic, stochastic, and discrete will be called discrete-event

simulation models
14

SIMULATION VS ANALYTICAL MODELLING


5/5/2013

Advantage:

various performance measures


greater realism easier 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.
15

SIMULATION VS PHYSICAL MODELLING

Advantage:

5/5/2013

High Speed Not disruptive Replication easy

Control variations
Generally less costly

Disadvantage:

Realism Validity
16

STATIC VS DYNAMIC SIMULATION


5/5/2013

Definition:

static

simulation

model

is

representation of a system at a particular point in time.

We usually refer to a static simulation as a Monte Carlo simulation.

Definition: A dynamic simulation is a representation of


a system as it evolves over time.

Within these two classifications, a simulation may be deterministic or stochastic.


17

DETERMINISTIC VS STOCHASTIC SIMULATION MODEL

5/5/2013

A deterministic simulation model is one that


contains no random variables

A stochastic simulation model contains one or more random variables.

18

CONTINUOUS AND DISCRETE EVENT SIMULATION


5/5/2013

Continuous

event:

state of system changes continuously over time

Ex. Level of fluid in tank

Programming:

Advances time in small intervals. Use differential equations to represent flows.

19

DISCRETE EVENT SIMULATION

Discrete-event simulation: Modeling of a system as it evolves over time by a representation where the state variables change instantaneously at separated points in time
More precisely, state can change at only a countable number of points in time These points in time are when events occur Programming

5/5/2013

Look at system only when events occur; time is advanced from event to event.

Event: Instantaneous occurrence that may change the state of the system

Sometimes get creative about what an event is e.g., end of simulation, make a decision about a systems operation
20

Can in principle be done by hand, but usually done on computer

EXAMPLE

To simulate a queuing system, we first have to describe

5/5/2013

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 their arrival (FCFS).

Arrivals occur one at a time in a random fashion.

All arrivals are eventually served with the distribution of


service teams.
21

... CONTD.

Service times are also assumed to be random. After service, all customers return to the calling population.

5/5/2013

For this example, we use the following variables to define the state of the system: (1) the number of

customers in the system; (2) the status of the server


that 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.
22

... CONTD.
5/5/2013

All the information about them is maintained in a list 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, an arrival, takes place at clock time 0.

Next we schedule the departure time of the first customer.


Departure time = clock time now + generated service time
23

... CONTD.

Also, we now schedule the next arrival into the system by randomly generating an inter-arrival time from the inter-arrival time distribution and setting the arrival time as
Arrival time = clock time now + generated inter-arrival time

5/5/2013

Both these events are their scheduled times are maintained on the event list.

This approach of simulation is called the next-event timeadvance mechanism, because of the way the clock time is

updated. We advance the simulation clock to the time of the


most imminent event.
24

... CONTD.

As we move from event to event, we carry out the appropriate actions for each event, including any scheduling of future events.

5/5/2013

The jump to the next event in the next-event mechanism may be a large one or a small one; that is, the jumps in this method are variable in size.

We contrast this approach with the fixed-increment timeadvance method.

With this method, we advance the simulation clock in increments of t time units, where t is some appropriate time unit, usually 1 time unit.
25

... CONTD.
5/5/2013

For most models, however, the next event mechanism

tends to be more efficient computationally.

Consequently, we use only the next-event approach for the development of the models for the 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


26

... CONTD.
5/5/2013

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 initializing all the


variables. This simple example illustrates some of the basic concepts in simulation and the way in which simulation can be used to analyze a particular problem.
27

... CONTD.
5/5/2013

Example: Single-server queue Estimate expected average delay in queue (line, not service) State variables Status of server (idle, busy) needed to decide what to do with an arrival Current length of the queue to know where to store an arrival that must wait in line Time of arrival of each customer now in queue needed to compute time in queue when service starts Events Arrival of a new customer Service completion (and departure) of a customer Maybe end-simulation event (a fake event) whether this is an event depends on how simulation terminates (a modeling decision)

28

WORLD VIEW THE STRUCTURE CONCEPTS AND


5/5/2013

VIEWS UNDER WHICH THE SIMULATION IS GUIDED FOR THE DEVELOPMENT OF THE SIMULATION MODEL

Event Orientation defines the changes in state that occur at each event time Process Orientation describes the process through which the entities in the system flow

Activity Scanning Orientation describes the activities in which the entities in the system engage
29

... CONTD.

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

5/5/2013

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 Pro-model programming language

30

EVENT SCHEDULING
Time is advanced from event to event Future events list ordered list of upcoming events

5/5/2013

As events are scheduled, they are added to the list As events occur they are removed from list

Activities in event ( one / event type) List is required to keep track of entities in a set Statistics Two types

Sample statistics average of some values (W)

W = (W1 +W2 + +Wn)/n = Total Wait / # of wait L = (0(t1) + 1(t2-t1) + 2(t3-t2) + 1(t4-t3)) / t4
31

Time average statistics time weighted (L)

ACTIVITY SCANNING
5/5/2013

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.
32

PROCESS ORIENTED

Process oriented:
5/5/2013

Many simulation models include elements which occur in defined patterns

The logic associated with such a system or events can be generalized and
defined by a single statement

A simulation language could then translate such statement into the appropriate sequence of events

describes the processes through which the entities in the system flow.
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 a set of standardized statement, provided by the simulation language, our model flexibility is not as great as with the event condition
33

FEATURE PROVIDED BY LANGUAGE


5/5/2013

Conceptual

framework(entities,

attributes,

resource,

queues)

Maintenance of event list Random variable generation Animation Debugging function Output analysis Input analysis Report generation
34

SIMULATION LANGUAGES
5/5/2013

One of the most important aspects of a simulation study is the

computer programming.

Several special-purpose computer simulation languages have been developed to simplify programming.

The best known and most readily available simulation


languages, includes GPSS, GASP IV and SLAM.

Most simulation languages use one of two different modeling approaches or orientations; event scheduling or process interaction.
35

... CONTD.

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.

5/5/2013

Of the general-purpose languages, FORTRAN is the most


commonly used in simulation.

In fact, several simulation languages, including GASP IV and SLAM, use a FORTRAN base.
36

... CONTD.
5/5/2013

To use GASP IV we must provide a main program, an

initialization routine, and the event routines.


For the rest of the program, we use the GASP routines. Because of these prewritten routines, GASP IV provides a great deal of programming flexibility.

GPSS, in contrast to GASP, is a highly structured specialpurpose language.

GPSS does not require writing a program in the usual sense.


37

... CONTD.
5/5/2013

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.
38

... CONTD.

The decision of which language to use is one of the

5/5/2013

most important that a modeler or an analyst must


make in performing a simulation study.

The simulation language offer several advantages.

The most important of these is that the specialpurpose languages provide a natural framework for simulation modeling and most of the features needed in programming a simulation model.
39

VERIFICATION AND VALIDATION


Always assume that your assumption is invalid. Robert F. Tatman

5/5/2013

Good software engineering practices will result in fewer bugs


Top-down, modular design Assertions (anti-bugging)

Say, total packets = packets sent + packets received If not, can halt or warn

Structured walk-through Simplified, deterministic cases

Even if end-simulation will be complicated and non-deterministic, use simple repeatable values (maybe fixed seeds) to debug
40

Tracing (via print statements or debugger)

... VERIFICATION CONTD.


5/5/2013

Continuity tests

Slight change in input should yield slight change in output, otherwise error
Thrput
Thrput

(Undebugged)

(Debugged)

Degeneracy tests

Try extremes (lowest and highest) since may reveal bugs


41

... VERIFICATION CONTD.


5/5/2013

Consistency tests similar inputs produce similar outputs

Ex: 2 sources at 50 pkts/sec produce same total as 1 source at 100 pkts/sec

Seed independence random number generator starting value should not affect final conclusion

(maybe

individual

output,

but

not

overall
42

conclusion)

VALIDATION

Ensure assumptions used are reasonable

5/5/2013

Want final simulated system to be like real system

Unlike verification, techniques to validate one simulation may be different from one model to another Three key aspects to validate:

Assumptions Input parameter values and distributions Output values and conclusions
Expert intuition Real system measurements Theoretical results
43

Compare validity of each to one or more of:


... CONTD.
5/5/2013

Most practical, most common Brainstorm with people knowledgeable in area Assumptions validated first, followed soon after by input. Output validated as soon as output is available (and verified), even if preliminary Present measured results and compare to simulated results (can see if experts can tell the difference)

Which alternative looks invalid? Why?

Throughput
0.2

0.4

0.8

Packet Loss Probability


44

MODEL VALIDATION TECHNIQUE REAL SYSTEM MEASURMENTS


5/5/2013

Most reliable and preferred

May be unfeasible because system does not exist or too expensive


to measure

That could be why simulating in the first place!

But even one or two measurements add an enormous amount to the validity of the simulation

Should

compare

input

values,

output

values,

workload

characterization

Use multiple traces for trace-driven simulations


45

Can use statistical techniques (confidence intervals) to determine if simulated values different than measured

MODEL VALIDATION TECHNIQUE THEORETICAL RESULTS


5/5/2013

Can be used to compare a simplified system with simulated results

May not be useful for sole validation but can be used to complement
measurements or expert intuition

Ex: measurement validates for one processor, while analytic model validates for many processors

Note, there is no such thing as a fully validated model


Would require too many resources and may be impossible Can only show is invalid

Instead, show validation in a few select cases, to lend confidence to the overall model results
46

INPUT MODELLING

You make custom Widgets How do you model the input process? Is it deterministic? Is it random? Look at some data

5/5/2013

ORDERS

1/5/2004 1/12/2004 1/20/2004 1/29/2004

2/3/2004 3/6/2004 2/15/2004 3/15/2004 2/19/2004 3/27/2004 2/25/2004 3/31/2004 2/28/2004

4/10/2004 4/14/2004 4/17/2004 4/21/2004 4/22/2004 4/28/2004

5/2/2004 5/3/2004 5/24/2004 5/26/2004


Now what?

6/4/2004 6/15/2004

47

HISTOGRAM
8

5/5/2013

7 6 5 4 3 2 1 0

[0 ,2 ]

[2 ,4 ]

[4 ,6 ]

[6 ,7 ]

[8 ,1 0]

[1 0, 12 ] [1 2, 14 ] [1 4, 16 ] [1 6, 18 ] [1 8, 20 ]

OTHER OBSERVATIONS

Trend?

Stationary or non-stationary process May require multiple processes


48

Seasonality

20

CHOICES FOR MODELLING


5/5/2013

Use the data directly (trace-driven simulation) Use the data to fit an empirical distribution Use the data to fit a theoretical distribution

ASSUMPTIONS
oTo fit a distribution, the data should be drawn from IID observations oCould it be from more than one distribution? oStatistical test oIs it independent?
49

ABSENCE OF DATA
5/5/2013

We have assumed that we had data to fit a distribution

Sometimes no data is available

Try to obtain minimum, maximum, and mode and/or


mean of the distribution

Documentation SMEs
50

TRIANGULAR DISTRIBUTION
5/5/2013

51

SYMMETRIC BETA DISTRIBUTIONS


a=b=2 a=b=3
5/5/2013

a=b=5

a=b=10

52

SKEWED BETA DISTRIBUTION


a=2, b=4
5/5/2013

53

BENEFITS OF FITTING A PARAMETRIC DISTRIBUTION


5/5/2013

We have focused mainly on the approach where we fit a distribution to data

Benefits:

Fill in gaps and smooth data Make sure tail behavior is represented

Extreme events are very important to the simulation but may not be represented

Can easily incorporate changes in the input process

Change mean, variability, etc.


54

Reflect dependencies in the inputs

WHAT ABOUT DEPENDENCIES


5/5/2013

Assumed so far an IID process

Many processes are not:

A customer places a monthly order. Since the customer keeps inventory of the product, a large order is often followed by a small order

A distributor with several warehouses places monthly orders, and these warehouses can supply the same customers The behavior of customers logging on to a web site depends on

age, gender, income, and where they live

Do not ignore it!


55

SOLUTIONS
5/5/2013

customer places a monthly order.


Should use a time-series model that captures the autocorrelation

distributor with several warehouses


Need a vector time-series model

Customers

logging on to a web site


56

Need a random vector model where each component may have a different distribution

TAXONOMY OF INPUT MODELS


Examples of models
Univariate Time-independent Multivariate
5/5/2013

Discrete Continuous Mixed Discrete Continuous Mixed

Binomial, etc. Normal, gamma, beta, etc. Empirical/Trace-driven Independent binomial Multivariate normal Bivariate-exponential

Discrete-state Markov chains (stationary?)


Discrete-time

Cont.-state
Stochastic Processes
Continuous-time

Time-series models Poisson process (stationary?) Markov process


57

Discrete-state
Cont.-state

WHAT IF IT CHANGES OVER TIME


5/5/2013

Do not ignore it! Non-stationary input process Examples:

Arrivals of customers to a restaurant


Arrivals of email to a server Arrivals of bug discovery in software

Could model as nonhomogeneous Poisson process


58

IS DATA REALITY
5/5/2013

Data

is often

Distorted
Poorly communicated, mistranslated or recorded Data is always old by definition Some of the data is often missing Often only summaries, or collected at certain times This may all be on purpose!

Dated

Deleted

Dependent

Deceptive

59

PROBLEMS WITH FITTING

Fitting an input distribution can be misleading for numerous


5/5/2013

reasons

There is rarely a theoretical justification for the distribution. Simulation is often sensitive to the tails and this is where the problem is!

Selecting the correct model is futile

The model gives the simulation practitioner a false sense of


the model being well-defined

ALTERNATIVE

Use empirical/trace-driven simulation when there is sufficient


data Treat other cases as if there is no data, and use beta distribution
60

RANDOM NUMBER GENERATION

Any simulation with random components requires generating a sequence of


numbers

random

E.g., we have talked about arrival times, service times being drawn from a particular distribution

5/5/2013

We do this by first generating a random number (uniform between [0,1]) and then
transforming it appropriately

THREE ALTERNATIVES

True random numbers


Throw a dice Not possible to do with a computer

Pseudo-random numbers

Deterministic sequence that is statistically indistinguishable from a random sequence


61

Quasi-random numbers

A regular distribution of numbers over the desired interval

WHY IS THIS IMPORTANT?


5/5/2013

Validity

The simulation model may not be valid due to cycles and dependencies in the model

Precision

You can improve the output analysis by carefully

choosing the random numbers


62

PSEUDO-RANDOM NUMBERS

Want an iterative algorithm that outputs numbers on a fixed


5/5/2013

interval

When we subject this sequence to a number of statistical test, we


cannot distinguish it from a random sequence

In reality, it is completely deterministic

LINEAR CONGRUENTIAL GENERATORS (LCG)


Introduced in the early 50s and still in very wide use today Recursive formula

Z i ( aZ i 1 c) mod m a multiplier c increment m modulus Z 0 seed


Every number is determined by these four values

63

GENERATING RANDOM VARIATES


5/5/2013

Say we have fitted an exponential distribution to inter-arrival times of customers.

Every time we anticipate a new customer arrival (place an arrival even on the events list), we need to generate a realization of of the arrival times

Know how to generate unit uniform. Can we use this to generate exponential? (And other distributions)

64

TWO TYPES OF APPROACH


5/5/2013

Direct

Obtain an analytical expression Inverse transform

Requires inverse of the distribution function

Composition & Convolution

For special forms of distribution functions

Indirect

Acceptance-rejection
65

CONCLUSION
5/5/2013

The historical background, need, and modelling of simulation, simulation tool, technique and input modelling are discussed in this presentation.

66

5/5/2013

THANK YOU
VALUABLE SUGGESTIONS

67

S-ar putea să vă placă și