




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Booklet of Network Modeling and Simulation
Course code CS Credits 3+
Instructor
Dr. Ali Hammad Akbar
Lecturing style
Video lectures of short
duration (5-7 minutes)
Evaluation
Quizzes
Assignment
Simulation modules
Mid-term and final
What is NeMS? Network Modeling and Simulation is often considered a single term. In reality, it is not! Simulation is the imitation of behaviour of real-world system or Computational re-enactment according to rules described in model. Whereas modeling is a step that precedes simulations. Together they form an iterative process approximating the real world systems. Model is the logical representation of a complex entity, system, phenomena or a process. In communications, network model could be analytical representation, mathematical form as a state Machine or closed or approximate form. Computer simulation is the execution of computer software that reproduces behavior with a certain degree of accuracy to provide visual insight. It is basically a template on which a computer program runs. It has Inputs Outputs Behaviour
Formally, simulations are pieces of computer software that implement algorithms, take inputs and give outputs.
The model definition could be Descriptive Analytical Mathematical Algorithmic
The computer models can be described into various types Stochastic vs Deterministic Continuous vs discrete Steady state vs Dynamic Local or Distributed Linear or nonlinear Open or closed These models must be applied according to the perspective. It is important to Model only what you understand. Likewise, understanding your model is equally necessary. Model what you need & no more so that it is neither underdefined nor overdefined.
Simulation Building Process Consider a one hop communication scenario between two wireless notebooks connected through a WiFi AP. The simulation entities would include wireless computers and their packets (multiple instances), WiFi AP (single instance), and a traffic generator (single instance) that creates wireless computers and their packets. The states of the system would include WiFi AP (idle or busy). Each computer generates a number of packets with each packet successful/failed. The events would include wireless computer creation, packet generation, wireless AP activity. Queues would be needed to schedule the events. These would contain frames waiting in output queue of wireless computer and frames (packets) at WiFi AP input queue. To make the simulation exciting, dynamic and insightful, randomization has to be performed. These would include random realizations of packet lengths, no. of frames per wireless computer, no. of wireless computers, BER (and PER) and packet drop ratio in WiFi AP input queue. It is further needed to distribute various entities and events. The distributions could include Uniform and Gaussian etc for packet lengths and no. of frames per wireless computer.
How Does The Simulation Run? Following steps are executed during the running of the simulation. Inputs created/initialized Events of transmission, reception and noise occur Randomness causes queues to behave and err Packet successes/failures Simulation logs are compiled and presented as the output in desirable formats
Components of a simulator A self-contained program Event queue Simulation clock State variables Event routines Input routine Report generation routine Initialization routine Main program
Types of simulations Monte Carlo simulation Trace driven Discrete events Continuous events
When to simulate Analytical model not feasible (complex) Analytical model not possible (too simple) Simulate to verify analysis Otherwise simulations are unnecessary
Scope & type of simulation determine best choice Object oriented vs. procedural
Unverified models Programming is non trivial Semantic mistakes make simulations get Wrong results Misleading results Modular verification a must
Improper initial conditions Initial condition not steady state Often a late realization Surprisingly wrong results May never converge
Short run times Strong dependence on Initial conditions Don't achieve true steady state
Poor random number generators Lacking pseudo-random sequence leads to predictability Wrong choice of seed value could cause inadvertent correlation between processes
Inadequate time estimate Models overstate the simulations
No achievable goals Goals not defined
Incomplete mix of essential skills Domain knowledge Statistics Programming Project management Past experience
Inadequate level of user participation
From modeling to implementation UI design Output analysis
Inability to manage simulation project Simulations are not monolithic Need software engineering tools
Simulation inaccuracies Over reliance on link budget methods for abstraction Overly simplistic modeling of radio layers
Over reliance on link budget methods for abstraction Link budget losses overly static
Overly simplistic modeling of radio layers Lowest layer often ignored
Development of Systems Simulation
A “Still I am not dead yet!” scenario
Available Not available h = height (feet) Mass of object t = time in motion (seconds) Air resistance v = initial velocity (feet per second, + is up) Location of object s = initial height (feet) a = acceleration (feet per second per second)
/* Height of an object moving under gravity. / / Initial height s and velocity v constants. */ main() { float h, v = 100.0, s = 1000.0; int t;
Calibration Parameter estimation Tweaking/tuning to ensure that simulated data follows real data
“What-if” analysis Performance measures with different inputs
Sensitivity analysis Relative importance of different parameters with respect to output Even with respect to each other
Life cycle of Simulation Development
Recommended Text and References
NeMS contents cover Well known mathematical models, equations and forms Widely used simulation tools and code reusability Their inter-relationship
NeMS contents don't cover
Mathematical derivations from scratch Programming dexterity
Uptill now Basics of NeMS Mohsen Guizani et al, “Network Modeling and Simulation” John Wiley , 2010.
Basics of NeMS Jack Burbank et al, “An Introduction to Network Modeling & Simulation for the Practicing Engineer” John Wiley , 2011.
Basics of NeMS John A. Sokolowski & Catherine M. Banks, “Modeling and Simulation Fundamentals” John Wiley , 2010.
Next Roadmap
TicToc tutorial
Compiling and installing on Windows self-contained Enter OMNeT++ folder that you unzipped Run the file called Mingwenv.cmd
Compile & Install When terminal appears, enter the commands /.configure Make
Debug mode Does not optimize the binary it produces Source code and generated instructions relationship is complex Allows accurate breakpoints setting Allows code step-through one line at a time Compiled with full symbolic debug information
Release mode Enables optimizations Generates instructions without any debug data Lots of code could be completely removed or rewritten Resulting executable may not match with written code
Running first time OMNeT++ comes with an Eclipse-based Simulation IDE Type omnetpp
Minimum GNU environment for Windows Compilers provide access to functionality Of Microsoft C runtime and some Language-specific runtimes
Build process produces Debug and release Binaries
Debug is elaborate But slow
Release is optimized & fast
Select the default workspace A workspace is a logical collection of projects A workspace called p2p may contain only peer to peer applications
Design of OMNET++
Model Structure Model consists of modules Modules communicate with message passing Modules are C++ files
Channels
Message; tuple (time stamp, arbitrary data, ...) Network; A compound module with no external gates
Module Parameters Pass configuration data to simple modules Define model topology String, numeric, boolean Constants, random numbers Expressions as references
Internal architecture of OMNET++
OMNeT++ simulation programs possess a modular structure.
Model Component Library Consists of the code of compiled simple and compound modules
Simulation Kernel & SIM Class Library Modules are instantiated and concrete simulation model is built by simulation kernel SIM covers most of the common simulation tasks through classes
Envir, Cmdenv and Tkenv Libraries Simulation executes in an environment Defines and determines
Typical Ingredients of NED description Network definitions Compound module definitions Simple module declarations
Network Definition Network definitions are compound modules
Simple Module Declaration
My_Module
Compound module name= standardHost
Inside standardHost
More About NED Language Inheritance Modules and channels can be subclassed Derived modules and channels may add
Example
Interface instantiation Module and channel interfaces can be used as a placeholder
Example:
GenericTCPClientApp Module
Derived (Extended) Module
FTPApp
BaseHost
BaseHost + WebClientApp
Simple Compound
ConstantSpeedMobility RandomWayPointMobility
Run time
IMobility
MobileHost compound module
Design time