On Mar 29, 2007, at 3:59 PM, Salvo Fiduccia wrote:



Ok, I have understood the code that removes the packet from the list and the following test, but I have originally mentioned the test inside the first "while" (see the arrow):

void sim_gain_receive_handle(sim_event_t* evt) {
    receive_message_t* mine = (receive_message_t*)evt->data;
    receive_message_t* predecessor = NULL;
    receive_message_t* list = outstandingReceptionHead;
dbg("Gain", "Handling reception event @ %s.\n", sim_time_string ());
    while (list != NULL) {
      if (list->next == mine) {
        predecessor = list;
      }
      if (list != mine) {
=====>       if ((list->power - sim_gain_sensitivity()) < heardSignal()) {
          dbg("Gain", "Lost packet from %i as I concurrently received a
packet stronger than %lf\n", list->source, list- >power);
          list->lost = 1;
        }
      }
      list = list->next;
    }
    .....

This cycle, as you have said, finds the node in the list that precedes the packet... and (I think) it sets to "1" the "lost" member of the packets that the node is currently hearing but that are different from "mine"; i.e. the test (see the arrow) is always true for the packets "!= mine".

n.b.: I'm interesting in this, because I would modify Tossim to allow interactions between actual and virtual motes (an augmented simulator).

Ah! I think you're right. That should be

if ((list->power - sim_gain_sensitivity()) < mine->power) {

Wow, nice catch.

Phil


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

Reply via email to