3.2. Energy Consumption Model
In accordance with Casals et al. [
29], the energy consumption involved in transmitting a LoRa packet can be segmented into distinct phases encompassing end device’s waking up, radio preparation, signal transmission, radio deactivation, and postprocessing. All of these phases except for signal transmission exhibit minimal or no dependency on resource allocation; hence, they are assumed to be uniform across all end devices in the proposed model.
Computational operations and costs associated with algorithms for selecting relays are deployed to run on a backend system (LoRa Network Server), not on the devices themselves. Offloading complex tasks to the backend system is common in LPWAN applications to keep the transceiver design simple and low-cost [
30]; thus, these operations are not included in the energy consumption model concerning device battery usage.
The energy consumption of the end device during LoRa packet transmission and reception according to [
8] is as follows:
where:
—ToA for symbol,
kHz—bandwidth,
—number of symbols encoding the preamble (value specified in the “Regional Parameters LoRaWAN” [
31]) and extended by an additional 4.25 symbols by the radio transmitter (resulting in 12.25 symbols),
B—payload size,
B—header size,
if low data rate optimization is enabled (for SF = 11 and SF = 12),
for disabled, and
—coding rate.
Then, the transmission energy usage
and reception energy usage
for a single packet are as follows.
The calculation results for the presented energy consumption model are included in
Table 1, and are utilized in the heuristic function described
Section 3.3 and in the simulations in
Section 5.
3.3. Heuristic Function
Each edge
is assigned a weight describing the quality of link between devices corresponding to nodes
u and
w. The formula for determining an edge weight is provided by the heuristic function
,
where
is the daily energy surplus (in mA) of the relay candidate
w, calculated on the basis of the device’s battery level and remaining operation time [
20]. The energy budget analysis includes the energy cost of switching to relay mode (1440 mAs). This value includes the cost of reconfiguring the settings and was established in collaboration with the industry partner while realizing the research grant nr POIR.04.01.04-00-0005/17. Nevertheless, our study is flexible in updating this variable. Here,
is the relay’s reception energy usage depending on the weak node’s
u SF value,
is the relay’s transmission energy usage depending on the relay’s SF value, both of which are taken from
Table 1.
The weight function (
12) estimates the attractiveness of the connection between a weak node
and a relay node candidate
. The Formula (
12) consists of two main components: the energy surplus per day
of the relay node candidate
(in the nominator), and the relaying energy cost of weak node
(in the denominator), which consists of the listening energy cost
and transmission energy cost
corresponding to a single packet of weak node
needing to be forwarded by a relay node
w.
The heuristic function (
12) considers a key parameter of LoRa technology, namely, the spreading factor
, which determines how many chirps (or symbols) are sent per second. Various spreading factor values result in significant differences in time-on-air (ToA) for a transmitting symbol [
32]. With
, a symbol can encode
n information bits into a chirp, and the bit rate is provided by
, meaning that the symbol period is calculated by
. Thus, when the number of bits in the symbol increases by only one, its ToA doubles; however, a higher SF means more resistance to interference and noise, resulting in a more extensive communication range.
In evaluating the link quality between a weak node and a relay candidate, it is necessary to consider two values of the SF, namely, the values for communications between a weak node and a relay candidate () and between a relay candidate and a LoRa gateway ().
The impact of these SFs is captured in appropriate proportions in the denominator of the function (
12). The formula considers the energy cost associated with the relay node’s listening, which is related to receiving packets from the weak node, and the energy cost of retransmitting those packets. It directly corresponds to the daily cost of serving as a relay for a weak node.
Nodes capable of serving as relays for individual weak nodes for as long as possible are prioritized, aiming to minimize future switches from relay mode.
The listening energy usage component evaluates the node w based on the value of the spreading factor in the communication between a weak node u and the relay candidate w.
The transmission energy usage component
evaluates node
w on the basis of the value of the spreading factor
in the communication between node
w and the destination gateway
g. As the value of
decreases, the value of the heuristic function (
12) increases. This approach considers power-efficient relay node selection. The smaller the spreading factor to the destination LoRa gateway
, the less energy is used by the device represented by node
w in relay mode. The higher the weight function value, the more attractive node
is to serve as a relay for weak node
.
This clear principle, which divides the surplus energy of a relay node candidate by the cost of operating as a relay, precisely reflects the quality of connection from a weak node to the relay node candidate tp the LoRa gateway, while considering the role of node as a relay for node .
The remaining operational time during which the device w must operate is already incorporated into the formula for determining the device’s energy surplus .
Figure 1 depicts the 2D distribution of weight function (
12) values depending on the spreading factors in the communication between weak node–relay node candidate (
) and relay node candidate–LoRa gateway (
) for each
,
.
As the values of both spreading factors decrease, the edge weight function increases. The heatmap effectively highlights the differences in the objective function values for the cases , and , , where . The SF in communication between the relay and the gateway () has a more significant impact on the relay’s energy consumption than the spreading factor in communication between the relay and a weak node (). The heatmap aims to depict the characteristic influence of SFs and visualize their impact on outcomes. It is generated for a constant surplus energy value; the exact value is not significant, as the distribution characteristics are preserved.
To summarize the main characteristics of the heuristic function
(
12) for providing an energy-efficient selection of relay-type devices, we emphasize the following:
The heuristic function promotes edges connecting potential relay nodes with a high energy surplus and a low maintenance cost for weak nodes. The value of increases as the numerator (energy surplus ) rises and the denominator (weak node maintenance cost ) decreases, enhancing the overall attractiveness of the relay node.
The energy surplus is calculated based on the device’s battery level, a crucial feature for battery-powered IoT devices.
The Spreading Factor, a vital transmission parameter in LoRa technology that influences battery consumption, is considered in the heuristic function
. The formula of
(
12) appropriately accounts for this factor regarding the energy used to receive a packet from a weak node (component
calculated on (
11)) and retransmit this packet (component
calculated on (
10)).
3.5. Computational Complexity
When establishing the running time of the ACO relay selection (Algorithm 1), the worst-case scenario was considered, i.e., a scenario in which the bipartite graph is complete. In this analysis, the focus was on the most computationally significant components of the procedure, with the steps characterized as negligible being omitted.
In
Table 2 and
Table 3, the computational cost and the multiplicity of operations for Algorithm 1 necessary for determining the pessimistic execution time of the algorithm are presented. According to [
33], each execution of the
kth line requires time
, where
is a constant.
Let , and .
Then, the pessimistic execution time of Algorithm 1 is presented as follows:
and, considering the asymptotic growth of the running time, the algorithm runs in time
In
Table 4, the time complexity of the proposed methods (the heuristic ACO, the exact EK method [
27], and reference method [
21]) are compared.
Compared to the EK and reference methods, the computational complexity of the ACO algorithm does not solely depend on the size of the number of vertices and edges, as the number of iterations and number of ants involved are significant as well. The ACO algorithm is an alternative to the exact EK approach for certain problems. The proposed heuristic approach is suitable for large sparse graphs, i.e., where
is significantly lower than
[
33]. ACO algorithm can find optimal or suboptimal solutions faster than exact methods for such cases, as presented in the subsequent
Section 4.