Joint Management of Energy Harvesting, Storage, and Usage for Green Wireless Sensor Networks

Recently, energy harvesting has been emerging as a promising technique to prolong the lifetime for wireless sensor nodes. Most existing efforts address the design of energy harvesting and sensor node subsystem separately or ignore some real-world constraints. In this paper, we study how to codesign the two subsystems and how to jointly manage energy harvesting, storage, and usage. We first propose a novel system architecture for energy harvesting which employs several supercapacitors to eliminate the conflicts on charging and discharging among different system components. Then, we present a method to schedule their charging and discharging, which is proved to be able to guarantee zero waste of the harvested energy if the battery is not full. Third, we propose an optimal algorithm to minimize different components’ capacity and two heuristic algorithms to maximize the system reward. We conduct extensive experiments based on real-life data traces. Results show that the proposed system architecture can harvest more energy compared to the state of the art, and the capacity optimization algorithm can choose the most suitable size for each system component.


Introduction
In recent years, more and more wireless sensor nodes have been integrating into real-world applications such as habitat study [1], environment or ecology monitoring [2], and structural health monitoring [3]. Traditional batterypowered sensor nodes are notorious for their limited lifetime. It is usually very expensive or even infeasible to replace their batteries after deployment. Energy harvesting has been emerging as a promising technique for such long-term applications [4][5][6][7]. This technique refers to harvesting energy from ambient energy sources (including solar, wind, thermal, and vibration) and converting it to usable electrical power to feed sensor nodes. This paper studies an important open problem of how to codesign the energy harvesting and sensor node subsystems and how to jointly manage energy harvesting, storage, and usage among different system components.
Most existing works address the design of the two subsystems separately. They either manage the power consumption of nodes without considering the scale or operations of the harvesting subsystem (e.g., [8,9]) or confine themselves to devising different architectures or implementations for energy harvesting with a little consideration of the management of nodes' power usage (e.g., [10][11][12]). This will cause energy under-or overprovisioning for the system, which results in problems such as energy inefficiency and lower utilization of the harvested energy. Some works have studied joint design of the two subsystems but ignored some realworld constraints for either one [13,14]. For example, they ignore how fluctuations in energy harvesting impact the energy usage. This may cause system halts in real-world applications. In this paper, we present a holistic solution to solve these problems. We list our contributions as follows.
First, we propose a novel system architecture 3SC, which eliminates the charging-discharging conflicts among different system components. This paper considers photovoltaic (PV) solar energy harvesting. The converted electrical energy is buffered by energy storage components including supercapacitors and batteries. However, these storage components 2 International Journal of Distributed Sensor Networks cannot charge and discharge at the same time [15,16]. If they all start charging together, the sensor node subsystem will halt due to no available power supply. To solve this problem, 3SC employs three supercapacitors between solar panel and batteries/sensor nodes. They behave as chargers (or dischargers) at different time instances.
Second, we present a charging and discharging scheduling algorithm named CDSA. CDSA makes wise decisions on how to choose energy storage component for the harvested energy to flow to and when should charge or discharge the component. The algorithm is proved to be able to guarantee zero waste of the harvested energy if the battery is not full.
Third, the design of energy harvesting sensor nodes is a three-player game among energy harvesting, storage, and usage. Energy storage components with small capacity may be enough to power up sensor nodes for a location with abundant solar resource and vice versa. On the other hand, to adapt to short-term variations of the harvested energy, we can also adjust the power needs of sensor nodes by tuning tasks' execution. We propose several algorithms to address the problem of how to achieve a match among solar resource, components' capacity, and power needs. An optimal algorithm COA is designed to minimize each component's capacity. Two heuristic algorithms (L2U and U2L) are developed to optimize the system reward if tasks are of different importance. We conduct extensive experiments using reallife data traces and results show the effectiveness of our design.
The rest of paper is organized as follows. Section 2 introduces the related work. Section 3 describes the novel system architecture for energy harvesting sensor nodes. Section 4 proposes a charging and discharging scheduling algorithm based on the proposed architecture. Sections 5 and 6 present several algorithms for system components' capacity optimization and system reward maximization. Section 7 shows experimental results. Section 8 concludes the paper.

System Architectures and Charging/Discharging Scheduling Algorithms.
There have been a number of works on the design of energy harvesting system architectures and charging/discharging scheduling methods. The authors of [10] present a system named Prometheus that combines positive attributes of the supercapacitor in terms of charging/discharging cycles and the lithium batteries for their high energy density and low leakage. In addition, a charging/discharging scheduling driver for Prometheus is proposed to prolong its lifetime. In [11], an autonomous energy harvesting platform named AmbiMax with a battery and a reservoir capacitor array is proposed and a simple charging/discharging management is designed according to voltages of capacitors and batteries. In [12], a batterysupercapacitor hybrid accumulator architecture is proposed and a charging/discharging management algorithm based on finite state machine is designed to extend the lifetime of batteries. Reference [13] proposes a unified joint rate control and power management framework. Reference [14] proposes a hybrid energy storage system with one Li-Ion battery and two separate supercapacitors connected by a DC bus and then designs a budgeting heuristic algorithm to assign energy for executing tasks and charging battery. In [17], hypoenergy (hybrid supercapacitor-battery powersupply optimization for energy efficiency) is introduced, which aims at maximizing the battery's lifetime. Reference [18] proposes a photovoltaic-thermoelectric hybrid power system, in which the energy management is to improve the energy efficiency and reliability. Reference [19] designs a realtime task scheduling framework based on the energy harvesting system, which contains a solar panel and a supercapacitor. And there are some other researches, for example, [20][21][22][23][24]. But these previous works do not consider how to eliminate the conflicts on charging and discharging among different system components and how to avoid wasting harvested energy.

Minimizing System Components' Capacity and Maximizing the System Reward.
For minimizing components' capacity in energy harvesting systems, the related work is as follows. The authors of [17] design a heterogeneous supercapacitor bank and choose the supercapacitors' capacity so as to minimize the supercapacitor leakage. In [25], thev system designers sweep the components' capacity to determine the system architecture that meets their requirements. Reference [26] focuses on stand-alone PV-H 2 systems and develops a systematical method to select the sizes of the PV panel, the electrolyzer, H 2 tanks, the fuel cell, and the battery. Reference [27] presents that the size of the battery should be overrated with a factor to extend battery lifetime and analyzes the effect on the factor for the volume and mass of system components. In [28], in order to satisfy system requirements, the designer chooses the sizes of energy system components based on the Pareto curve that relates energy storage to energy generation.
Reference [29] focuses on the reward of the system with multiversion tasks, in which a task has multiple versions and each version corresponds to a reward value that shows the importance for systems. Then a heuristic algorithm is proposed to maximize the system reward under time and energy constraints. Reference [30] is the first work to maximize the system reward for energy harvesting systems with predictable energy sources. The authors design polynomial-time algorithms to solve this problem for systems with continuous service levels and prove that the polynomial-time algorithms are optimal. Then, in [31,32], the same authors extend these algorithms to the system with discrete service levels and more application scenarios. Reference [33] is based on decomposable and combinable tasks. The reward optimization problem is modeled as the bounded Knapsack problem, which is solved using dynamic programming. However, the system models of previous works are not the same as ours; therefore the related work about minimizing components' capacity and maximizing system reward cannot be used without modification in this paper.

System Architecture
In this paper, we adopt the harvest-store-use architecture, which is the most popular architecture for sensor nodes [5].
We choose the solar energy as our energy harvesting source. Rechargeable batteries and supercapacitors are two choices for energy storage. Rechargeable batteries have a higher energy density than supercapacitors, while supercapacitors have a higher power density and more charging/discharging cycles than batteries. Recent research works have illustrated that the battery-supercapacitor hybrid energy system is the best choice for energy harvesting sensor nodes. So we adopt this battery-supercapacitor hybrid architecture in our system. However, existing battery-supercapacitor hybrid architectures (e.g., [12,14]) cannot eliminate the charging-discharging conflicts among different system components, which will cause the intermittency of power supply. To address this problem, we design a battery-supercapacitor hybrid system architecture, which we name 3SC (shown in Figure 1). 3SC is composed of one rechargeable battery, one solar panel, one sensor node subsystem, and three supercapacitors. Supercapacitors store electrical energy generated by the solar panel and transmit electrical energy to the sensor node or the battery. Each supercapacitor can play multiple roles: (1) receiving energy from the solar panel, (2) charging the battery, and (3) powering the sensor node subsystem. But a supercapacitor cannot play more than one role at the same time. The roles of several supercapacitors can switch with each other. If the energy stored in supercapacitors is not enough to power the sensor node subsystem, the battery will supply energy to power it. We can see that supercapacitors are related to all of other system components. Moreover, (1), (2), and (3) may occur simultaneously. But supercapacitors cannot charge and discharge at the same time. So the number of supercapacitors must be at least 3. In the case of existence of only two supercapacitors, only two of three roles can be supported at the same time, and the remaining one must wait. Then the following situations may occur.
(i) Although the solar panel generates electrical energy and energy storage components are not full, the system cannot harvest energy, since two supercapacitors are assigned to the sensor node subsystem and the battery, respectively.
(ii) In order to harvest solar energy uninterruptedly, one supercapacitor must be used to receive energy generated by the solar panel and another supercapacitor charges the battery or powers the sensor node subsystem. But the charging time will affect the sensor node subsystem performance. In this case, how to satisfy the performance constraint of the sensor node system is an unsolved problem.
Three supercapacitors with an advanced charging/ discharging scheduling algorithm can eliminate the conflicts on charging and discharging between energy components, since the three supercapacitors can be seen as an energy buffer with three bidirectional interfaces, which can make (1), (2), and (3) execute in parallel. We propose the system architecture as shown in Figure 1, where DC-DC converters serve the purpose of voltage conversions between components. Each supercapacitor is connected to the solar panel, the battery, and the sensor node subsystem by converters. The charging/discharging scheduling algorithm is described in the next section.
Comparing with the architecture containing two supercapacitors [12], our system architecture adds extra cost, but it is small. The price of the supercapacitor with capacitances on the order of tens of farads is about several dollars. (The suggestion about selecting supercapacitors is shown in Section 5.) For example, the 10 , 30 , 50 , and 70 supercapacitors produced by Panasonic Corporation are $2, $4, $4, and $6, respectively. And the price of the converter controller TPS4000 is $5. In the DC-DC converter, all other components' price is less than $1. So the extra cost of our architecture is less than $15.

Charging/Discharging Scheduling
The key notations used in this paper are summarized in Notations section.
Our proposed charging/discharging scheduling algorithm (shown in Algorithm 1) manages energy conversions according to the stored electrical energy in system components. We assume that all of the energy storage components are ideal. SP, SC , BA, and SN denote the solar panel, the th supercapacitor, the battery, and the sensor node subsystem, respectively. SC is the stored energy in the supercapacitor SC . We use SP to present the supercapacitor that is being charged by the solar panel SP. Similarly, BA is the supercapacitor that charges the battery BA and SN is the supercapacitor or the battery that supplies energy to the sensor node subsystem SN. The threshold energy th is the minimum energy to power a sensor node. , , and are variables. SC , SC , and SC denote supercapacitors. We use Require: SC , SP , BA and SN Ensure: Algorithm 1: Charging/discharging scheduling algorithm. different variables to distinguish different supercapacitors. The algorithm is driven by three events. The first event is between lines (1) and (7). If there is no energy in the supercapacitor that is powering the sensor node subsystem (line (1)), then the energy source of the sensor node subsystem is assigned as the supercapacitor that can power the sensor node subsystem and stores the maximum energy (line (2)). At the same time, the supercapacitor with the minimum energy is charged by the solar panel (line (3)). In this case, if no supercapacitor can start the sensor node subsystem (line (4)), the battery supplies energy to the sensor node subsystem (line (5)). Otherwise, the energy that is stored in the idle supercapacitor (neither the supercapacitor powering the sensor node subsystem nor the supercapacitor charged by the solar panel) is charged to the battery if it exists (lines (6) and (7)). If the battery is full, the redundant energy is discarded.
The second event is between lines (8) and (10). When the amount of one supercapacitor's energy is enough to power the sensor node subsystem (line (8)), the energy source is changed from the battery to the supercapacitor (line (9)) and the supercapacitor with the minimum energy is charged by the solar panel (line (10)). The premise of this event is that the battery is the energy source of the sensor node subsystem; that is, the energy stored in any supercapacitor is less than th . Then one supercapacitor is charged by the solar panel, until its energy is higher than th and the second event occurs. The energy stored in the other two supercapacitors is also less than th . So they cannot charge the battery; that is, no supercapacitor is assigned to the battery in this event.
The third event is between lines (11) and (15). When the supercapacitor is charged fully by the solar panel, the third event occurs (line (11)). This supercapacitor is assigned as the energy source (line (12)). Similarly, the supercapacitor with the minimum energy is charged (line (13)), and the energy stored in the idle supercapacitor is charged to the battery (lines (15)).
To sum up, the design for CDSA is based on the following considerations.
(i) To reduce the frequency of running CDSA, the supercapacitor with the maximum energy is chosen as the power source of the sensor node subsystem SN (line (2)) and the supercapacitor with the minimum energy is charged by the solar panel SP (lines (3), (10) and (13)).
(ii) To reserve enough capacity to store the energy generated by the solar panel, the energy in the idle supercapacitor is converted to the battery BA (lines between (6) and (7) and between (14) and (15)).
We show the following example to explain our algorithm CDSA.
(1) We assume that the battery is half full and the three supercapacitors are empty. In this case, SN = BA and SP = SC 1 . (2) When SC 1 ≥ th , the second event occurs. Then SN = SC 1 and SP = SC 2 .
(3) The supercapacitor SC 1 supplies energy to the sensor node subsystem until it becomes empty. Then the first event occurs, and SN = SC 2 and SP = SC 1 .
(4) If sunlight is sufficient, SC 1 is charged fully before the energy of SC 2 becomes less than th . In this case, the third event occurs. Then SN = SC 1 , SP = SC 3 , and We assume that 10 percent of the battery's energy is reserved to deal with the unpredictable solar radiation, supply energy to CDSA, and handle some other unexpected events.
So the energy leakage of supercapacitors and the energy used by CDSA are ignored in the following sections of the paper.
In our system, the output power of the solar panel with the area (cm 2 ) is SP = ⋅ cm , where cm (mW/cm 2 ) is the power density. max cm is the maximum cm . The voltage of the battery is represented by V BA and the cut-off voltage V min BA is the voltage at which the battery is considered to be fully discharged. To extend the lifetime of the battery, our system uses the constant current (0 < < 1) to charge the battery, even if this method will lose a part of the capacity of the battery (20%-30%) [12]. So the battery with 80% capacity is defined as full battery. denotes the charging and discharging rate (see [34]), and is its coefficient. Based on the above statements, we prove the effectiveness of CDSA as follows.
Property 1. The energy storage components can harvest all output power of the solar panel if the battery is not full and Proof. To prove Property 1, the following two parts must be proved.
(1) If inequality (1) can be satisfied, then the energy conversion channel from the solar panel to the battery (or to the sensor node subsystem) will not be blocked.
(2) Our algorithm CDSA can guarantee that at any time there is at least one nonfull supercapacitor that can be charged by the solar panel.
For part (1), we use out and in to denote the output and input power of the supercapacitor, respectively. If out ≥ in , the energy conversion channel will not be blocked. The power density of the supercapacitor is quite high, so the output power and input power of the supercapacitor are determined by the input power of the battery (or the sensor node subsystem) and the output power of the solar panel, respectively. The sensor node subsystem is also powered by the battery; thus its input power is not higher than that of the battery. Therefore, if the battery is not full, the output power of the supercapacitor is equal to the input power of the battery. Thus, Therefore, if then out ≥ in . For part (2), we assume by contradiction that all supercapacitors are full and the last charged supercapacitor is charged fully in the time interval between 1 and 2 . Thus, at the time Property 2. If the energy storage components are not empty, the sensor node subsystem can be powered uninterruptedly.
Proof. As shown in Algorithm 1, in all of three events, a nonempty supercapacitor (lines (2), (9), and (12)) or the battery (line (5)) is assigned to the sensor node subsystem as its power source.

Capacity Optimization for System Components
The capacity selection is a major factor affecting the system performance. If the capacity is too small, there is not enough energy to drive the sensor node subsystem. If the capacity is very large, although there is enough energy to drive it, the remaining resource cannot be used effectively and the system cost is wasted. Therefore, in this section, we optimize the capacity of each system component according to system power needs and the historic values of the solar radiation.
Recall that we reserve 10 percent of the battery's energy to deal with the unpredictable solar irradiation. This is also because the value of the solar radiation is different for different years. The power required by the sensor node depends on the tasks running on it. So we will first introduce our system model in the following subsection.
( ) represents the upper (lower) bound of . Each task must be complete within its period; that is, the relative deadline is equal to the period . The power required by a sensor node subsystem is represented as There are batteries that can be selected. The selectable battery set is denoted by = { 1 , . . . , }. Each battery ( ∈ [1, ]) is characterized by = ⟨ , V min , ⟩, where , V min , and denote the charging and discharging rate, the cut-off voltage, and maximum available energy (excl. the reserved energy and unchargeable capacity), respectively. We use ( ∈ [1, ]) to denote the selected battery. The cut-off voltage is highly dependent on the type of the battery instead of the capacity, and the charging and discharging rate is proportional to . So we choose as the optimized capacity of batteries. For the solar panel, the optimized capacity is the area , which is less than or equal to the maximum acceptable area .
In our proposed system, the supercapacitor is designed as the energy buffer. The supercapacitor's capacity cannot affect energy harvesting (Property 1). Therefore, we do not optimize it in this paper. But the capacity of the supercapacitor cannot be too large or too small, since the supercapacitor with small capacity will lead to invoke CDSA frequently. While the large supercapacitor is not the best alternative, since the larger the supercapacitor, the higher the leakage power, we suggest selecting supercapacitors with capacitances on the order of several to tens of farads.
We process the solar energy on a daily basis. This is because the daily cycle of sunlight leads to the charging/discharging cycle of the energy storage system. Moreover, this method can balance the complexity and efficiency of our algorithm. We use ℎ to represent the number of days of the historic values and to denote the generated energy per unit area of the solar panel at the th day.

Problem Formulation.
Given the task set , the battery set , and the historic values of ℎ days, our objective is to find and such that where SP and BA are the given weight coefficients.
The capacity optimization should respect the following constraints.
(i) Area Constraint. The area cannot exceed the maximum acceptable area : (ii) Power Conversion Constraint. According to Property 1, inequality (1) should be satisfied, which is rewritten as follows: where is a constant between 0 and 1.
(iii) Energy Constraint. At any time, the available energy in energy storage components cannot be less than zero: where day is the number of seconds in a day and is the lower bound of available energy in the battery at the end of the th day, which is shown in Lemma 1. The proof of inequality (8) is shown in Theorem 2.

Lemma 1. The lower bound of available energy at the end of the th day is
Proof. Earlier in the paper, we described the supercapacitor (several to tens of farads), whose capacity is far less than the capacity of the battery. So we ignore it.
If the capacity of the battery is unlimited, then = −1 + ⋅ − day ⋅ . But the capacity of the battery is up to . It limits the peak of the stored energy. When the battery is full, the incoming harvested energy cannot be stored anymore and the superfluous energy has to be discarded if the energy required by the sensor node subsystem has been met. Therefore, although the generated energy ⋅ has been known, not all of them can be stored in the battery or used by the sensor node subsystem.
If the battery is full and the power supplied by the solar panel is the maximum, then the discarded energy is the maximum and the harvested energy is the minimum. So the lower bound of available energy occurs in the situation where is harvested within the shortest time . At time , if we do not consider the capacity limit of the battery, the stored energy is −1 + ⋅ − ⋅ , where ⋅ denotes the consumed energy by tasks. But due to the capacity limit of the battery the available energy is min{ −1 + ⋅ − ⋅ , }. From the time to the end of the th day, there is no harvested energy and the energy ( day − ) ⋅ is supplied to tasks. Therefore, the lower bound holds.

Theorem 2. In ℎ days, the lower bound of available energy is
Proof. We assume that = arg(min ∀ ∈[1,ℎ] { }) and the minimum available energy appears at the time of the th day; then ≤ . Since +1 ≥ 0, at the time , the available energy But it is impossible to see the value of − day ⋅ in this system. If it appears, then there must be that = and +1 = 0. Thus +1 < . It contradicts the assumption. To guarantee the assumption for , at least the time day ⋅ ⋅ max cm (13) is used to recover the available energy; then Therefore, the lower bound of is

An Optimal
Algorithm. Now we present our capacity optimization algorithm COA (shown in Algorithm 2), which finds the area and the battery to minimize the objective equation (5). For each ∈ (line (2)), an area is searched to minimize the objective . The while loop (lines between (4) and (9)) for searching is a binary search which reduces the search space by half in each iteration. At line (3), the upper bound right of the binary search is calculated according to inequalities (6) and (7). Then, lines between (6) and (9) determine to get rid off which half of the current interval [left, right]. Until the interval [left, right] cannot be compressed, the binary search finishes. Lines between (10) and (15) show that the bound satisfied inequality (8) is the result of the binary search. Then, at lines between (16) and (17), the battery with the minimum and its corresponding is selected as the optimized capacity of the battery and solar panel, respectively.
The number of iterations of while loop at line (4) is (log ) due to the binary search, where The complexity of the verification of inequality (8) is (ℎ).
The number of iterations of for loop at line (2) is ( ). Therefore, the complexity of Algorithm 2 is ( ℎ log ). Proof. For each battery, the binary search can find the optimal area of the solar panel to minimize the objective, since a linear relationship exists between the area and our objective equation (5). Then COA finds the battery with the minimum objective among the set . The finding process traverses all of elements in , so it is optimal. Therefore COA is optimal.

System Reward Maximization
Each task has a reward which is a measure of task's importance. The task with a higher reward is considered more important and should be executed frequently. The task's importance is based on not only the system resource, but also the user requirements. So the task reward is assigned by the user. In this section, based on the system model shown in Section 5.1, we maximize the system reward according to the given system components' capacity.

Problem Formulation.
Given the task set , the historic values, and system components' capacity which satisfy inequalities (6) and (7), our objective is to assign the period for each task such that The system reward maximization should respect the following constraints.
(i) Microprocessor Utilization Constraint. The utilization of the microprocessor in the sensor node is not more than the utilization bound for EDF scheduling:  (8) and (18) then (10) ++; (11) if == then (12) ← − { }; (13) if == Φ then (14) break; (15) until { 1 , . . . , } satisfies Inequality (8)  Our system can supply energy to the sensor node subsystem uninterruptedly (Property 2). Based on this situation, the sensor node subsystem can be seen as a uniprocessor system. So any task scheduling for uniprocessor systems can be used in our system. The utilization constraint assumes that preemptive EDF scheduling is used. A different utilization formula can be used with different scheduling algorithms, such as RM and DM.
(ii) Energy Constraint. In order to stably supply power to system tasks, at any time, the available energy in energy storage components is not less than zero. The formulation of this constraint is the same as inequality (8).
(iii) Period Constraint. The assigned period cannot exceed the lower and upper bound of the period: 6.2. Efficient Heuristic Algorithms. The harvesting energy and the computational resource limit the system reward. So to maximize the system reward the frequently executed task should have a large optimized objective / , a small power requirement / , and a small utilization / , that is, using lower cost to obtain higher reward. Therefore, for each task , we define the following metric: The task with the larger metric should be executed more frequently and vice versa. Based on the metric , we propose two heuristic algorithms (L2U and U2L) to maximize the system reward.

Stretch (from the Lower Bound to the Upper Bound).
For the first heuristic algorithm L2U (shown in Algorithm 3), we begin with assigning all periods to the lower bound (line (4)). If they can satisfy inequalities (18) and (8) (lines between (5) and (6)), the initial assignment will be the solution.
Otherwise, we need to stretch the period of the task with the minimum (lines between (7) and (18)) in the set , which contains the tasks with the stretchable period. If the period is stretched to its upper bound , it will be removed from the set , to prevent the period from exceeding its upper bound (lines between (11) and (12)). For the task , if the set { 1 , . . . , , . . . , } cannot satisfy inequalities (18) and (8) and the set { 1 , . . . + 1, . . . , } can satisfy the inequalities, then we call the task as the critical task. Ω is used to denote the critical task set. During the process of stretching, once the task is removed from the set to the set Ω, its period cannot be increased until there are no tasks in the set . Otherwise, tasks in the set can no longer be optimized. Then when the period of the critical task with the minimum is increased 1 (lines between (19) and (20)), according to the definition of critical task, the current periods can satisfy all inequalities of this problem. Even if the set Ω is an empty set, Algorithm 3 can also obtain a solution. Since lines between (16) and (18) are not executed, then all periods are assigned to the upper bound . In this situation, lines between (1) and (3) have excluded the possibility that all upper bounds cannot satisfy inequality constraints. So the set { 1 , . . . , } is the solution, when the set Ω is empty.
The number of iterations of repeat until loop is ( ), where = ∑ =1 ( − ). In the worst case, the complexity of line (9) and line (15) is ( ) and (ℎ), respectively. In each iteration of while, at least one task is removed from the set , so the complexity of while loop is ( ). Therefore, the complexity of Algorithm 3 is ( ⋅ ⋅ (ℎ + )).

Compression (from the Upper Bound to the Lower Bound).
Instead of assigning all periods to the lower bound at the beginning, following an opposite direction, the second heuristic algorithm begins with assigning the upper bound (line (4)). If they cannot satisfy inequalities (8) and (18), the input parameters are not feasible (lines between (4) and (6)). Otherwise, we need to compress the period of the task with the maximum , until they cannot satisfy inequalities (8) and (18) (lines between (8) and (13)). The last that satisfied the inequalities is assigned to the task (line (14)), and is removed from the set (line (15)), which contains the tasks with the compressible period. Although the period of the task with the maximum cannot be compressed again, the other tasks in the set may be able to be compressed. So the ending condition of Algorithm 4 is that the set is empty (line (7)).
The steps in Algorithm 4 are similar to those in Algorithm 3. Therefore, the complexity of Algorithm 4 is the same as Algorithm 3.

Experimental Results
We proposed a battery-supercapacitor hybrid architecture and several algorithms to jointly manage the energy harvesting, storage, and usage. In this section, we compare our architecture 3SC and charging/discharging scheduling algorithm CDSA with the state-of-the-art research [14] and discuss the results of the capacity optimization algorithm COA and the system reward maximization algorithms (L2U and U2L) based on the historical data of solar radiation of 365 days, from July 1, 2012, to June 30, 2013, provided by the Measurement and Instrumentation Date Center (MIDC) of National Renewable Energy Laboratory (NREL).

Capacity Optimization.
We evaluate our proposed capacity optimization algorithm COA based on the historical data over the past year (i.e., ℎ = 365), which is shown in Figure 3(a). From the harvesting energy profile, we can see that there is a great difference between the harvested energies in different seasons. In summer, the harvested energy is larger than the task requirement. The excess energy is stored in the battery and the execution of tasks is independent of the stored energy. But, in winter, if the harvested energy is less than the task requirement, the stored energy must be supplied to power tasks. Moreover, if there is no energy in the battery, to guarantee the task requirement, the area of the solar panel should be enlarged to harvest more energy. Therefore, the initial energy of the battery and the season, in which the sensor node starts running, will impact system components' capacity optimization.
There are 12 batteries as shown in Table 1. We set SP = 1 and BA = 100, since the area and the rate differ by two orders of magnitude.
represents that the starting season is winter and the initial energy is equal to ⋅ . Similarly, denotes that the starting season is summer. Figure 2 shows the optimized capacities of system components under different task requirements. From the figure, we can see the following.
(ii) When > 0.23, the result is nearly the same as . The reason is that the initial energy is enough to compensate for the lacking of the solar energy in winter. Therefore, if the initial energy of the battery is large enough, the starting season almost has no impact on components' capacity selection.
(iii) When the starting season is summer, no matter what the initial energy is, the results of COA are the same (shown as ). The system components, which can guarantee tasks' execution in winter, will harvest more energy than tasks required in summer. The remaining energy is stored in the battery. So in summer the battery is charged fully, no matter what the initial energy stored in the battery is.
We developed a simulator in C++ to trace the changes of the energy stored in the battery. Figure 3 shows the comparison of the stored energy profile under different capacities of system components. First, in Figure 3(b), { = 8, = 41} is the COA's optimized result. Recall that 10% of energy is reserved (see Section 5) and 20% of the capacity of the battery is lost (see Section 4). So the range of -axis is 10% to 80%. Then, in Figure 3(c), we set the area to 39 without changing other parameters, and, in Figure 3(d), the battery 7 is chosen instead of 8 . From the comparison, we can see that slightly decreasing system components' capacity leads to  energy shortage in some days. Therefore, the lower bound of available energy (Theorem 2) is fairly tight in practice.

Architecture Comparison.
We compare our architecture 3SC to the state-of-the-art research HY [14], which focuses on real-world applications. In this experiment, we adopt the algorithm COA's optimized result { = 12, = 110} and assume that the two supercapacitors of the architecture HY are big enough. Figure 4 shows the ratio of the harvested energy of HY to that of our architecture 3SC over one year.
is the charging current. Note that as long as inequality (1) is satisfied (i.e., when = 12 and = 110, is greater than or equal to 0.19), the harvested energy of our architecture is independent of . From Figure 4, we can see that the less the charging current, the less the harvested energy of the architecture HY. The reason is that when two supercapacitors are assigned to the embedded system and the battery, the architecture HY cannot harvest energy until the energy in one of the two supercapacitors is charged to the battery. So the charging time will impact the energy harvesting. The charging current determines the charging time and further impacts the energy harvesting of the architecture HY. This comparison proves that the charging-discharging conflict reduces the harvested energy and our conflict-free architecture can harvest more energy.

System Reward Maximization.
In this subsection, the ILOG CPLEX solver is exploited to obtain the optimal solution from the MIQCP formulation ((17), (18), and (8)) compared to which we evaluate the performance of the proposed system reward maximization algorithms (L2U and U2L). In addition, we implement two variant algorithms: G-L2U and G-U2L. They assign periods according to the reward instead of the metric equality (20). In order to make it solvable by the ILOG CPLEX, the parameters are set as follows. We uniformly sample sixteen s from the data over the past year. According to the optimal solution obtained from the algorithm COA, we set = 20, = 6, and = 24. The task set is generated randomly, where ∈ [1, 100], ∈ [10,2000] (ms), = 1(s), and = 20 (s). The power of each task is generated according to the Uunifast algorithm [35] such that we can create the solvable task set. The power of each task multiplied by is equal to , and the execution time is monotonically nondecreasing with increasing . Figure 5 shows the normalized system rewards of CPLEX and the four algorithms for different number of tasks. Each measurement point is the average value of 200 task sets. The results of U2L and L2U are at least 93% and 85% of the optimal results, respectively. From Figure 5, we observe the following.
(i) G-U2L and G-L2U have a lower system reward, since they do not take and into consideration; that is, they ignore the trade-off between the task schedulability and the system reward.
(ii) When the number of tasks is small, the system reward of U2L is higher than that of L2U. It is because U2L aims at decreasing the period of the task with high reward and this objective is the same as the objective of system reward maximization. However, L2U stretches the period from the lower bound to upper bound. The system reward is inversely proportional to periods. So increasing small periods will bring more impact on the system reward than decreasing large periods; that is, L2U skips more solutions. Therefore, when the number of task is less than 6, U2L is more effective and stable than L2U. When the number of tasks is greater than 5, the solution space of the large task set contains more solutions. So L2U can also find a nearly optimal solution.

Conclusion
In this paper, we study the joint management of energy harvesting, storage, and usage for green wireless sensor networks. First, we propose a novel system architecture to eliminate the conflicts on charging and discharging between energy components. Based on the system architecture, a charging/discharging scheduling algorithm is designed to effectively harvest, store, and use the solar energy. Then we prove the lower bound of available solar energy. Based on the lower bound, one system components' capacity optimization algorithm, which is proved to be able to find the optimal result, and two system reward maximization algorithms are proposed. We evaluate our architecture and algorithms based on real-life data traces. For our architecture and the charging/discharging scheduling algorithm, the comparison experiment proves that the conflict-free architecture can harvest more energy than the architecture HY. For the capacity optimization algorithm, experimental results show the impacts of realistic data traces and the initial energy on the capacity optimization. In addition, the result of the simulation for the battery's energy shows that the lower bound of available solar energy is fairly tight in practice. For the system reward maximization algorithms, their results are nearly optimal.

Notations
, , , , : Variables , , : Intermediate variables SP: Solar panel SC , SC i : The th supercapacitor and energy stored in SC BA: Battery SN: Sensor node subsystem SP : The supercapacitor that is charged by the solar panel BA : The supercapacitor that charges the battery SN : The supercapacitor or the battery that supplies energy to the sensor node subsystem th : The minimum energy to start a sensor node subsystem : Th ea r e ao ft h es o l a rp a n e l cm : The power density (mW/cm 2 ) of the solar panel max cm : Themaximum cm SP : Th eo u t p u tpo w ero fth eso la rpa n e l V BA : The voltage of the battery V min BA : Thecut-offvoltage : The battery charging and discharging rate : Th ec o e ffi c i e n to ft h er a t e , 0 < < 1 : The number of tasks in a task set , : Thetasksetandthe th task ( ∈ [1, ]) : The worst-case execution time of the task : Th ee n e r g yr e q u i r e db yt h et a s k : The reward of the task : The period of the task , : The upper and lower bound of the period : The power required by a sensor node subsystem : Th en u m b e ro fs e l e c t a b l eb a t t e r i e s , : The set of selectable batteries and the th battery ( ∈ [1, ]) : The charging/discharging rate of the battery V min : The cut-off voltage of the battery : The maximum available energy of the battery : Th e th battery chosen to use in the energy harvesting subsystem, ∈ [1, ] : The generated energy per unit area of the solar panel at the th day ℎ: The number of days of the historic values SP , BA : The given weight coefficient of the solar panel and the battery, respectively : The maximum acceptable area of the solar panel day : Thenumberofsecondsinaday : The lower bound of available energy in the battery at the end of the th day : The available energy at the time : The task's metric used to optimize the system reward Ω: Thecriticaltaskset Win: The starting season is winter and the initial energy is equal to Win ⋅ Sum: The starting season is summer.