# Collision Avoidance Adaptive Data Rate Algorithm for LoRaWAN
## 5 The Proposed Adaptive Data Rate Model  
In this section, we propose an adaptive data rate algorithm named the SNR-based Spreading Factor Interference Rate-controlled Adaptive Data Rate Algorithm (SSFIR-ADR). The proposed algorithm aims to decrease energy utilisation whilst preserving a high packet delivery ratio by mitigating interference. This algorithm achieves this by dynamically controlling the allocation of spreading factors to minimise the prospect of simultaneous transmissions with the same spreading factor in a particular annulus region within the network. To facilitate this, the network is divided into K radial regions according to the \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Initial Energy of EDs & 10,000 J \\ Supply Voltage & 3.3 V \\ Standby Current & 0.0014 A \\ Tx Current & 0.028 A \\ Sleep Current & 0.0000015 A \\ Rx Current & 0.0112 A \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Energy model parameters. Figure 2: The LoRaWAN network scenario. available SF regions, \(\text{K}\in\{\text{k}_{7},\text{k}_{8},\cdots,\text{k}_{12}\}\). By varying the SF values based on the defined framework, the data rate is optimised. SSFIR-ADR is divided into two variants, SSFIR-ADR1 and SSFIR-ADR2. The key goal of the proposed algorithm is to utilise two spreading factors in a specific annulus region centred on the historical signal-to-noise ratio of the individual end nodes, thereby reducing interference within that region. The SSFIR-ADR algorithm uses several global variables in determining the optimal SF allocation as defined in Algorithm 1. 1. The SNR values of the four most recently received data packets are stored in the **ReceivedPacketList**. 2. The average SNR values for each ED are computed and stored in a list, \(\text{SNR}_{\text{avg}}\), updated every time an ED transmits a packet to the network server. 3. The required SNR threshold values are stored in a list called \(\text{SNR}_{\text{thresh}}\), as presented in Table 1.
4. An SF list that correlates to the values stored in the \(\text{SNR}_{\text{avg}}\) list is stored in SFvalue. 5. The **Usageindex** keeps track of the list of EDs within each SF region K which the algorithm uses to determine which EDs should have their SFs optimised. 6. **Dmargin** stores the value of the device margin. \(\rho\) is the probability that will control the decrease in SF at region K and will provide a number from 0 to 1. 7. \(\rho\)**SF** represents a vector with the probability of EDs the algorithm randomly selects for optimisation for each K region. 8. The optimised spreading factor is labelled \(\text{SF}_{\text{new}}\). Once sufficient data are collected, this variable will store the new SF value computed by the algorithm. The algorithm operates as follows: Considering each SF region K, except \(\text{k}_{7}\), a subset of nodes within the same radial ring region K (i.e., EDs utilising the same spreading factor) is selected for transitioning to the adjacent lower SF region. Each ED is assigned the lowest SF possible such that the power received from the ED is higher than the required sensitivity threshold. SSFIR-ADR1 selects EDs that are in K with the minimum value of \(\text{SNR}_{\text{avg}}>\text{SNR}_{\text{thresh}}\) and reduces the spreading factor by one. On the other hand, SSFIR-ADR2 employs a stochastic approach to randomly select a subset of end devices from the Usageindex, with a specific probability assigned for optimising their spreading factor. This subset of EDs then transitions to a new SF denoted \(\text{SF}_{\text{new}}\). In our implementation for this work, we utilised a constant value of \(\rho\)SF across all spreading factor regions. However, it is possible to set individual probability values for each of the SF levels based on the network size and node deployment considering the application needs. The network topology with 300 EDs and its corresponding SF distribution is visualised in Figure 3, showcasing the differentiated SF allocations achieved by Algorithm 1.