The default ns-3.16 implementation of the Enhanced Distributed Channel Access (EDCA) follows the backoff timer countdown rule from the deprecated IEEE 802.11 Distributed Coordination Function (DCF). The mechanism seeks to reduce collisions in a distributed network of wireless stations. In both mechanisms, stations rely on carrier sensing to determine if the wireless medium is currently busy. If so, stations wait for a random time interval before retrying to access the channel. This random delay is referred to as backoff.
The EDCA method prioritizes channel access into different traffic classes. It defines four Access Categories (ACs) with different backoff parameters. In addition, it also allows each AC to have a different Arbitration Inter-Frame Space (AIFS). The AIFS further controls how long a transmitter has to wait after the medium becomes idle. However, the EDCA also introduces a subtle change in the way that backoff countdown is performed.
In ns-3.16, the EDCA function and the DCF function share one class,
DcfManager, for backoff-timer countdown. However, as illustrated in Figure 1, the IEEE 802.11 standard mandates different times at which the backoff timer is decremented in the two functions. The backoff timer is decremented at the beginning of a slot for EDCA and at the end of a slot for DCF. In other words, for EDCA, the medium needs to be idle only for an AIFS[AC] period before the backoff timer is decremented, while the backoff timer has to wait for one Distributed Inter-Frame Space (DIFS) plus one SlotTime before decrementation in the DCF. In the latter case, if the medium becomes busy again during this slot time, the backoff timer remains unchanged. Therefore, to accurately implement the EDCA functionality, the backoff timer needs to be changed in ns-3 simulator.
The modification steps are as follows: First, the idle duration of medium is tracked by each station. Once the idle duration of one station becomes greater than or equal to AIFS, the next step is triggered. In step two, the slot boundary of AIFS is identified and the potential decrement for the backoff timer counter is increased by one. Hence, the length of the idle duration after AIFS is divided by the length of one SlotTime and, in step three, the backoff timer counter is decremented by the quotient plus one. When the backoff timer reaches zero, the station is allowed to immediately transmit after the medium becomes idle for one AIFS.