Energy Allocation for LoRaWAN Nodes with Multi-Source Energy Harvesting

Many connected devices are expected to be deployed during the next few years. Energy harvesting appears to be a good solution to power these devices but is not a reliable power source due to the time-varying nature of most energy sources. It is possible to harvest energy from multiple energy sources to tackle this problem, thus increasing the amount and the consistency of harvested energy. Additionally, a power management system can be implemented to compute how much energy can be consumed and to allocate this energy to multiple tasks, thus adapting the device quality of service to its energy capabilities. The goal is to maximize the amount of measured and transmitted data while avoiding power failures as much as possible. For this purpose, an industrial sensor node platform was extended with a multi-source energy-harvesting circuit and programmed with a novel energy-allocation system for multi-task devices. In this paper, a multi-source energy-harvesting LoRaWAN node is proposed and optimal energy allocation is proposed when the node runs different sensing tasks. The presented hardware platform was built with off-the-shelf components, and the proposed power management system was implemented on this platform. An experimental validation on a real LoRaWAN network shows that a gain of 51% transmitted messages and 62% executed sensing tasks can be achieved with the multi-source energy-harvesting and power-management system, compared to a single-source system.


Introduction
The IoT (Internet of Things) has become an important research area in recent years for both the academic and industrial communities, leading to the development of multiple technologies dedicated to this market. LoRaWAN [1] (Long-Range Wide-Area Network), for instance, which uses the LoRa [2] (Long-Range) modulation, enables long-range communication with limited power consumption. As more IoT nodes are deployed, the way they are powered becomes a critical issue. In particular, using non-rechargeable batteries for several billion devices [3] would create a significant amount of chemical waste. Moreover, the use of rechargeable batteries is not always feasible as recharging those would increase the maintenance cost of the network or is even impossible if the IoT node is deployed in a harsh area. Thus, using energy-harvesting technologies can reduce the cost of ownership of the network but comes with technical challenges, which this paper attempts to tackle.
An energy-harvesting IoT node harvests energy from its environment to recharge an energy-storage device and/or to directly power its components. In order to increase the amount of harvested energy, recent designs have introduced the possibility to simultaneously harvest energy from different sources [4,5]. More harvested energy allows the node to be powered for a longer time or to increase its QoS (Quality of Service). In the context of this work, the QoS of a node is defined as the quantity of data sensed and transmitted. When the node executes multiple tasks, the definition of QoS also includes the execution of multiple sensing and transmission tasks.
However, most energy-harvesting sources are variable and do not provide a constant power supply. Even if low-power IoT nodes are used, there is a risk of fully depleting the energy storage while no energy is harvested. In order to ensure continuous operation of the IoT node, the use of a power management system has been introduced in [6]. In such a system, the IoT node adapts its QoS to its energy capabilities, thus avoiding depleting its storage when energy can seldom be harvested and increasing its QoS when energy is plentiful.
The purpose of this work is to use technologies from both the energy-harvesting and energy-management fields and to design a production-ready autonomous IoT node based on an existing industrial platform. A multi-source and multi-task energy-harvesting LoRaWAN IoT node is presented and uses a power-management system to maximize its QoS and to ensure continuous operation. This IoT node is connected to a real commercial LoRaWAN standard network, including a network server and an application server for data presentation. The IoT node operates as a standard class C LoRaWAN device and is seen by the network as any other class C LoRaWAN device. Though the whole system is presented here, its different components are largely independent and could be reused with different hardware or software. Specifically, the contributions presented in this paper are as follows:

1.
A multi-source energy-harvesting circuit based on off-the-shelf components that can harvest energy from a large variety of energy sources without a design change. This includes sources such as a solar panel, a low-voltage source such as a TEG (Thermo-Electric Generator), and any alternating voltage source such as a wind turbine or a piezoelectric generator. This platform is presented in Section 3.

2.
An energy-allocation policy used to fairly allocate the harvested energy to multiple heterogeneous tasks. This design is explained in Section 4.2, from the theoretical optimal energy allocation calculation to the adaptation of these results to real-world conditions. 3.
An implementation based on a real-world device and LoRaWAN network instead of simulation, which corresponds to an industrial use-case. This bridges the academic results and industrial constraints. The benefits of multi-source energy harvesting are measured and demonstrated, especially when complementary energy sources are used.
The rest of this paper is organized as follows. The state-of-the-art of different hardware platforms and power-management systems for IoT nodes is presented in Section 2. The hardware and software architectures of our LoRaWAN energy-harvesting IoT platform are then presented in Section 3. Section 4 details the designed energy-allocation systems for both single-task and multi-task IoT nodes. The experimental results obtained with the previously described energy-allocation policies are shown in Section 5. Finally, the conclusions and perspectives for future works are presented in Section 6.

Review of the Literature
In order to fulfill the requirements of all IoT applications, several wireless transmission protocols have been developed. LoRaWAN [1], based on LoRa [2] communications, is particularly suitable for remote data sensing, as it enables long-range communications with a reduced power consumption. LoRaWAN IoT nodes can therefore be deployed in remote areas with a small number of gateways, where energy harvesting is a relevant candidate as the power [7,8]. Such sensor networks can typically be deployed to increase the precision of phenomenon detection in remote areas [9][10][11].
Multiple energy-harvesting systems have been designed for different energy sources, such as solar panels [12], wind turbines [13], TEGs [14], or piezoelectric generators [15]. Additionally, different multi-source energy-harvesting systems have been designed to simultaneously harvest energy from different sources. In [16], a diode ORing system was used to connect multiple energy sources to a single power converter. However, this system does not use a MPPT (Maximum Power Point Tracking) [17,18] system for each source, which prevents the sources from delivering their maximum power. In [5], each source was alternatively connected to the power converter and stored its energy in a capacitor while it was disconnected. This system is efficient when sources have a similar voltage but requires more than three sources to be cost efficient. Ambimax [4] used a power converter and an energy storage for each source, which is more expensive but enables the use of an MPPT circuit per source. In our work, a similar architecture is used, but all of power converters are directly connected to a single energy storage through an integrated battery-management circuit. Another approach [19] is the use of a specific material able to harvest energy from solar, thermal, and kinetic sources. The use of such materials could remove the need for specific circuitry when energy is harvested from different sources.
In order to efficiently use the harvested energy, multiple techniques are used to reduce the component power consumption. Dynamic Frequency and Voltage Scaling (DVFS) [20] reduces the dynamic power consumption by lowering the operating voltage and frequency of the active components. Another method is to use duty cycling [21], where components are powered off or set in sleep mode while they are inactive. This method is especially efficient for IoT nodes, where the components are inactive most of the time as the device does not continuously measure and transmit data. However, even with a reduced energy consumption, an energy-harvesting IoT node can empty its energy storage in cases of energy scarcity. Thus, the node needs to integrate a power-management system to dynamically adapt its QoS to its energy capacities.
This type of power-management system was first proposed in [22], which uses an Exponentially Weighted Moving Average (EWMA) algorithm to predict the future harvested energy from a solar panel and accordingly adapts the node duty cycle. This system is extended in [23], which presents the Weather Conditioned Moving Average (WCMA), improving the prediction precision of EWMA by taking into account past and present weather measurements. These power managers are called "model-based", as they expect the energy source to match a model of the source in order to predict its energy output. However, they are difficult to apply for unpredictable energy sources or for multi-source energy harvesting systems, where multiple energy sources are combined.
An alternative is to use "model-free" algorithms, which only take as data input current and past energy capabilities, such as the residual energy of the storage device E R and the harvested energy E H . These algorithms are often close to control systems, in which a control loop dynamically adapts a controlled output value to match the input value variations. For instance, the authors of [24] used Proportional-Integral-Derivative (PID) control system to adapt the delay between two data transmissions based on the energy in a super-capacitor. LQ-tracker [25] uses a linear quadratic tracker that adapts the duty cycle to minimize the difference between the current residual energy and a target one, using only E R as the input. Fuzzyman [26] uses fuzzy logic to compute an energy budget, i.e., the quantity of harvested energy that can be used in a time slot, and use E R and E H as the inputs. RLman [27] is based on reinforcement learning but is limited to single-task IoT nodes.
Energy allocation for multi-task systems can be seen as a task scheduling problem, where tasks are constrained by both their energy consumption and QoS requirements instead of their deadline and/or period. Most energy-aware task scheduling policies [28][29][30][31][32][33] target real-time systems, for which the objective is to ensure that all tasks meet their deadline requirements instead of allocating energy to different tasks. DEOS [34] takes a different approach by considering energy as a schedulable resource to dynamically schedule tasks depending on their energy consumption and the available energy. Furthermore, DEOS is able to enforce QoS rules using the minimum and maximum number of tasks executed. Our work differs from DEOS as a mathematical approach is used to compute the optimal number of executions for each task. Moreover, our work considers the full system design, from energy harvesting hardware to energy management, while DEOS focuses solely on the task scheduling problem.
Although the use of long-range radio networks is picking up in recent years, most academic work on energy-harvesting IoT networks focus on mesh network technologies, and only a few articles discuss the use of LoRaWAN Energy-Harvesting IoT (EH-IoT) nodes. A LoRaWAN IoT node used for safety applications was presented in [35]. The node implements a functional power management system but does not detail it. Solar panels and a TEG were both used in [36] to power a floating LoRaWAN IoT node, but no power management was implemented. In our work, a LoRaWAN IoT node platform with flexible multi-source energy-harvesting capabilities and power-management features is presented. Our approach is entirely based on off-the-shelf components to ease implementation. Moreover, the case of IoT nodes that execute different sensing tasks is also considered.

Multi-Source Multi-Task Node Architecture
In order to validate their design, the energy allocation policies proposed in this paper were implemented on a real multi-source EH-IoT node. The complete block diagram of the proposed node is shown in Figure 1. The hardware part is composed of two boards: a preexisting industrial LoRaWAN platform from Wi6labs and a multi-source energyharvesting board. Both the networking protocol and power management software module are implemented on a microcontroller. The use of LoRaWAN in this work serves as a context, and no modifications or contributions are made to the LoRaWAN standard stack itself. The full platform is built using off-the-shelf components, making it easier to adopt for industrial applications.  The Wi6labs LoRaWAN platform is composed of a STM32 microcontroller, a SX1272 LoRa transceiver from Semtech, and their power supplies. The platform provides standard interfaces (I2C, SPI, and UART), GPIOs, and ADC inputs to connect multiple sensor boards depending on the target application. In this study, the sensor board includes a CO 2 sensor, a noise level measurement system and a temperature/humidity sensor.

Multi-Source Energy-Harvesting Architecture
The LoRaWAN platform is powered by a multi-source energy-harvesting board, described in Figure 2, which can combine up to three energy sources: a very low-voltage source, such as a TEG; an alternating voltage source, such as a wind turbine; and a voltage source up to 18 V, such as a solar panel. The board can therefore be used with most of the energy-harvesting sources used for IoT nodes. Moreover, it is possible to change the configuration of each input by changing the value of a few resistors, allowing the adaptation of the board to different applications without designing a new one. In order to ease its potential industrialization, the board is only composed of off-the-shelf components. The architectures allowing the simultaneous harvesting of multiple-energy sources have been previously explored in [5], and the results show that the architecture of Figure 2 gives the best performance. Although the architecture is straightforward, its implementation as well as its integration with energy management techniques in an industrial product are new.  Each input is connected to a SPV1050 [37] from STmicroelectronics, as shown in Figure 2. This component integrates a power converter, which can be configured as a boost or buck-boost regulator, a battery charger, and a MPPT circuit in order to maximize the harvested energy. The MPPT circuit used in this component is based on the Fractional Open-Circuit Voltage approach [38,39], which enables a small and cheap implementation and is precise enough for the targeted energy levels. To set its operating point at the correct voltage, the DC-DC converter varies its switching frequency. This modulates its input impedance and, thus, the voltage-operating point of the integrated circuit (IC) according to the MPPT circuit. Both the MPPT and battery charger thresholds can be configured with external resistors.

SPV1050
The SPV1050 stores the harvested energy in a capacitor C STORE . This capacitor is connected to the battery when its voltage V STORE reaches the end-of-charge voltage V EOC and is disconnected when V STORE decreases under the under-voltage protection threshold V UVP . Moreover, to avoid overcharging the battery, the integrated DC-DC converter is stopped when V STORE reaches V EOC until V STORE decreases under V EOC − EOC HYST , where EOC HYST is an hysteresis voltage set to 1% of V EOC .
The use of this battery charging circuit ensures that the energy storage is neither charged nor discharged outside of the energy-storage specifications, i.e., V STORE stays bounded between V UVP and V EOC . Thus, it is possible to directly connect each SPV1050 to a single energy storage. If one energy source does not provide enough power to charge the common energy storage but its capacitor C STORE is still connected to the energy storage (i.e. V STORE ≥ V UVP ), the SPV1050 is powered from the energy storage. A diode could prevent this current return, but the current consumption of the component (≤3 µA) is much lower than the return current of a diode. In the EH-IoT considered in this paper, the three SPV1050 are connected to a 7.5 F supercapacitor, which directly powers the IoT node. This supercapacitor has a maximum leakage current of 70 µA. This current is much lower than the ones provided by the energy sources used in our experimentation and, thus, is ignored to simplify the energy management.

Software Architecture
The considered EH-IoT node firmware is based on Contiki RTOS [40]. Besides the typical sensing, data processing, and LoRa transmission tasks, a power management module is also embedded to adapt the node behavior to its energy capabilities. As shown in [26], a power management system can be divided in two sub-blocks: an Energy Budget Estimator (EBE), which computes an energy budget E B , which represents how much energy can be spent over a time slot, and an EA (Energy Allocator), which decides how the energy budget E B should be used. For multi-task systems, there is indeed an interest in separ-ating how much energy can be used, which takes only energy capabilities into account, and how it is used, which should only take a task set and QoS requirements as inputs. As most previously designed power managers only take single-task devices into account, the energy-allocation step is implicit and the power manager can easily skip this step and deliver an E B .
In state-of-the-art applications, the power management algorithm is executed at the end of fixed-duration time slots, and the computed duty cycle is applied for all transmissions during the next time slot. The duration of the time slot must be long enough to cover multiple transmissions. For example, many works use a time slot duration of one hour with mesh network communications, where the delay D TX between two transmissions varies from seconds to minutes. However, in the case of LoRaWAN communications, D TX can range from minutes to hours or even days, depending on the use case. This requires the use of very long time slots, and prevents the power management algorithm from converging to an optimized duty cycle in a reasonable time. To prevent this problem, the considered power manager is executed after each data transmission, so that the node can quickly adapt its behavior to variations in the environment.
The use of multi-source energy harvesting impacts the choice of EBE algorithms. As multiple energy sources can be used with the platform, no single model can be applied to estimate future harvested energy. Thus, it is not possible to use model-based EBE algorithms. Moreover, as the delay between two EBE executions can be long, it is necessary to use a model-free EBE algorithm that can converge towards an optimized duty cycle in a few executions. However, previous work [41] has shown that EBE algorithms have low performance differences when they are properly optimized, which enables the use of simple algorithms to compute E B . For this study, LQ-tracker [25] is used as the EBE algorithm, since it provides good performance without requiring its parameters to be tuned.
The calculated E B then has to be allocated to one or more tasks. This is the role of the energy-allocation system. The choice of this system is mainly dependent on the applicative use case of the EH-IoT node. A distinction can be made between single-task and multi-task systems. In the first case, the EH-IoT has to execute a single task, which can be composed of multiple sub-tasks. An EH-IoT node that senses, processes, and transmits the data falls into this category. On the other hand, multi-task systems have to execute multiple tasks such as different types of measurement. In this case, the EA system aims to allocate the energy-budget E B according to their defined characteristics. These can include their priority, energy consumption, or QoS requirements set by the designer. This energy allocation subsystem is described in detail in Section 4. In this paper, both cases are considered and studied.

Energy Allocation for IoT Nodes
Energy allocation is the process of allocating an E B to one or more tasks. It can be noticed that, in some industrial use cases, the QoS can be constrained by a minimum and/or maximum number of transmissions and task executions. Therefore, the EA decides how many times a task is executed between two consecutive LoRa transmissions, separated by a delay D TX while taking into account these applicative constraints.

Single-Task Energy Allocation
This part first addresses the case of IoT nodes that only perform one task. Although this task can be composed of multiple sub-tasks, it is assumed that the task is executed as a whole. An example of such a system is a node that measures a value, processes it, and immediately transmits it over the network. This approach is typically used for measurement reporting applications. The energy consumption of this single task is supposed to be constant and known a priori, and is denoted E mono C . All the notations of this section are given in Table 1. In terms of energy allocation, this approach is a relatively simple one. Indeed, in this use case, the goal of energy allocation is to convert the energy budget E B into an inversely proportional delay between two messages D TX . The energy allocator computes a decreasing function D TX = f (E B ). This function can be designed so that its shape fits the application, e.g., it takes more risks by computing a smaller D TX for a large range of E B values, or is more conservative and delivers D TX = D max TX for a range of small E B values. Different functions can be used as long as it is a decreasing one. The allocation is either conservative or reactive depending on the choice of function.
The QoS is set in the library by defining a time reference D, and the minimal and maximal delays between two transmissions D min TX and D max TX . The value of D is used to compute sleep duration values. A high D value enables longer low-power periods but reduces the granularity and precision of short ones. The minimal and maximal energy budget E min B and E max B for this application are computed as (1) and (2), respectively. In our case, D is set to one hour.
In this work, two functions for single-task energy allocation are introduced and evaluated. Both deliver a delay D TX between the minimal and maximal values D min TX and D max TX , which are set as parameters by the system designer. The first function computes D TX between D min TX and D max TX as a pro-rata of E B between E min B and E max B . Thus, the ramp function D TX = f (E B ) is given by the following: The second function generalizes (1) and (2), which compute, respectively, E min B and E max B as functions of E mono C , D, D min TX , and D max TX : The delay D TX can then be extracted by the inverse function: Equation (5) is equivalent to a previous result obtained through a different reasoning [42] and by considering the power consumption in sleep mode negligible. This approximation holds in the case of long-range transmission as E mono C is generally higher than in traditional mesh-networked IoT nodes. Indeed, in our use case, the delay between two task executions is constrained between 15 min and 3 h. Thus, the energy consumed in sleep mode (≤0.8 mJ, depending of duty cycle) is negligible compared to the energy burst consumed during a task execution (≈140 mJ) and can be considered equal to 0. The practical impact of this decision is that the computed D TX is slightly lower, thus increasing the QoS but slightly increasing the risk of energy storage depletion.

Multi-Task Energy Allocation
The multi-task case is significantly more complex than the single-task one. Several multi-task use cases can be considered, e.g., a single sensor that separates the sensing, processing, and transmission tasks or nodes that measure multiple physical values with different QoS requirements for each sensing task. An example of such a use case is the Super Citizen Smart Sensor (SCSS) project [43], in which nodes are able to measure noise level and gas concentration for air quality, temperature, and humidity. Each sensing task requires a different periodicity: temperature and humidity tend to change slowly, while the noise level can vary very quickly. Moreover, the power consumption of each task is different. An efficient energy allocation algorithm is therefore required.
The strategy for data transmission can also differ according to the use case. Measured data can be either directly transmitted after its measurement or aggregated with other measured data. The first strategy reduces the latency (i.e., the delay between a measurement and its transmission) to a minimum. However, it consumes more energy, as a larger number of transmissions is attempted. Thus, the QoS for all tasks is also reduced. If all tasks must be executed only once per transmission slot, the system can wake up, execute all sensing and processing tasks, transmit the relevant data, and go back into sleep mode. In this case, the system is analogous to a mono-task system, in which a meta task composed of all sensing/processing tasks and the transmission task is periodically executed. Finally, the transmission task can send aggregated data from multiple sensing and processing tasks. This last case is explored in this part, with a target of QoS maximization for all sensing tasks. The task set is considered constant, and the use of dynamic tasks is not considered in this work.
All the notations of this section are given in Table 2. In this work, a task τ i is defined by the process it executes, its energy consumption E τ i C , its priority ρ i ∈ [0; 1], and its number of executions between two transmissions φ i . φ i has minimal and maximal values, denoted by φ min i and φ max i , respectively, which enable us to set the required QoS of the task. A highpriority task has a high ρ i . A task for which execution is not always required can have φ min i set to 0. The transmission task is a particular one, as it is always executed at the end of a time slot and can be modeled by setting both φ min i and φ max i to 1. The energy consumption of the transmission task is denoted E TX C . This task model only adds QoS requirements and energy awareness to processes. Real-time capabilities can be integrated either by linking energy-aware tasks to real-time processes, which embed information about their deadline and/or period, or by adding this information to the task model.
with K being the total number of tasks.
Inversely, E max B corresponds to the case where each task τ i is executed φ max i times with a delay D min TX between two transmissions: The goal of the EA is the maximization of the QoS for all sensing tasks, i.e., maximizing φ i , ∀i ∈ {1, . . . , K}. The energy-allocation problem can be formulated by (8) and its goal is to maximize the consumed energy E Total C , constrained by the energy budget E Total To solve this problem, a first approach is to use purely algorithmic solutions to find the set {φ 1 , φ 2 , . . . , φ K } that maximizes E Total C while still keeping E Total Such an algorithm has to compute all possible combinations of φ i and to select the one that best respects both energy budget and QoS constraints and the task priorities. However, its complexity is growing quickly with the number of tasks and requires both memory and computing resources that are not always available in an IoT node. As the solution space is very important, a fully algorithmic energy allocator will provide a suboptimal solution. There is therefore a need to determine an optimal solution to this problem. To solve this problem, we suppose the following hypotheses: -All priorities ρ i are normalized so that ∑ K i=1 ρ i = 1 -Data are transmitted only once, at the end of each time slot.
This second assumption stems from the use of LoRaWAN as the transmission network. Many state-of-the-art energy management algorithms use mesh-networking technologies to transmit data, for which the delay between two messages ranges from seconds to minutes. In such a case, a time slot has a fixed duration that covers multiple transmissions. In our use case, the delay between two LoRaWAN messages can range from minutes to hours or even days in extreme cases. A fixed duration time slot long enough to cover multiple transmissions would lead to a long convergence time of the energy management algorithms and would decrease their stability. Thus, a variable duration time slot is chosen, defined as the time between two transmissions.
The allocation problem solution must be able to provide equity between the different tasks to avoid a task with a much lower consumption E τ i C or much higher priority ρ i being the only one executed. One way to solve this problem while keeping fairness between tasks is to solve the cost function as a sum of logarithms [44], as defined in (9), where x = [φ 1 , φ 2 , . . . , φ K ] is a solution vector: with the constraint defined by the function g i (x): This is a linear optimization of a convex function problem; thus, a local solution is also a global solution. The Lagrangian function for the problem can be expressed as follows: with λ being a vector composed of the Lagrange multipliers λ i . This optimization problem is solved using the KKT conditions [45]. This theorem states that, for each point x that maximizes the f 0 (x) function, there exists a set of these multipliers that satisfies the following conditions: Thus, if a local solution satisfies the KKT conditions, this solution is proven to globally maximize the function and is the optimal allocated energy value. To determine this local solution, we pose that i = K (11) becomes the following: This function of φ K presents a local maximum when its derivative with respect to φ K is equal to 0, expressed as follows: A local solution is achieved with λ K > 0 (as φ K ≥ 0) and thus respects the first and second KKT conditions. If the third KKT condition is checked for λ i = λ K ≥ 0, it becomes the following: λ K cannot be equal to 0; otherwise, φ K would not exist. By integrating the local solution in (14), we obtain the following (15): As ρ i values are normalized so that their sum is equal to 1, (15) can be simplified as follows: 1 Thus, if E B > E TX C , (16) proves that we have a set of λ i defined as λ i = λ K = 1/(E B − E TX C ) > 0, a solution that fulfills both the second and third conditions while the first condition is fulfilled by the fact that the function is convex. Therefore, the solution provided that E B enables at least one transmission. If E B < E TX C , the problem does not apply, as the IoT node does not have enough energy to perform any action.
Hence, the optimal φ i for each task can be computed as follows: Although this result is quite simple to compute, the mathematical process behind its demonstration ensures its optimality. It can be noticed that the result of this optimal formula is not always an integer value. It is possible to truncate each φ i to obtain integer values that respect the constraint E Total C ≤ E B − E TX C . This enables computing the delay D τ i of each task and scheduling them as with the previous algorithmic method. However, that breaks the optimality, as there will still be a difference between E Total C and E B − E TX C . Another possibility is to compute D τ i = D TX /φ i while keeping the exact value of φ i , even if it is not an integer. As it becomes much complicated to compute a greatest common divisor of the different φ i , each task must be scheduled with its own timer. Although this increases the computing requirements, most embedded operating systems provide software timer libraries that simplify this implementation and do not require a large number of hardware timers. Each timer can be set to the new D τ i value when it is computed. As the tasks are run asynchronously from the transmission task and the time slot, the data to be transmitted must be stored in a properly sized buffer. In the case of long-range transmission, such as LoRaWAN networks, where only a few tens of bytes can be transmitted at once, the QoS of the tasks must be set carefully to avoid overflowing this transmission buffer and losing data.
Although this solution is optimal with regard to the priority ρ i and energy consumption E τ i C of the tasks, it does not take into account the minimal and maximal QoS of the tasks. Moreover, it does not compute the delay between two consecutive transmissions, as it is supposed that each time slot ends with a transmission. Thus, these computations have to be included in an algorithm that enforces the required QoS and computes an adapted D TX .
Algorithm 1 proposes the integration of the optimal φ i . It defines E max C as the maximum energy that can be consumed, i.e., the E Total C when all φ i are equal to φ max i and D TX = D min TX . If E B > E max C , it enforces the maximal QoS rules, which lets the node save more energy for later usage. If E B < E max C , it tries to maximize the QoS by allocating energy using the optimal formula in (17). This example favors the battery life over the QoS, as the minimal QoS settings are not enforced if not enough energy is available. On the other hand, it tries to maximize QoS as much as possible, ensuring that high-priority tasks are favored. It can be noticed that the QoS limits do not have to be aligned with the priority setting. For example, a high-priority task may require only one execution per timeslot while a less important sensing task may be executed multiple times. Due to this, the calculated φ i must be capped at φ max i . Although this breaks the optimality of the φ i computation for the other tasks, it avoids spending energy on an unrequired task execution.

Algorithm 1:
Optimal φ i calculation integrated in a practical solution input : A list of the tasks to be scheduled, sorted by descending priority.

Experimental Validation
All proposed energy allocators were implemented, tested, and compared on a real LoRaWAN IoT node, shown in Figure 3. This implementation was performed in an external library, and neither the base OS nor the tasks needed to be modified. This node was based on the Wi6labs platform and the multi-source energy-harvesting board described in Section 3. LQ-tracker was used as the EBE algorithm. All functions were implemented as a portable C library to help validation and to speed up the development. During the experiments, all of the nodes were connected to a commercial IoT network and reported the measured data to a real application server. Thus, the experiments were executed and validated in a real-world scenario. These experiments also validated the approach of multi-source energy harvesting to increase the QoS of an IoT node.

Single-Task Energy-Allocation Results
Two nodes were deployed, each powered by a small solar panel with a maximum voltage of 5 V for 40 mA. The IoT node firmware consists of a single task, composed of a temperature and humidity measurement and its transmission over the LoRaWAN network. Both nodes used LQ-Tracker as the EBE algorithm. The first one used the ramp function (3) and the other used the inverse function (5). Both IoT sensor nodes were run at the same location for approximately 40 days, sending logs of each transmission and energy capabilities over an UART link to a computer. During the campaign, the energystorage voltage V BAT , the energy budget E B , the delay between two transmissions D TX , and the number of successful transmissions were recorded. The results of this experiment are shown in Table 3. The use of the ramp function implements a more conservative policy than the inverse function. This induces a higher delay D TX despite a higher energy budget E B , which enables the node to keep more energy in storage, as shown by the increase in the mean V BAT value, and to decrease the QoS as less messages are transmitted. This experiment shows that, for single-task IoT nodes, the choice of the D TX = f (E B ) EA function is a compromise between QoS and energy safety.

Multi-Task Energy-Allocation Results
Algorithm 1 was implemented and evaluated on real-world IoT nodes. The node firmware provides lightweight software timer libraries. Thus, an asynchronous task execution scheme, where all tasks have their own timer, can be implemented with a low overhead. The delay for each timer was computed using the proposed algorithm.
This multi-task energy allocation scheme was implemented on two sensor nodes with two different energy-harvesting sources. Each node was equipped with a temperature/humidity sensor, a CO 2 sensor, and a noise sensor. The power consumption characteristics and minimal/maximal QoS settings for each sensor are described in Table 4. In this experiment, all priorities were set to the same value. It is clear that a higher priority leads to more task executions. Setting an equal value for all tasks priority avoids this effect and highlights the influence of QoS requirements on the energy allocation. Gas (CO 2 ) 0.172 1 3 The delay between two LoRa transmissions is heavily dependent on the use case and should be adapted depending on the application. In our system, it was set to vary between 15 min to 3 h. A minimal delay D min TX was required as LoRa transmissions operate in Industrial, Scientific, and Medical (ISM) bands, which are free to use but limit the transmission airtime of the device. Moreover, too frequent transmissions could drain the battery and make the system less stable. The maximum delay D max TX was set to enforce a minimum QoS. In our use case, D max TX was set to 3 h, as we considered it a reasonable minimum QoS for meteorological data, which tends to change slowly. These delays should be adapted to each application use case by the system designer.
The first sensor was powered by a 2 W solar panel, while the second sensor used a multi-source energy-harvesting board to combine two solar panels capable of up to 2 W and 3.5 W. Additionally, a voltage generator was used to emulate a TEG with an open voltage of 800 mV and a short-circuit maximum current of 4 mA. Taking into account the MPPT circuit and power converter efficiency, this simulated source delivers a continuous power of 0.64 mW, which is small enough to let the 7.5 F supercapacitor partially discharge. In addition to the previous measurements, the number of failed transmissions was also recorded. These measurements are shown in Figure 4.  The experiment was run for a total of 15 days. The emulated TEG was turned off during the second day in order to test the efficiency of multi-source energy harvesting with similar types of energy sources, i.e., two solar panels. The emulated TEG was turned on at the end of the fifth day.
This experiment first shows that such a system is functional with real-world platforms and use cases. The solution is implemented as an add-on and does not modify the existing hardware, while the energy management software only extends the firmware without modifying the existing tasks or the underlying OS. The measurements show that, as expected, the use of multiple energy-harvesting sources has a positive impact on the QoS of the node. In particular, Table 5 shows that the mean E B is significantly higher and that the mean D TX is lower when more energy-harvesting sources are used. Due to this, the node with multiple sources is able to transmit 672 packets, compared to 446 packets when the node is powered by a single energy source. In both cases, no transmission failed due to a low E R . These results show that multi-source energy harvesting is a valid way to increase the QoS of IoT nodes. Furthermore, the use of data aggregation enables the node to maximize the QoS by reducing the number of transmissions, thus saving power via radio sleep. It can be noticed that the type of energy sources used has a direct impact on the efficiency of the multi-source energy-harvesting system. From the second to the fifth days, the first node was powered by two solar panels, providing, respectively, 2 and 3.5 W while the second node was only powered by a 2 W solar panel. During this period, the multisource energy-harvesting node was only marginally more efficient than the single-source energy-harvesting node, with 141 transmitted packets against 133. Indeed, the 2 W solar panel is sufficient to completely recharge the energy storage and to maximize its QoS at the start of a new day. Thus, the additional solar panel only helps the node recharge its storage faster and additional energy is not required during the day.
On the contrary, when a TEG is used during day and night, its energy enables the node to significantly increase the QoS. In this case, the simulated TEG complements the solar panel, bringing energy when solar panels do not harvest energy. This shows that the use of a second similar source has little interest in some use cases while a complementary energy source would have a higher impact on the QoS of the node.
Additionally, the number of executions per time slot is counted for each task. Thus, the mean and total number of executions can be computed for each task. These results are presented in Table 6, while Figure 5 shows the distribution of the measurements over time.

Discussion
Overall, the use of multi-source energy-harvesting increases the number of executed sensing tasks by 62% and the number of transmitted messages by 51%. This shows that our energy allocation system works as expected and enables the multi-source energy-harvesting node to execute significantly more tasks than the single source one. These results confirm that the addition of a second solar panel has much less effect on the node QoS than the use of the emulated TEG. Indeed, the emulated TEG is complementary to the solar panels, as it provides power at night when the solar panels does not. This can be seen in the distribution of task execution, which is similar between the two nodes when the emulated TEG is powered off. When it is powered on, however, the multi-source energy-harvesting node has enough energy to maximize the QoS of each task and to reduce the delay D TX between transmissions while the other node still has to modulate the number of executions of each task to avoid depleting its battery. This demonstrates that the energy allocation works as expected: the multi-source energy-harvesting node executes significantly more tasks than the single-source one.
In some time slots, the number of executions of some tasks is higher than the specified maximum. This is due to the fact that each task manages its own timer. In some situations where multiple timers expire at a similar time, a task execution is already scheduled before its new number of executions is calculated. As the scheduler does not check if the task is already in the execution queue, it does not check this task execution, which can lead to an additional task execution. A bug also occurred around days 6 and 14, when the singlesource energy-harvesting node, respectively, executed 12 and 31 noise sensing tasks, far more than specified in Table 4. However, these bugs are linked to implementation and do not prevent proper application of the energy-allocation policy.
In this case, the use of additional energy sources enable the multi-source energyharvesting node to keep executing its tasks at their maximum QoS. Due to this, the number of task executions per time slot is much more stable, as seen with the lower standard deviation of this value in Table 6. Thus, the use of additional energy sources enables both a higher and more predictable QoS.

Conclusions
In this paper, a multi-task LoRaWAN IoT node with multi-source energy harvesting is presented and the associated power management system is detailed. We showed that an energy budget can be optimally allocated to multiple sensing tasks using simple calculations. This method was implemented and demonstrated on a real industrial hardware platform connected to a commercial LoRaWAN network. The presented system highlights how the power manager can be used to efficiently allocated an energy budget to heterogeneous tasks. Furthermore, the use of a multi-source energy-harvesting system enabled the same IoT node, in the same conditions, to execute 62% more sensing tasks and to transmit 51% more LoRaWAN messages. This demonstrates the interest in multi-source energy harvesting to increase the QoS of IoT nodes, especially when complementary energy sources are used. This also shows that current research results can easily be integrated into existing IoT nodes, which should help system designers reduce the reliance on single-use batteries in the future. This paper is significant as it associates the fields of energy harvesting and power management to present a whole system. Moreover, it bridges academic excellence and industry by applying state-of-the-art research results to an existing production-ready platform. Thus, it shows how existing platforms and products can be adapted to use energy harvesting with no costly architecture change. Funding: This work was funded by Wi6labs [46] and the French National Technology Research Association (ANRT) [47] in the context of the CIFRE PhD thesis. This work reuses parts of the produced manuscript.