# Analysis of Bidirectional ADR-Enabled Class B LoRaWAN Networks in Industrial Scenarios
## 2 LoRaWAN
### Adaptive Data Rate (ADR)  
LoRaWAN specification features the adaptive data rate (ADR), which is a mechanism that allows saving resources while improving communications with lower quality. This mechanism optimizes airtime and energy consumption in end devices. On the other hand, the end devices are the ones that decide whether or not to activate this mechanism [7]. Changing the data rate (DR) directly impacts the SF used by the device: as one increases the other decreases, as can be seen in Table 3. If the final device decides to activate the ADR, the mechanism works as follows:  
The SF is decreased as follows (Figure 5a):  
* The device sets the ADR bit in an upload message.
* The server stores the last 20 upload messages from the device that has requested the ADR. After 20 messages have arrived, the maximum Signal to Noise Ratio (SNR\({}_{\text{max}}\)) of the 20 messages is calculated.
* With the calculated value, the gateway decides whether to increase the SF or maintain it, with the Equations (1) and (2) below. The SF is increased one step at a time.  
\begin{table}
\begin{tabular}{c c c} \hline
**Name** & **Band (MHz)** & **Limitations** \\ \hline G & 8630–8680 MHz & EIRP \(<\) 25 mW—duty cycle \(<\) 1\% \\ G1 & 8680–8686 MHz & EIRP \(<\) 25 mW—duty cycle \(<\) 1\% \\ G2 & 8687–8692 MHz & EIRP \(<\) 25 mW—duty cycle \(<\) 0.1\% \\ G3 & 8694–86,965 MHz & EIRP \(<\) 500 mW—duty cycle \(<\) 10\% \\ G4 & 8697–8700 MHz & EIRP \(<\) 25 mW—duty cycle \(<\) 1\% \\ \hline \end{tabular}
\end{table}
Table 2: Duty cycle restrictions on EU bands.  
\begin{table}
\begin{tabular}{c c} \hline
**DR/SF** & **Required SNR (dB)** \\ \hline DR0/SF12 & \(-\)20.0 \\ DR1/SF11 & \(-\)17.5 \\ DR2/SF10 & \(-\)15.0 \\ DR3/SF9 & \(-\)12.5 \\ DR4/SF8 & \(-\)10.0 \\ DR5/SF7 & \(-\)7.5 \\ \hline \end{tabular}
\end{table}
Table 3: Required SNR for reception.  
\[SNR_{margin}\ =\ SNR_{max}\ -\ requiredSNR-margin. \tag{1}\]  
\[N_{step}=round\!\left(\frac{SNR_{margin}}{3}\right)\left\{\begin{array}{l}<0 \ \text{Increment TX power by }3 dB\\ >0\ DR=DR+1\ (until\ DR5)\end{array}\right. \tag{2}\]  
where  
\[SNRmax=max\ (SNR\ \text{of last 20 received signals})\]  
\[margin=10\ (by\ default)\]  
and _requiredSNR_ is taken from Table 3.  
When the new SF is determined, it is communicated to the end device in a download packet.  
When the end device receives the new SF, it sends upload messages with the new configuration. In the case that the network condition keeps improving, the server will send a download message with the new SFs.  
The SF is increased as follows (Figure 5b):  
An end device with ADR activated also continues to analyze download traffic to detect packet losses. With acknowledgements (ACKs) or downlink messages enabled, if the node does not receive the expected responses from the gateway, it also increments a counter up to 20.  
Then the device activates a timer, which when expired forces the device to increase the SF to a more robust configuration.  
If the device receives a response during the process, it resets the counter and timer and uses whichever SF the server has set up in the response.  
Figure 5: Selection of the new spreading factor (SF): (**a**) decreasing mechanism; (**b**) increasing mechanism.