16-02-2013, 10:36 AM
Network Simulator Tutorial
Network Simulator.ppt (Size: 471.5 KB / Downloads: 76)
Why Simulation?
real-system not available, is complex/costly or dangerous (eg: space simulations, flight simulations)
quickly evaluate design alternatives (eg: different system configurations)
evaluate complex functions for which closed form formulas or numerical techniques not available
Simulation: advantages/drawbacks
advantages:
sometimes cheaper
find bugs (in design) in advance
generality: over analytic/numerical techniques
detail: can simulate system details at arbitrary level
drawbacks:
caution: does model reflect reality
large scale systems: lots of resources to simulate (especially accurately simulate)
may be slow (computationally expensive – 1 min real time could be hours of simulated time)
art: determining right level of model complexity
statistical uncertainty in results
Programming a simulation
What ‘s in a simulation program?
simulated time: internal (to simulation program) variable that keeps track of simulated time
system “state”: variables maintained by simulation program define system “state”
e.g., may track number (possibly order) of packets in queue, current value of retransmission timer
events: points in time when system changes state
each event has associate event time
e.g., arrival of packet to queue, departure from queue
precisely at these points in time that simulation must take action (change state and may cause new future events)
model for time between events (probabilistic) caused by external environment
What is NS2?
Network Simulator
A package of tools that simulates behavior of networks
Create Network Topologies
Log events that happen under any load
Analyze events to understand the network behavior
Basics of using NS2
Define Network topology, load, output files in Tcl Script
To run,
$ ns simple_network.tcl
Internally, NS2 instantiates C++ classes based on the tcl scripts
Output is in form of trace files