[Smac-users] regarding listenTime_ and cycleTime_ in ns2 smac program

=?gb2312?q?=D5=F7=20=BA=E9?= hz83997 at yahoo.com.cn
Wed Jul 14 01:27:29 PDT 2004


Recently I am reading SMAC program in ns2. IN my opinion,
sync   data       sleep      sync    data
-------|-----------|-----------------|--------|-----------
   listenTime        sleeptime
listenTime=synctime+datattime;

In the program, I wonder what the variables listenTime_, dataTime_,cycleTime_ stand for? Do they stand for " beginning of the  listen period ", " beginning of the data transfer period " or " end of the listen period " and " end of the data transfer period " ? But what does cycleTime_ mean?
 
As we can see from the original program, 
if (time <= CLKTICK2SEC(cycleTime_) && time > CLKTICK2SEC(listenTime_)) 
the commentary is "in sleep state", 
I am puzzled here. Can anyone help me clarify the three variables.
 
Thanks a lot!
 
***********************************************************************************
void SmacCounterTimer::sched(double time) {
 // the cycle timer assumes that all time shall be scheduled with time "left to sleep" 
 // and not the absolute time for a given state (sleep, sync or data). Thus inorder 
 // to schedule for a sleep state, need to schedule with aggregate time CYCLETIME 
 // (sleeptime+synctime+dadatime).
 // Similarly for sync state, schedule with listenTime_ (synctime+datattime)
 // This is implemented to be in step with the counter used in actual smac.
 tts_ = time; // time before it goes to sleep again
 stime_ = Scheduler::instance().clock();
  
 if (time <= CLKTICK2SEC(cycleTime_) && time > CLKTICK2SEC(listenTime_)) { // in sleep state
  value_ = sleepTime_;
  if (status_ == TIMER_IDLE)
   TimerHandler::sched(time - CLKTICK2SEC(listenTime_)); 
  else
   TimerHandler::resched(time - CLKTICK2SEC(listenTime_)); 
    
 } else if ( time <= CLKTICK2SEC(listenTime_) && time > CLKTICK2SEC(dataTime_)) { // in sync state
  value_ = syncTime_;
  if (status_ == TIMER_IDLE)
   TimerHandler::sched(time - CLKTICK2SEC(dataTime_)); 
  else
   TimerHandler::resched(time - CLKTICK2SEC(dataTime_)); 
    
 } else { // in data state
  assert(time <= CLKTICK2SEC(dataTime_));
  value_ = dataTime_;
  if (status_ == TIMER_IDLE)
   TimerHandler::sched(time); 
  else
   TimerHandler::resched(time); 
    
 }
}
 



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


More information about the Smac-users mailing list