# Adaptive Parameters for LoRa-Based Networks Physical-Layer
## 3 Proposal
### SlidingChange: A Proposal of a Sliding Window for Automatic Parameter Changing
The graphs from Figures 11-14 illustrate the change/shift points, and the biggest three SNR improvements were highlighted with an arrow in each figure (We only present a sample of the measures at this moment. We complement these results later using tables). The graphs introduced by this section show a comparison of both techniques: without any windows, referring to the technique by [14] (Figure 11), and with windows of 10 and 20 units of length (Figures 12 and 13), using \(SF=10\) and \(BW=125\) kHz. Figure 11: Without SlidingChange (InstantChange) \(W=0\). Figure 10: Settings screen on mobile app. As illustrated in Figures 11-14, we noted that for the presented configuration, there is a direct correlation between the maximum SNR values and the window size. As the length of the window becomes larger, there are slightly higher maximum SNR values measured, especially considering the 20 elements' window. Considering the previous related work, InstantChange and SlidingChange algorithms were compared with LR-ADR to complement and enrich our analysis. All the algorithms were implemented to conduct the comparison. Despite LR-ADR being developed to select the best network server in a LoRa network with multiple gateways, we compare our approach with it, considering the gain in terms of SNR. The LR-ADR uses simple linear regression to smooth the SNR signal from the last packets received to introduce the LR-ADR. The authors consider, by default, 10 SNR values for each gateway per end device. In our case study, in a real testbed with one gateway and real data collected, we consider different SF, BW, and Frequency values as a base to apply the LR-ADR and configure it. The configuration shifts and SNR metrics were computed and compared with our proposal. Considering LR-ADR algorithm, the \(SNR\) is calculated in time \(T\) as follows: \(SNR_{T}=\beta T+\alpha\) where \(SNR_{T}\) is the \(SNR\) at time \(T\), and \(\alpha\) is equal to \(\alpha=\overline{SNR}-(\beta\overline{T})\). The \(\beta\) is represented by:

\[\beta=\frac{\sum_{i=1}^{n}(T_{i}-\overline{T})(SNR_{i}-\overline{SNR})}{\sum_{ i=1}^{n}(T_{i}-\overline{T})^{2}} \tag{8}\]

To estimate the next expected SNR values and choose the parameters' values, the authors use

\[SNR_{N}=\beta(T+T_{period})+\alpha \tag{9}\]

Figure 4.0 SlidingChange with \(W=30\) elements. Figure 4.1 SlidingChange with \(W=10\) elements. Figure 4.2 SlidingChange with \(W=20\) elements. More details about the LR-ADR algorithms can be found in [28]. Table 3 shows the best result for each parameter value combination in the experiment at a specific moment, and Table 4 shows the number of shifts of each setting to another. Table 3 shows all observed configurations and their corresponding SNR gains. The average from all 27 measurements taken on the given setup (i.e., windowless, a window of 10 units of length, etc.) is displayed in the \"Average\" column. Measurements 1, 2, and 3 show the first, second, and third biggest SNR gain variations from each setup with a sliding window, respectively. The highlighted values show the highest SNR gain (in this case, 11.89%) and the best gain average (of 4.60%) observed. From Table 3, it is possible to note a slight rise in the SNR gain for the technique with a window using \(W=10\) and a smaller rise for the window with \(W=20\). The window with \(W=30\) presented a significantly smaller gain compared with the previous two window lengths. Then, the window with \(W=40\) scored the smallest gain of all techniques. Observing the data on Table 3, it is possible to note that the window with \(W=20\) scored the best results from the entire table, reaching an SNR gain of 11.89%. However, as the average values show, the window with \(W=10\) achieved the best gain consistency. Finally, we can highlight that LR-ADR obtained a result close to not using windows.