I'm trying to find a way to change the gain of a radio link in TOSSIM (from CVS) midway through the simulation. I didn't see a function specifically for changing the gain of a link already added, so I thought I would remove the original link and re-add it with a new gain. Something like this in C (this is a bit contrived):

Tossim* t = new Tossim(NULL);

t->radio()->add(0, 1, -50);
t->radio()->add(1, 0, -50);
t->radio()->add(1, 2, -120);
t->radio()->add(2, 1, -50);

for (int i = 0; i < 10000; i++)
  t->runNextEvent();

t->radio()->remove(1, 2);
t->radio()->add(1, 2, -50);

for (int i = 0; i < 10000; i++)
  t->runNextEvent();

However, I get a segfault when trying to remove the link. I believe this is because of a bug in sim_gain_remove() when you remove the link most recently added for a given source. I tried to fix that, but then I just ended up with other crashes when messages were trying to be sent and such. Any ideas?

Thanks,
Ryan

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to