Reserach
NS2.35 installation on Ubuntu 18.04 LTS
Here are the steps,
$] sudo apt update
$] sudo apt install build-essential autoconf automake libxmu-dev
$] sudo apt install gcc-4.8 g++-4.8
now copy ns-allinone-2.35.tar.gz zip file to your home folder.
$] tar zxvf ns-allinone-2.35.tar.gz
$] cd ns-allinone-2.35/ns-2.35
$] gedit Makefile.in
make a change in Makefile on line number 36 & 37 column no. 15
CC = gcc-4.8
CPP = g++-4.8
$ gedit linkstate/ls.h and change a function erase to this->erase at line number 137 and column no. 27. save and exit from both files.
$ cd ..
$ ./install
Once the installation is over, you need to set the path to make ns and nam works from any terminal.....
To set the path do the following
$ gedit /home/pawan/.bashrc and put the following in .bashrc file
export PATH=$PATH:/home/pawan/ns-allinone-2.35/bin:/home/pawan/ns-allinone-2.35/tcl8.5.10/unix:/home/pawan/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/pawan/ns-allinone-2.35/otcl-1.14:/home/pawan/ns-allinone-2.35/lib
save file and run the following :
$ source /home/pawan/.bashrc
to test whether ns2 has been install or not.
TYPE $ns
% (means ns2 has been installed sucessfully).
Installing ns3 in Ubuntu 22.04
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 libclang-dev llvm-dev automake python3-pip libxml2 libxml2-dev libboost-all-dev
Step 2 : Download ns-allinone-3.36.1.tar.bz2 from the website nsnam.org.
https://www.nsnam.org/releases/ns-allinone-3.36.1.tar.bz2
Step 3 : Unzip the above file content to the home folder (in my case, its /home/pradeepkumar) - Check your home folder and do it accordingly.
To unzip use the GUI with Right click and extract and select the /home/pradeepkumar/ folder.
else you can use the command
$ tar jxvf ns-allinone-3.36.1.tar.bz2
Step 4: Go to the folder
$ cd ns-allinone-3.36.1/
$ ./build.py --enable-examples --enable-tests
This process takes some time depends on the Speed of your system.
Once the installation is done. You can run the example as shown
$ cd ns-3.36.1/
$ ./ns3 run hello-simulator
Hello Simulator
(You will get this output)
To run the examples, we need to copy the examples/tutorial/first.cc to the scratch folder and execute the file as shown below
To run C++ (.cc) file, the following command is used.
$ ./ns3 run scratch/first
To run the python file, here is the command
$ ./ns3 run scratch/first.py
Installation of SUMO 1.2.0 in Ubuntu 18.04
Step 1: Prerequisities (download all the dependencies)
$] sudo apt update
$] sudo apt-get install cmake python g++ libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev swig
Step 2: Download SUMO
$] sudo apt install git
$] git clone --recursive https://github.com/eclipse/sumo
step 3 - Setting the path
$] export SUMO_HOME="$PWD/sumo"
Step 4 - Cmake build
$] mkdir sumo/build/cmake-build && cd sumo/build/cmake-build
$] cmake ../..
$] make -j8
$] cd .. out (form sumo/build/cmake-build)
Step 5 – path exporting in .bashrc
$] gedit .bashrc and the following lines of code
export PATH=$PATH:/home/pawan/sumo/bin
export SUMO_HOME=/home/pawan/sumo (save it and exit)
$ source .bashrc
Step 6 – testing of your installation
$ sumo
$ sumo-gui
NAM and XGraph Installation in Ubuntu 18.04
We have to modify at two locations;
1. nam-1.15/Makefile.in
2. xgraph-12.2/Makefile.in
$cd ns-allinone-2.35/
$ gedit nam-1.15/Makefile.in
$ gedit xgraph-12.2/Makefile.in
Change as per the following in the above two files.
@CC@ --> gcc-4.8
@CPP@ --> g++-4.8
$ source /home/pawan/.bashrc
$ ./install
now try nam and xgraph for testing purpose
SUMO, Open Street Maps and NS2 - A Real Traffic Simulation
Installation of SUMO-0.32.0 and Connecting to NS-2.35
323 sudo apt update
324 sudo apt upgrade
325 sudo apt install build-essential autoconf automake libxmu-dev libfox-1.6-dev libproj-dev libxerces-c-dev libxerces-c3.2 libgdal-dev default-jdk
327 tar zxvf sumo-src-0.32.0.tar.gz
329 cd sumo-0.32.0/
330 ./configure
331 make
332 sudo make install
346 gedit .bashrc
export PATH=$PATH:/home/pawan/sumo-0.32.0/bin
export SUMO_HOME=/home/pawan/sumo-0.32.0
333 sumo
334 sumo-gui
Installation Compelete
Step 2: Steps to create a Traffic
1. Open browser and type http://www.openstreetmap.org and search a particular area and click export in the top.
2. click "Manually select an area" and select the area (as shown in the video below) and click export again (it will download a file called map.osm, rename this file as per your convenience)
3. Open the terminal and type the commands one by one (assume my file name is guindy.osm, so i maintain the same file name guindy for all the xml files)
4. cd maps
5. ls
6. guindy.osm ---------- as output
357 netconvert --osm-files guindy.osm -o guindy.net.xml
Now, copy the osmPolyconvert.typ.xml from the $SUMO_HOME/data/typemap/ and copy it to the folder where you put all the files.
358 polyconvert --osm-files guindy.osm --net-file guindy.net.xml --type-file osmPolyconvert.typ.xml -o guindy.poly.xml
359 python $SUMO_HOME/tools/randomTrips.py -n guindy.net.xml -r guindy.rou.xml -e 50 -l
here 50 is no. Of vehicle.
Now, create a new file (to be named as guindy.sumocfg in same folder ) and paste the following lines
<configuration>
<input>
<net-file value="guindy.net.xml"/>
<route-files value="guindy.rou.xml"/>
<additional-files value="guindy.poly.xml"/>
</input>
<time>
<begin value="0"/>
<end value="100"/>
<step-length value="0.1"/>
</time>
</configuration>
360 sumo-gui guindy.sumocfg ## use this to run and see simulation of guindy.sumocfg
Step 3: Exporting to NS2
from sumo trace to ns2, here is the step to do
Open terminal and type the following commands,
361 sumo -c guindy.sumocfg --fcd-output sumoTrace.xml
362 python /home/pawan/sumo-0.32.0/tools/traceExporter.py --fcd-input sumoTrace.xml --ns2config-output guindy.tcl --ns2activity-output activity.tcl --ns2mobility-output mobility.tcl
This will generate three tcl files (guindy.tcl, activity.tcl and mobility.tcl). Among this activity.tcl might not be needed, but mobility.tcl file is mandatory)
The generated guindy.tcl have to be modified or altered as per the networking parameters like routing protocol, Mac layer, physical layer, link layer, etc.
Now edit guindy.tcl with following command
384 gedit guindy.tcl
add the following code in it for wireless network parameters
A Sample TCL File for your Use
Here is the guindy.tcl file, you can use it for your purpose
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 41 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set opt(x) 4707
set opt(y) 3002
# ======================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
set ns_ [new Simulator]
set tracefd [open guindy.tr w]
$ns_ trace-all $tracefd
set namf [open guindy.nam w]
$ns_ namtrace-all-wireless $namf $opt(x) $opt(y)
# set up topography object
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
#
# Create God
#
create-god $val(nn)
#
# Create the specified number of mobilenodes [$val(nn)] and "attach" them
# to the channel.
# Here two nodes are created : node(0) and node(1)
# configure node
$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
$ns_ initial_node_pos $node_($i) 20
}
#
#
source mobility.tcl
set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $tcp
$ns_ attach-agent $node_(22) $sink
$ns_ connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ at 10.0 "$ftp start"
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 100.0 "$node_($i) reset";
}
$ns_ at 100.0 "stop"
$ns_ at 100.01 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
puts "Starting Simulation..."
$ns_ run
385 ns guindy.tcl
386 nam guindy.nam
patch GPSR in ns-2.35
$] sudo apt update
$] sudo apt install build-essential autoconf automake libxmu-dev
$] sudo apt install gcc-4.8 g++-4.8
now copy ns-allinone-2.35.tar.gz zip file to your home folder.
$] tar zxvf ns-allinone-2.35.tar.gz
$] cd ns-allinone-2.35/ns-2.35
$] gedit Makefile.in
make a change in Makefile on line number 36 & 37 column no. 15
CC = gcc-4.8
CPP = g++-4.8
$ gedit linkstate/ls.h and change a function erase to this->erase at line number 137 and column no. 27. save and exit from both files.
$ cd ..
$ ./install
$ cd ns-allinone-2.35/
$ patch -p0 < gpsr-KeLiu_ns235.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing
$ ./install
$ cd ns-2.35/
$ cp ns ns-gpsr-keliu
$ sudo cp ns-gpsr-hls /usr/local/bin/
... Then you can do: $ ns-gpsr-keliu ssoumayaa.tcl
... from the examples-----------------------
GPSR-KeLiu-examples_07Jun17.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNakpZcF85eFJrRnM/view?usp=sharing
More examples : GPSR-KeLiu-examples_0614.tar.gz
→ https://drive.google.com/file/d/0B7S...it?usp=sharing
Flying Adhoc Network Simulation (FANET) using NS3
Fast Processing Scopus/SCI Index Journal in Computer Science
Scopus Listed Journal List Free/Paid Journals
Indian Journal of Computer Science and Engineering
International Journal of Recent Technology and Engineering
International Journal of Innovative Technology and Exploring Engineering
International Journal of Scientific & Technology Research