Showing posts with label NS2 Tools. Show all posts
Showing posts with label NS2 Tools. Show all posts

Thursday, January 22, 2009

How to run Bonnmotion for NS-2

After installing the Bonnmotion in NS-2, I was literally confused on how to use this tool in NS-2. The readme file which came up with the package was not a well detailed one, it only explained how to produce the mobility scenarios for NS-2. The document did not cover any detail on how to use the scenario files generated. I refered the mailing lists for the answer, and I noticed that there were many users who all had the same question but I was unable to find the answer.
Finally searching in Google helped me. Here I am enclosing the link to a document, which helped me a lot
http://sce.uhcl.edu/yang/teaching/csci5931netSecuritySpr05/ns-tutorial.doc

Anyway in this post I will cover the details on how to run the bonnmotion and how to use the generated scenario files in NS-2.

1. After installing the Bonnmotion, open the dos window and navigate to the location where Bonnmotion is installed.
2. Now navigate to the bin folder
3. Type the below command to generate a scenario file
        bm -f scenario1 RandomWaypoint -n 100 -d 900 -i 3600
The above command will create a Random Waypoint scenario file with 100 nodes, with duration of 900 seconds and initial phase cutoff of 3600 seconds.
4. This command will produce 2 files
- scenario1.params which has complete set of paramaters used for the simulation
- and the second file is scenario1.movements.gz, which is a compressed file containing the movement data
5. These two files cannot be directly used in ns2, an application called "NSFILE" is provided with bonnmotion package which is used to transform these files so that they can be integrated to TCL and used with NS-2.
6. Open the dos prompt again, and navigate to the bin directory location of your Bonnmotion and type the following command
        bm NSFile -f scenario1
This command will generate two files
- scenario1.ns_params containing the parameters for running simulations in NS-2
-scenario1.ns_movements which contains the movements data essential for NS-2
7. Now comes the critical part,- How to use this files in NS-2
In the TCL script of your protocol, assign the path of the scenario1.ns_movements file to the sc variable,
you may ignore the scenario1.ns_params file.
#-----------------------------------------------------------------
# Scenario parameters
#------------------------------------------------------------------
set val(x) 2000 ;# X dimension of the topography
set val(y) 2000 ;# Y dimension of the topography
set val(ifqlen) 100 ;# max packet in queue
set val(seed) 0.0 ;#random seed
set val(adhocRouting) [routing protocol]
set val(nn) [no. of nodes] ;# how many nodes are simulated
set val(cp) [traffic pattern file]
set val(sc) [mobility scenario file]

You now have the Random Waypoint model successfully incorporated in your script.

Any Comments, Suggestions, Positive Criticism and Corrections are welcome!!!
Please apologise me for my English!!!!!

Hope that helped!
Good Luck :)

Friday, January 16, 2009

How I installed bonnmotion on WindowsXP system with jdk1.5

My project needs a Random way point scenario to be created, and on searching on Google i came across a useful tool called as Bonnmotion. The tool seemed to be useful but the problem is that it is a very old version. This tool can be downloaded from this link and you can find the documentation of this tool here. This is the homepage of this tool BonnMotion.

http://web.informatik.uni-bonn.de/IV/Mitarbeiter/dewaal/BonnMotion/

The BonnMotion is a Java software. It can be installed in Linux and also in Windows. It has been tested on jdk1.4. It can be used to create the following models
  • the Random Waypoint model,
  • the Gauss-Markov model,
  • the Manhattan Grid model and
  • the Reference Point Group Mobility model.
Coming to my experience, recently my whole day was wasted installing this tool. I initially tried to install it on Linux but as I need to install java in Linux and my Linux version is RHEL 3, which is a old version (I was concerned whether jdk6 will be compatible with RHEL 3 or not) so I decided I would go with Windows instead. The sad part of the story is that I was unable to install it straight-away in Windows either.

Once I tried to execute the install script it asked the java path which I provided, my Java path is
C:\Program Files\Java\jdk1.5.0
and next it asked the bonnmotion path. I placed my bonnmotion in the C: directory itself.

I initially thought the problem was concerning with version compatability of Java, Bonnmotion was tested with jdk1.4, and I have jdk1.5 installed on my system. I searched in the net for jdk1.4 and was unsuccessful in my effort, than I tested some of the scripts in batch file and felt like there were some problems with the scripts in batch files.[This I cannot guarantee, and is just my thought].

Ok this is what I did and successfully installed Bonnmotion in my Windows XP.
While looking at the errors
"The system cannot find the specified path"
I observed that the error emerged from the statements
if not exists ......
script statement in "install.bat" batch script
so I removed all such statements from that script, and also embeded the important JAVA variables within double quotes

Here are the steps to be followed:
1. Try to edit the install.bat file using notepad or any of your favourite text editor,

2. This is the install.bat file before modification(here I am showing only the lines to be modified, not the entire code)

.............................
.............................

set PACKAGE=edu.bonn.cs.iv.bonnmotion
set JAVA=%JAVAPATH%\bin\java.exe
set JAVAC=%JAVAPATH%\bin\javac.exe
set JAVADOC=%JAVAPATH%\bin\javadoc.exe

if not exist %JAVA% (
echo Don't forget to configure this script.
echo Could not find java.exe : %JAVA%
goto Ende
)
if not exist %JAVAC% (
echo Don't forget to configure this script.
echo Could not find javac.exe : %JAVAC%
goto Ende
)
if not exist %JAVADOC% (
echo Don't forget to configure this script.
echo Could not find javadoc.exe : %JAVACDOC%
goto Ende
)
if not exist %BONNMOTION% (
echo Don't forget to configure this script.
echo Could not find BonnMotion root directory: %BONNMOTION%
goto Ende
)

echo Installing ...

REM bm
set FILE=bm.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo %JAVA% -cp %BONNMOTION%\classes %PACKAGE%.run.BM %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >> bin\%FILE%

REM compile
set FILE=compile.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist classes mkdir classes >> bin\%FILE%
echo echo on >> bin\%FILE%
echo for /r %%%%i in (*.java) do %JAVAC% -d classes -sourcepath src -classpath classes %%%%i >> bin\%FILE%

REM makedoc
set FILE=makedoc.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist doc mkdir doc >> bin\%FILE%
echo %JAVADOC% -quiet -d doc -use -windowtitle "BonnMotion" -sourcepath %BONNMOTION%\src edu.bonn.cs.iv.bonnmotion edu.bonn.cs.iv.bonnmotion.apps edu.bonn.cs.iv.bonnmotion.run edu.bonn.cs.iv.bonnmotion.models >> bin\%FILE%

echo done.
:Ende


......................................
......................................

3. After deleting the conditional statements which start with "if not exist" (You can also comment the lines if you do not want to delete them, by placing :: before the lines) and embeding some important Java variables (JAVA,JAVAC,JAVADOC) within doublequotes

The modified code looks like this

..............................
..............................

set PACKAGE=edu.bonn.cs.iv.bonnmotion
set JAVA=%JAVAPATH%\bin\java.exe
set JAVAC=%JAVAPATH%\bin\javac.exe
set JAVADOC=%JAVAPATH%\bin\javadoc.exe

::The conditional statements are deleted

echo Installing ...

REM bm
set FILE=bm.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo "%JAVA%" -cp %BONNMOTION%\classes %PACKAGE%.run.BM %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >> bin\%FILE%

REM compile
set FILE=compile.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist classes mkdir classes >> bin\%FILE%
echo echo on >> bin\%FILE%
echo for /r %%%%i in (*.java) do "%JAVAC%" -d classes -sourcepath src -classpath classes %%%%i >> bin\%FILE%

REM makedoc
set FILE=makedoc.bat
echo %FILE%
if exist bin\%FILE% del bin\%FILE%
echo @echo off >> bin\%FILE%
echo cd %BONNMOTION% >> bin\%FILE%
echo if not exist doc mkdir doc >> bin\%FILE%
echo "%JAVADOC%" -quiet -d doc -use -windowtitle "BonnMotion" -sourcepath %BONNMOTION%\src edu.bonn.cs.iv.bonnmotion edu.bonn.cs.iv.bonnmotion.apps edu.bonn.cs.iv.bonnmotion.run edu.bonn.cs.iv.bonnmotion.models >> bin\%FILE%

echo done.
:Ende

......................................
......................................

4. Now try to install the Bonnmotion by double clicking the install.bat file. If you see these files being created
bm.bat
compile.bat
makedoc.bat
than bonnmotion is successfully installed in your system. Congrats!!!

Any Comments, Suggestions, Positive Criticism and Corrections are welcome!!!

Hope it helped!
Good Luck!!! :)