Friday, November 29, 2013

Aqua-Sim For Simulating Underwater Acoustic Sensor Networks

When working on terrestrial wireless sensor networks (WSN), we are dealing with electro-magnetic waves to propagate our signals from a sender to a receiver. However, underwater sensor networks are significantly different from their terrestrial counterpart due to the usage of acoustic signals for communication. In underwater environments we are unable to depend on radio signals for communication in long distances since higher attenuation of radio signals when traveling through water. Therefore acoustic signals is the only or most prominent and practical solution so far.

Simulating underwater acoustic sensor networks (UASN) requires special propagation models and other considerations specific to the unique features of acoustic physical medium . Due to this reason, its not possible to simulate UASNs using simulators used for terrestrial WSNs with same configurations. That means we need simulators which specifically support UASNs. Aqua-Sim is such a simulator which is based on NS-2 and therefore I found it easier to use than learning a completely new simulator. Today I installed it and ran a test TCL script to initiate using it for my simulation requirements of UASN. Since its a modified version of standard NS2 simulator, there's nothing new to be done to install it. However since I faced some error during the installation, I decided to write down the steps I followed for future reference.

First I had to download the source files of Aqua-Sim from the following link. At the end of the page pointed by this link, they have provided a download link for 1.0 version of Aqua-Sim. After downloading I extracted the compressed folder to the desktop of my Ubuntu 12.04 system. Entered the following commands in the terminal to install Aqua-Sim on my system.

cd Desktop/Aqua-Sim-1.0/
./install

After running the installation process for a while, suddenly it turned out with an error saying "ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined". After searching in the web for this error I found the solution mentioned in this blog. According it, I had to edit a configuration file, so I opened the file Aqua-Sim-1.0/otcl-1.12/configure and searched for the line SHLIB_LD="ld -shared" inside it. Then I commented and added a different line as shown below.

#SHLIB_LD="ld -shared"
SHLIB_LD="gcc -shared"

Then I ran the command "./install" again and this time it worked. At the end of the installation process, as usual in NS2 installation, it asked for setting some environmental variables in my system. So I opened the "/etc/profile" file and added the following lines at the end of the existing content and saved.

export PATH=$PATH:/home/asanka/Desktop/Aqua-Sim-1.0/bin:/home/asanka/Desktop/Aqua-Sim-1.0/tcl8.4.13/unix:/home/asanka/Desktop/Aqua-Sim-1.0/tk8.4.13/unix

export LD_LIBRARY_PATH=/home/asanka/Desktop/Aqua-Sim-1.0/otcl-1.12:/home/asanka/Desktop/Aqua-Sim-1.0/lib

export TCL_LIBRARY=/home/asanka/Desktop/Aqua-Sim-1.0/tcl8.4.13/library

Now we are done with installation. Just to make sure that the installation went fine, I ran the validation script as follows. It takes a long time for the validation scripts to complete.

cd Aqua-Sim-1.0/ns-2.30
./validate

After the validation script finished the execution, I ran a sample TCL simulation script as shown below.

cd /ns-2.30/underwatersensor/uw_tcl
ns tmac-example.tcl

This script executed successfully indicating that everything is OK and Aqua-Sim is ready for my future simulations of UASN networks. Cheers!

25 comments:

  1. Its good to see the commands for ubuntu , but i need the commands in fedora , could you please help me out to get the commands?

    ReplyDelete
  2. Hi
    Thank you very much for sharing your experience. I have a little problem, after "./install" how/where do set the environmental variables. I am not able to understand it. Can you please elaborate ablt.
    Many thanks

    ReplyDelete
  3. For setting the environmental variables mentioned in the above article, you have to issue the following command on the terminal which will open a file with Gedit after entering the root password.

    sudo gedit /etc/profile

    You have to append the mentioned content of the above article to the end of the opened file. Then save and close the Gedit editor window.

    To make the changes get into effect, you have to logout and log in again. Now you can proceed into run the validation script mentioned in the article.

    ReplyDelete
    Replies
    1. can you please tell me that aquasim can calculate bandwidth,temperature,pressure,depth,salinity and frequency. thankyou

      Delete
  4. after installing aquasim successfully i tried to validate but got an error please help me

    sangram@sangram-HP-Pavilion-dv6-Notebook-PC:~$ su
    Password:
    root@sangram-HP-Pavilion-dv6-Notebook-PC:/home/sangram# cd aqua-sim/ns-2.30/./validate
    bash: cd: aqua-sim/ns-2.30/./validate: Not a directory

    ReplyDelete
  5. Hello Sangram, it seems you have entered the "cd" command and "./validate" command in the same line, did you?
    First you should cd into the directory and then run the validation script.

    ReplyDelete
  6. Thank you for all Asanka P. Sayakkara (y)

    For Sangram, I think you must give a permission to the validate file to be executed
    chmod -x validate

    ReplyDelete
  7. Have you tried Aqua 3D?
    If so kindly share how to install it and how to load a trace file in aqua 3D

    ReplyDelete
  8. Dear Asanka,
    Can you please update how to install Aqua 3D with other dependancy softwares.

    ReplyDelete
  9. Hello Asanka,
    Can you please help me download Aqua-Sim on Ubuntu GNOME 15.04?

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. how to install aquasim 2.30 on windows,please help

    ReplyDelete
  12. Hi Friend!

    Thank you for sharing your experience, it is very helpful.
    I am trying to install aquasim in Mint as well but it seems the source code link is broken (http://ubinet.engr.uconn.edu/aqua_packages/Aqua-Sim-1.0.tgz).
    I have tried searching for a mirror but I couldn't find any. So do you happen to have a copy of the source to share?

    Thank you again!

    ReplyDelete
  13. Hi Lucas, I just checked and yes you are right, the download link in their website is not working now.The bad news is that I don't have a copy either because it was a long time ago when I use it. The best hope is writing an email to those who developed it. They are listed in the website http://obinet.engr.uconn.edu/wiki/index.php/Aqua-Sim

    ReplyDelete
    Replies
    1. I sent some e-mails, lets see what comes out of it. I will come back to let you know.

      Delete
    2. A new link is up here: http://www.nsnam.com/2015/07/aqua-sim-for-ns2-underwater-sensor.html

      Delete
  14. This comment has been removed by the author.

    ReplyDelete
  15. hello sir,
    i made the changes in otcl configure ,thn also i am getting the same error.pls help with further procedure

    Thanks & Regards

    ReplyDelete
  16. Build OTcl-1.12
    ============================================================
    No .configure file found in current directory
    Continuing with default options...
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ANSI C... none needed
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking how to run the C preprocessor... gcc -E
    checking for egrep... grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for string.h... (cached) yes
    checking for main in -lXbsd... no
    checking for socket in -lsocket... no
    checking for gethostbyname in -lnsl... yes
    checking for dcgettext in -lintl... no
    checking for getnodebyname in -ldnet_stub... no
    checking that g++ can handle -O2... no
    checking standard STL is available... no
    checking for tcl.h... -I../include
    checking for tclInt.h... -I../include
    checking for libtcl8.4... -L../lib -ltcl8.4
    checking for init.tcl... ../lib/tcl8.4
    checking for http.tcl... ../lib/tcl8.4/http1.0
    checking Tcl http.tcl library... yes
    checking for tclsh8.4.11... no
    checking for tclsh8.4... ../bin/tclsh8.4
    checking for tk.h... -I../include
    checking for libtk8.4... -L../lib -ltk8.4
    checking for tk.tcl... ../lib/tk8.4
    checking for X11 header files
    checking for X11 library archive
    checking for XOpenDisplay in -lX11... yes
    checking for XShmAttach in -lXext... yes
    checking for ranlib... ranlib
    checking for a BSD-compatible install... /usr/bin/install -c
    checking system version (for dynamic loading)... Linux-3.5.0-36-generic
    No explicit static compilation flag; setting V_STATIC to ""
    checking for dlopen in -ldl... yes
    checking for a BSD-compatible install... /usr/bin/install -c
    configure: creating ./config.status
    config.status: creating Makefile
    rm -f libotcl.a otcl.o
    gcc-4.3 -c -g -O2 -DNDEBUG -DUSE_SHM -I. -I/home/mis12345/Desktop/aquasim/include -I/home/mis12345/Desktop/aquasim/include -I/home/mis12345/Desktop/aquasim/include -I/include otcl.c
    make: gcc-4.3: Command not found
    make: *** [libotcl.a] Error 127
    otcl-1.12 make failed! Exiting ...
    See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
    mis12345@malnad:~/Desktop/aquasim$

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Hi!I send you an email with a question abou aquasim! I would apreciate very much if you can please answer me as soon as possible!
    Thank you
    Larissa

    ReplyDelete
  19. hi..
    while am trying to execute the code ./validate, am getting like "permission denied"
    what shall i do for that?

    ReplyDelete
    Replies
    1. how about running the validation as root? You can do that using the command,
      sudo ./validate

      Delete
    2. ./validate, am getting like "permission denied"
      what shall i do for that?

      Delete