Bug 1616 - WifiPhyStateHelper reports false CCA_BUSY times at State trace source
WifiPhyStateHelper reports false CCA_BUSY times at State trace source
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: wifi
ns-3.16
PC Linux
: P5 normal
Assigned To: Nicola Baldo
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-31 12:27 UTC by Karsten Roscher
Modified: 2013-10-09 16:48 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Roscher 2013-03-31 12:27:54 UTC
The reported times at the trace source "State" of the WifiPhyStateHelper are not consecutive.

Expected:
The reported times should be without gaps, i.e., the previous state change start time plus the repported duration equals the next state change start time. However, with CCA_BUSY states, this is not always true. In some cases the reported start time is too late and the duration too short.


Digging deeper through the code, I suppose I found the cause for this behavior:

WifiPhyStateHelper::SwitchMaybeToCcaBusy () updates the internal m_startCcaBusy time with "now" on every call even if the state has already been CCA_BUSY. This leads to a truncation of the CCA_BUSY interval at the beginning if WifiPhyStateHelper::SwitchMaybeToCcaBusy () is called for a second time within a single CCA_BUSY phase.


I suggest replacing (line 423 in wifi-phy-state-helper.cc):

m_startCcaBusy = now 

with

if (GetState () != WifiPhy::CCA_BUSY)
  {
    m_startCcaBusy = now;
  }

This appears to fix it for me. However, I'm not sure if it won't introduce other subtle bugs that I'm not aware of.
Comment 1 Daniel L. 2013-10-09 16:48:19 UTC
Fixed in 10210:674b7a1cb71e
Thanks Karsten!