|
From: David K. <da...@em...> - 2013-12-07 17:05:02
|
In both simulation and the real world a collision is reported by the
transmit routine when the radio detects a high RF level as part of the clear
channel assessment before going into tx mode. In that case no packet is sent
and the collision result is returned. Cooja does not know if a node delayed
tx because of a failed cca.
Once tx is started, while the packet is being sent the transmitting node has
no way of knowing if other RF sources have interfered with the signal.
Cooja however knows this and can collect interference statistics and show it
on the timeline (notice interference on the timeline is a property of each
receiver, not the senders. Two transmitters far apart can both have clear
channels but cause interference at a receiver midway between them). When a
unicast tx is complete the node may listen for an ACK. In some radios that
is done in hardware and NO_ACK is returned if not detected. If done in
software there is the possibly of reporting NO_ACK if no RF was detected
before the timeout, or COLLISION if RF was detected but it was not the ACK.
In that case the node collision statistics may include both the packets that
were never sent because of a failed cca, and packets that were sent but the
response was not a proper ACK.
So NO_ACK always means the packet was sent (multiple times in the case of
contikimac) but you would have to check the code and possibly add a separate
collision_while_sending counter to keep track of the number of packets sent.
See e.g. contikimac.c for ack detection after transmit:
if(len == ACK_LEN && seqno == ackbuf[ACK_LEN - 1]) {
got_strobe_ack = 1;
encounter_time = txtime;
break;
} else {
PRINTF("contikimac: collisions while sending\n");
collisions++;
}
-----Original Message-----
From: Lixia Guan
Sent: Saturday, December 07, 2013 4:37 AM
To: Contiki developer mailing list
Subject: Re: [Contiki-developers] UDGM: Distance Loss-collisions
Hi,
Could somebody help me clarifying the following?
In simulator, the collision will be sensed when nodes send packet at the
same time. But in the real environment, I have also collected these
statistics at the transmitting using the following code.
contiki/core/net/mac/csma.c:
switch(status) {
case MAC_TX_COLLISION:
PRINTF("csma: rexmit collision %d\n", n->transmissions);
break;
case MAC_TX_NOACK:
PRINTF("csma: rexmit noack %d\n", n->transmissions);
break;
....
}
Now I got bit confused how does the above statistic of collisions collect in
the real environment? How do you detect the collisions at the transmitter?
My second question is ->
How to compute the total number of retransmissions?
@ Simulator -> is this equal to xxx(collisions) + yyy (no-ack) ?
@ Test-bed -> only the yyy ?
|