Sensors 23 07783 v2
Sensors 23 07783 v2
Sensors 23 07783 v2
Article
Modeling and Optimization of LoRa Networks under
Multiple Constraints
Hui Zhang ∗ , Yuxin Song ∗ , Maoheng Yang and Qiming Jia
Tianjin Key Laboratory of Optoelectronic Sensor and Sensing Network Technology, Nankai University,
Tianjin 300350, China
* Correspondence: [email protected] (H.Z.); [email protected] (Y.S.)
Abstract: With the access of massive terminals of the Internet of Things (IoT), the low-power wide-
area networks (LPWAN) applications represented by Long Range Radio (LoRa) will grow extensively
in the future. The specific Long Range Wide Area Network (LoRaWAN) protocol within the LoRa
network considers both low power consumption and long-range communication. It can optimize data
transmission to achieve low communication latency, ensuring a responsive system and a favorable
user experience. However, due to the limited resources in LoRa networks, if certain terminals have
heavy traffic loads, it may result in unfair impacts on other terminals, leading to increased data
transmission latency and disrupted operations for other terminals. Therefore, effectively optimizing
resource allocation in LoRa networks has become a key issue in enhancing LoRa transmission
performance. In this paper, a Mixed Integer Linear Programming (MILP) model is proposed to
minimize network energy consumption under the maximization of user fairness as the optimization
goal, which considers the constraints in the system to achieve adaptive resource allocation for
spreading factor and transmission power. In addition, an efficient algorithm is proposed to solve this
optimization problem by combining the Gurobi mathematical solver and heuristic genetic algorithm.
The numerical results show that the proposed algorithm can significantly reduce the number of
packet collisions, effectively minimize network energy consumption, as well as offering favorable
fairness among terminals.
Keywords: LoRa network; data extraction rate; collisions; network energy consumption; integer
Citation: Zhang, H.; Song, Y.; Yang,
programming
M.; Jia, Q. Modeling and
Optimization of LoRa Networks
under Multiple Constraints. Sensors
2023, 23, 7783. https://doi.org/
10.3390/s23187783
1. Introduction
With the rapid development of the Internet of Things (IoT), Massive Machine-Type
Academic Editors: Yuanqing Zheng,
Communication (MMTC) [1] plays a crucial role in connecting a vast number of devices and
Jiliang Wang and Wan Du
enabling intelligent services. The emergence of MMTC is driven by the explosive growth
Received: 16 August 2023 of IoT devices and the increasing demand for low-power and long-distance transmission.
Revised: 5 September 2023 According to predictions, the number of MMTC terminals connected via wireless com-
Accepted: 7 September 2023 munication will exceed 30 billion by 2025 [2], which demonstrates the immense potential
Published: 10 September 2023 and wide-ranging applications of the MMTC in the future development of the IoT [3].
Compared to traditional Internet connectivity, the MMTC generally focuses on connecting
a large number of machines and IoT devices, spanning various industries and domains
such as smart cities, intelligent transportation, industrial automation, and agricultural
Copyright: © 2023 by the authors.
monitoring. However, the conventional IoT connectivity technologies based on cellular
Licensee MDPI, Basel, Switzerland.
systems usually struggle to meet the requirements of the MMTC applications for low
This article is an open access article
power consumption and independent networking, which has led to the rise of low-power
distributed under the terms and
conditions of the Creative Commons
wide-area networks (LPWAN) technologies, bridging the technological gap between short-
Attribution (CC BY) license (https://
distance communication and cellular technologies [4]. The LPWAN technologies offer
creativecommons.org/licenses/by/ characteristics such as low power consumption, long-distance transmission, and wide
4.0/). coverage, providing an ideal communication solution for the MMTC [5]. Through LPWAN
End LoRa
End device device
Network Server
LoRa LoRa
End device
Gateway End device
End
End device device
limitation [13], etc. However, the performance of LoRa terminals depends not only on the
communication link, but also on how each gateway manages resources. In the actual LoRa
networks, resource allocation is crucial due to a range of issues, including limited network
capacity, unfair resource utilization, data conflicts and collisions, energy consumption, and
the lifespan of terminals.
Especially, the spreading factor and transmission power are important metrics for
adjusting data transmission parameters in the resource allocation of LoRa networks. The
spreading factor determines the bandwidth and transmission rate of data, whereas the
transmission power determines the transmission distance and reliability of data packets.
Although a high spreading factor may reduce bandwidth and data transfer rates, longer
communication distances can still be achieved. The spreading factor refers to the expansion
of the original signal into a wider frequency band when sending data, and a higher spread-
ing factor means a wider frequency band, so that the interference signal is dispersed, which
helps to reduce the interference of data in the transmission process and makes the data
packet transmitted over a long distance. At the same time, the high spreading factor allows
the network to operate under a relatively low signal-to-noise ratio, and in the process
of long-distance transmission, the signal may become very weak due to path loss, but
the high spreading factor still allows the receiver to correctly decode and identify these
weak signals. The higher transmission power can increase the propagation range of the
signal, improve the successful transmission rate of the data packet over a long distance,
and improve the reliability of the packet to a certain extent when the signal is weakened.
However, excessive transmission power will increase the energy consumption of the termi-
nal and introduce interference, thereby reducing the reliability of the packet. Therefore, the
requirements of data transmission rate, distance, and reliability can be effectively balanced
by selecting the appropriate spreading factor and transmission power. As a special case,
using a higher spreading factor in LoRa networks helps to provide a longer transmission
distance but with a lower transmission rate, whereas using a higher transmission power
helps to increase the transmission distance and signal penetration but at the cost of higher
energy consumption. In addition, the automatic data rate (ADR) technology of LoRa
networks helps to optimize the transmission parameters of the terminal devices, including
spreading factor and transmission power, based on factors such as data packet quality and
network congestion.
On the contrary, the use of unreasonable spreading factors and transmission power in
LoRa networks, as well as the lack of ADR technology, may lead to increased unfair resource
utilization, data conflicts and collisions, increased energy consumption, and shortened
lifespan of terminals. Therefore, in the case of limited resources, it is necessary to select an
appropriate spreading factor and transmit power, and utilize the ADR technology to ensure
the stability, fairness, and efficiency of LoRa networks, so as to improve the utilization of
network capacity.
Moreover, some other existing works have analyzed the effect of LoRa transmission
parameters on network performance, such as spreading factor, bandwidth, coding rate,
and transmission power, etc., improved LoRa performance through single resource opti-
mization [14]. Moreover, there are adaptive mechanisms considering the configuration of
LoRa network communication parameters in dense IoT scenarios, and some parameter
assignment algorithms have been proposed. For example, a LoRa terminal can configure
its parameters according to the link budget, energy efficiency, network load, etc. [15].
Generally, most of the existing works focused on optimizing a single radio parameter in
LoRa to improve network performance. The representative work was as follows.
the airtime of the data package transmitted by terminals in each SF group. In addition
to RSSI, the path loss was also used as a measure to optimize the allocation of SF. The
terminals were ordered by the estimated path loss distance to the gateway, and the terminals
closest to the gateway were assigned the lowest SF. By optimizing the SF distribution, the
average packet error rate of users far from the gateway was reduced [17]. Moreover,
the multi-gateway configuration has also become a consideration for allocating SF, and a
distributed SF allocation algorithm was proposed based on several criteria facing multi-
gateway deployments that effectively allocated SF to progressively joining terminals [18].
Particularly, linear programming has become an important tool for optimizing SF allocation,
for example, some works optimized SF allocation by using an integer linear programming
model to maximize the number of serving terminals [19]. Moreover, some works adopted
an intelligent assignment strategy in SF assignment based on machine learning, which was
optimized by using support vector machine and decision tree classifier machine learning.
This mechanism usually started from learning the transmission behavior of terminals, and
the network server assigned SFs according to its prediction of collisions [20]. In general,
the adaptive SF allocation algorithm often had great flexibility, which took the initial SF
allocation and the interference-based adaptive SF allocation in the deployment phase [21].
tion rate is 5.2%, and the energy consumption is reduced by an average of 41.5%.
Compared to traditional allocation strategies, including minimum airtime allocation,
equal distribution allocation, and random allocation, the data extraction rate increases
by an average of 14.3%, and energy consumption decreases by an average of 23.7%.
1.3. Organization
The rest of this paper is organized as follows. The LoRa network collision effect is
analyzed in Section 2, including the transmission model and collision analysis. The LoRa
network resource allocation optimization is introduced in Section 3, including the problem
formulation and the MILP solution algorithm. Section 4 provides the simulation results.
The conclusions are finally summarized in Section 5.
where Rb is the data rate, spreading factor SF ∈ {7, 8, 9, 10, 11, 12}, coding rate CR ∈ {1, 2, 3, 4},
bandwidth BW ∈ {125, 250, 500}. The LoRa network transmission rate varies due to the
radio parameter selection of each terminal. When BW and CR are constant, the increase
of SF can make the signal resist greater interference, thereby increasing the transmission
range, but at the same time, it will also increase the airtime of the data packet, which will
lead to a decrease in data rate and increase energy consumption, so a trade-off should be
made between transmission range and energy consumption by changing SF. In particular,
data packet transmission time Ts consists of the preamble transmission time Tpreamble and
the payload transmission time Tpayload , and satisfies the following equation:
where Tpreamble and Tpayload , respectively, satisfy the following relationship [15]:
where Tsym represents the time required to send a single symbol, n preamble is the length of
the preamble, payloadSymbNb is the number of symbols that make up the packet payload
and header, Tsym and n preamble respectively satisfy the following formula [37]:
2SF
Tsym = (5)
BW
where PL represents the length of the payload, H represents the selected header type, DE
represents whether low-rate optimization is used during data transmission, and ceil is the
rounding function.
To analyze the dense LoRa network deployment scenario, we adopt the log distance
propagation model [37]:
d
L pl (d) = L pl (d0 ) + 10γlog + Xσ (7)
d0
Sensors 2023, 23, 7783 7 of 21
where L pl (d) is the path loss, L pl (d0 ) is the mean path loss at the reference distance d0 , γ is
the path loss index, and Xσ is a normal distribution with zero mean, that is Xσ ∼ N 0, σ2 .
where Prx = Ptx + G − L − L pl , and Ptx is LoRa terminal transmission power, G is antenna
gain, L is transmitter signal loss, and L pl is the path loss between the transmitter and
receiver. However, in real LoRa networks, SF is not perfectly orthogonal [39–41]. The impact
due to this imperfect orthogonality has been shown to depend on the LoRa transceiver, the
signal-to-noise ratio, and the number of deployed terminals [40]. In this paper, we assume
that SF is orthogonal. As shown in Figure 2, assuming that the available SFs are SF7 and
SF12, consider the following three theorems:
SF7
Case 2:conflict avoidance Channel 1
SF12
SF7
Case 3:conflict Channel 2
SF12 SF7 occurrence
Theorem 1. (No Conflict) Two data packets using the same SF arrive at the same time, and because
they are on different channels, they can be successfully decoded.
Proof of Theorem 1. Assume that both data packets a and b use the same spreading factor
SF12 and arrive at the same time. Define a on channel C1 and b on channel C2. Because C1
and C2 belong to different channels and are disjoint with each other, C1 is not equal to C2,
so there is no chance of collision between the data packets located in C1 and C2, so the two
data packets a and b do not interfere with each other and can be successfully decoded.
Theorem 2. (Conflict Avoidance) Since the SFs are mutually orthogonal, collisions can be avoided
even if multiple terminals use the same channel.
Proof of Theorem 2. Assume that terminal D1 uses spreading factor SF7, terminal D2
uses spreading factor SF12, and both D1 and D2 occupy the same channel C1. Because the
spreading factors SF7 and SF12 are orthogonal to each other, that is, SF7 ∩ SF12 = 0, the
data packets of terminal D1 and terminal D2 do not interfere with each other and can be
successfully decoded.
Theorem 3. (Conflict Occurrence) Collisions occur because data packets using the same SF overlap
in time on the same channel.
Sensors 2023, 23, 7783 8 of 21
Proof of Theorem 3. Assume that both packets a and b use the same spreading factor SF7,
a, and b are located on the same channel C2 and overlap in time. Because the spreading
factors SF7 and SF7 are the same, they do not satisfy the mutually orthogonal condition,
that is, SF7 ∩ SF7 6= 0, so the two data packets of a and b on the same channel will interfere
with each other and cause collisions.
To sum up, when two or more data packets have the same carrier frequency, use the
same SF, and have overlapping arrival times, it can be considered that a collision will occur.
In addition, when a collision occurs, if the difference between the received power
of two data packets is not less than 6dB, a capture effect will occur, the data packet with
higher power is received, and the other is lost. When the difference is less than 6dB, the
receiver will constantly switch between the two packets, unable to efficiently decode either
packet [42].
where Gs,i represents the traffic load. Moreover, the average number of packets arriving at
the channel within the packet transmission time Ts,i of the terminal i determined by SF is
recorded as λ × Ni , where Ni is the number of terminals using the same SF as terminal i,
then Gs,i can be expressed as:
Gs,i = Ts,i × λ × Ni (10)
It can be seen from Equation (10) that the more data packets arrive at the network, the
greater the network load, and the higher the possibility of data packet collision. Terminals
of the same SF are generally considered to interfere with each other, but given the capture
effect, the following optimizations can be made:
(
i −P j
1, Prx rx ≤ 6
C pwr (i, j) = (11)
0, otherwise
where C pwr (i, j) indicates whether there will be a conflict between terminals i and j with
j
i and P represent the received power of the two terminals respectively.
the same SF, Prx rx
Therefore, the total number of conflicting terminals can be defined as:
Ni = ∑ Cipwr(ij) (12)
j∈ N,j6=i
where Ni is always not greater than the total number of terminals using SF.
When the number of periodically transmitted terminals increases dramatically, the
collision problem of data packets in the LoRa network will become a serious challenge.
While ensuring the low energy consumption of the LoRa network, how to reduce data
Sensors 2023, 23, 7783 9 of 21
packet loss is an urgent problem to be solved. Due to the capture effect, the received power
level will determine whether the data packet is decoded when the data packet collision
occurs. Therefore, we define network energy consumption (NEC) as follows:
N
NEC = ∑ Ts ,i × Ptx,i . (13)
i =1
We set the optimization goal as the lowest network energy consumption while mini-
mizing the collision rate, as follows:
min minPcoll NEC
s.t. SF ∈ {7, 8, 9, 10, 11, 12}, (14)
TP ∈ {2, 5, 8, 11, 14}.
The key parameters to solve the LoRa network optimization problem are the data
packet transmission time and received power. On the one hand, a larger transmission rate
can be obtained by using a smaller SF, resulting in a shorter transmission time. On the
other hand, a higher receiving sensitivity can be obtained by using a larger SF, but the
transmission rate is lower and the transmission time is increased. Therefore, it is necessary
to find an optimal solution of mutual constraints among received power, transmission time,
and the number of SF terminals used.
where Us f ,tp is the utility function of the (SF, TP) combination, and the objective function
reflects the minimization of the difference between the utility of each (SF, TP), so that
each (SF, TP) has the least load and achieves good fairness among terminals. The utility
function is expressed as:
Utpi,s f j = Ntpi,s f j × Ts (s f j) × λ; (16)
Utpl,s f k = Ntpl,s f k × Ts (s f k ) × λ (17)
where Ntpi,s f j is the number of terminals using (SFj , TPi ), and Ntpl,s f k is the number of
terminals using (SFk , TPl ). To improve the receiving reliability of the system, we use the
receiving sensitivity as a constraint condition to manage the selection of spreading factor,
so that the terminal can allocate the best parameters under the premise of ensuring that the
data packets reach the gateway:
Sensors 2023, 23, 7783 10 of 21
i 1, Prx ≥ RXsen (SF )
Pder = (18)
0, Prx < RXsen (SF ).
In addition, considering that each terminal is only assigned one SF and one TP, the
following constraints exist:
∑ tpi,tp = 1 ∀i : 1..N
(21)
tp∈ TP
∑ s f i,s f = 1 ∀i : 1..N. (22)
s f ∈SF
Equations (19) and (20) belong to the product of multiple binary variables and is a
nonlinear expression. Therefore, we introduce auxiliary variables for linearization transfor-
mation for terminal i:
zi,tp,s f = tpi,tp × s f i,s f . (23)
i
ri,tp,s f ≤ Pder (26b)
i
ri,tp,s f ≥ zi,tp,s f + Pder − 1. (26c)
In this paper, by establishing a MILP model, the system performance optimization
problem is transformed into a mathematical problem to achieve the allocation of spreading
factor and transmission power. In the model, the spreading factor and transmission power
are used as decision variables, and the network data extraction rate and network energy
consumption are used as objective functions, with constraints introduced. We use the
hierarchical sequence method to solve this problem, that is, first obtain the optimal solution
set corresponding to the minimum conflict rate under the constraint conditions, and then
solve the optimal solution corresponding to the lowest energy consumption under the
premise of ensuring the optimal solution of the previous goal. For the MILP model, we
use the mathematical solver Gurobi, the heuristic genetic algorithm, and the combined
algorithm of the two to solve them separately, and input the better solution obtained by the
heuristic genetic algorithm into the solver as the initial solution of Gurobi. The algorithm
flow is as shown in Algorithm 1.
Sensors 2023, 23, 7783 11 of 21
4. Simulation Results
To show the performance of different parameter selection strategies, we choose the
LoRaSim simulation platform for performance verification [43]. With this tool, we deploy
terminals as well as a gateway in a two-dimensional area, assuming that a single gateway
can decode concurrent signals on all SFs. The parameters set in the simulation are shown
in Table 1.
We use three types of indicators to evaluate the performance of the LoRa network,
namely data extraction rate (DER), the number of collisions, and network energy consump-
tion, in addition to evaluating the effectiveness of the model.
It can be found from the analysis that our proposed MILP model is a non-convex optimiza-
tion problem. Therefore, when using the mathematical solver, we first set a fixed solution time
of 3600 s to obtain as good a solution accuracy as possible within this time. For the proposed
MILP model, we combined the Gurobi mathematical solver and heuristic genetic algorithm
to solve the problem. The parameter allocation strategies we selected include minimum air-
time allocation, equal distribution allocation, random allocation, Genetic Algorithm (GA), and
Approximate Average Packet Airtime Algorithm (AAPA) [36].
(1) Data extraction rate: We evaluate the data extraction rate of the LoRa network
within the value range between 0∼1. The closer the DER is to 1, the more effective the LoRa
deployment will be. The following is the calculation formula of DER:
Nr − C
DER = (27)
Ns
where Nr represents the number of received packets, C represents the number of conflicting
packets, and Ns represents the number of sent packets. As shown in Figure 3, compared
with the genetic algorithm, AAPA algorithm, minimum airtime allocation, random and
equal distribution allocation, the DER optimal solution obtained by using the Gurobi tool
Sensors 2023, 23, 7783 12 of 21
increased by 2.7%, 7.6%, 10.7%, 14.8%, and 17.3%. It can be found that the genetic algorithm
has a poor search ability and low search efficiency in the face of high-dimensional and
complex problems, and it is prone to premature convergence problems and falls into local
optimal solutions. In addition, random allocation and equal distribution allocation are
suitable for the situation with few LoRa network terminals. The disadvantage is that
random allocation may have terminals close to the gateway using high SF, thereby increas-
ing the airtime of data packets and increasing the probability of collision, whereas equal
distribution allocation only distributes the number of terminals evenly among (SF, TP),
without considering the different applicable distances of SF. The model proposed in this
paper is a global optimization that considers all terminals in the entire network, providing
the optimal spreading factor and precise transmission power values for each terminal.
Accurate parameter allocation helps to reduce packet collisions and interference, thereby
improving the data extraction rate of the network.
'