# SINR-Based MCS Level Adaptation in CSMA/CA Wireless Networks to Embrace IoT Devices
## 3 Proposed Algorithm
### Automatic-MCS-Level Adaptation  
In CSMA/CA wireless networks, when a node receives data packets successfully, the node sends back ACK frames to the sender of the data packets. In the proposed algorithm in this paper, a sender uses the SINRs of the ACK frames from its receiver to estimate the channel status between the sender and the receiver and adjusts the MCS levels of subsequent packets to be sent to the receiver. However, to avoid frequent updates of MCS levels caused by possible abrupt and frequent changes in the measured SINRs, we use (exponentially weighted) moving averaged SINR values (\(avgSINR_{i}\)) instead of the instantaneous SINR value (\(SINR_{i}\)) of each ACK frame from receiver \(i\).  
As a result, \(avgSINR_{i}\) is calculated with every new \(SINR_{i}\) as  
\[avgSINR_{i}=\alpha\cdot avgSINR_{i}+(1-\alpha)\cdot SINR_{i}, \tag{3}\]  
where \(\alpha\) is the smoothing factor, which is set to 0.9 in this paper. The value is set similarly to that used to calculate the moving averaged round-trip times of packets in transmission control protocol (TCP) [30] because both TCP and the proposed algorithm work in a similar time scale although they are in different communication layers.  
In the proposed algorithm, a sender starts sending traffic to its receiver \(i\) with the lowest MCS level (e.g., 0 in Table 1). Whenever an ACK frame from receiver \(i\) arrives, the MCS level for receiver \(i\) is increased by one if \(avgSINR_{i}\) for receiver \(i\) is higher than the minimum SINR requirement of the next higher MCS level unless it is the highest level (e.g., 3 in Table 1). If \(avgSINR_{i}\) is less than the minimum SINR requirement of the current MCS level, the MCS level is decreased by one unless it is the lowest MCS level. Otherwise, the MCS level for receiver \(i\) remains unchanged.  
In addition, if the sender detects a retry limit event (A retry limit event occurs when the number of consecutive ACK timeouts of a data packet reaches a limit. By default, the long retry limit is 4 and the short retry (i.e., RTS/CTS is not used) limit is 7 [8].), the MCS level is decreased by one unless it is the lowest one. This decrease is necessary because the retry limit event may have occurred as a result of an MCS level that the receiver could not decode. Furthermore, \(avgSINR_{i}\) is set to the middle value of the new minimum SINR requirement and the previous minimum SINR requirement to avoid additional timeouts that may occur while updating the moving averaged SINRs.  
The pseudo code in Algorithm 1 summarizes the proposed algorithm using the MCS levels in Table 1 as an example (Note that the proposed algorithm does not control MCS levels of ACK frames. The MCS levels of ACK frames are always set to the lowest one (i.e., 0)).  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**MCS Level (\(k\))** & **MCS** & **Transmission Speed (Mbps)** & **Min. SINR (\(\tau_{k}\)) (dB)** \\ \hline
0 & BPSK, 1/2 coding & 6 & 5 \\
1 & QPSK, 1/2 coding & 12 & 8 \\
2 & 16 QAM, 1/2 coding & 24 & 15 \\
3 & 64 QAM, 3/4 coding & 54 & 25 \\ \hline \hline \end{tabular}
\end{table}
Table 1: MCS levels supported by the IEEE 802.11 Ext module.  
```
initialization: \(k\gets 0\); foreach ACK from receiver \(i\) arrivesdo  calculate \(SINR_{i}\) in dB scale; \(avgSINR_{i}\gets avgSINR_{i}\ast 0.9+SINR_{i}\ast 0.1\); if\(avgSINR_{i}>\tau_{k+1}\)then \(k\gets min(k+1,3)\) ; else if\(avgSINR_{i}<\tau_{k}\)then \(k\gets max(k-1,0)\);  end if  end foreach
1 end foreachRetry limit event to receiver \(i\) occursdo \(k\gets max(k-1,0)\) ; \(avgSINR_{i}\leftarrow(\tau_{k}+\tau_{k+1})/2\) ;  end foreach
2
```  
**Algorithm 1**Adjustment of MCS level \(k\) for receiver \(i\).