Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to set dynamic topology of the nodes in NS2?

  • The dynamic topology can be created in ns2 using rand function.
  • Each node is assigned with a random location within area (Val(x)*Val(y)) using rand function.

    set ns [new Simulator]
    set node_(0) [$ns node]
    set Val(x) 500
    set Val(y) 500
    $node_(0) set X_ [expr rand()*$val(x)]
    $node_(0) set Y_ [expr rand()*$val(y)]
    $node_(0) set Z_ 0
    where,
    ns → Simulator instance
    rand() → Random Function
    $val(x) → X dimension of the network
    $val(y) → Y dimension of the network