[Tinyos-help] [TOSSIM] simulate node leave

Andrey Gursky andrey.gursky at online.ua
Sun Feb 15 05:36:31 PST 2009


Hi Pratibha!

Pratibha S wrote:
> hi All,
> 
> can anyone tell me how to simulate a node leaving the network after a
> specified time in tossim?
> There is mote(i).turnOff(), but it doesnt consider time. I want the
> counterpart of bootattime(time) function.

Consider the basic simulation loop:
  while(t->time() < 600 * t->ticksPerSecond()) {
    t->runNextEvent();
  }

You could put before runNextEvent() something like the following check:
    if (t->time() == TURN_OFF_TIME) {
       mote(i).turnOff();
    }

Would it fit your needs?


Best wishes,
Andrey


More information about the Tinyos-help mailing list