Research


Steps for Creating a New Routing Module in Castalia WSN Simulator

ATTENTION:
i) Make sure the path CASTALIA_HOME point to the location where Castalia is being installed
ii) “MyCustomRouting” is the name of the routing module that we wish to create

STEP 1: Creating the source-code files for the new module

1.a) Create a directory with name “MyCustomRouting” under the directory:
        CASTALIA_HOME/src/Node/Communication/Network

1.b) Copy the source-code files (*.h *.cc *.ned files) of directory:
        CASTALIA_HOME/src/Node/Communication/Network/BypassRouting
        into the new directory that was created in Step 1.a):
        CASTALIA_HOME/src/Node/Communication/Network/MyCustomRouting

1.c) Rename the contents of folder:
        CASTALIA_HOME/src/Node/Communication/Network/MyCustomRouting
        as follows:

BypassRoutingModule.h —> MyCustomRoutingModule.h
BypassRoutingModule.cc —> MyCustomRoutingModule.cc
BypassRoutingModule.ned —> MyCustomRoutingModule.ned

1.d) Open file “MyCustomRoutingModule.h” for editing and make the following text
        replacements:

BYPASSROUTINGMODULE –> replace with –> MYCUSTOMROUTINGMODULE
        BypassRoutingModule –> replace with –> MyCustomRoutingModule

        Save changes

1.e) Open file MyCustomRoutingModule.cc for editing and make the following text
        replacements:

BypassRoutingModule –> replace with –> MyCustomRoutingModule

        Save changes

1.f) Open file MyCustomRoutingModule.ned for editing and make the following text
        replacements:

BypassRoutingModule –> replace with –> MyCustomRoutingModule

        Save changes

STEP 2: Modify the build configuration file

2) Open file CASTALIA_HOME/config/makemake.config for editing and add the
      following lines/text:
      At end of line 38 (which starts with “ALL_WSN_INCLUDES =”) add the following
      text:

-I$(SRCDIR)/Node/Communication/Network/MyCustomRouting

      (make sure that you include a spaces before and after this text)
      Save changes
      This file is used by the script “makemake” and contains information on how to
      generate Makefile files at each sub-directory of the Castalia/src folder.

**Variables reside in makemake.config file:
2.a) OPTS ==> here you can add/modify the options of the opp_makemake tool.
        Usually it has not to be modified at all.



2.b) ALL_WSN_INCLUDES ==> here you MUST add every directory that either
        contains an *.h (C++ header) file or it will contain one after the invocation of
        opp_makemake by the Castalia/makemake script (usually the *.msg files produce
        extra header files). What you have to do is to add all the directories
        with the *.h or *.msg files that you created in the form of:
        -I$(SRCDIR)/Your_include_Dir_Under_Castalia_src.

** Make Targets:
2.c) You MUST modify the “WSNetwork” target. Most of the times you need to add a line
        like

cd $(SRCDIR)/Your_Dir_Under_Castalia_src && $(MAKEMAKE) $(OPTS) -n -r
-I$(SRCDIR)/Your_include_Dir_A_Under_Castalia_src

        for each new directory that you have created and that contains source(*.ned, *.cc,
        *.h) or *.msg files.

ATTENTION :
i) You may need to add more than one
           -I$(SRCDIR)/Your_include_Dir_XX_Under_Castalia_src
    flag at the end of this line if you use a source file from a different directory
ii) You don’t have to create your own omnetpp.config. It is generated automatically
      after the execution of “makemake”
iii) You don’t have to create your own nedfiles.lst. It is generated automatically after the
      execution of “makemake”

STEP 3: Clean and re-build Castalia

3) Change into directory CASTALIA_HOME and issue the following
      commands at the terminal:
      This will produce all the needed “Makefile” files automatically.

# make clean
# ./makemake
# make

      Normally you will not get any compile-time errors and you will be able
      to see in file CASTALIA_HOME/nedfiles.lst the following line:

./src/Node/Communication/Network/MyCustomRouting.ned



STEP 4: Create the appropriate ini file for simulations

4.a) Create a new file with name “Routing_myCustom.ini” under the directory:
         CASTALIA_HOME/ Simulations/Parameter_Include_Files

4.b) Copy and paste the contents of file:
         CASTALIA_HOME/Simulations/Parameter_Include_Files/Routing_bypass.ini
         into file:
         CASTALIA_HOME/Simulations/Parameter_Include_Files/Routing_MyCustom.ini          
         and then replace all occurrences of “BypassRoutingModule” with
         “MyCustomRoutingModule”

4.c) You can use MyCustomRouting module as your preferred
         Network-level protocol in your simulation by including the following line at the
         appropriate place inside your omnetpp.ini file:
         include ../Parameter_Include_Files/Routing_MyCustom.ini

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IMPORTANT NOTICE:
Please make sure that you always provide a correct relative directory pointer to the containing folder of Routing_MyCustom.ini from within your omnetpp.ini file.

Check the Castalia/nedfiles.lst to all the ned files that have been found inside the sources.
Check the Castalia/Bin to see the CastaliaBin executable binary with the core functionalities of the simulator.
This binary is invoked everytime you need to run a simulation.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Original link: http://groups.google.com/group/castalia-simulator/browse_thread/thread/7265a1327f281c4d/5ccd943bfabf458e?lnk=gst&q=New+Routing+Module+in+Castalia#5ccd943bfabf458e

OR

Refer the README.txt file in Castalia folder.

Step by step guide to install Castalia in fedora 10:

Step 1:
Untar and unzip the Castalia package:
# tar –xvzf Castalia-1.3.tar.gz

Step 2:
A new directory will be created ‘Castalia-1.3’
Direct to the ‘config’ folder reside in ‘Castalia-1.3’ folder and edit the ‘Castalia.config’ file:
# cd Castalia-1.3/config
# vi Castalia.config
Change the following line:
ROOT=$(HOME)/YOUR_PATH_TO_CASTALIA
into
ROOT=$(HOME)/username/Castalia-1.3

Remark: Make sure that the path that you set is correctly pointed to the Castalia folder or else you have problem make it.
Remark: Press “i” key to insert line to Castalia.config after finish editing press “Esc” key follow by “:” key and type “wq” to write and quit from vi.

Step 3:
Change back to the Castalia home directory and run the command mkmk:
# cd ..
# ./mkmk

Step 4:
The Makefile should be generated by now, proceed with the usual built command:
# make

After finish make, check the directory Castalia/bin for the generated binary/executable file CastaliaBin.

*success* ^_^

Download the User manual and start coding!!!

All download, documentation and installation steps can be gain from http://castalia.npc.nicta.com.au/index.php

The instructions below describe the step-by-step guide on installing omnet++ in fedora 10:

The following packages need to be install before the omnet++ installation:
1. TCL/TK
2. BLT

Step 1: Installing TCL/TK
From the terminal extract tcl package in home directory:
# tar -xzf tcl8.4.18-src.tar.gz
Proceed by entering to the unix directory:
# cd tcl8.4.18/unix
# ./configure
# make
# make test
# make install

As above, from the terminal extract tk package in the same directory:
# tar -xzf tk8.4.18-src.tar.gz
Proceed by entering to the unix directory:
# cd tk8.4.18/unix
# ./configure–with-tcl=/usr/local/lib
# make
# make install

Remark: if error occur regarding during the installation please refer to the post "NS-2 in Fedora 10" and follow the solution at Step 5.

Step 2: Installing BLT
Extract the BLT package:
# tar -xzf BLT2.4z.tar.gz
Enter into the blt directory:
# cd blt2.4z
# ./configure --with-tcl=/usr/local/lib
# make
Enter into the demos directory and test the demo, a graphical window appear with 2 large fishes:
# cd demos
#./graph1.tcl
Entering back to blt directory and finish with the installation:
# cd ..
# make install

Step 3: Installing Omnet++
Download Omnet++ from http://www.omnetpp.org/filemgmt/index.php

Again, extract the Omnet++ to the home directory:
# tar zxvf omnetpp-3.3p1-src.gz

Before the installation took place we need to set the appropriate path at ./bashrc
At the terminal edit .bashrc:
# vi /root/.bashrc
Enter the following line to .bashrc:
------------------------------------------------------------------------------------
export PATH=$PATH:/home/omnetpp-3.3p1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/omnetpp-3.3p1/lib:/usr/local/lib
export TCL_LIBRARY=/usr/local/lib/tcl8.4
------------------------------------------------------------------------------------
Remark: Press "i" key to insert line to ./bashrc after finish editing press "Esc" key follow by ":" key and type "wq" to write and quit from vi.

Next, we need to edit the 'configure.user' file reside in omnetpp3.3p1 directory by comment out the line:
TK_CFLAGS=" -I/usr/local/include"
TK_LIBS=" -L/usr/local/lib -ltcl8.4 -ltk8.4"

Now we can proceed with the installation:
# ./configure
Make sure you see this before proceed to make:
Your PATH contains /home/omnetpp-3.3p1/bin. Good!
Your LD_LIBRARY_PATH is set. Good!
TCL_LIBRARY is set. Good!

# make
After make, test the samples at omnetpp/samples/dyna:
# cd dyna
# ./dyna

A network consist of server,switch and computer will appear.

*success* ^_^

Reference from the instruction above: http://blog.163.com/mchen_6431/blog/static/3228631220086210366137/#

To install NS-2 in FEDORA 10 i have followed the instructions from this url: http://www.edaboard.com/ftopic297674.html

Step 1:
Make sure your computer is connected to the internet and Please log in as a superuser so that you have permission to do as follow.
At the terminal please type the following to install the packages dependencies:
—————————————
yum install autoconf
yum install automake
yum install gcc-c++
yum install libX11-devel
yum install xorg-x11-proto-devel
yum install libXt-devel
yum install libXmu-devel
—————————————

Step 2:
Download NS-allinone-2.33 package from sourceforge.net and do as follow at directory of your choice.
At home directory extract the ns file:
# tar -xzf ns-allinone-2.33.tar.gz
Proceed by entering to the ns directory:
# cd ns-allinone-2.33
# ./install

Step 3:
After Step 2, still at the terminal type:
# vi /root/.bashrc
To insert text please press the “i” key then add the following lines to the ./bashrc

—————————————
# LD_LIBRARY_PATH
OTCL_LIB=/home/username/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/username/ns-allinone-2.33/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB

# TCL_LIBRARY
TCL_LIB=/home/username/ns-allinone-2.33/tcl8.4.18/library
export TCL_LIBRARY=$TCL_LIB

# PATH
XGRAPH=/home/username/ns-allinone-2.33/bin:/home/username/ns-allinone-2.33/tcl8.4.18/unix:/home/username/ns-allinone-2.33/tk8.4.18/unix
NS=/home/username/ns-allinone-2.33/ns-2.33/
NAM=/home/username/ns-allinone-2.33/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM
—————————————

Remark: Press the “Esc” key follow by the “:”(shift+;) key then type the letters “wq” to write and quite from the terminal.

Let the environment variable that you set take effect immediately by typing the following at the terminal:
# source ~/.bashrc
or
you can choose to restart your computer

Step 4:
The NS should be working by now by typing:
$ ns
the symbol “%” should appear, press ctrl+c to exit from it.

Step 5:
The following error occur when i type “nam” at the terminal:

—————————————

: no event type or button # or keysym
while executing
"bind Listbox {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" [tk windowingsystem] eq "aqua"} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."
---------------------------------------

I found the solution at the following url:http://victorgau.blogspot.com/2008/12/ns2-233-nam.html

1. Download tk-8.4.18-tkBind.patch from http://bugs.gentoo.org/show_bug.cgi?id=225999
2. Put the patch file in the ns-allinone-2.33 directory and patch it:
patch -p0 < tk-8.4.18-tkBind.patch
3. after this step please type ./install again at the NS directory

After this when you type "nam" at the terminal you shall see the nam GUI.

Step 6
Validate the NS by typing:
# ./validate

Step 7
Start by looking at the example provided by NS in the ex folder:
# cd /home/username/ns-allinone-2.33/ns-2.33/tcl/ex
# ns wireless-flodding.tcl

Feel free to explore your newly install NS-2.

NS2 (http://www.isi.edu/nsnam/ns/)
• discrete event simulator : Ns provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks
• Language used is a mixture of oTcl and C++
• need extension for WSN

Omnet++ (http://www.omnetpp.org/)
• strong GUI support and an embeddable simulation kernel
• Components (modules) are written in C++, then assembled into larger components and models using a high-level language (NED)
• Extension for WSN

Overall comparison of the simulation tools can be found in the following url:
http://ctieware.eng.monash.edu.au/twiki/bin/view/Simulation/OMNeTppComparison

Characteristic of sensor node:
– limited computational ability
– memory constraint
– lack of power resource

WSN:
– consist of 10 -1000 of sensor nodes
– communicate through wireless channel for data gathering and processing

using AA batteries must consume less than 200µA to last for a year
– form network by communicate with each other either directly or through mean of other neighboring nodes (multihop)

Environment monitored:
– targeted to be allocated in rural area (which may not be subject to tempering)
– no existing infrastructure for either energy or communication(backbone)
– SN will be expected to be battery equipped

Constraints:

– large no. of distributed nodes

– unpredictable nature (hard to change or recharge the batteries during operational time)

– communication is the main power consumption
– once deployed show strong dependency on battery lifetime (can only operate while battery power is adequate)

Objective:
– routing algorithm: task of finding the optimal path based on certain criteria –> the energy

– aim at creating a routing protocols that can efficiently send data without wasting the energy resource

Conclusion:
– How well the WSN can collect data depend on the energy resource and network routing
– It proves that lifetime of SN will affect data routing in WSN which also have a direct relation with the efficient performance of the network