Aqua Sim for NS2 - Underwater Sensor Networks


Sensor nodes deployed inside water are known to be underwater sensor networks. These network is helpful in fish cultivation, habitat monitoring, predicting ptusami, etc.

Updated 9th April 2016 : the link to download the Aquasim is updated, the regular link is not working

This network uses different MAC protocol, routing protocol, etc. Real test bed are costlier and one cannot afford it. Simulators are the ultimate solution to know about these networks. Aquasim is one such tool that is integrated in ns2 for handling underwater sensor networks. This simulator supports new mac layer, new protocols that are helpful in routing inside water. There are examples also to simulate these networks.

Here is the installation steps of Aquasim.  Some points to be taken care of
  • ns-allinone-2.30 is used in creating the underwater sensor networks 
  • nam misbehaves (or does not work) in recent Ubuntu and Mint distributions. 
  •  Need to have the X11, automake and build essential tools to install Aquasim. 
Installation of AquaSim
OS Tested:  Ubuntu 14.04+ and Linux Mint 17+
AquaSim: 1.0 Version (It does not have a 3D version)

Download the aquasim simulator
Here are steps to install the libraries needed to install Aquasim

pradeep@localhost $] sudo apt-get update
pradeep@localhost $] sudo apt-get install libxmu-dev build-essential autoconf automake 

Create a folder called aquasim/ and extract the Aquasim-1.0.tgz inside this folder

pradeep@localhost $] mkdir aquasim 
pradeep@localhost $] cd aquasim/
copy the Aquasim-1.0.tgz in aquasim folder and extract it using 
pradeep@localhost $] tar zxvf Aquasim-1.0.tgz
pradeep@localhost $] ./install 

You may get an error as stated below: to clear this error, do the following step

Open the file (~aquasim/ns-2.30/linkstate/ls.h)  using gedit or vi or vim 

In line number 137, change the following line
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
to
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

and again issue the command ./install . After successful installation, some paths will be provided. You need to paste those paths in the /home/pradeepkumar/.profile or .bashrc (/home/pradeepkumar/ is my home, you have to use your corresponding directory where the software is installed)

Here is the sample path in my .profile file

export PATH=$PATH:/home/pradeepkumar/aquasim/bin:/home/pradeepkumar/aquasim/tcl8.4.13/unix:/home/pradeepkumar/aquasim/tk8.4.13/unix
export LD_LIBRARY_PATH=/home/pradeepkumar/aquasim/otcl-1.12:/home/pradeepkumar/aquasim/lib
export TCL_LIBRARY=/home/pradeepkumar/aquasim/tcl8.4.13/library


After setting these paths, you logout and login back and aquasim works well now.

Open the terminal and type ns, if it indicates a %, then aquasim was installed successfully.

Nam as i said earlier, may not work well, here is a workaround - please follow the link - http://www.nsnam.com/2015/07/nam-installation-segmentation-fault.html

Once installed, you can explore the folder /home/pradeepkumar/aquasim/ns-2.30/underwatersensor

This folder contains all the source codes relevant to the under water sensor networks. The above folder has five sub folders like uw_common/, uw_routing/, uw_mac/, uw_mobility_pattern/ and uw_tcl/ 

pradeep@localhost $] cd uw_tcl/ 
will give you the examples of under water sensor networks. 

pradeep@localhost $] ns vbf_example_5.tcl 
pradeep@localhost $] nam vbf_example_5.nam 
Here is the screenshot of the example run using nam
aquasim
Aquasim
This post does not handle the Aqua 3d where you have the option of viewing the nodes inside a water using a 3D view. Users are requested to try themselves for installing Aqua 3D. 

Comment below for any queries related to this installation.

 T S Pradeep Kumar

nam installation - Segmentation Fault (Solved)

If you are encountering "Segmentation Fault" error while running nam in Ubuntu 14.04 or Linux Mint 17+ editions, this post will be helpful for you.

Download the nam file from this link

First, remove the nam which was installed earlier using the following command 

pradeep@localhost $] sudo apt-get remove nam

and install the new nam which was downloaded just now. go to the folder where the file was downloaded and issue the following command

pradeep@localhost $]  sudo dpkg --install nam_1.15-10_i386.deb

See the screenshot below to install and use nam

nam
Nam
 T S Pradeep Kumar

Passive Optical Network (PON) in NS3

This post will tell you how to install and work with Passive Optical Network Simulation under NS3.  I request the readers to not to ask any help related to the working of this PON (Passive Optical Network) as I was helping one of my friend in compiling this tool. and I dont know anything about optical networks.

Version: ns-allinone-3.19
PON: xgpon
OS: ubuntu 14.04.2 and Linux Mint 17.2

Download ns-allinone-3.19 from here
Download XGPON from here

Installation of NS3

To install ns3, perform the following steps.
1. Open the terminal
2. Execute the following commands one by one
pradeep@localhost $] sudo apt-get update
pradeep@localhost $]sudo apt-get install build-essential autoconf automake libxmu-dev python-pygoocanvas python-pygraphviz cvs mercurial bzr git cmake NetAnim p7zip-full python-matplotlib python-tk

Unzip the ns-allinone-3.19.tar.bz2 in the home folder (/home/pradeepkumar)

pradeep@localhost $] tar jzvf ns-allinone-3.19.tar.bz2
pradeep@localhost $] cd ns-allinone-3.19/

Now extract the xgpon software in this location 
/home/pradeepkumar/ns-allinone-3.19/ns-3.19/src. You can see the screenshot given below (the selected folder is xgpon, when you download the xgpon software, the folder name may be anything, but rename it is xgpon as shown in the following figure)
XGPON
Ns3-xgpon
Once the copying is done, go to the ~ns-allinone-3.19/ folder and execute the following command to compile ns3

Important Instructions
There are two important things to be done before you go for compiling ns3. 
 
There is a file which have to be copied to the ns3 folder from the xgpon folder. 
ipv4-l3-protocol.cc file from xgpon (/home/pradeepkumar/ns-allinone-3.19/ns-3.19/src/xgpon/changesOnOtherModules/src/internet/model) have to be copied to (/home/pradeepkumar/ns-allinone-3.19/ns-3.19/src/internet/model).  This is to run a huge simulation called Giant

A Path related to your ns3 installation have to be set. In linux mint, the path has to be set in the .profile file and in Ubuntu it has to be set in the .bashrc file. (here is the NS3 variable which is set as given below, either you can copy the entire line in to the .profile file or you can paste the following line in the terminal)

export NS3=/home/pradeepkumar/ns-allinone-3.19/ns-3.19/

Compiling NS3

pradeep@localhost $] ./build.py --enable-examples --enable-tests

This will take a few minutes to build all the software packages, finally you will get a screenshot like this (the highlighted information shows that the xgpon software is built)
pon
XGPON
After the installation of NS3 is over, the examples of xgpon can be run using the following command. 

There are some examples given in (/home/pradeepkumar/ns-allinone-3.19/ns-3.19/src/xgpon/scripts4evaluation/), the contents of this folder have to be pasted at ~ns-allinone-3.19/ns-3.19/. To run the example, here is the command 
pradeep@localhost $] cd ns-allinone-3.19/ns-3.19/
pradeep@localhost $] ./waf --pyrun pedro/pargiantscript.py
You will finally get the waveforms printed like the following pics
XGPON
XGPON

XGPON
XGPON
 
 The above simulation runs are almost more than 2 hours to get the waveform plotted. In the recent versions of ns3, it is faster, but I failed to install it on a ns-3.23 version. 

If any user is successful in getting the simulation, let me know through the comment section 
 
T S Pradeep Kumar