# An Adaptive Data Rate Algorithm for Power-Constrained End Devices in Long Range Networks
## 4 LoRa Network Performance Evaluation
### LoRa Network ED Latency Analysis  
The latency of an ED can be defined as the time interval between the generation of a packet by the ED and the reception of the packet at the NS [14]. In a LoRaWAN network, compared to the LoRa communication between the ED and the GW, the connection between the GW and the NS via Ethernet means that \(T_{GW-NS}\) and \(T_{NS}^{\text{Proc}}\) can be ignored. The ED latency mainly includes the time to generate a packet \(T_{ED}^{\text{Proc}}\) and the time on air \(T\text{oA}_{UL}\). Assuming that the process of generating data packets in the network follows a Poisson process with an average generation rate of \(\lambda\) packets per second, and the packet length is \(L\), the EDs in the LoRa network use \(m\) different data rates to transmit data packets. There are \(N_{i}\) EDs for each data rate \(R_{b,i}\), and \(G_{i}\) represents the number of packets generated by the EDs transmitting at rate \(R_{b,i}\). Under the pure ALOHA protocol, the probability \(P_{success}\) of successful transmission without collision by EDs using rate \(R_{b,i}\) is calculated \begin{table}
\begin{tabular}{c c} \hline \hline
**Transmission Power** & **Working Current** \\ \hline
2 dBm & 143.85 mA \\
5 dBm & 153.51 mA \\
8 dBm & 167.72 mA \\
11 dBm & 183.39 mA \\
14 dBm & 205.22 mA \\
17 dBm & 222.89 mA \\
20 dBm & 236.41 mA \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Working current of ED in transmission state at different transmission power levels. \begin{table}
\begin{tabular}{c c} \hline \hline
**Type** & **Value** \\ \hline \(I_{auxle}\) & 150.69 mA \\ \(I_{sample}\) & 182.55 mA \\ \(I_{receive\_delay1}\sim I_{receive\_delay2}\) & 108.82 mA \\ \(I_{rx\_RX1}\sim I_{rx\_RX2}\) & 119.72 mA \\ \(I_{sleep}\) & 0.01 mA \\ \(T_{auxle}\) & 0.73 s \\ \(T_{sample}\) & 1.19 s \\ \(T_{receine\_delay1}\sim T_{receive\_delay2}\) & 1.00 s \\ \(T_{rx\_RX1}\sim T_{rx\_RX2}\) & 1.50 s \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Working current and duration of LoRa ED with SX1262 chip. using Equation (21). Assuming that failed transmissions can be retransmitted infinitely, the number of failures _k-1_ plus \(1\) success is required to successfully transmit a data frame. For EDs using data rate \(R_{b\_i}\), the average latency \(T_{avg\_i}\) can be calculated using Equation (35). \[T_{avg\_i}=\sum_{k=1}^{\infty}(1-p_{success})^{k-1}p\Big{[}(k-1)T_{fall}+T_{success }\Big{]}=\frac{1-p_{success}}{p_{success}}T_{fall}+T_{success} \tag{35}\]  
In Equation (35), the latency for a successful transmission \(T_{success}\) is given as Equation (36). \[T_{success}=T_{ED}^{\text{proc}}+T\text{oA}_{UL} \tag{36}\]  
The latency for a failed transmission \(T_{fail}\) includes the time from when the ED generates a packet to when it waits for an ACK timeout, as well as the time interval \(T_{\text{interval}}\) before the next retransmission. Thus, the latency for a failed transmission \(T_{fail}\) is given by Equation (37). \[T_{fail}=T_{ED}^{\text{proc}}+T\text{oA}_{UL}+2\cdot T_{wait}+2\cdot T_{RX}+T _{\text{interval}} \tag{37}\]  
where \(T_{wait}\) is the time when the ED opens the receive window after sending the data packet; \(T_{RX}\) is the duration of the receive window (assuming the duration of both receive windows is the same); and \(T_{\text{interval}}\) is the time interval before the ED retransmits the data packet after a failed transmission. Since the process of generating data packets by the ED follows a Poisson process with an average generation rate of \(\rho\) packets per second, the time interval between two packet transmissions follows an exponential distribution with parameter \(\rho\). Therefore, the average time interval between two packets is \(T_{\text{interval}}=\frac{1}{\rho}\).