random deployment of node in NS2
hi all
i would like to know how to randomly deploy some wireless sensors nodes in ns2. have been trying and am getting this error / Code:
num_nodes is set 120 for {set i 0} {$i < $val(nn)} { incr i } { set X_ axis [expr rand()*600] set Y_ axis [expr rand()*500] $node_($i) set X_$X_ axis $node_($i) set Y_$Y_ axis $node_($i) set Z_$X_ 0.0 } i believe it is something simple but i guess i need some coffee:) i cant see it. thanks |
I don't think this is the biggest problem but I'd say you probably need a space in here:
Code:
X_$X_ axis Code:
X_ $X_ axis However, the error leads me to believe your syntax is wrong; specifically the addition of the "axis" after $X_ in the two lines after the for loop. Consider something like this instead: Code:
for {set i 0} {$i < $val(nn) } { incr i } { |
Quote:
but moreover i had to declare the variable X_ s a random variable to make it work! now its work fine thanks |
All times are GMT -5. The time now is 06:56 AM. |