Skip to main content

Routing in VANETs using ns3

Part 1
WAVE - Wireless Access for Vehicular environments. vanet-routing-compare.cc It might take more than an hour. The readers are requested to be patient. SUMO, VANETs, routing comparison 1. Explain the full source code (1550 lines of code) 2. Creating a real scenario using osm (Open Street Map Web Wizard) 3. Performance analysis for various vanet protocols. https://www.nsnam.com Location of the source code /home/pradeepkumar/ns-allinone-3.27/ns-3.27/src/wave/examples
Move this file to the scratch/ for inclusion of all modules. Step 1: Explanation of source code. Copy the file to scratch folder. This is just Part 1 of the VANET comparison

Part 2
Please watch the First Part before watching this video  

Part 2 - Analysis of the results.

Please go through the first video (Part 1) and then watch this video (PArt 2)

#VANETs #NS3 #Routing

1. SUMO for web traffic (osmWebWizard.py)
2. Convert this into mobility.tcl file and that can be loaded to vanet-routing-compare.cc file (as discussed in part1)
3. We will be analysing various metrics like 
Receive Rate
Packets Received
Mac PHY overhead
Packetloss
Throughput and other metrics.
Files that are generated
mobility.tcl (for generating traffic in the network)
.tr (Ascii Trace, throughput and goodput)
.flowmon (FlowMonitor)
.xml (for NetAnim)
.pcap (Wireshark)

Step 1 - SUMO

$] export SUMO_HOME=/home/pradeepkumar/sumo/
$] cd sumo/tools
$] python osmWebWizard.py

Once the data generated

$] sumo -c osm.sumocfg --fcd-output trace.xml
sumo has a traceExporter.py file, this file has to be processed.


$]  python traceExporter.py -i 2019-08-18-20-47-08/trace.xml --ns2mobility-output=/home/pradeepkumar/mobility.tcl

from the mobility.tcl file,there are 
32 nodes (vehicles) and 249 seconds


Step 2:
NS3 part
Copy the file vanet-routing-compare.cc file to the scratch folder. 
$] cp ns-allinone-3.27/ns-3.27/src/wave/examples/vanet-routing-compare.cc ns-allinone-3.27/ns-3.27/scratch/

Do the modifications in line numbe 2392 as indicated in the video

My simulation will be running for various protocols like OLSR, AODV and DSDV
Scenario 2 is used for Selaiyur, Tambaram, Chennai, India
Total time is 30 seconds 
Vehicle movement is 20m/s

$] ./waf --run "scratch/vanet-routing-compare --protocol=1 --scenario=2"
1 - OLSR 
2- AODV
3- DSDV
4. DSR


To process the results, we used gnuplot and LibreOFfice Spreadsheet
Gnuplot Code.

set terminal pdf
set output "RR.pdf"
set title "Receive Rate"
set xlabel "Simulation Time (Seconds)"
set ylabel "Receive Rate"
plot "AODV.csv" using 1:2 with linespoints title "AODV", "OLSR.csv" using 1:2 with linespoints title "OLSR","DSDV.csv" using 1:2 with linespoints title "DSDV","DSR.csv" using 1:2 with linespoints title "DSR" 

set terminal pdf
set output "PR.pdf"
set title "Packets Receives"
set xlabel "Simulation Time (Seconds)"
set ylabel "PAckets Received"
plot "AODV.csv" using 1:3 with linespoints title "AODV", "OLSR.csv" using 1:3 with linespoints title "OLSR","DSDV.csv" using 1:3 with linespoints title "DSDV","DSR.csv" using 1:3 with linespoints title "DSR" 

set terminal pdf
set output "macphy.pdf"
set title "Mac Phy OVerhead"
set xlabel "Simulation Time (Seconds)"
set ylabel "Overhead"
plot "AODV.csv" using 1:22 with linespoints title "AODV", "OLSR.csv" using 1:22 with linespoints title "OLSR","DSDV.csv" using 1:22 with linespoints title "DSDV","DSR.csv" using 1:22 with linespoints title "DSR" 


WE have done the basic simulations.. and plotting of characteristics. 
Similar way , we can do it for other results also.

In the next video, I will be showcasing how to use flowmonitor for plotting the various losses, bitrates in the system or network.

python scripts to read the flowmonitors.

Thanks for watching. please share the videos to your friends and ask them to subscribe. 

Thank you....

Comments

  1. how can i count my number of neighbor in AODV using ns2.35?
    please help me
    thank you

    ReplyDelete
  2. Thank you sir for this effective tutorials on VANETs. sir I need use fuzzy logic in VANETs. Can you provide some information how we can do this in ns3?

    ReplyDelete
    Replies
    1. i also want code for fuzzy logic in manet kindly mail me...

      Delete
  3. Your web site is very useful for students and researchers. Thank you so much

    ReplyDelete
  4. Hello Dr. Kumar!
    Congratulations of videos. Its much helping me in master´s degree.
    Health, Peace and Success.
    Thank you very much!

    ;-) Edivaldo Pastori Valentini

    ReplyDelete
  5. Sir i got this error can you help me to resolve it
    /home/sarath/ns-allinone-3.29/ns-3.29/build/../src/wave/examples/vanet-routing-compare.cc:1736: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'
    collect2: error: ld returned 1 exit status

    ReplyDelete
    Replies
    1. I also got the same error, Help please

      Delete
  6. Dr, plss I need your help. Am a big fan of your website. Have sent a mail but u didn't reply.

    There is code I need you to explain for me sir.

    RSA algorithm on AODV.

    This is the link to the file

    https://www.researchgate.net/post/RSA_algorithm_on_AODV_Please_Can_Somebody_run_this_file_on_NS2_and_explain_it_to_me

    ReplyDelete
  7. sir, how to find the energy spend by a node in routing process?

    ReplyDelete
  8. I ALSO WANT TO USE FUZZY LOGIC IN MANET DO YOU HAVE A CODE FOR IT?

    ReplyDelete
  9. Sir, i always face an error during the running the code :

    msg="Could not connect callback to /NodeList/*/DeviceList/*/ns3::WifiNetDevice/Phy/PhyTxDrop", +0.000000000s -1 file=../src/core/model/config.cc, line=923
    terminate called without an active exception

    Command ['/home/babak/ns-allinone-3.32/ns-3.32/build/scratch/vanet-routing-compare', '--protocol=1', '--scenario=2'] terminated with signal SIGABRT. Run it under a debugger to get more information (./waf --run --gdb").

    appreciate your help, i really need it to be run

    ReplyDelete
  10. Thank you very much for the videos, Very informative and helping in research.

    Best Regards,

    ReplyDelete
  11. Thank you sir for all your work. Best channel for Network Simulator. Can I know if you have created the 3rd video for this? The one where you will showcase how to use flowmonitor for plotting the various losses, bitrates in the system or network?

    ReplyDelete
  12. dear where are the source code in your website

    ReplyDelete
  13. I'm unable to find wave directory in my ns-3.40. In which other directory I can find "vanet-routing-compare.cc" file. Please tell me the solution.

    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...