Steps for Creating a New Routing Module in Castalia WSN Simulator

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:

1.b) Copy the source-code files (*.h *.cc *.ned files) of directory:
        into the new directory that was created in Step 1.a):

1.c) Rename the contents of folder:
        as follows:

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

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

        BypassRoutingModule –> replace with –> MyCustomRoutingModule

        Save changes

1.e) Open file for editing and make the following text

BypassRoutingModule –> replace with –> MyCustomRoutingModule

        Save changes

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

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


      (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:

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

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

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

i) You may need to add more than one
    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:


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:
         into file:
         and then replace all occurrences of “BypassRoutingModule” with

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

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:


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:

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