[ns] Moving wireless nodes

Przemek Machan przemac-ns at o2.pl
Sat Jun 11 02:39:00 PDT 2005


You can disable random motion and schedule "setdest" command to move node in
the specified direction, e.g. $ns at 10.0 "$node_($i) setdest 1400 190 10".
With random motion turned on the node will "appear" in random locations
during the simulation.
See ns manual and ns-2.2x/ns-tutorial for examples.

Regards,
Przemek



-----Original Message-----
From: ns-users-bounces at ISI.EDU [mailto:ns-users-bounces at ISI.EDU] On Behalf
Of Rafael Paoliello Guimaraes
Sent: Friday, June 10, 2005 5:35 PM
To: ns-users at ISI.EDU
Subject: [ns] Moving wireless nodes


Hello all,

Maybe this is a stupid question, I don't know... But I don't really know how
to do this. I am trying to run simulations with a manet (mobile
nodes) but I want the nodes to have different initial positions. I will have
x nodes that move around randomly and communicate to each other and, I want
to run X different scenarios and the only difference between them is the
initial position of the nodes.

I was able to do this with a static scenario. In this case, I have changes
the random seed and set the position of each node:

set rng [new RNG]
$rng seed $opt(RNDseed)

for {set i 1} {$i <= $opt(NumOfMN) } {incr i} {
      set node_($i) [$ns_ node]
      $node_($i) set X_ [expr [$rng next-random] % $opt(X)]
      $node_($i) set Y_ [expr [$rng next-random] % $opt(Y)] }

But if I try to move the nodes, this does not work. How can I set these
initial positions? I have tried with the code below, but ns seems to ignore
the positions I have set.

set rng [new RNG]
$rng seed $opt(RNDseed)

for {set i 1} {$i <= $opt(NumOfMN) } {incr i} {
      set node_($i) [$ns_ node]

      # Set initial position
      $node_($i) random-motion 1  ;# enable random motion

      $node_($i) set X_ [expr [$rng next-random] % $opt(X)]
      $node_($i) set Y_ [expr [$rng next-random] % $opt(Y)]

      $node_($i) set speed_ $opt(speed)
      $node_($i) start
}

I have also tried without the "set X_" and "set Y_" commands, but the start
command does not seem to be influenced by the random seed...

Cheers,

-- 

===========================================
  Rafael Paoliello Guimaraes
  PhD Student - Computer Networking Group
  Department of Computer Architecture (DAC)
  Polytechnic University of Catalonia (UPC)
  Phone: +34-934017187   Fax: +34-934017055
  URL: http://people.ac.upc.es/rpaoliel
===========================================


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 2005-06-08
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.6.7 - Release Date: 2005-06-10
 



More information about the Ns-users mailing list