Ns-3 Training Simulator core ns-3 training, June 2016.

Slides:



Advertisements
Similar presentations
INSE - Lectures 19 & 20 SE for Real-Time & SE for Concurrency  Really these are two topics – but rather tangled together.
Advertisements

Simulation Where real stuff starts. ToC 1.What, transience, stationarity 2.How, discrete event, recurrence 3.Accuracy of output 4.Monte Carlo 5.Random.
Power-Window Control A design exploration using Felix VCC Claudio Pinello EE249 Fall 1998 Prof. Alberto Sangiovanni-Vincentelli Mentor: Dr. Alberto Ferrari.
Chapter 13 Embedded Systems
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
NETWORK SIMULATOR 3 Reporter: Chechieh Lin. O UTLINE Introduction NS3 vs. NS2 NS-3 Modules Key Abstractions A First ns-3 Script.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
© 2003, Carla Ellis Simulation Techniques Overview Simulation environments emulation exec- driven sim trace- driven sim stochastic sim Workload parameters.
Ch. 10 For Statement Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
Probability Refresher COMP5416 Advanced Network Technologies.
Variance Reduction Techniques
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
David Adams ATLAS Hybrid Event Store Integration with Athena/StoreGate David Adams BNL March 5, 2002 ATLAS Software Week Event Data Model and Detector.
Introduction to Simulation What is a simulation? A system that represents or emulates the behavior of another system over time; a computer simulation is.
2.3 Output Formatting. Outputting Format Specify the number of spaces, “c”, used to print an integer value with specifier %cd, e.g., %3d, %4d. E.g. printf.
Bill Tucker Austin Community College COSC 1315
Plugin overview Functional Plugins (PMP)
Chapter 9: Value-Returning Functions
OPERATING SYSTEMS CS 3502 Fall 2017
Topics Designing a Program Input, Processing, and Output
User-Written Functions
Programming in R Intro, data and programming structures
Objectives You should be able to describe: Interactive Keyboard Input
Realizing Concurrency using the thread model
Functions, Part 2 of 2 Topics Functions That Return a Value
Module 4 Remote Login.
‘if-else’ & ‘case’ Statements
CS399 New Beginnings Jonathan Walpole.
Deploying and Configuring SSIS Packages
Introduction to Events
Hash Table.
Topics Introduction to File Input and Output
Realizing Concurrency using the thread model
A First Book of ANSI C Fourth Edition
CIS16 Application Development and Programming using Visual Basic.net
Lecture 2 – Monte Carlo method in finance
CS703 - Advanced Operating Systems
ns-3 Waf build system ns-3 Annual Meeting June 2017
Realizing Concurrency using the thread model
Operating Systems.
Exploring the Power of EPDM Tasks - Working with and Developing Tasks in EPDM By: Marc Young XLM Solutions
Variables and Expressions
C++ Concerns: Timing Code, Random Numbers, Memory
Exception Handling Imran Rashid CTO at ManiWeber Technologies.
Interrupts and Exception Handling
Last Class We Covered What makes “good code” good Top down design
Ns-3 Training ns-3 training, June 2017.
Realizing Concurrency using the thread model
Realizing Concurrency using Posix Threads (pthreads)
Realizing Concurrency using the thread model
MAPREDUCE TYPES, FORMATS AND FEATURES
COP 3330 Object-oriented Programming in C++
Ns-3 Tutorial Xin Li.
Chapter 4: Threads.
Ns-3 Training ns-3 training, June 2018.
Topics Designing a Program Input, Processing, and Output
Time Sources and Timing
C++ Concerns: Timing Code, Random Numbers, Memory
Realizing Concurrency using Posix Threads (pthreads)
Topics Designing a Program Input, Processing, and Output
Chapter 6.
Random Sampling using RAN#
Topics Introduction to File Input and Output
Where real stuff starts
DATA STRUCTURES-COLLISION TECHNIQUES
DATA STRUCTURES-COLLISION TECHNIQUES
ns-3 training Tom Henderson ns-3 annual meeting 2019
Interrupts and Exception Handling
Random Sampling using RAN#
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

ns-3 Training Simulator core ns-3 training, June 2016

Simulator and Scheduler Command line arguments Random variables Simulator core Simulation time Events Simulator and Scheduler Command line arguments Random variables Execute a function (may generate additional events) Virtual time Advance the virtual time to the next event (function) ns-3 training, June 2016

Simulator example ns-3 training, June 2016

Simulator example (in Python) ns-3 training, June 2016

Simulation program flow Handle program inputs Configure topology Run simulation Process outputs ns-3 training, June 2016

Command-line arguments Add CommandLine to your program if you want command-line argument parsing Passing --PrintHelp to programs will display command line options, if CommandLine is enabled ./waf --run "sample-simulator --PrintHelp" ns-3 training, June 2016

Time in ns-3 Time is stored as a large integer in ns-3 Minimize floating point discrepancies across platforms Special Time classes are provided to manipulate time (such as standard operators) Default time resolution is nanoseconds, but can be set to other resolutions Note: Changing resolution is not well used/tested Time objects can be set by floating-point values and can export floating-point values double timeDouble = t.GetSeconds(); Best practice is to avoid floating point conversions where possible ns-3 training, June 2016

Events are just function calls that execute at a simulated time Events in ns-3 Events are just function calls that execute at a simulated time i.e. callbacks this is another difference compared to other simulators, which often use special "event handlers" in each model Events have IDs to allow them to be cancelled or to test their status ns-3 training, June 2016

Simulator and Schedulers The Simulator class holds a scheduler, and provides the API to schedule events, start, stop, and cleanup memory Several scheduler data structures (calendar, heap, list, map) are possible "RealTime" simulation implementation aligns the simulation time to wall-clock time two policies (hard and soft limit) available when the simulation and real time diverge ns-3 training, June 2016

Random Variables Currently implemented distributions from src/core/examples/sample-rng-plot.py Currently implemented distributions Uniform: values uniformly distributed in an interval Constant: value is always the same (not really random) Sequential: return a sequential list of predefined values Exponential: exponential distribution (poisson process) Normal (gaussian), Log-Normal, Pareto, Weibull, triangular ns-3 training, June 2016

Random variables and independent replications Many simulation uses involve running a number of independent replications of the same scenario In ns-3, this is typically performed by incrementing the simulation run number not by changing seeds ns-3 training, June 2016

ns-3 random number generator Uses the MRG32k3a generator from Pierre L'Ecuyer http://www.iro.umontreal.ca/~lecuyer/myftp/papers/str eams00.pdf Period of PRNG is 3.1x10^57 Partitions a pseudo-random number generator into uncorrelated streams and substreams Each RandomVariableStream gets its own stream This stream partitioned into substreams ns-3 training, June 2016

Key Terminology Seed: A set of values that generates an entirely new PRNG sequence Stream: The PRNG sequence is divided into non-overlapping intervals called streams Run Number (substream): Each stream is further divided to substreams, indexed by a variable called the run number. ns-3 training, June 2016

Streams and Substreams Incrementing the Run Number will move all streams to a new substream Each ns-3 RandomVariableStream object is assigned to a stream (by default, randomly) Figure source: Pierre L’Ecuyer, Richard Simard, E. Jack Chen, and W. David Kelton. An object-oriented random number package with many long streams and substreams. Operations Research, 2001. ns-3 training, June 2016

Run number vs. seed If you increment the seed of the PRNG, the streams of random variable objects across different runs are not guaranteed to be uncorrelated If you fix the seed, but increment the run number, you will get uncorrelated streams ns-3 training, June 2016

Setting the stream number The ns-3 implementation provides access to 2^64 streams 2^63 are placed in a pool for automatic assignment, and 2^63 are reserved for fixed assignment Users may optionally assign a stream number index to a random variable using the SetStream () method. This allows better control over selected random variables Many helpers have AssignStreams () methods to do this across many such random variables ns-3 training, June 2016

Putting it together Example of scheduled event Demo real-time, command-line, random variables... ns-3 training, June 2016