Docsity

Simulation in Computer Networks: A Comprehensive Guide - Prof. Talib, Cheat Sheet of Career Counseling

Partial preview of the text

Download Simulation in Computer Networks: A Comprehensive Guide - Prof. Talib and more Cheat Sheet Career Counseling in PDF only on Docsity!

Booklet of Network Modeling and Simulation

CONTENT

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

  • Types/diversity of simulation parameters  Interpreted vs. compiled
  • Machine dependence
  • Speed

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

  • Use celebrated RNGs

Inadequate time estimate  Models overstate the simulations

  • Implementations get delayed  Software development life cycle must assess model complexity

No achievable goals  Goals not defined

  • Tangible output analysis
  • Logs and trace files  Goals are unreal
  • Affects simulation complexity and implementation

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

  • Multivariate design
  • Code management
  • Track changes

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

  • Fair enough for steady state analysis
  • Dynamic analysis not possible  Results are misleading

Overly simplistic modeling of radio layers  Lowest layer often ignored

  • No bit level BER & delay  Often the Achilles heel  Wrong results in highly dynamic use cases

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

  • Implement simulation class library
  • Run in simulation kernel

 Channels

  • Connection types with specific properties
  • Reusable at several places
  • Standard Host talking to another Standard Host via an Ethernet cable

 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

  • Generate random number (distributions)
  • Queues (F IFO, priority)  Messages (hold arbitrary data structures)  Routing (explore topology, generate graph data structure)

Envir, Cmdenv and Tkenv Libraries  Simulation executes in an environment  Defines and determines

  • Where input data come from
  • Where simulation results go to
  • What happens to debugging output?
  • Controls the simulation execution
  • How model is visualized What is NED Language?  A network description language  Creates network topologies in OMNeT++  You create alternately create topology graphically as well  Correspondingly NED source code is automatically generated

Typical Ingredients of NED description  Network definitions  Compound module definitions  Simple module declarations

Network Definition  Network definitions are compound modules

  • Self-contained simulation models

Simple Module Declaration

Module name

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

  • New parameters
  • Gates  Similarly compound modules may add
  • New parameters
  • Connections

Example

Interface instantiation  Module and channel interfaces can be used as a placeholder

  • where normally a module or channel type would be used  Concrete module or channel type determined
  • At network setup time by a parameter

Example:

GenericTCPClientApp Module

Derived (Extended) Module

FTPApp

BaseHost

BaseHost + WebClientApp

Simple Compound

ConstantSpeedMobility RandomWayPointMobility

Run time

IMobility

MobileHost compound module

Design time