# Implementation of a Fast Link Rate Adaptation Algorithm for WLAN Systems
## 3 The Link Adaptation Firmware
### Overall Flow  
The wrapper function is named link_adaptation_ku which is shown in Figure 8. The inputs to this function are the integer data type PHY_Mode (the mode used in the PHY that is 0 for legacy, 1 for high throughput or HT, and 2 for very high throughput or VHT) (not shown in Figure 8 for brevity), the integer data type mcsin (the MCS index for the previous packet), the integer data type ack (the ACK for the previous packet), and the pointer to short data types nch_coef_real and nch_coef_imag (the real and imaginary parts of the channel information or normalized channel coefficients \(H_{i}/\sqrt{N_{0}}\) per subcarrier). This wrapper function determines the MCS value of the next packet and returns this value. It may be subdivided into two parts--one part that executes the PBLA algorithm and the other part that runs the remaining algorithms. If a mismatch occurs between the uplink and the downlink SNRs, stemming from the disagreement between the TX and the RX radio frequency (RF) performances, then PBLA will not run correctly. By contrast, the proposed algorithm, APBLA, by means of amending the channel SNR through the SNR offset, gets around this problem. APBLA multiplies the channel SNR by the SNR offset and this product is fed to the next firmware functions, as shown in Figure 8. The SNR offset grows or drops according to whether the ACK of the previous packet is 1 or 0. \[SNR_{APBLA_{i}}=Offset_{k}\cdot SNR_{k,i} \tag{3}\]  
In Equation (3), \(Offset_{k}\) means the SNR offset of the \(k\)-th packet and \(SNR_{APBLA_{i}}\) means the amended SNR of the \(i\)-th subcarrier of the \(k\)-th packet. Equations (4) and (5) show the way the SNR offset is updated according to ACK or NACK. (NACK frames are not actually transmitted over the air in IEEE 802.11 but a NACK signal is sent by the driver internally when an ACK is not received over the air. Thus, we denote no ACK as NACK, hereafter.) In case of ACK,  
\[Offset_{k+1}=Step_{ACK}\cdot Offset_{k} \tag{4}\]  
In case of NACK,  
\[Offset_{k+1}=Step_{NACK}\cdot Offset_{k} \tag{5}\]  
here, \(Step_{ACK}\) is the ACK update step which is multiplied to the SNR offset in case of ACK while \(Step_{NACK}\) is the NACK update step which is multiplied to the SNR offset in case of NACK. The update steps vary when channel conditions vary, which is detailed in Section 3.3 on the offset_update function. The APBLA algorithm compensates for the mismatch of the channel SNRs but if this mismatch is much too large it takes some time to compensate. Thus, on initiation of the  
Figure 8: Overall structure of the proposed link adaptation. overall function (link_adaptation_ku), ARF can be employed at the beginning. In this ARF phase, the MCS is determined and output by ARF and at the same time the computation is executed to determine the SNR offset (from the MCS obtained by running PBLA) before APBLA sets in. The SNR offset in the ARF phase is updated once every 200 packets whereas before reaching the packet count of 200, the temporary SNR offset is (internally) updated every packet, by Equation (6). The SNR offset is updated every 200 packets by substituting the corresponding temporary SNR offset and then the SNR offset is applied to PBLA for 200 packets. \[Offset_{TMP_{k+1}}=0.995405^{(MCS_{ARF_{k}}-MCS_{pBL_{k}})}\cdot Offset_{ TMR_{k}} \tag{6}\]  
where \(Offset_{TMP_{k+1}}\) is the temporary SNR offset, \(MCS_{ARF_{k}}\) is the MCS determined by ARF, and \(MCS_{PBLA}\) is the MCS determined by PBLA. Specifically, the update step of the temporary SNR offset is determined by the difference between the MCS value recommended by PBLA and the MCS value recommended by ARF. In this paper, the update step is chosen such that the value is proportional to the difference between the two MCS values and, through extensive simulation, the proportionality constant is determined at 0.995405 empirically.