Thursday, October 7, 2010

Node Movement and Topology Generation

To simulate a mobility scenario, the nodes' positions at every time instant need to be determined.


Instead of specifying and controlling each nodes' position and movement pattern, we may use a CMU tool "setdest" to generate large number of nodes and there movements. The tool use a random waypoint model.
Setdest
Setdest tool is used to generate the positions of nodes and their moving speed and moving directions.
The syntax is:

 setdest -v 1 -n $numnodes -p $pt -M $maxspeed -t $simtime -x $maxx -y $maxy
for example: 

    setdest -v 1 -n 50 -p 0 -M 20 -t 900 -x 1500 -y 300
will generate a 1500*300 topology with 50 nodes random distributed labeled by a XY(Z) coordinates.  

(Note that, there is a bug in the README file, which gives a wrong option for specifying the speed, we should use "-M" instead of "-s" ).
In the output, you can find that: after the initial positions are given, the nodes are specified with their movement destination and speed. Then, the initial distance (hop counts) information are counted by a GOD. 
Currently, the god object is used only to store an array of the shortest number of hops required to reach from one node to an other. The god object does not calculate this on the fly during simulation runs, since it can be quite time consuming. The information is loaded into the god object from the movement pattern file (this file)..
Then, the nodes are going to move during this 900-second simulation scenario. During this, the distance (hop-counts) information is going to change, thus, the following lines are going to show this recent change. Note that the distance is calculated based on a nominal radio range as "250" meters. The god information should not be available to any of the node. Thus, for a routing protocol, it has to discover the distance by itself with some mechanism.
It's possible that a node reaches its destination before the simulation timer ends. Thus, it needs to re-specify a new direction and speed for it. Also, the average pause time is a parameter to allow a node stop to move in a destination before moving again.
Finally, there are some statistics about this movement file? During the simulation, some nodes get isolated from all other nodes which results one count of "destination unreachable". Also, all route changes and link changes are calculated.
# nodes: 50, pause: 0.00, max speed: 20.00, max x: 1500.00, max y: 300.00
#
$node_(0) set X_ 1472.239335818631
$node_(0) set Y_ 218.102475038104
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 266.329091949493
$node_(1) set Y_ 188.988756134562
$node_(1) set Z_ 0.000000000000
.....
$ns_ at 0.000000000000 "$node_(0) setdest 298.258250355189 34.553480936942 5.763540789209"
$ns_ at 0.000000000000 "$node_(1) setdest 783.793876303622 280.181784294036 16.832727003192"
$ns_ at 0.000000000000 "$node_(2) setdest 978.836090908830 151.467060345492 19.354908025316"
$ns_ at 0.000000000000 "$node_(3) setdest 376.126888262665 139.747808400435 11.497476206039"
$ns_ at 0.000000000000 "$node_(4) setdest 370.541780738321 185.032792269909 8.002013555825"
$ns_ at 0.000000000000 "$node_(5) setdest 1463.652810766312 132.618506062927 17.607998988233"
$ns_ at 0.000000000000 "$node_(6) setdest 1020.046295404814 40.982731716802 15.434148765705"
......
$god_ set-dist 0 1 6
$god_ set-dist 0 2 1
$god_ set-dist 0 3 4
$god_ set-dist 0 4 2
$god_ set-dist 0 5 4
$god_ set-dist 0 6 8
$god_ set-dist 0 7 6
......
$ns_ at 0.141920608238 "$god_ set-dist 17 24 2"
$ns_ at 0.165720133690 "$god_ set-dist 3 15 1" 
$ns_ at 0.263269271549 "$god_ set-dist 1 46 2" 
$ns_ at 0.263269271549 "$god_ set-dist 7 46 2" 
$ns_ at 0.263269271549 "$god_ set-dist 12 46 1"
$ns_ at 0.263269271549 "$god_ set-dist 25 46 3"
$ns_ at 0.263269271549 "$god_ set-dist 46 47 3"
$ns_ at 0.314230786054 "$god_ set-dist 5 42 5" 
......
$ns_ at 12.602131706040 "$god_ set-dist 16 36 2"
$ns_ at 12.623221733243 "$node_(12) setdest 424.679916546080 186.581540202946 5.803287072825"
$ns_ at 12.682532746855 "$god_ set-dist 18 40 3"
.....
$ns_ at 899.907548331028 "$god_ set-dist 32 40 1"
$ns_ at 899.932142983319 "$god_ set-dist 22 40 1"
$ns_ at 899.991403308054 "$god_ set-dist 3 29 1"
#
# Destination Unreachables: 429
#
# Route Changes: 72037
#
# Link Changes: 11892
#
# Node | Route Changes | Link Changes
# 0 | 2709 | 433
# 1 | 3098 | 467
# 2 | 2651 | 496
# 3 | 3398 | 642Setdest
# 4 | 3036 | 548
# 5 | 2755 | 252
# 6 | 3471 | 601
for generate scenarios in a patch, we could use following shell scripts.
#!/bin/csh
unset noclobber
set outdir = wzb-scen

set maxspeed = 1
set numnodes = 50
set maxx = 1500
set maxy = 300
set simtime = 900

foreach pt (5 10 15 20 25 30 40 50)
foreach scen ( 1 2 3 4 5)
echo scen $scen : setdest -n $numnodes -p $pt -M $maxspeed -t $simtime \
      -x $maxx -y $maxy
time ./setdest -n $numnodes -p $pt -M $maxspeed -t $simtime \
      -x $maxx -y $maxy \
      >$outdir/scen-${maxx}x${maxy}-${numnodes}-${pt}-${maxspeed}-${scen}
echo
end
end

12 comments:

AL SHEHRI said...

Nice .. what about if I want to generate a random movement but without extra generating .. Instead I would like to control the next step movement dynamically and while live or runtime all in Mobile Network ??

Anchal Kumawat said...

dear sir could u plz help me about the setdest command.
when i am writing



ns-2.35/indep-utils/cmu-scen-gen/setdest$ setdest -v 1 -n 50 -p 0 -M 20 -t 900 -x 1500 -y 300
setdest: command not found


this above type of error coming.
reply me sir..

with regards
anchal kumawat

ali ej said...

1 Enter the folder /home/ali/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/setdest/setdest.
./setdest -v2 -n 150 -s 1 -m 1 -M 5 -t 300 -p 0 -x 1000 -y 1000 > scen2n150
comand -v2 number of nodes speed min sped M is Max speed t is simulation senario
time p is pass time x position y position > file name to put the result in
2.Or using the file make-scen.csh
open this file and chage you network setting
like in 1 such that max speed, number of nodes and so on.

ali ej said...

the command is ./sedest

neha said...

Hello sir..
please can u tell me how to use mobility model Random Way Point in MANET?

ali ej said...

I am on leave I will try to answer your pquestion as soon as possible, plz remind me on Tuesday.tq

Pratikshya Shrestha said...

Hello sir,
I am confused after editing the setdest file. I have a tcl file with my scenarios and need to run that tcl file with the random generation of nodes. How do i run it?

One more question sir, how can we find out the direction of motion of a node? I need to calculate the LET parameter. So, I need the moving direction of each node too.

Please help me!

ali ej said...

Q1. to make new movement follow the previous post :
1 Enter the folder /home/ali/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/setdest/setdest.
./setdest -v2 -n 150 -s 1 -m 1 -M 5 -t 300 -p 0 -x 1000 -y 1000 > scen2n150

Q2 in the new file which is scen2n150 aft you open it you can see the movement and the position of the node durin the sim time
I wish I answer ur qs.


Pratikshya Shrestha said...

Thank you for your reply sir. So, i dont have to edit or anything in my original tcl file ? dont i have to link the node movement file and my original tcl file?

ali ej said...

The mobility file is Stan alone and you tcl should call this file

mala said...

hello sir, i have a txt file which consist of anchor node movement. i dont know how to add that in txt file in my ns2 code!!!

Unknown said...

Hi sir! Can you tell me how to attach mobile node with sensor nodes?