On Jul 5, 2006, at 8:08 PM, Liu Haibin wrote:

Hi,

I'm confused with the following code from enqueue_receive_event from UscGainInterfaerenceModelC.nc. The condition at label 1 is understandable. It checks if the power is large enough against the destination noise plus all the other transmissions to the destination. What I don't understand is the condition label 2. Why does it need to compare the power with the max destination noise? What is the variable "receiving" used for?

I have very limited knowledge in the area of radio transmission. I guess I missed some very basic concepts here. Could someone help me out with it?


Regards,
Haibin


// If I'm off, I never receive the packet, but I need to keep track of // it in case I turn on and someone else starts sending me a weaker
    // packet. So I don't set receiving to 1, but I keep track of
    // the signal strength.
    if (!sim_mote_is_on(sim_node())) {
dbg("Gain", "Lost packet from %i due to %i being off\n", source, sim_node());
      rcv->lost = 1;
    }
    else {
1    if ((sigStr + sim_gain_sensitivity()) >= power) {
dbg("Gain", "Lost packet from %i due to power being too low (%f >= %f)\n", source, sigStr, power);
         rcv->lost = 1;
      }
      else if (receiving) {
dbg("Gain", "Lost packet from %i due to being in the midst of a reception.\n", source);
         rcv->lost = 1;
      }
2 if (power >= sim_gain_noise_mean(sim_node()) + sim_gain_noise_range(sim_node())) {
         receiving = 1;
      }
    }


The receiving variable keeps track of whether the node thinks it is receiving a packet or whether it is searching for packet preambles. You can only start receiving a packet if you are in the latter state (unless you can recover preambles during packets, which no existing radio stack besides Kamin's prototype mica2 stack can do).

The second case is for when the packet is strong enough to hear. If the signal strength is not above noise, then you do not detect the preamble.

Actually, this looks like a very optimistic approach. The logic should be more like:

if (signal is below noise + threshold) {
  lose packet
}
else if (already receiving) {
  lose packet
}
else {
  receive packet;
}

Note that the current approach resamples the noise but does not consider the signal threshold. In the end, the difference between the two is pretty small (the number of preambles you detect of packets that might be lost), but still, I should look at it carefully.

Phil

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to