Highest Energy Level Nodes in ns2

  • Highest energy node in Wireless network is identified using the following formula:
  • Execute the following commands to set the energy of nodes.Energy of all nodes

    for {set i 0} {$i < 5 } {incr i } {set E($i) [expr rand()*1000];#Energy is applied within 1000 Jules$ns node-config \-initialEnergy $E($i)

    set node_($i) [$ns node] ;#node creation

    }

  • Sorting energy value facilitate in identifying Highest Energy Node