Professional Documents
Culture Documents
ns3 SST PPT R1
ns3 SST PPT R1
ns3 SST PPT R1
by
Dr. Shrikant S. Tangade
Asst. Prof. & Research Scholar, School of ECE, REVA University &
Acknowledgement
4
Introduction to ns-3
ns History:
1990 2000 2016 2018
Inputs: yans,
GTNetS, ns-2 ns-3 core development (2006-08)
June 2008: ns-3.1
October2016: ns-3.26
6
Introduction to ns-3 (cont.)
ns-3 is Discrete-event Simulation:
• Simulation time moves in discrete jumps from event
to event
• C++ functions schedule events to occur at specific
simulation times
• A simulation scheduler orders the event execution
• Simulation::Run() executes a single-threaded event
list
• Simulation stops at specific time or when events end
7
Introduction to ns-3 (cont.)
ns-3 Core Internal Structure:
• ns-3 is written in C++
• Provides a set of simulation models implemented as
C++ objects.
• More emphasis on emulation.
8
Introduction to ns-3 (cont.)
ns-3 Sample Models:
9
Introduction to ns-3 (cont.)
Basic ns-3 program architecture:
Application Application
Application Application
Sockets-like
API
Protocol Protocol
Packet(s) stack
stack
NetDevice NetDevice
NetDevice Channel NetDevice
Channel
Node-1 Node-2
10
ns-3
Introduction to ns-3 (cont.)
Publications using ns-3:
A common question is "How many ns-3 papers are there?
• Small survey of 139 paper results from 2013-14 & 1000+
as of now search in the IEEE library (top relevant results)
• Some papers matched multiple categories
• Hot topics:
– LTE/cellular networks (15)
– Wireless routing protocols (14)
– Sensor networks (13)
– Wireless MAC and PHY protocols (11)
– Vehicular Network: VANET
11
Introduction to ns-3 (cont.)
Paper Counts by Topic (sample):
Topic Count Topic Count
LTE/Cellular 15 Network coding 4
Wireless routing protocols 14 Datacenter networks 4
Wireless sensor networks 13 Distributed systems 4
Wireless MAC/PHY 11 Optical links 3
Wireless QoS 9 Misc. physical links 3
Vehicular networks 9 Multicast 3
TCP/congestion control 9 Misc. security 2
Wireless security 9 Wired routers 2
About ns-3 itself 8 Wireless QoS 2
Wifi/mesh networks 7 WiMAX 1
Voice/video apps 6 Mobility 1
Energy/resource consumption 6 Misc. routing 1
DTN and space networks 5 Miscellaneous 1
Misc. wireless 5
12
Features of ns-3 Vs. ns-2
13
Features of ns-3 Vs. ns-2
“ns-3 is a new simulator, without backward compatibility”
Similarities to ns-2:
• C++ software core
• GNU licensing (free software license)
Differences:
• Python scripting or C++ programs replaces OTcl
• most of the core rewritten
• new animators, configuration tools: pyViz
• ns-3 documentation actively maintained but ns-2 is no
longer actively maintained/supported
14
Features of ns-3 Vs. ns-2 (cont.)
• ns-3 documentation actively maintained
• ns-3 Main Website: https://www.nsnam.org
15
Features of ns-3 Vs. ns-2 (cont.)
16
Features of ns-3 Vs. ns-2 (cont.)
Simulation Output: NAM & NetAnim
17
Features of ns-3 Vs. ns-2 (cont.)
• Performance:
“Slow with ns-2, Efficient with ns-3”
problem
18
Features of ns-3 Vs. ns-2 (cont.)
• Approach for building:
“Complex with ns-2, Simple with ns-3”
‘makefile’ for ns-2, ‘waf’ for ns-3
19
Features of ns-3 Vs. ns-2 (cont.)
• Community Support:
“Good for ns-2, New & Improved for ns-3”
20
Installation Steps of ns-3
21
Installation Steps of ns-3
• Installing and Testing ns-3 with NetAnim on Ubuntu 14.04
• ns-3 version considered: ns-allinone-3.20
22
Installation Steps of ns-3 (cont.)
• ns-3 version considered: ns-allinone-3.20
25
Installation Steps of ns-3 (cont.)
• Part-C: Installing ns-3 (cont.)
• Installation ns-3 using Method 1: by using build.py
Step -1: Unzip the “ns-allinone-3.20.tar.bz2” tarball
tar xjf ns-allinone-3.20.tar.bz2 (through terminal)
Step-2: Go in “ns-allinone-3.20” folder and give the following
command for installation
./build.py - - enable-examples - - enable-tests
• After a while, you may see the following message on screen
• Note: Some tests may be skipped while testing but that should
not bother you if your module is not among those that were
skipped!
27
Installation Steps of ns-3 (cont.)
• Part-D: Testing NetAnim
• only for those users who installed qt4-dev-tools package before
ns-3 installation):
29
Examples of ns-3 programs
30
Examples of ns-3 Programs
Organization of Program
• Any ns-3 program organization contains following Key-
Abstractions:
– Node
– Application
– Net device
– Channel
• Each abstraction have their separate module to implement in
ns-3
31
Examples of ns-3 Programs (cont.)
Modules
• Each modules has 'Attributes‘
32
Examples of ns-3 Programs (cont.)
General Structure of ns-3 Program
• For our simulation, we need to write a simulation program
which is a C++ program.
33
Examples of ns-3 Programs (cont.)
General Structure of ns-3 Program (cont.)
• The “General Structure/Steps of ns-3 program” are:
1) Include necessary header files
2) Use appropriate name space
3) Enable logging for different modules (Optional)
4) Create nodes
5) Create net devices with MAC and PHY
6) Attach Net devices to nodes and set interconnections
7) Install protocol stack in nodes
8) Set network address for interfaces
9) Install applications in nodes
10) Setup tracing (Optional)
11) Set application start and stop time
12) Set simulation start time
13) Run simulation
14) Release resources at end of simulation
34
Examples of ns-3 Programs (cont.)
Example-1: Simple ns-3 Simulation Program
• A simple “Hello ns-3”
• Refer Program
35
Examples of ns-3 Programs (cont.)
Example-2: VANET ns-3 Simulation Program
• Using ns-3 VANET “WAVE Module” for V2V/V2I communications
• Refer Program
36