[Smac-users] two questions in ns2 smac program

=?gb2312?q?=D5=F7=20=BA=E9?= hz83997 at yahoo.com.cn
Thu Jul 15 03:38:24 PDT 2004


Thank you very much for your reply. I still have two questions.

(1)As you mentioned, sleepTime_ is the duration of sleep, can  you explain what does the program mean below? Because I find lots of this kind of sentence in the program.
 
  if( mhCounter_[0]->value_ == sleepTime_ )
                        sleep();
 
As far as I am concerned, the sentence means at the time of compare, if 
mhCounter_[0]->value_ equals sleepTime_, the node goes to sleep. But I wonder what is the meaning of comparing two "durations"? I had thought mhCounter_[0]->value_ is a "point in time" rather than "a duration of time". 

(2)what's the meaning of function adaptivelisten()? In the original journal, the 
mechanism of adaptive listen enables the node to wake up immediately after a nearby transimssion. I read the original program of adaptivelisten(), and found the main function seemed to be  "set timer to bring the node back to sleep " after adaptive listen. This function is called in handleNavTimer() ,handleNeighbNavTimer() and many other functions. I wonder what function does adaptivelisten()  perform in SMAC.
 
Thanks a lot!
 
*****************************
void SMAC::adaptiveListen()
{
        // adaptively wake-up at the end of current transmission. Will try to
        // send only if the buffered packet is unicast. Since my next-hop
        // neighbor may not be aware of the Tx of my previous-hop neighbor,
        // broadcast now is unreliable
        file://printf("adaptiveListen set AdaptiveTimer: node %d scheduletime: %f 
adapTime_: %d time:%.9f \n", index_, mhCounter_[0]->value_, adapTime_, 
Scheduler::instance().clock());
        mhAdap_.resched(CLKTICK2SEC(adapTime_)); // set timer to bring me back to 
sleep
        adaptiveListen_ = 1;
        if (state_ == SLEEP) {
                file://printf("adaptiveListen wakeup: node %d scheduletime: %f time:%.9f 
\n", index_, mhCounter_[0]->value_, Scheduler::instance().clock());
                wakeup();
        }
         else {
        }
                                                                                     
                                                                       
        if ( schedTab_[0].txData == 1 && sendAddr == UNICAST_ADDR){
                adapSend_ = 1;
                checkToSend();
        }
}
#endif




---------------------------------
Do You Yahoo!?
ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬"Ò»ËÑ"ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
100Õ×ÓÊÏä¹»²»¹»Óã¿ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.isi.edu/pipermail/smac-users/attachments/20040715/80877ac1/attachment.html


More information about the Smac-users mailing list