Skip to main content

Comparison of AODV, DSR and DSDV in ns2 - NS2 Tutorial # 9

Performance Evaluation of Adhoc Routing Protocols using NS2

Very old Project as well as a topic, but this will give an idea of how to compare multiple protocols or agents.

1 hour Project*

See the video for the full project


* - you should know ns2 already
should know how to write AWK scripts
Should know about energy model
Should know about wireless networks and protocols

To know the above concepts, check my Ns2 Lecture series videos in Youtube and come back to this video

Youtube.com/tspradeepkumar

AODV, DSDV and DSR
AODV - Adhoc On Demand Distance Vector
DSDV - Destination Sequenced Distance Vector
DSR - Dynamic Source Routing

Lcture 8 - AWK Scripts
Average throughput
Instant throughput
Residual Energy
Packet Delivery ratio

To download the source codes, visit https://www.nsnam.com

Going inside the project

Step 1:
Use the same network and same disntace, energy, etc when you compare multiple protocols

Step 2:
Generate Scenario, You need not write the code in TCL (of course you can modify).
We use NSG for creating a network. Refer my lecture series on NSG (NS2 scenario Generator)

$] java -jar NSG2.1.jar

As seen in the GUI, Create a network (for example with 17 nodes) and two nodes are moving
with a interference of 550 metres and tranmission range of 250metres.

Create a network with a AODV protocol

Create two copies of AODV protocol and name it as DSR.tcl and DSDV.tcl

$] cp AODV.tcl DSR.tcl
$] cp AODV.tcl DSDV.tcl


Three files are ready now called
AODV.tcl, DSR.tcl, DSDV.tcl

and now these three files using ns filename.tcl

$] ns AODV.tcl
$] ns DSR.tcl
$] ns DSDV.tcl
I have the three files and got 9 files namely
AODV.tr, DSDV.tr and DSR.tr
AODV.nam, DSDV.nam and DSR.nam

There is no energy coding, i need to implement that

DSR does not obey the queue model as specified for AODV,
Queue/DropTail/PriQueue  is not supported by DSR, we have to go for CMUPriQueue

DSR supports this queue called CMUPriQueue, it should reflect in the tcl code.

All the tcl files run successfully. now we are going to analyse the results and sometime plot the graphs too.

we have already written AWK scripts for Average throughput, instant throughput , residual energy and packet delivery ratio

average_throu.awk
instant_throu.awk
pdr.awk
resenergy.awk

To run these scripts we need awk interpreter as below

$] gawk -f resenergy.awk AODV.tr
$] gawk -f resenergy.awk DSDV.tr
$] gawk -f resenergy.awk DSR.tr

Whenvern you compare multiple protocols
Use three different sets of nodes

Small number of nodes (10 nos)
Medium number of nodes (20 to 30 nos)
Huge number of nodes (upto 100)

beyond 100 nodes, ns2 suffers.

in this case, we did it for 17 nodes only. You can do the rest.
So we are coming to the conclusion

Comparing protocols needs
1. Three minimum protocols (AODV, DSR, DSDV)
TCP, TCPReno, TCPVegas, FullTCP
2. number of nodes (small, medium and huge) as mentioned above, 10 nodes, 30 nodes, 100 nodes
3. Atleast three performance metrics, in this case we have, average throghput, instant througput, residual energy and packet delivery ratio
4. Strong knowledge on the protocols
5. AWK scripts to be known or atleast to be downloaded.
6. Design the network rather than coding the network, use scenario generators for ns2.

Our project is complete!!! Stay tuned
Share and subscribe my youtube channel

Youtube.com/tspradeepkumar
nsnam.com
pradeepkumar.org

pradeepkumarts@gmail.com

Thank you !!! More lectures to come!!!!

Download the TCL Codes from here
https://drive.google.com/open?id=1B4HN87qBg8Pc5LpfWq6ldOSe33ZYtv-6

T S Pradeep Kumar

Comments

  1. can you please clear, where you have specified total packet size sending in awk script so that you are receiving 445 as a received packet during the calculation of avg. throughout?

    ReplyDelete
  2. can you please guide me, where you have specified total packet size sending in awk script so that you are receiving 445 as a received packet during the calculation of avg. throughout?

    ReplyDelete
  3. Is there a way to implement Buffer Node and No Buffer Node scheme? Can u please make a tutorial on that?

    ReplyDelete
  4. thanks Dr. you are the best lecture.

    ReplyDelete

Post a Comment

Popular posts from this blog

Installing ns3 in Ubuntu 22.04 | Complete Instructions

In this post, we are going to see how to install ns-3.36.1 in Ubuntu 22.04. You can follow the video for complete details Tools used in this simulation: NS3 version ns-3.36.1  OS Used: Ubuntu 22.04 LTS Installation of NS3 (ns-3.36.1) There are some changes in the ns3 installation procedure and the dependencies. So open a terminal and issue the following commands Step 1:  Prerequisites $ sudo apt update In the following packages, all the required dependencies are taken care and you can install all these packages for the complete use of ns3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libc...

Installation of NS2 (ns-2.35) in Ubuntu 20.04

Installation of NS2 (ns-2.35) in Ubuntu 20.04 LTS Step 1: Install the basic libraries like      $] sudo apt install build-essential autoconf automake libxmu-dev Step 2: install gcc-4.8 and g++-4.8 open the file using sudo mode $] sudo nano /etc/apt/sources.list Include the following line deb http://in.archive.ubuntu.com/ubuntu bionic main universe $] sudo apt update $] sudo apt install gcc-4.8 g++-4.8 Step 3:  Unzip the ns2 packages to home folder $] tar zxvf ns-allinone-2.35.tar.gz $] cd ns-allinone-2.35/ns-2.35 Modify the following make files. ~ns-2.35/Makefile.in Change @CC@ to gcc-4.8 change @CXX@ to g++-4.8 ~nam-1.15/Makefile.in ~xgraph-12.2/Makefile.in ~otcl-1.14/Makefile.in Change in all places  @CC@ to gcc-4.8 @CPP@ or @CXX@ to g++-4.8 open the file: ~ns-2.35/linkstate/ls.h Change at the Line no 137  void eraseAll() { erase(baseMap::begin(), baseMap::end()); } to This void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); } All changes ...

Installation of NS2 in Ubuntu 22.04 | NS2 Tutorial 2

NS-2.35 installation in Ubuntu 22.04 This post shows how to install ns-2.35 in Ubuntu 22.04 Operating System Since ns-2.35 is too old, it needs the following packages gcc-4.8 g++-4.8 gawk and some more libraries Follow the video for more instructions So, here are the steps to install this software: To download and extract the ns2 software Download the software from the following link http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download Extract it to home folder and in my case its /home/pradeepkumar (I recommend to install it under your home folder) $ tar zxvf ns-allinone-2.35.tar.gz or Right click over the file and click extract here and select the home folder. $ sudo apt update $ sudo apt install build-essential autoconf automake libxmu-dev gawk To install gcc-4.8 and g++-4.8 $ sudo gedit /etc/apt/sources.list make an entry in the above file deb http://in.archive.ubuntu.com/ubuntu/ bionic main universe $ sudo apt update Since, it...