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

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


Pavan said...

Hi , I tried using bonnmotion. I installed successfully, but wen i run the commmand it says Exception in main thread " NoClassFoundError:

CAn u HeLP??


Pavan said...

Hi , I tried using bonnmotion. I installed successfully, but wen i run the commmand it says Exception in main thread " NoClassFoundError:

Anonymous said...

Altough this post is quite old. Maybe somebody has the same problem...

Unfortunatly Pavan did not specify what he did, but I guess he forget to compile the bonnmotion classes.

HowTo install bonnmotion?
1. run the "install" script
2. go to the bin/ dir and run "compile"
3. That's it ;)

A FAQ can be found under

victor said...


I did a ManhattanGrid scenario with bonnmotion. I converted to the ns2 version but it is not working.

I could find that sometimes the "setdest" command of a node is called before that node reaches its current destination, so ns2 stops with not any comments. Quite frustrating.

Would be really grateful if someone could put some light on this...

Staci said...

Hi I'm trying to install this on Windows 7 but don't understand what I need to change in the install.bat file. I need to add the Java and BonnMotion path but not sure where. Can someone please help me??

Nandini Samshette said...

once scenario1.ns_params and scenario1.ns_movements generated how to assign path of scenario1.ns_movments file to sc variable

ranjith kumar said...


Arvind Shukla said...

kindly help me for this
bm -f example TIMM -b graph -F 1.037,0.212 -g 4,4,4,4 -G -o 16.1,66.8 -s 0.577,0.106 -S 10,20,30,40 -n 16

Tactical Indoor Mobility Model ("TIMM").
i am facing problem to run this command
when i put this cmd as its is at cmd prompt
The problem is :
error whil parshing string to double array:"1.037 0.212"
java.lang.NumberFormatException:For input string:"1.037 0.212"

kindly help me for running this command

Arvind Shukla

ishani desai said...

i am using bonmotion..but i am getting error while using scenario file i tcl script.. how can i solve this error?

Anonymous said...

Hello and thank you chandra for the help through your blo i want to ask can we change the sending packet rate in bonnmotion actually i want to produce random sending rate