180 likes | 429 Views
Simulation Overview. COMP5416. Simulation. Simulation: allows experiments on a software model of some complex system. It allows us to perform studies of complicated systems, and where it would be either impractical or impossible to experiment on the actual system.
E N D
Simulation Overview COMP5416
Simulation • Simulation: allows experiments on a software model of some complex system. • It allows us to perform studies of complicated systems, and where it would be either impractical or impossible to experiment on the actual system. • Simulation can be an important part of conducting design studies of proposed systems, in order to determine performance differences between different configurations.
Simulation • Describe the interaction between the elements of the system by a software model. • Once this software model has been generated, it can be driven by providing some input data describing the timing of the various events in the model. • Timing information may be experimentally measured information, but for stochastic simulation is usually provided by a random number generator. • Simulation basically involves conducting experiments on a model of the system.
Types of Simulation • Discrete event simulation • Associate times with all events • Step through the actions at these times • Markovian simulation (for Markovian systems) • aka Roulette simulation • No timing information needed • Jump from event to event, without needing to know the times between these events • Monte-Carlo simulation • Independent samples from some analytic solution • Rare event simulation • Simulates a different system which makes the rare events less rare!!
Simulation approaches • Code in some HLL: C, C++, Java,…. • Code in some HLL, using some simulation-specific HLL library • Use a simulation package: ns, ssf,Opnet… • Ns (http://www.isi.edu/nsnam/ns/): “Ns is a discrete event simulator targeted at networking research. Ns provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks” • Ssfnet (http://www.ssfnet.org/): “A public-domain standard for discrete-event simulation of large, complex systems in Java and C++. “ • Opnet (www.opnet.com): Commercial network simulation product
t1, t1info t2, t2info t3, t3info t4, t4info t5, t5info t6, t6info t7, t7info Discrete Event Simulation: Event List • Key is the event list • Contains times of scheduled events • All events must be scheduled • Assuming t1<t2<t3<t4<t5<t6<t7 • Next event
t1, t1info t2, t2info t3, t3info tn, tninfo t4, t4info t5, t5info t6, t6info t7, t7info t4, t4info t5, t5info t6, t6info t7, t7info tn, tninfo Discrete Event Simulation: Event List • Now schedule new event at time tn where t3<tn<t4
Example: Single Server Queue Events: • Packet arrives and joins queue • Packet begins service • Packet completes service
Example: Single Server Queue • Packet arrives and joins queue • Increment queue; if queue was empty, begin service of packet • Packet begins service • Schedule completion of packet service • Packet completes service • Decrement queue
Scheduling Arrivals • Single server queue example • Schedule all arrivals at start • Use bootstrapping: schedule next arrival when prior arrival happens • Or a combination of the above…
Markovian Simulation Relies on memoryless property of negative-exponential distribution Single Server Queue Example • Arrivals Poisson at rate l • Service neg-exponential at rate m • Next event • Arrival with probability l/(l+m) so long as a packet is present; otherwise with probability 1.0 • Departure with probability m/(l+m) so long as a packet is present • Simulation just needs to determine type of next event • (i.e. arrival or departure)
probability 1 value 1 Generating Random Variables • Usually an random number generator which generates pseudo-random rv’s uniformly distributed on [0,1]
Generating Random Variables • To generate other random variables:If distribution function is explicitly invertibleExample: i.e. generate Y uniform[0,1], then apply the inverse
Confidence Interval, with probability x%, true mean lies within this range Estimated Mean Confidence Intervals • Simulation is an experiment of a software model • This means that we MUST analyse the simulation results statistically
Confidence Intervals OR??
More Information • B.D. Ripley, Stochastic Simulation, John Wiley and Sons, 1987 • B.D. Ripley, "Uses and abuses of statistical simulation", Mathematical Programming Vol 42, pp 53-68, 1988 • A.M. Law and W.D. Kelton, Simulation Modelling and Analysis, McGraw-Hill, • R.F. Garzia and M.R. Garzia (eds), Network Modelling, Simulation and Analysis, Marcel Dekke 1990 • E.D. Lazowska, Quantitative System Performance: Computer System Analysis using Queueing Network Models, Prentice-Hall, 1984 • Telecom Australia, A Course in Teletraffic Engineering, Telecom Australia, 1978 • The Network Simulator - ns-2, http://www.isi.edu/nsnam/ns/ • Nam: Network Animator, http://www.isi.edu/nsnam/nam/