[Tinyos-help] Time in Trickle

2008-07-02 Thread Jimmy Lee
Hi, everyone:

  I've read the Trickle implementation code
(\tos\lib\net\TrickleTimerImplP.nc) in 2.X.

  And I'm puzzled by the variable time in this code.

  This is the defination of struct trickle_t:
  typedef struct {
uint16_t period;
uint32_t time;
uint32_t remainder;
uint8_t count;
  } trickle_t;


  I wonder about what the time and remainder means?

  Also, at the function adjustTimer(), I have some  questions.

event void Timer.fired()
{
uint8_t i;
uint32_t dt = call Timer.getdt();

for (i = 0; i  count; i++)
{
  uint32_t remaining = trickles[i].time;//What does the remaining mean?
  if (remaining != 0)
{
  remaining -= dt;// Does this make remaining negative?
  if (remaining == 0)

{
  if (trickles[i].count  k)
{
  atomic
{
call Pending.set(i);
  }
  post timerTask();
  }

generateTime(i);

   /* Note that this logic is not the exact trickle algorithm.
* Rather than C being reset at the beginning of an interval,
* it is being reset at a firing point. This means that the
* listening period, rather than of length tau/2, is in the
* range [tau/2, tau].
*/


trickles[i].count = 0;//
   }
   else
{
trickles[i].time = remaining;//So trickles[i].time becomes
negative?
   }
  }
  }
adjustTimer();
  }
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] Time in Trickle

2008-06-12 Thread Jimmy Lee
-- Forwarded message --
From: Jimmy Lee [EMAIL PROTECTED]
Date: 2008/6/13
Subject: Time in Trickle
To: TinyOS Help tinyos-help@millennium.berkeley.edu


Hi, everyone:

  I've read the Trickle implementation code
(\tos\lib\net\TrickleTimerImplP.nc) in 2.X.

  And I'm puzzled by the variable time in this code.

  This is the defination of struct trickle_t:
  typedef struct {
uint16_t period;
uint32_t time;
uint32_t remainder;
uint8_t count;
  } trickle_t;


  I wonder about what the time and remainder means?

  Also, at the function adjustTimer(), I have some  questions.

event void Timer.fired()
{
uint8_t i;
uint32_t dt = call Timer.getdt();

for (i = 0; i  count; i++)
{
  uint32_t remaining = trickles[i].time;//What does the remaining mean?
  if (remaining != 0)
{
  remaining -= dt;// Does this make remaining negative?
  if (remaining == 0)

{
  if (trickles[i].count  k)
{
  atomic
{
call Pending.set(i);
  }
  post timerTask();
  }

generateTime(i);

   /* Note that this logic is not the exact trickle algorithm.
* Rather than C being reset at the beginning of an interval,
* it is being reset at a firing point. This means that the
* listening period, rather than of length tau/2, is in the
* range [tau/2, tau].
*/


trickles[i].count = 0;//
   }
   else
{
trickles[i].time = remaining;//So trickles[i].time becomes
negative?
   }
  }
  }
adjustTimer();
  }
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help