# Smart Preliminary Channel Access to Support Real-Time Traffic in Wi-Fi Networks
## 2 Channel Access in Wi-Fi Networks  
Modern Wi-Fi networks use Enhanced Distributed Channel Access (EDCA), which works as follows. EDCA defines four access categories (ACs): Voice, Video, Best Effort, and Background, each of which corresponds to a separate queue of packets at every STA. If a new frame arrives in an empty queue while the channel is busy, the STA initializes the backoff counter with a random integer uniformly distributed in \([0,W_{min}-1]\), where \(W_{min}\) is the minimum size of the contention window.  
If the channel is busy, the STA suspends its backoff counter. When the channel becomes idle and remains idle for the Arbitration Interframe Space (AIFS) time, the STA resumes and decrements its backoff counter by one. Then, the STA decrements it by one each time the channel is idle for the time \(T_{e}\). The STA transmits the frame if the counter is equal to zero, and a new decrement time comes. If a new frame arrives in an empty queue when the channel has been idle for the AIFS time and the backoff counter after the previous transmission has become zero, then the STA immediately transmits the frame. In case of successful reception, the receiving STA responds with an acknowledgment (ACK) frame after the Short Interframe Space (SIFS) time. If a transmitting STA does not receive an ACK within the ACKTimeout interval since the end of its transmission, it considers the transmission unsuccessful and repeats channel access with a new backoff initialized with a random value selected from a larger interval.  
Specifically, after the failed transmission attempt \(r\), the contention window doubles until it reaches the maximum value \(W_{max}\):  
\[W_{r}=\begin{cases}W_{min},&r=0;\\ \min\{2W_{r-1},W_{max}\},&0<r<R.\end{cases}\]  
The frame is discarded if the number of failed attempts \(r\) reaches the retry limit \(R\).  
For each AC, the STA uses different channel access parameters. Table 1 shows the \(W_{min}\), \(W_{max}\), AIFSN, and TXOP limit, where AIFSN defines the duration of the AIFS \(=\text{SIFS}+T_{e}\cdot\text{AIFSN}\) interval and can be an integer from 2 to 15, and the TXOP Limit sets the maximum time the STAs can occupy the channel. The standard defines the default values of these parameters, but the AP can change them.  
The STAs also use the Request-to-Send/Clear-to-Send (RTS/CTS) mechanism, which works as follows. Before data transmission, the STA sends an RTS frame. Then, if the receiving STA considers the channel idle, it responds with a CTS frame. Only after receiving CTS, does the STA begin data transmission. If the STA does not receive the CTS frame within the CTSTimeout interval, it retransmits RTS. Other STAs that have received at least one of these frames consider the channel virtually busy until the end of the data transmission and acknowledgment, which is implemented as follows. Both RTS and CTS contain the Duration/ID field that specifies for how long the channel is busy after the frame is transmitted. STAs that read this field set the Network Allocation Vector (NAV) counter according to the specified time and consider the channel busy until the counter is reset to zero. Although the RTS/CTS handshake adds overhead, collisions between two RTS frames are much shorter than collisions between long data frames, so the RTS/CTS mechanism can improve delays and throughput.