# Optimizing Routing Protocol Design for Long-Range Distributed Multi-Hop Networks
## 4 Load-Balancing Routing Optimization Scheme Design
### Load-Balancing Optimization Model  
In a LoRa distributed multi-hop network, end nodes not within the gateway coverage range need to relay service data to the gateway through multiple hops via relay nodes. When multiple end nodes in the network carrying different service types report service data simultaneously, some end nodes will assume the task of relaying service data for other nodes. To avoid network congestion caused by excessive load on some end nodes, load-balancing routing optimization is necessary to ensure that end nodes operate within a reasonable load range [25]. The load-balancing optimization model for a LoRa distributed multi-hop network uses communication delay, link reliability, node occupancy rate, and node load rate as constraint conditions to minimize the node load balance degree while maintaining a lower average node load rate. This paper addresses only the allocation of the SF, with all other LoRa packet parameters remaining consistent. 1. Communication Delay  
Communication \(T_{\text{delay}}\) is the time required for business data to be transmitted from LoRa end nodes to the gateway. As indicated in Equation (1), it primarily consists of four components [26]: transmission delay \(T_{td}\), propagation delay \(T_{pd}\), queuing delay \(T_{qd}\), and processing delay \(T_{cd}\). \[T_{\text{delay}}=T_{td}+T_{pd}+T_{qd}+T_{cd} \tag{1}\]  
Given that the propagation delay and the processing delay are relatively small and can be considered negligible, the communication delay is shown as in Equation (2). \[T_{\text{delay}}=T_{td}+T_{qd} \tag{2}\]  
Figure 6: Load-balancing routing optimization strategy. Transmission delay \(T_{td}\) refers to the total air time taken by business data while transferring between nodes. The transmission delay \(T_{td}^{M_{i}}\) for business data from node \(M_{i}\) to the gateway mainly depends on the number of hops \(N_{l}\), the data packet transmission rate \(T_{R}^{SF=k}\), and the number of data packets \(B_{M_{i}}\), as shown in Equation (3). \[T_{td}^{M_{i}}=N_{l}\times T_{R}^{SF=k}\times B_{M_{i}} \tag{3}\]  
Queuing delay \(T_{td}\) refers to the time business data must wait for processing at different relay nodes \(S_{i}\) when reaching the aggregation node from a node \(M_{i}\). As shown in Equation (4), \(N_{l}\) indicates the number of relay nodes traversed by business data from the source node to the aggregation node, \(B_{S_{j}}\) represents the number of data packets in the queue of nodes \(S_{i}\) that have higher priority than those of node \(M_{i}\), and \(\alpha_{k}^{M_{j}}=1\) indicates that the data transmission path from node \(M_{i}\) passes through node \(k\) ; otherwise, \(\alpha_{k}^{M_{j}}=0\). \[T_{td}^{M_{i}}=\sum_{k=1}^{N_{l}}\left(\alpha_{k}^{M_{j}}\times B_{S_{j}} \times T_{pk}^{SF=k}\right) \tag{4}\]  
Average communication delay refers to the time it takes for a data packet to be transmitted from the source node to the gateway, as shown in Equation (5). Different business types require different communication delays, with \(T_{\text{maxDelay}}\) denoting the maximum allowable average communication delay for a given business type. \[\overline{T_{\text{delay}}}=\frac{T_{\text{delay}}}{B} \tag{5}\]  
\[\overline{T_{\text{delay}}}\leq T_{\text{maxDelay}} \tag{6}\]  
2. Link Reliability  
Signal propagation can be easily obstructed by obstacles and interference sources, leading to reflection, diffraction, and scattering, resulting in signal attenuation. The logarithmic path loss model is shown in Equation (7), where \(d_{0}\) is the reference distance, usually set to 1; \(d\) is the distance between the transmitting and the receiving nodes; \(\mu\) is the path loss exponent, and \(X_{\sigma}\) is a normal random variable with a mean of 0 and a standard deviation \(\sigma\)[27].