# An Adaptive Data Rate Algorithm for Power-Constrained End Devices in Long Range Networks
## 3 Link State Evaluation
### Link State Parameters  
In a LoRa network, ED collects sensor data and transmits them to the GW via LoRa modulation. The GW uploads the data packets to the NS, where the server gathers link quality information, including RSSI, SNR, and PRR. RSSI and SNR are physical layer parameters that can instantly reflect link conditions but are susceptible to fluctuations [29]. PRR, as a soft metric at the data link layer, more accurately reflects link quality but requires a longer time to be statistically meaningful and cannot be obtained directly [30]. In a LoRa network, link state evaluation should be accurate and comprehensive, and using PRR alone is insufficient to fully capture the link condition [31]. The link state is dynamic, with short-term fluctuations reflected by physical layer parameters and long-term trends indicated by PRR.  
Assuming the statistical window size for packet reception is \(n\), the SNR and RSSI of the received packets within the window are recorded, and the PRR is calculated. Let \(SNR_{avg_{i}}\) and \(RSSI_{avg_{i}}\) represent the average SNR and average RSSI within the window, respectively, and let \(CV_{SNR_{i}}\) and \(CV_{RSSI_{i}}\) represent the coefficients of variation for SNR and RSSI within the window, respectively. The values \(SNR_{avg_{i}}\), \(RSSI_{avg_{i}}\) and \(PRR\) measure the reliability of the link, while \(CV_{SNR_{i}}\) and \(CV_{RSSI_{i}}\) measure the stability of the link. The specific calculation formulas are shown in Equations (1)-(4).  
\[SNR_{avg_{i}}=\frac{\sum\limits_{j=1}^{n}SNR_{j}}{n} \tag{1}\]  
\[RSSI_{avg_{i}}=\frac{\sum\limits_{j=1}^{n}RSSI_{j}}{n} \tag{2}\]  
\[CV_{SNR_{i}}=\frac{\sqrt{\frac{1}{n}\sum\limits_{j=1}^{n}\left(SNR_{j}-SNR_{ avg_{i}}\right)^{2}}}{SNR_{avg_{i}}} \tag{3}\]  
\[CV_{RSSI_{i}}=\frac{\sqrt{\frac{1}{n}\sum\limits_{j=1}^{n}\left(RSSI_{j}-RSSI_ {avg_{i}}\right)^{2}}}{RSSI_{avg_{i}}} \tag{4}\]  
The evaluation of link state includes measuring various parameters that reflect the link state and calculating the combined weights of these parameters. The determination of weights is achieved using a combined weighting method. Subjective weights are calculated using the fuzzy analytic hierarchy process (FAHP), while objective weights are determined through the improved CRITIC method and further optimized using the VIKOR method. Finally, the subjective weights and the optimized objective weights are combined using the multiplicative comprehensive method to obtain the final combined weight. The calculation of the link state score is shown in Equation (5).  
\[score=(\omega_{1},\omega_{2},\omega_{3},\omega_{4},\omega_{5})\begin{pmatrix} \frac{\overline{SNR_{avg_{i}}}}{RSSI_{avg_{i}}}\\ \frac{\overline{PRR}}{\overline{CV_{SNR_{i}}}}\\ \frac{\overline{PR}}{\overline{CV_{SNR_{i}}}}\\ \end{pmatrix} \tag{5}\]Among them, \(\left(\overline{SNR_{avgi}},\overline{RSSI_{avgi}},\overline{PRR},\overline{CV_{ SNRi}},\overline{CV_{RSSi}}\right)^{T}\) represents the normalized values of various link state parameters, while \(\left(\omega_{1},\omega_{2},\omega_{3},\omega_{4},\omega_{5}\right)\) represents the combined weights corresponding to each parameter. The link state score ranges from 0 to 1.