Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to select an energy based path in AODV routing protocol using NS2?

Description

During route discovery process of the routing, every node receiving RREP (Route Reply) packet forwards it only if its energy is greater than threshold otherwise it drops it. Hence the RREP packet is reached to the source node only through energy efficient nodes. In this way the data is transmitted via energy efficient path. Sample code given below considers AODV routing protocol and route reply functionality of AODV protocol is modified in such a way that it selects energy efficient path. Each node is required to be configured with energy model in TCL script.

Sample Code

# Configure the Energy

for {set i 0} {$i < $val(nn)} {incr i} {

set energy($i) [expr rand()*100]

$ns node-config \

-initialEnergy $energy($i) \

-rxPower 0.1 \

-txPower 0.3

set E($i) $energy($i)

set IE($i) $E($i)

set node_($i) [$ns node]

$node_($i) color black

}

set source 3

set destination 5

$ns at 0.1 "$node_($source) color magenta"

$ns at 0.1 "$node_($destination) color magenta"

$ns at 0.1 "$node_($source) label Source"

$ns at 0.1 "$node_($destination) label Destination"

# Defining Communication Between source node to destination node

set udp [new Agent/UDP]

$ns attach-agent $node_($source) $udp

set null [new Agent/Null]

$ns attach-agent $node_($destination) $null

$ns connect $udp $null

set cbr [new Application/Traffic/CBR]

$cbr attach-agent $udp

$cbr set packetSize_ 512

$cbr set interval_ 0.1

$ns at 1.0 "$cbr start"

$ns at 6.0 "$cbr stop"

 

 

aodv.cc file
//Energy based Path Selection using AODV Protocol

iNode1 = (MobileNode *) (Node::get_node_by_address(index));

residual_energy = iNode1->energy_model()->energy();

if (residual_energy > 35.0) {

forward(packet);

} else {

discard(packet);

}

Screenshots

Normal path

 

Source node is 3.

Destination node is 5.

Source transmits data to destination via the normal path found by AODV routing protocol.

3 – 4 -10 – 9 – 5.

Energy based path

 

Source transmits data to destination via energy based path

3 – 4 -10 – 8 – 5


select an energy based path in AODV routing protocol
AODV routing protocol in NS2 MANET