Energy based routing is the important routing functionality required by MANET. Energy of the node is considered while selecting the router to balance the energy consumption of the network.
#Filename: aodv.cc
residualenergy = Nodeaddr->energy_model()->energy();
If (residualenergy > Threshold) {
// send reply via the energy efficient router
}