introduction to network simulator-2(ns-2)
Post on 07-Aug-2015
75 Views
Preview:
TRANSCRIPT
Network Simulator (NS-2)
Presented By:
Praveen Kumar Sheri
2
Agenda Overview of NS-2 History Current Status Platforms Supported Discrete Event Simulator NS-2 Environment NS-2 Hierarchy NS-2 Architecture
Node Architecture Multicast Node Architecture Packet Structure Links Traffic Flow
Example
3
Overview of NS-2
Discrete Event Simulator Packet level Modeling Network protocols
Collection of Various protocols at multiple layers TCP(reno, tahoe, vegas, sack) MAC(802.11, 802.3, TDMA) Ad-hoc Routing (DSDV, DSR, AODV, TORA) Sensor Network (diffusion, gaf) Multicast protocols, Satellite protocols, and many
others
4
Overview of NS-2 Maintained through VINT project NS2 :collaborative simulation environment
Freely distributed and open source Supports NT research and education
Protocol design , traffic analysis etc. Provides common reference
5
History
1995 : Developed by LBL through support of DARPA
1996: NS was extended and distributed by VINT project
1997: Satellite models added @ UCB 1999: Wireless models added @ CMU Recent incorporation of emulation
6
Current status
Releases: Periodic releases (currently 2.35,NS-3) Daily snapshots (probably compiles and works,
but “unstable”) Available from: USC/ISI, UC Berkeley, UK mirror More than 10k users from hundreds of univs
7
Platforms supported Most UNIX and UNIX-like systems
FreeBSD Linux Solaris
Windows 98/2000/2003/XP Cygwin required Some work , some doesnt
8
NS-2 : Components NS – Simulator NAM – Network AniMator
visual demonstration of NS output Preprocessing
Handwritten TCL or Topology generator
Post analysis Trace analysis using Perl/TCL/AWK/MATLAB
9
User’s Perspective From the user’s perspective, NS−2 is an
OTcl interpreter that takes an OTcl script as input and produces a trace file as output.
10
Discrete event simulator
ns-2 is an discrete event driven simulation Physical activities are translated to events Events are queued and processed in the order of their
scheduled occurrences Time progresses as the events are processed
1 2
Time: 1.5 sec Time: 1.7 sec
Time: 1.8 secTime: 2.0 sec
© Varaprasad Reddy 11
Event Scheduler
Non-Real time schedulers Implementations : List , Heap , Calender Calender is default
Real time schedulers Used for emulation for direct interaction with
real NT. Basic use of an event scheduler:
schedule simulation events, such as when to start an FTP application, when to finish a simulation, or for simulation scenario generation prior to a simulation run.
12
NS-2 Environment
Simulation Scenario
Tcl Script
C++ Implementation
1 2
set ns_ [new Simulator]
set node_(0) [$ns_ node]
set node_(1) [$ns_ node]
class MobileNode : public Node {
friend class PositionHandler;public: MobileNode();
••
}
13
NS-2 Hierarchy
A d dr
R e p lica to r
M C a s t
M P a th
H a sh
C la ss ife r
D e la y
A ge nt
A p p lica tion
Q ue ue
T ra ce
C o n ne c to r
N S O je ct
T c lO b je ct
14
NS-2 Hierarchy
U D P
R B P
R e no
R B P
V eg as
S a ck1
N e w R e no
T ap
S in k
F u llT C P
A d ap tive
S R M
T C P D S D V A O D V T O R A D S R
A ge nt
T e ln e t
E xpo n en tia l
P are to
C B R
T ra ce
T ra ff ic
F T P
A p p lica tion
D ro p ta il
R E D
F Q
S F Q
D R R
C B Q
Q ue ue
E nq
D eq
D ro p
T ra ce
15
NS-2 Directory Structure
sim
tk8.0 otcl Tcltcl8.0 ns-2 nam-1
tcl
ex test lib
...
...
tcl code
example
validation test
C++ code
tcl code core
16
Node Architecture
Classifier
Classifier Agent
Link
Agent
Agent
Node
Addr
Port
Node entry point
Local
Link Link
17
NS-2 : C++ / OTCL NS-2 Code contains two sets of
languages, namely C++ and OTcl.
C++ is used for the creation of objects because of speed and efficiency.
OTcl is used as a front-end to setup the simulator, configure objects and schedule events because of its ease of use.
18
Why two languages? (Tcl & C++)
C++: Detailed protocol simulations require systems programming language byte manipulation, packet processing, algorithm
implementation Run time speed is important Turn around time (run simulation, find bug, fix bug,
recompile, re-run) is slower Tcl: Simulation of slightly varying parameters
or configurations quickly exploring a number of scenarios iteration time (change the model and re-run) is
more important
19
Tcl or C++?
TclSimple Configuration, Setup, Scenario If it’s something that can be done without
modifying existing Tcl module. C++
Anything that requires processing each packet
Needs to change behavior of existing module
20
Shadowing
TclObject
Agent
Agent/DSDV
Agent/DSDV OTcl shadow object
Agent/DSDV C++ object
TclObject()
Agent()
DSDVAgent()
OTcl classhierarchy
C++ classhierarchy
21
Making Changes in C++ Space
Existing coderecompile
Additionchange Makefile and recompile
22
Making Changes in otcl Space
Existing coderecompilesource
Additionsourcechange Makefile (NS_TCL_LIB), tcl/ns-
lib.tcl (source) and recompile
23
Installation Unix variants
Download NS-allinone-2.27 package Contains
TCL/TK 8.4.5 oTCL 1.8 Tclcl 1.15 Ns2 Nam -1
24
Installation After successful downloading and unzipping
install allinone package , install NS by install by calling ~/ns-allinone-2.27/install
After successful installation , Validate the scripts by running ./validate in ~/ns-allinone-2.27/ns-2.27/
Its now all set to work with NS
25
Final topology Generated
THANK YOU
Contact me on:
praveenksheri@gmail.com
9742510339
top related