# An Adaptive Data Rate Algorithm for Power-Constrained End Devices in Long Range Networks
## 4 LoRa Network Performance Evaluation
### ED Power Consumption Model
#### 4.2.3 Analysis of ED Power Consumption in Different Operating States  
When a LoRa ED sends a data frame, it switches between various operating states until the transmission is successful. The energy consumption of the ED can be evaluated by calculating the average power consumption for successfully transmitting a data frame. The total power consumption \(E_{total}\) for successfully transmitting one frame equals the sum of the sleep power consumption \(E_{sleep}\) and the active power consumption \(E_{work}\). However, in  
Figure 5: ED normal operating state classification. Figure 6: ED failed data frame transmission state classification. actual testing, \(E_{sleep}\) is found to be negligible compared to \(E_{work}\). Therefore, the total power consumption for successfully transmitting one frame \(E_{total}\) is given by Equation (28). \[E_{total}=E_{sleep}+E_{work}\approx E_{work} \tag{28}\]  
In the pure ALOHA model, a LoRa ED may encounter two scenarios: collision or successful transmission. Assuming the probability of successful transmission without collision is \(p\), which follows a binomial distribution, successfully transmitting one data frame requires \(k\)-\(I\) failures and \(I\) success. Thus, the average power consumption for successfully transmitting one data frame is given by Equation (29). \[E_{work}=\sum_{k=1}^{\infty}(1-p)^{k-1}p\cdot\left[(k-1)E_{fail}+E_{success} \right]=\frac{1-p}{p}\cdot E_{fail}+E_{success} \tag{29}\]  
In Equation (29), the energy consumption for successful transmission \(E_{success}\) is equal to the energy consumed by the ED when sending the data frame and successfully receiving the ACK. The energy consumption for a failed transmission due to collision \(E_{fail}\) is equal to the energy consumed by the ED when waking up, collecting data, sending the data frame, and experiencing ACK timeout in both receive windows, as shown in Equations (30) and (31). \[E_{success}=U\left[I_{awake}T_{awake}+I_{sample}T_{sample}+I_{tx}T_{tx}+I_{ receive\_delay1}T_{receive\_delay1}+I_{rx\_RX1}T_{rx\_RX1}\right] \tag{30}\]  
\[E_{fail}=U\left[I_{awake}T_{awake}+I_{sample}T_{sample}+I_{tx}T_{tx}+I_{ receive\_delay1}T_{receive\_delay1}+I_{rx\_RX1}T_{rx\_RX1}\right. \tag{31}\]  
The power consumption of the ED when in the data transmission state is \(E_{TX}=U\cdot I_{TX}\cdot T_{TX}\). The time required for a LoRa signal to travel from the transmitter to the receiver is defined as the time on air (ToA), that is, the time \(T_{TX}=ToA\) during which the ED sends the data frame. ToA is calculated as in Equation (32). \[T_{\text{ToA}}=\frac{1}{R_{\text{s}}}\times N_{\text{symbol}}(s) \tag{32}\]  
In the formula, \(R_{s}\) is the symbol rate, which can be calculated as \(R_{s}=BW/2^{SF}\)\((symbols/s)\), where \(N_{symbol}\) represents the number of symbols in the data frame transmitted by the ED. A LoRa data frame [2] consists of a preamble and a payload, i.e., \(N_{symbol}=N_{preamble}+N_{payload}\). Assuming that in the LoRa network, an ED using data rate \(R_{b\_i}\) and transmission power \(TP_{i}\) successfully sends a total of \(N_{i}\) data packets, the average power consumption for the ED to successfully send one data frame is given by Equation (33). \[E_{avg\_i}=\frac{1}{N_{i}}\sum_{k=1}^{N_{i}}E_{total\_ik} \tag{33}\]  
Equation (33), \(E_{total\_ik}\) represents the power consumption of the ED when transmitting the \(k\) data frame using data rate \(R_{b\_i}\) and transmission power \(TP_{i}\), \(N_{i}\) represents the number of successfully transmitted data packets. Assuming there are \(n\) EDs in the LoRa network, and a total of \(m\) different data rates and transmission power combinations (\(R_{b\_i}\), \(TP_{i}\)) are used, with \(n_{i}\) EDs for each combination, the average power consumption \(E_{avg}\) of the EDs in the entire LoRa network can be calculated using a weighted average as per Equation (34).