Upload
trinhmien
View
218
Download
0
Embed Size (px)
Citation preview
Stochastic Simulation of Communication Networks
and their Protocolsand their Protocols
Prof. Dr. Carmelita Görg
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 1
Table of Contents
1 General Introduction1 General Introduction2 Random Number Generation3 S i i l E l i3 Statistical Evaluation4 ComNets Class Library (CNCL)5 OPNET6 Network Simulator (ns)6 Network Simulator (ns)7 SDL + OpenWNS8 l d M h d8 Simulation Speed-Up Methods
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 2
OverviewOverv ew• What is simulation?
Wh simul ti ns??
• Why simulations?• Classification of simulations• Discrete Event Simulation (DES)
E t S h d li– Event Scheduling– Random Number Generation– Statistical Evaluation
• Simulation systems and applicationsSimulation systems and applications
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 3
References• P. Bratley, B.L. Fox, L.E. Schrage: A Guide to
Simulation. Springer 1983, 1987.• B.P. Zeigler, H. Praehofer, T.G. Kim: Theory of
Modeling and Simulation, Academic Press 1976, 2000.D Möll M d llbild Si l ti d • D. Möller: Modellbildung, Simulation und Identifikation dynamischer Systeme. Springer Lehrbuch 1992.
• R.Y. Rubinstein, B. Melamed: Modern Simulation and Modeling. Wiley Series in Probability and Statistics 19981998.
• P.A.W. Lewis, E.J. Orav: Simulation Methodology for Statisticians Operation Analysts and Engineers Vol Statisticians, Operation Analysts, and Engineers. Vol. 1. Wadsworth 1989.
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 4
References• G.S. Fishman: Principles of Discrete Event
Simulation. J. Wiley and Sons. New York, S mu at on. J. W y an Sons. N w Yor , 1978.
• A.M. Law, W.D. Kelton: Simulation Modeling & .M. L w, W.D. K n mu n M ng &Analysis. McGraw-Hill, 1991.
• Kreutzer W.: System Simulation -Kreutzer, W.: System Simulation Programming Styles and Languages, Addison Wesley Publishers - Reading (U.S.A.) 1986.Wesley Publishers Reading (U.S.A.) 1986.
• L. Devroye: Non-Uniform Random Variate Generation. Springer, New York, 1986.Generation. Springer, New York, 1986.
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 5
Web References• www.informs-sim.org • ...
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 6
Historical Development• Pre-computer era, e.g.:
Buffon (1777) coin experiments 4040 trialsBuffon (1777) coin experiments, 4040 trialsPearson (1857-1936) 24000 trialsKendall (approx 1938): random number Kendall (approx. 1938): random number generation using the London telephone directory directory
• Von Neumann (1944): Monte Carlo Method for the calculation of complex formulas in nuclear the calculation of complex formulas in nuclear physics1946 1956 “t ffi hi ”• 1946-1956: “traffic machines”simulation of telephone systems
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 7
Historical Development• Development of special simulation languages
– GPSS (IBM 1961 General Purpose Simulation – GPSS (IBM, 1961, General Purpose Simulation System)
– SIMULA (class concept Norwegian Computing SIMULA (class concept, Norwegian Computing Center, 1963, Simula 67)
– SIMSCRIPT (based on FORTRAN)SIMSCRIP (based on FOR RAN)• Development of special multiprocessor
simulatorssimulators– network structure (Chandy 1981)– function oriented structure – function oriented structure
(Lehnert 1979, Barel 1983)
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 8
Random Experiments and their Application Areas
h i i l iStochastic Simulationof
Complex Systems
ComputerRandom
Experiments
Improved Simulation Controlby
New Evaluation MethodsExperiments New Evaluation Methods
Modeling and Validationof
Statistical Concepts
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 9
Statistical Concepts
Communication Network Examplese.g.
S & W i P l• Stop & Wait Protocol• WLAN MAC ProtocolWLAN MAC Protocol• Ad hoc networks• TCP/IP Protocols• HSDPA ProtocolsHSDPA Protocols• ...
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 10
Evaluation Goals• Goal of the study of systems or their models
i th l ti f h t i ti f is the evaluation of some characteristics of the system
• Gain insight into system operation on a more conceptual level
• Compare two systems with respect to particular metricsp
• Tune system behavior for specific situations• Judge a priori the effects of • Judge a priori the effects of
reconfiguration/upgradingReduce c sts
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 11
• Reduce costs
Ways to study a systemy y ySystem
Experiment h h
Experiment h with the
actual systemwith a
system model
Mathematical Model
Physical Model ModelModel
SimulationAnalytical Solution
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 12
What is simulation?• simulation is imitation
h b d f t t i • has been used for many years to train, explain, evaluate and entertain
• the facility or process of interest is usually called a systemy y
• the assumptions, which usually take the form of mathematical or logical form of mathematical or logical relationships, constitute a modelsimul ti ns nd th ir m d ls r • simulations and their models are abstractions of reality
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 13
Why Simulations?y• Extensively used to verify
the correctness of designsg• Realistic models are often too complex to
evaluate analyticallyy y• The simulation approach gives more
flexibility and conveniencey• Accelerates and replaces effectively
the "wait and see" anxieties• Safely plays out the "what-if"
scenario from the artificial world
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 14
Real System PlannedSystemy System
ModelingModeling
Model
Measurement Simulation AnalyticCalculation
Result Result Result
Realizeplanned
ModifyPlanned
Validation
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 15
plannedsystem
Planned System
Performance Evaluation Cycle
Simulation Classification
dynamic staticy
discrete hybridcontinuous
t h ti d t i i tistochastic deterministic
event driven activity orientedtransaction driven
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 16
Classification of Simulations1. Static vs. Dynamic Simulation models
Static model: representation of a s st m t p ti l tim s st m system at a particular time, or a system in which time simply plays no role.Example: Monte Carlo model
Dynamic model: represents a system as it evolves over timeit evolves over time.Example: a WLAN network
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 17
Classification of Simulations2. Deterministic vs. Stochastic Simulation
ModelsDeterministic model: If a simulation model does not contain any probabilistic (i.e., y prandom) components, it is called deterministic.
Example: a system of differential equationsd ibi h i l ti i ht b h describing a chemical reaction might be such a model.
Stochastic model: Many systems however Stochastic model: Many systems, however, must be modeled as having at least some random input components and these give rise random input components, and these give rise to stochastic simulation models.
Example: Most queueing and inventory systems are
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 18
p q g y ymodeled stochastically.
Classification of Simulations3. Continuous vs. discrete time
Simulation modelsDefined analogous to the way discrete and Defined analogous to the way discrete and continuous systems are defined, i.e.,
a discrete system is one in which the state a r t y t m n n w t tat variables change instantaneously at separated points in time, andin a continuous system the state variables change continuously with respect to time.
It is important to mention that a discrete model is not always used to model a discrete
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 19
ysystem, and vice-versa.
Application Areas• Determining hardware requirements or
protocols for communication networksp
• Determining hardware and software requirements for
g qa computer system
• Designing and analyzing logistic systems (manufacturing and transport)(manufacturing and transport)
• Designing and operating transportation systems such as airports, freeways, ports and sub-waysE l ti d i f i i ti h • Evaluating designs for service organizations such as call centers, fast-food restaurants, hospitals, post offices, gas stations, …p g
• Re-engineering of business processes• Evaluating military systems or their logistic
requirements
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 20
requirements• ...
Drawbacks• No exact answers, only approximationsy pp• Get random output from stochastic
simulations careful output analysis simulations, careful output analysis necessary as standard statistical
th d i ht t kmethods might not work• Development of the model pm f m
takes a lot of time
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 21
Discrete-Event Simulation• State variables change instantaneously at
t i t i ti separate points in time
• State transitions are triggered by eventsState transitions are triggered by events
• Thus, simulation models considered here are di t t d i d t h tidiscrete-event, dynamic and stochastic
• Example: Example: CNCL (Communication Network Class Library)-a portable C++ library providing a base for all p y p gC++ applications
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 22
G/G/1 Model
1Arrival (λa) Server (λb)b
b λτ 1
=
FIFO- QueueFIFO- Queue
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 23
Discrete Event SimulationsExample: A simple queuing system
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 24
System Terminologyy gy• State:
A variable characterizing an attribute in the system, b f b f e.g., number of jobs waiting for processing or
level of stock in inventory systems• Event: An occurrence at a point in time which may • Event: An occurrence at a point in time which may
change the state of the system, e.g., arrival of a customer or start of work on a job
• Entity: An object that passes through the system, e.g., jobs in the queue or orders in a factory. Often an event (e g arrival) is associated with an Often an event (e.g., arrival) is associated with an entity (e.g., customer).
• Queue: QA queue is not only a physical queue of people, but any place where entities are waiting to be processed
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 25
System Terminologyy gy• Creating: Creating is causing an arrival of a new
entity to the system at some point in timeS h d li S h d li i th t f i i • Scheduling: Scheduling is the act of assigning a new future event to an existing entity
• Random Variable: • Random Variable: A random variable is a quantity that is uncertain– Interarrival time between two incoming jobs (e.g.
fl h f f g j ( g
message, flights, number of defective parts in a shipment)
• Random Variate: A random variate is an Random Variate: A random variate is an artificially generated random variable
• Distribution: A distribution is the mathematical Distribution A d str but on s the mathematical law which governs the probabilistic features of a random variable
E ti ti l l di t ib tiProf. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 26
– E.g. negative exponential or normal distribution
Steps of a SimulationpProblem Formulation
• Identify controllable and uncontrollable inputsy p• Identify constraints on the decision variables• Define measure of system performance
d bj ti f tiand an objective function• Develop a preliminary model structure to interrelate
the inputs and the measure of performancethe inputs and the measure of performance
S tControllable Input OutputSystemControllable Input Output
Uncontrollable Input
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 27
(from the outside world)
Steps of the Simulation• Descriptive Analysis
D t C ll ti d A l i f I t V i bl– Data Collection and Analysis of Input Variables– Computer Simulation Model Development
V lid i– Validation
and finallyand finally
• Performance Evaluation– Pre-scriptive Analysis:
Optimization or Goal Seeking– Post-prescriptive Analysis:
Sensitivity and What-If Analysis
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 28
Steps in a Simulation Studyp y
Problem formulation Set objectives and plans Conceptual modelProblem formulation Set objectives and plans Conceptual model
Collect dataValidation
Create simulation model
Production runs and analysis Experimental designDocumentation
and report
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 29
Structure of a Simulation System Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 30
Structure of a Simulation System (adapted from Kreutzer 1986)
D t il f th t h t t Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 31
Detail of the event approach structure (from Kreutzer 1986)
(Future) Event List
also called SQS (sequencing set) in Simula
t1 ≤ t2 ≤ tn
t1
E1
t2
E2
tn
En
time t
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 32
Event List• The event list controls
the simulationSimulation at Mensa
the simulation• It contains all the
future events (FEL) 1t arrival
t i l tithat are scheduled• It is ordered by
increasing time of
2t service completion at cashier 2
increasing time of event scheduler
• Events can be
service completionat meal 1
3t
Some state variablesE nt can categorized as primary and conditional events
4t finish eatingSome state variablesPeople in line 1People at meal line 1&2
conditional events• E.g.: CNEventHandler,
CNEventScheduler, 5t finish eating
People at cashier 1&2People eating at tables
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 33
NEventScheduler, etc. in CNCL
List of Events
Discrete Event Simulation: “Model Time“ and “Processing Time“
t : E t : E t : Emodel time =simulation time
t1, E1 t2, E2 t3, E3
t1 : E1 t2 : E2 t3 : E3
e.g., h, ms, μs
e.g., ms, μs
T T
processing time = CPU time
Ts TsTE1 Ts TE2 TE3
ti : event / (process) planning timeEi : event routine resp. processTs : administration time
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 34
Ts administration timeTEi : processing time event Ei
Example: Simulation IntroductionAssume the example of a gas station (or super market, doctor‘s office, …)• Why do we simulate?• What does the model of the gas station look like?What does the model of the gas station look like?
Make a diagram of the model identifying the system components.Name the parameters needed to characterize the system.Which results could be obtained by the simulation?
• How can you best model a queue on a computer and why?• How can you best model a queue on a computer and why?What would an implementation look like?What is the difference between a queue and a list?Which functions are needed for a queue (list)?
h d l f h d f h l • Is the model of the gas station a good mapping of the real system?What potential improvements are possible?
• Describe a traffic model for the gas station model? Which additional parameters are needed?Which additional parameters are needed?
• Why are event-oriented systems usually preferred to other systems (e.g. periodic)?What are the advantages?N h i h i l i f h i • Name the events in the simulation of the gas station.
• Describe the idealized usage of simulation for the introduction of a new (mobile) communication network
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 35
for the introduction of a new (mobile) communication network.
Exercise 1: Probability and Correlation 1. The cumulative distribution function (cdf)(Verteilungsfunktion) FX(x)of a random variable (RV) Xof a random variable (RV) Xresp. the probability density function (pdf) fX(x)is defined as:
∫ ∞−=≤=
w
XX dxxfwXPwF )(}{)(
xdF )(resp.
A random variable is defined: X = 10i dx
xdFxf XX
)()( =
where i stands for all possible realizations of arandom experiment tossing a fair die. Draw the cdf and the pdf of this experiment!Draw the cdf and the pdf of this experiment!
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 36
Exercise 1.2 (cont.)Distributions can be characterized by their moments. The most prominent moments are expectation (Erwartungswert) (mean, Mittelwert)
and variance (Varianz), that are a measure for the distribution of the samples (Stichprobenwerte) around the mean value. of th samp s (St chpro nw rt ) aroun th m an a u .
The expectation E{X} resp. μX and the variance бX of a random variable X are defined as:
∫∫
∞+
+∞
∞−== dxxxfXE X )(}{ μ
where бX is called standard deviation (Standardabweichung) (бX ≥ 0).In a simulation experiment only a finite sample of values is available from the possible result set.
∫∞+
∞−−=−= dxxfxXE
X)()(}){( 222 μμσ
p y f p f f pThis leads to the usage of estimators (Schätzer), that will approach the exact value for mean
value and variance as more values are added to the sample.The following estimators are used as expectation and variance:
1~}{N
XE ∑2
1
22
1
)(1
1~
1~}{
X
N
iiX
iX
xN
xN
XE
Xμσσ
μμ
∑
∑
=
−−
=≈
=≈=
Which problems are to be expected when using these estimators in a simulation program?Can the estimator of the variance be rearranged in such a way that it is better suited for
implementation? Which disadvantages can this rearranged estimator have?
1i=
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 37
Which disadvantages can this rearranged estimator have?
Exercise 1.3 (cont.)An important aspect in simulation experiments is the dependency of values
between each other, called correlation (Korrelation). A measure for the correlation of two random variables is the (global) (g )
correlation coefficient (Korrelationskoeffizient) : ρ. First the covariance (Kovarianz) C of two random variables X and Y is defined
as follows:
Using the definition of the global correlation coefficient shows the following:
}{}{}{)})({( YEXEXYEYXEC YX −=−−= μμ
and YX
Cσσ
ρ =YXC σσ≤||
and thus |ρ| ≤ 1.
What is the value of C and ρ in the uncorrelated case?
Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 1 - 38