Hi Maurizio Bellemo

It depends upon which type of energy module you are using. For instance if
you are using SMAC then it has some other variables for energy module. OR If
you are using your customized energy module then it may have other names
used as variables.

I think to calculate the distance between the nodes, following functions may
be helpful to you.

void MobileNode::getLoc (  double *  *x*,

double *  *y*,

double *  *z*
)  [inline] double MobileNode::distance (
MobileNode<http://www-rp.lip6.fr/ns-doc/ns226-doc/html/classMobileNode.htm>*
 )
see MobileNode.h File
http://www-rp.lip6.fr/ns-doc/ns226-doc/html/mobilenode_8h.htm

And you also need to work on with the energymodule file
http://www-rp.lip6.fr/ns-doc/ns226-doc/html/energy-model_8h.htm

And you have to create a logic in your recv() and send() functions to fulfil
your task.

Regards

Mubashir Husain Rehmani

2008/9/18 Maurizio Bellemo <[EMAIL PROTECTED]>

> Thank you Mubashir and Ahmad.
>
> If you are not very busy i would have another question. I'm trying to
> simulate an efficient flooding and i need the data about transmission power.
> I'll try to be clear. I have a MANET with all the nodes moving around and,
> supposing a constant signal strength, i want to know it to determine the
> distance between the node. If a packet reaches the destination with a low
> power i will suppose the node is farthest than another which packet arrives
> with a greater power. How can i take this data?
>
> Thank you very much
> Maurizio
>
> 2008/9/17 Mubashir Rehmani <[EMAIL PROTECTED]>
>
> Hi Mauriwio Bellemo
>>
>>
>>
>> Here is the example of simple timer
>> >
>> >
>> > *Declare this timer in the header fil***e**
>> >
>> >
>> > class MyTimer : public TimerHandler {
>>
>>
>> >  public:
>> >
>> >   MyTimer(AODV* ms) : TimerHandler() {ms_=ms;};
>> >
>> >  protected:
>> >   virtual void expire(Event* e);
>> >   AODV* ms_;
>> >
>> >
>> > };
>> >
>> >
>> > MyTimer MS_*timer*_;
>>
>>
>> >
>> >
>> > *Declare in the .cc file *
>> >
>> > void MyTimer::expire(Event*) {
>> >
>> >
>> >
>> >         ms_->MS_*timer*_.resched(10); //delay of 10 seconds
>> >         cout<<"time is : "<<Scheduler::instance().clock()<<endl;
>>
>>
>> >         //call any function which you want to schedule....
>> >
>> > }
>> >
>>
>>
>> Now what you have to do is simply in the expire function, just write the
>> logic for purging the entries (removal of entries) from the table. For
>> instance, you can look at AODV.cc file in which they have clearly defined
>> the logic of purging the routes from the routing table.
>>
>> I hope it helps.
>>
>> Mubashir Husain Rehmani
>>
>> Regards
>>
>>
>> 2008/9/17 Maurizio Bellemo <[EMAIL PROTECTED]>
>>
>>
>>> Hi,
>>>
>>> I'm writing a piece of code to create a routing table with the use of std
>>> map. Does anyone know how I can implement lifetime?? I need to create a
>>> timer which, at the expiration, causes the removal of the entry in the
>>> table. Any suggestions?
>>>
>>> Thank you very much
>>> Maurizio
>>>
>>
>>
>>
>> --
>> Mubashir Husain Rehmani
>>
>> Mobile : 00 33 (0)6 32 00 89 35
>>
>>
>


-- 
Mubashir Husain Rehmani

Mobile : 00 33 (0)6 32 00 89 35

Reply via email to