## 3 The Proposed CA-CWA Algorithm
### The Contention Window Adaption Scheme  
In this section, we present the contention window adaption scheme based on the channel status estimation. In a general backoff scheme, a station should randomly select a backoff value from the interval \([0,\,CW]\) before each transmission in order to avoid collision. Let \(W_{k}\) be the CW size of the \(k\)th transmission attempt. The value of \(W_{k}\) in BEB algorithm can be calculated as follows. If the CW limit \(CL\) (\(CL=[log_{\omega}\frac{CW_{min}}{CW_{min}}]\)) is greater than the retry limit \(RL\), then,  
\[W_{k}=\omega^{k}CW_{min}. \tag{7}\]  
otherwise,  
\[W_{k}=\left\{ \begin{array}{ll}\omega^{k}CW_{min},&\text{for}\;k\in[0,CL]\\ \\ CW_{max},&\text{for}\;k\in[CL,RL]\end{array} \right., \tag{8}\]  
where \(CW_{max}\), \(CW_{min}\), and \(\omega\) are the maximum CW size, the minimum CW size, and the backoff stage factor, respectively. In CA-CWA, only the CW update procedure is different from BEB after a success transmission and a failure transmission. In a fixed interval \(T_{\rho}\), each station should observe the channel, and calculate the modified channel busyness ratio \(\rho^{\prime}\) by Equation (6). Besides, to minimize the estimation bias introduced by burst traffic or interference, CA-CWA adopts an Exponentially Weighted Moving Average (EWMA) estimator to smoothen the estimated \(\rho^{\prime}\). In an arbitrary interval \(T_{\rho}^{j}\), the value of \(\rho_{j}^{\prime}\) is updated according to the following rules:  
\[\rho_{avg}^{j}=(1-\pi)\times\rho_{j}^{\prime}+\pi\rho_{avg}^{j-1^{\prime}}, \tag{9}\]  
where \(\rho_{j}^{\prime}\) is the estimated \(\rho^{\prime}\) in the interval \(T_{\rho}^{j}{\rho_{avg}^{j}}^{\prime}\) is the smoothed \(\rho^{\prime}\) value for CW adaption, and \(\pi\) is the smoothing factor of the EWMA estimator, which determines the preserved number of historical values in the smoothing process. The \(\rho_{avg}^{\text{ }}\) is updated continuously in each estimating interval \(T_{\rho}\). The value of \(T_{\rho}\) should be set appropriately to reflect the recent channel state better. As mentioned in Section 2.1, EDCA defines four traffic types with different priorities. To ensure the priority mechanism still works properly, CA-CWA defines a decrement factor \(\theta\) with different values for each type of traffic. Based on \(\theta\), the station is able to adjust its CW dynamically according to \(\rho_{avg}^{j}\). The decrement factor of \(n\)th priority traffic (\(\theta_{n}\)) is defined as:\[\theta_{n}=\min\{\omega^{n}\rho^{j}_{avg}{}^{\prime},\theta_{max}\},\quad n\in[1,4] \tag{10}\]  
The traffic priority decreases gradually from \(n=1\) to \(n=4\), which ensures the higher priority class is able to adjust the CW parameter with a smaller \(\theta\). \(\theta_{max}\) is a parameter that keeps the value of \(\theta\) not be too large. An excessive value of \(\theta\) might cause the reset CW value to be greater than the previous CW value. For each class \(n\), \(CW_{n}\) is updated after each successful transmission according to Equation (11):  
\[CW^{n}_{new}=\max\{CW^{n}_{min},\theta_{n}CW^{n}_{old}\},\quad n\in[1,4] \tag{11}\]  
where \(CW^{n}_{old}\) is the CW value before an arbitrary successful transmission for class \(n\), \(CW^{n}_{new}\) is the updated CW value after the successful transmission. After each unsuccessful transmission, the CW of each class is doubled as long as the value of CW is less than \(CW_{max}\), which is as same as the mechanism in BEB. Based on the channel status estimation, the aforementioned design of backoff adaption in CA-CWA follows a few principles which provide improved network performance in terms of timeliness. In a highly congested channel, a station should avoid blind resetting its CW to \(CW_{min}\) after a successful transmission. In CA-CWA, a station will select an appropriate (relatively high) CW value according to the high value of \(\theta\) in this situation.