[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] Accessing Energy state through routing agent



this was one way i used to access the enery level of
the nodes, by first including

#include "node.h"

Node *rt_thisnode;
    rt_thisnode =
Node::get_node_by_address(nb->nb_addr);
    if((rt_thisnode -> energy_model() &&
       
rt_thisnode->energy_model()->energy())>rt_energy) {
          rt_energy =
rt_thisnode->energy_model()->energy();
          rt_id = nb->nb_addr;
    }

Ahmad

--- nitin kumar singh <[email protected]> wrote:
> hi,
>        I am trying to simulate routing of packets
> based on the energy level of 
> nodes . I need to know how can one send the current
> energy level of the node 
> to the routing agent attached to that node .
>    
> As an example when we do :
> 
> node-config -adhocrouting DSDV "
> 
> We make a new Agent/DSDV and send node id as a
> parameter , now this id ( 
> address) remains constant throughout the simulation
> ( I am assuming this!) 
> whereas the energy level of the node changes all the
> time and
> my routing agent needs to know this energy level to
> construct packets .
> 
> i want to know if i pass the node itself as a
> parameter during the creation to 
> DSDV constructor then will i be able to access
> node->energymodel()->energy_ 
> and get the energy value correctly ? 
> I think it boils down to if the parameter passing is
> by reference or by value 
> between and OTcl and C++ . Is thery any other way u
> might suggest to get to 
> know the energy level of the node to which my
> routing agent is attached?
> 
>   thanks ,
>   nitin
> 


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com