Thursday, September 6, 2012

Simulating Wireless Networks With GloMoSim

During my research seminar days I came across two important research papers which introduced me to a wireless network simulator which I hadn't use before. First paper was "Hierarchical Geographic Multicast Routing for Wireless Sensor Networks" presented by Ravinda while the other one was "Design and analysis of a leader election algorithm for mobile ad hoc networks" presented by Chathuranga. In both of these papers, the evaluations of their solutions are performed using the simulator called GloMoSim. So, I wanted to try this tool.

GloMoSim is an even-driven, packet-level simulator. It is written using a language called PARSEC. The reason to use PARSEC is it is a language specially designed to implement simulators. GloMoSim comes with various implementations of routing protocols, MAC protocols, etc. Therefore it is pretty easy to setup a network and simulate different scenarios. In addition to those default features GloMoSim can be easily extended by adding our own protocols and applications for our research purposes.

In this article I will write down the steps I followed to run a simple simulation starting from downloading GloMoSim source code. This article which I found while searching on the web helped me a lot. I installed and worked with GloMoSim on an Ubuntu 10.10 machine. So, here we go.

1) Go to GloMoSim download page and download the  2.03 version which was the latest one available by the time I write this. Then extract the compressed directory to get the directory named as glomosim-2.03. Let's say you have extracted it to your desktop.

2) Now open a terminal and go on to this uncompressed directory. Inside this directory there's a separate directory named as parsec which contains the PARSEC compiler which is used to compile GloMoSim. For Ubuntu, we use redhat-7.2 version of it. So go to this directory located at "~/Desktop/glomosim-2.03/parsec/redhat-7.2/bin".

  cd ~/Desktop/glomosim-2.03/parsec/redhat-7.2/bin

This directory contains two files parsecc and pcc. Copy them to /usr/bin directory.

  sudo cp parsecc /usr/bin/
  sudo cp pcc /usr/bin/

3) Now we need to add the directory path to the environmental variable. So, open the .bashrc file by issuing following command.

  gedit ~/.bashrc

Add the  following content to the end of this file.

  PCC_DIRECTORY=~/Desktop/glomosim-2.03/parsec/redhat-7.2
  export PCC_DIRECTORY

Now you have to restart the machine. To avoid restarting the machine, you may add that on the terminal instead of adding to the .bashrc file.

4) It's time to compile GloMoSim. So, do the following.

  cd ~/Desktop/glomosim-2.03/glomosim/main
  make

If every things are done properly, you will see the compilation process. You have to wait until it completes. Then our initial works are over.

5) Now we can run a sample simulation on GloMoSim. For that go to bin directory as follows.

  cd ~/Desktop/glomosim-2.03/glomosim/bin

There's a file named as config.in which contains the configurations of a simulation. Another file called app.conf contains the configurations of each node in the simulated network. You can find these two files in this current directory. GloMoSim use those configurations to simulate a network. Now lets run the default simulation configured in these files. So, issue the following command.

  ./glomosim config.in

You will see an output like the following on the terminal when the simulation runs.





















For our evaluation purposes, the statistics of the simulation is written to a file named as glomo.stat which we can open and view the data statistics.

  cat glomo.stat

Contents of the file may look like the following.


















More details of the simulator can be found by reading through the GloMoSim website. Additionally those two configuration files I previously mentioned contains lot of comments which are pretty much self documenting. Therefore it's worth reading through all these things.

I'm hoping to write another article about adding a new application layer functionality to simulated nodes in GloMoSim. Until then, that's all I got for now.

4 comments:

  1. the download page for glomosim is not working. Is there any other download page?

    Thank you.

    ReplyDelete
    Replies
    1. Hi!
      Have you found another site to download GloMoSim?

      Delete
  2. how to run a code written in c language on glomosim

    ReplyDelete
  3. how to download glomosim simulator,which web site

    ReplyDelete