Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to set sleep and wakeup for nodes in ns2 in aodv
#1

how to set sleep and wakeup for nodes in ns2 in aodv

public:
AODV();
void CLUSTERING();
..
AODV.cc :
void AODV::CLUSTERING(){
if(current_){
while(numberofNodes){
// Selecting clusters
}
}
}
Now we know how the mechanism of ns2 works.so let's get started with sleep nodes.
First of all there is 4 functions in ns2 for turning a node to 'off', 'on', 'sleep', 'idle'. The difference between these are not so big.
As you know the 'off' function turns a node to off but it still broadcasts something based on your protocol.
$ns_ at 7.0 "$node(2) off"
And you can turn it on like :

$ns_ at 7.0 "$node(2) on"
The base is :

$simulator at $time "$Node_($number) off"
I don't know how to set a node to sleep in scenario.tcl but you can do that in your protocol's codes.
Now, to set a node to sleep we could do several things..

setting nodes to sleep from energy model
setting nodes to sleep from wireless physics
First we'll try energymodel.cc and if it didn't work we'll use the other one.
To set a node to sleep from energymodel.cc we can use this code in void Mac802_11::recv function in ns-2.35/mac/mac-802_11.cc :

if(index_ == myNode){
EnergyModel *em = netif_->node()->energy_model();
if (em && em->sleep()) {
em->set_node_sleep(1);
//em->set_node_state(EnergyModel::INROUTE);
}
}
Replace myNode with the number of the interface you want to set it to off.
If you are not using MultiInterface for your simulation so the number of interfaces will be equal to the number of your nodes.

example :
Normal :

node -- > interface --> channel
MultiInterface :

-- > interface[0] --
--
v
node -- -- > interface[1] -- > channel
^
--
-- > interface[2] --
Open a terminal and cd to your ns2 directory, for example if you have ns-allinone-2.35, cd to /ns-allinone-2.35/ns-2.35/ and now type make and inter. After it finished try to simulate your scenario.tcl.

Now if your simulation start and you see the nam file, when the nodes get the first packet, the shape of them must change from balck circle to black circle blue hexagon.
From then on the nodes must not send or receive any data packet.

If this way didn't work now it's the time to use the other option.
Go to /ns-2.35/mac/ and open wireless-phy.cc.
You'll see that at the end of the file it contains our 4 function that we need.
we can simply use those function on the wireless-phy.cc to set a node to sleep or off by just calling those functions.But we may need to use them in another layer like in mac.
To use those functions in mac-802_11.cc simply use the below code anywhere you want in mac-802_11.cc and add wireless-phy.cc to your mac headers:

#include "wireless-phy.h" // at the header of mac-802_11.cc
/*
* Use the below code in any function you want in mac
*/
Phy *p;
p=netif_;
((WirelessPhy *)p)->node_sleep();
And to use another one of those 4 function just change the function's name like ->node_sleep(); to ->node_wakeup();.
Reply

#2
how to set sleep and wakeup for nodes in ns2 in aodv

ABSTRACT

MANET became the focus of researchers as a promising technology for a broad range of applications due to their selforganizing,
self-configuring capability in different mobile network scenarios. One significant area of research within ad hoc networks is energy consumption issue. The primary goal of ad hoc networks is to call for the energy-constrained protocols. Energy consumption evaluation methodology is introduced for the protocol consideration in different mobile network. AODV routing protocol performs well on assessment of energy consumption for the mobile ad hoc network with high node mobility. Nodes in MANET networks are basically battery operated, and thus have access to alimited amount of energy. This process proposes an Energy based Ad-Hoc on-Demand Routing algorithm that balances energy among nodes so that a minimum energy level ismaintained among nodes and the lifetime of network is increased. This paper, focused on increasing the prolonged existence of node in the network. In this proposed work, one set the minimum energy threshold limit of a mobile node,when a node reach the minimum threshold limit the node goes to sleep mode, save energy and participate in the event aslong as possible. The research papers are published toimprove the network lifetime on the network layer. The construct of network scenarios and performance analysis is done on NS-2.34 to simulate both the AODV and AODVSleep under the similar scenario. This paper also compares and analyzes the simulation results with a popular on-demandrouting protocol AODV to show the usefulness of this algorithm. From this simulation one finds that the overallMANET s efficiency is enhanced.
Reply

#3
123456789123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789123456789123456789
123456789
123456789
123456789
Reply

#4
How to make a node uninterested or in sleep mode. We have done few changes in mac.cc file but dono which command to use in tcl script.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.