energy-neutral networked wireless sensors

30
Energy-Neutral Networked Wireless Sensors Soledad Escolar Computer Science Department. University Carlos III of Madrid. Madrid, Spain. Stefano Chessa Computer Science Department. University of Pisa. ISTI-CNR, Pisa, Italy. Jes´ us Carretero Computer Science Department. University Carlos III of Madrid. Madrid, Spain. Abstract Solar cells combined with power management algorithms enable the dynamic scheduling of Wireless Sensor Networks applications in a reference period, where the objective of the scheduling is to maximize the application quality level while conserving an energy level sufficient to constantly maintain the sensor operation. With the purpose of fulfillment of its activities the sensor may have alternative different applications with different costs and quality levels, which are intended to express how much the application meets the user requirements. In this paper we propose an algorithm that aims to find a (sub)optimal scheduling that maximizes the overall quality of service for two networked, solar cells powered sensors, and keeps the system energy neutral, thus ensuring that the system works uninterruptedly. Keywords: Power Management, Wireless Sensor Networks, Quality of Service, Solar cells, Adaptive duty cycling 1. Introduction A Wireless Sensor Network (WSN) comprises a large number of low- power wireless embedded devices, called sensors, which can be easily de- ployed in a given area, in order to collect environmental data and detect the Correspondence author. Tel.: +34-916249143. Email addresses: [email protected] (Soledad Escolar), [email protected] (Stefano Chessa), [email protected] (Jes´ us Carretero) Preprint submitted to Simulation Modelling Practice and Theory November 6, 2013

Upload: independent

Post on 05-Nov-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

Energy-Neutral Networked Wireless Sensors

Soledad Escolar∗

Computer Science Department. University Carlos III of Madrid. Madrid, Spain.

Stefano Chessa

Computer Science Department. University of Pisa. ISTI-CNR, Pisa, Italy.

Jesus Carretero

Computer Science Department. University Carlos III of Madrid. Madrid, Spain.

Abstract

Solar cells combined with power management algorithms enable the dynamicscheduling of Wireless Sensor Networks applications in a reference period,where the objective of the scheduling is to maximize the application qualitylevel while conserving an energy level sufficient to constantly maintain thesensor operation. With the purpose of fulfillment of its activities the sensormay have alternative different applications with different costs and qualitylevels, which are intended to express how much the application meets theuser requirements. In this paper we propose an algorithm that aims to finda (sub)optimal scheduling that maximizes the overall quality of service fortwo networked, solar cells powered sensors, and keeps the system energyneutral, thus ensuring that the system works uninterruptedly.

Keywords: Power Management, Wireless Sensor Networks, Quality ofService, Solar cells, Adaptive duty cycling

1. Introduction

A Wireless Sensor Network (WSN) comprises a large number of low-power wireless embedded devices, called sensors, which can be easily de-ployed in a given area, in order to collect environmental data and detect the

∗Correspondence author. Tel.: +34-916249143.Email addresses: [email protected] (Soledad Escolar),

[email protected] (Stefano Chessa), [email protected] (Jesus Carretero)

Preprint submitted to Simulation Modelling Practice and Theory November 6, 2013

occurrence of events of interest. Once an event is detected, the sensors sendany related sensed data to a special node, called sink, that acts as a gatewaybetween the WSN and external networks and that forwards the sensed datato the user.

Most of the commercial sensors available nowadays are powered by limited-capacity batteries that provide the energy required to sustain the operationof the sensor by feeding its circuitry. Consequently, the sensor lifetime isalso limited: when the battery drops below a minimum charge level, thesensor stops working. There is great emphasis on the efficient use of energyto prolong battery life [3, 17, 9]. Such a limitation may be addressed bymeans of energy harvesting systems that use the energy obtained naturallyfrom the environment to power on the sensors. However, since the energyproduction of the energy harvesting systems is generally not continuous, asit depends on the conditions of the environment, the sensors generally use abattery that is recharged when there is an excess of energy production (i.e.it is produced more energy than required) by the energy harvesting system,and that guarantees the operation of the sensors when there is insufficientproduction of energy. In other words, the battery acts as a limited-capacitybuffer of the energy. In such a system, an efficient energy management isnecessary in order to guarantee an infinite sensor’s lifetime while maintainingthe activities of the sensors.

In this work we model the sensors activities as tasks; for example, a taskmay define sensing, processing, and communication activities with a givenrate. Each task is associated to a cost (defined in terms of energy requiredby the task per unit of time) and to a Quality of Service (QoS) level, whichexpresses how much the task meets the user needs/requirements. We alsomodel the energy production from a solar cell, which can be used to esti-mate the maximum amount of energy that the sensor could waste. Basedon these models, we devise a scheduling strategy that consists in findingan assignment of execution tasks along a time frame, for instance one day,such that maximizes the QoS while keeping the sensor energy neutral, whichmeans that within the time frame the energy production equals the energyconsumption. Specifically, we address the problem considering a scenariothat comprises two networked devices, one sensor and one sink, where bothemploy an energy harvesting system based on solar cells. Both the sensorand the sink perform a set of tasks that also include the communicationsamong themselves. For this scenario we propose a low-complexity algorithmaimed at finding a (sub)optimal application scheduling that concerns boththe sensor and the sink, such that the overall quality of the scheduling ismaximized, the energy is preserved to guarantee the execution of applica-

2

tions even in conditions of darkness or low production, and the tasks selectedat each time for the sensor and for the sink are compatible (i.e. they canwork together). The optimization process is automatic and does not requirehuman intervention.

In this paper we formulate the optimization problem for two networkedsensors and present its evaluation. We have evaluated our approach bysimulation and not by experimentation; note, however, that in order toconstruct more realistic models, both the energy consumption model froma sensor and the energy production model from a solar cell, are based onthe parameters of real-world platforms: MicaZ and MSX-005F, respectively.Additionally, we discuss a generalization of the problem, which takes anynumber of sensors and a sink. It is important to point out that, even thescenario that we are addressing in this paper is limited to two nodes, to thebest of our knowledge this is the first work that considers the optimizationof the overall QoS of two networked sensors under the constraints of energy-neutrality and compatibility.

The remainder of this paper is organized as follows. After reviewing therelated work in Section 2, we present in Section 3 our solar cell-based energyharvesting system, its energy production model and the energy consumptionmodel of WSN applications. Section 4 describes our approach to schedulethe applications to be executed on networked, solar cells powered wirelesssensors, with the aim of optimizing their QoS. Section 5 provides the simu-lation results and Section 6 presents the generalization of the model for anynumber of sensors. Finally, Section 7 discusses the conclusions and furtherresearch.

2. Related Work

Quality of Service (QoS) has been explicitly addressed under differentperspectives in WSN. One of the most common approaches consists in look-ing for QoS at different layers of the network architecture, mainly MACand routing layers. At MAC layer, several protocols [21] were proposed toimprove the QoS based on service differentiation according to some static ordynamic criteria. At routing layer, QoS consists in finding the best path be-tween a source and a destination node according to another metric, such aslatency, bandwidth, packet loss, or fault tolerance. Some examples of theseprotocols are SAR [19], SPEED [11] and its evolution MMSPEED [10]. [20]discusses QoS at routing layer attending to the congestion control. QoS hasbeen extensively studied at the scope of the application level, in such a waythat the user is who may define application-specific performance metrics

3

such as coverage, exposure, deployment, or reliability. In [13], for example,the optimum number of sensors that should send data is considered a QoSmetric.

The sampling rate used by the application is another QoS metric withimpact on the energy consumption of the sensor. Additionally, samplingcould be provided simultaneously by different transducers able to monitorthe same event but with different accuracy level and, in turn, different en-ergy consumption. In this sense, several techniques focus on selecting themost appropriate transducer as well as its sampling rate according to theresidual energy in order to balance sampling and energy [13, 1]. Adaptivesampling techniques adjust the sampling rate of a sensor based on the spa-tial/temporal correlation of the data [1] to save energy. These techniquesare often used in the sensors equipped with some energy harvesting systemand able to estimate the energy that will be produced in a future time frame.For example, among the forms of energy harvested from the environment,it is known that the energy produced from the sun may be predicted withreasonable accuracy [2]. In [14] the authors present a theoretical model forplanning and modeling micro-solar power systems. The model is validatedby simulation and real experimentation, predicting with a minimal error thesolar profile in different environments.

Several works combine adaptive sampling techniques and solar cells [18].An example is [15], where the authors define the concept of energy neutrality,which states that the energy consumed by the sensor in a period of time isalways less or equal to the energy harvested from the environment in thesame period. Based on this, they propose an algorithm that divides thesensor lifetime in time slots, and that assigns to each slot the maximumsampling rate that keeps the system energy neutral. Although the authorsdo not mention explicitly QoS, we observe that increasing the sampling ratecorresponds to rising the QoS of the application running on the sensor.

We have addressed the problem of QoS optimization while keeping theenergy neutral condition in two previous works. Firstly, in [7], we propose analgorithm aimed at optimizing the QoS only attending to the duty cycle. Weconsider the re-optimization problem in [8], which considers an over/underproduction of energy with regard to the estimated production, and then finda (sub)optimal reassignment of applications to time slots that optimize theoverall QoS while keeping the system energy neutral. Differently than theabove works, in this paper we aim at the optimization of the QoS in a contextof networked sensors, where the optimization should take into account alsothe compatibility of the scheduling plans of different devices and the factthat energy production and consumption is, in general, not the same on

4

all devices. It is important to point out that, in this work, our view ofQoS is rather different to the meaning used in the papers cited above. QoSenables to balance the application performance and its energy consumption,where performance is related to the use of different duty cycles, transducersand sampling rates, and/or communication patterns. To the best of ourknowledge, this is the first work that consider the optimization of QoS inenergy harvesting sensors under this perspective.

3. System Model

This section describes the energy production model of a solar cell andthe energy consumption model of a sensor. We recall that, as discussed inthe Section 1, we consider an application scenario that comprises one sensorand one sink. Note, however, that this assumption does not prevent that themodel can be applied to an arbitrary number of sensors. A sensor capturesenvironmental data and transmits the results to the sink, which, in turn,stores and forwards the data to a remote user. We assume that both thesink and the sensors are powered by solar cells combined with embeddedbatteries. A device powered by means of a solar cell cannot count on acontinuous power source (the energy production is dependent on the weatherand time of the day), and uses the battery as an energy buffer to sustain itsoperations when there is no production of energy by the solar cells. If thebattery level drops below a minimum threshold, the only alternative for thesensor is to switch to idle mode and wait until the solar cells start producingenergy again.

In order to adapt to the user requirements, environmental situations, andavailable power, the application can adapt its duty cycles and monitoringtasks dynamically. Specifically, we assume that the application is structuredin tasks corresponding to different monitoring activities and/or differentduty cycles and different energy consumptions. Each task also correspondsto a different quality level of the monitoring tasks that should be maximized,while taking into account the drained energy, the residual power in thebattery, and the expected energy production of the solar cells.

3.1. Solar Cell Energy Production

We have designed an energy harvesting system that obtains energy fromthe sun light by means of solar cells, which transforms the solar energyinto electricity. Thus, a device that is attached to a solar cell may use theelectricity obtained from the solar cell to maintain their activities (underconditions of sufficient solar light) or obtain it from its batteries (under

5

conditions of darkness or deficient sun light). In this subsection we presentthe requirements for the solar cell and for the device.

Solar cells are composed of wafers (in the order of micrometers thick)made of some semiconductor material at crystalline state, typically silicon,with the property of converting the energy of the photons in electricity bythe photovoltaic effect. The efficiency of a solar cell (η) is a measure of theenergy conversion efficiency of the incident light absorbed by a solar cellinto electric power. In turn, this depends on intrinsic factors of the regionwhere it is located as, for instance, geographic coordinates, solar time, andinclination with respect to the sun rays. The efficiency is computed asη = Pmax

D×S, where Pmax is the maximum output power provided by the cell

(in Watts), D is the irradiance, defined as the density of incident power on asurface under standard assumptions (in W/m2) and S is the surface area ofthe solar cell (in m2). For this work we selected the MSX-005F solar cell [4]manufactured by BP-SOLAR, a polycrystalline cell with a Specified LoadVoltage (Vld) of 3.3V, a Pmax of 500mW, a surface area (S) of 36cm2 andthat provides a maximum current (Ild) of 150mA.

To compute the energy production of the solar cell we take into accountthe relevant parameters of the solar cell (η, S) and the average monthlysolar irradiance (D) in some location. The output power is computed asPout = η ×D × S and the average energy production Ep of the solar cell isPout/Vld. Thus, by taking the parameters D, η of a solar cell and the valueof the irradiance D, we can obtain the energy production during a periodof time. However, to obtain the instantaneous irradiance of the solar cell attime t, we should apply a correction factor depending on the current day andsolar time. For example, in hours with no solar light the energy production isclose to zero. Thus, at time t the instantaneous irradiance can be expressed

as D(t) = (t−h)2

4p + Dmonth, where t is any hour between 0:00 and 23:00,h is the hour of maximum solar light (12:00am), Dmonth is equal to theaverage irradiance in a month and p = 9/Dmonth, where 9 corresponds tothe number of standard hours of solar light, which depends on the month ofthe year. Figure 1 shows the irradiance at time t represented as a quadraticfunction which draws a parabola with vertex at 12:00 in the noon. Then,the estimated energy production at time t is Ep(t) =

D(t)×η×S

Vld. In Figure 1,

the point (around 6:00) in which energy production begins corresponds tothe sunrise and the point (around 18:00) in which energy production endscorresponds to the sunset.

We select MicaZ [5] as energy consumer device (both for the sensor andfor the sink). MicaZ is a well-known platform for sensor networks applica-

6

0 5 10 15 20Time in hours (0-23)

0

50

100

150

200

250

300

350

400En

ergy

produ

ction (W

/m2)

max 86max 120max 240max 360

Figure 1: Irradiance per hour for different Dmonth.

tions, powered by 1.5V 2-AA batteries with a capacity C (between 1500-3000mAh), which should provide a voltage between 2.7 and 3.3V for thecorrect working of the device. The battery discharge model depends mainlyon the power requirements of the device. The battery charge model dependsmainly on the solar cell energy production, which may lead to an increaseof the stored energy. Thus, the time of charge (in hours) that is required tocompletely charge a battery of capacity C, assuming no consumption and aconstant energy production Ep is C

Ephours. Note that we used for this work

the MSX-005F solar cell and the MicaZ platform, which provide the param-eters for the production and consumption of energy, respectively; however,any other solar cell and sensor platform can be used instead.

3.2. Task Model

We represent a sensor as an automaton that executes predefined tasks.In a given period of time, the sensor may be assigned to execute a subsetof the available tasks Θ = {T0, . . . , Tα}. A task Ti (i > 0) is representedby a triple Ti = 〈ti, pi, wi〉, where ti is the execution time of the task, pi isthe period of execution of the task (note that must be pi > ti, otherwisethe period of execution of the task cannot be met), and wi is the energyconsumption of the sensor due to the execution of task Ti. A special taskT0 (also called Idle task) is executed when there is no other task to execute,which means that T0 does not have a period and a predefined executiontime, and its energy consumption w0 is defined as the energy consumed perunit of time. Hereafter we denote the execution of T0 for a duration t as T t

0 .

7

A sensor executes a scheduling plan P that is defined as a finite sequenceof tasks in Θ. Note that since the tasks are periodic, the scheduling plan P iscyclic and the total execution time of the cycle of P equals to the Least Com-mon Multiple (LCM) of the period of the tasks, i.e. tP = LCM(T0, . . . , Tα).The cost of execution of the scheduling plan P per unit of time is then givenby:

c =∑

Ti∈ΘTi 6=T0

wi

pi+ w0

1−∑

Ti∈ΘTi 6=T0

tipi

(1)

We consider the scenario described in Section 1, where a sensor interactswith a sink for communication purposes. Let us assume there are n possiblescheduling plans of the sensor PN

1 , . . . , PNn and m scheduling plans of the

sink PS1 , . . . , P

Sm. We use notation PX

i , with X ∈ {S,N}, to denote thescheduling plan i that is either of the sensor (if X = N) or of the sink (ifX = S). For a given scheduling plan PX

i are defined its energy cost perunit of time cXi and a defined quality level qXi . Then, the usage of an energyharvesting system in the sensor and the sink restricts the set of schedulingplans that can be selected in both devices.

Let us assume two scheduling plans PNi and PS

j with i ≤ n, j ≤ m.To enable the communication between the sensor and the sink, it existsa sending task Tx ∈ PN

i and a receiving task Ty ∈ PSj (Tx = 〈tx, px, wx〉,

Ty = 〈ty, py, wy〉). Then, PNi and PS

j are compatible iff (px) ≥ (py) and (px+tx) ≤ (py + ty), which means that the time of transmission (in the sender)and the reception (in the receiver) must match. This is the purpose of manyMAC protocols for WSN based on Low Power Listening [12, 6, 9]. In thispaper we call to this condition compatibility among any pair of schedulingplans of the sensor and of the sink. We use a matrix C, composed by n rowsand m columns, that represents the compatibilities between the schedulingplans of the sensor and of the sink by using simple binary notation: ifC(i, j) = 1 then PN

i and PSj are compatible scheduling plans; otherwise

C(i, j) = 0, which means that the plans are incompatible and they cannotbe run together.

A scheduling plan has associated a quality level q, which represents thedegree of fulfillment of the user requirements. q is therefore a metric forQoS. Different scheduling plans of the sensor (or, equivalently, of the sink)may implement completely different functionalities or they may have thesame functionalities although with different performance. For example, twodifferent plans in the sensor PN

i and PNj could perform the same set of

8

tasks at different rates, e.g. sensing and forwarding at 4 and 60 seconds,respectively. Generally speaking, higher sampling rate implies higher qualitylevel. Therefore, the quality level of PN

i is larger than PNj . We observe that,

without loss of generality, higher quality level implies larger cost. We denoteas efficiency the ratio between the quality level and the cost ( q

c). Note that

quality level not only refers to the sampling rate or to the duty cycles butalso to any feature that provides a better fulfillment degree of the activitiesin the device. For example, to perform the monitoring activity a sensor mayuse a different set of transducers, with different energy costs and differentresolutions.

3.3. Energy Model

Let BXmax be the maximum battery capacity and BX

min be the minimumbattery capacity necessary to maintain the working of the device. A deviceconnected to the solar energy harvesting system, as explained in Section 3.1,obtains the energy from the sun to charge its batteries accordingly to thelight conditions at each moment. Thus, the energy available in the batteriesmay increase (or decrease) depending on the solar irradiance in a place andinstant of time.

As observed in [15], an energy harvesting sensor can operate uninter-ruptedly if its energy management is energy neutral. Considering a referenceperiod of time [t′, t′′] the energy management of a sensor is energy neutralif Bt′ = Bt′′ . In our case, considering that the energy harvesting system isbased on solar cells, the energy production has a cycle of 24 hours, for thisreason we aimed at devising an energy management strategy that is energyneutral in the 24 hours. To this purpose we consider a time frame of 24hours divided into σ slots of duration δ = 3600×24

σseconds.

Let eNp (i) and eSp (i) be the energy production at the end of slot i in the

sensor and the sink, and eNe (i) and eSe (i) be the expected energy production(estimated by using the model in Section 3.1) at the end of slot i, of thesensor and the sink, respectively. Similarly, let cN (i) and cS(i) be the energycost due to the execution of a scheduling plan during the slot i, in the sensorand the sink, respectively.

We denote with BX(i) the battery level at the end of slot i of the deviceX. Let also φ ∈ [0, 1) be the charging efficiency of the battery and therectifier function [xX ]+ be defined as:

[xX ]+ =

{

x x ≥ 00 x < 0

(2)

9

If the duration of the slots is small enough we can assume that if the chargetends to overflow the battery above its maximum BX

max, then the batterycharge will be BX

max also at the end of the slot. Similarly, if the charge tendsto underflow the battery below 0, then the battery charge will be 0 also atthe end of the slot. This assumption is motivated by the fact that the slotsare short, the energy production will keep the same trend while the energyconsumption will remain almost the same. Under these assumptions, anddisregarding the power leakage of the battery, we can express the estimatedbattery level of the sensor and of the sink for each slot i ∈ [1, σ] as follows:

BX(i) = max{BXmax, B

X(i− 1) + φ[eXe (i)− cX(i)]+ − [cX(i)− eXe (i)]+} (3)

where BX(0) is the initial battery level at the beginning of slot 1, the secondterm accounts for the energy which is produced and not consumed by X(which recharges the battery), and the last term accounts for the energythat is drained from the battery in X. This equation considers the factthat the battery is not an ideal energy buffer and it assumes that the excessenergy that is neither used nor accumulated in the battery is dissipated bythe system.

4. Energy Neutral Adaptivity

Although uncontrollable, the energy production given by a solar cell ispredictable [15]. Based on this fact we devise a task scheduling strategy forthe sensor and the sink aimed at achieving energy neutrality strategy of theoverall systems.

We assume that the scheduling plans (and their respective costs andquality levels) for both the sensor and the sink are known, and that they areenergy neutral at least in some condition. For example, a scheduling planmay not be energy neutral if executed in winter, but it may be energy neutralin summer (where the solar cells guarantee a larger energy production).Furthermore, as observed in Section 3.2, a scheduling plan of the sensor maybe compatible only with some scheduling plans of the sink and vice versa. Onthe other hand, we assume that there always exists compatible schedulingplans to be executed by the sensor and the sink, and that the schedulingplans that keep in idle the sensor or the sink are always compatible.

The objective of the power management algorithm that we are proposingis to find an assignment of scheduling plans within a time frame such thatmaximizes the overall quality level, while maintaining the overall systemenergy neutral, and while guaranteeing the compatibility of the scheduling

10

plans executed by the sensor and the sink. Let us remind that we considera time frame of 24 hours divided into σ slots. The power managementalgorithm returns two vectors SN and SS, that contain the allocation of thescheduling plans to each time slot for the sensor and for the sink, respectively.Specifically, SN [i] = j iff the algorithm assigns at the slot i ∈ [1, σ] thescheduling plan PN

j to the sensor, and SS [i] = k iff the algorithm assigns at

the slot i the scheduling plan PSk to the sink.

For a given assignment SN [] and SS [], the energy budget of the sensor isBN (σ)−BN (0) and of the sink is BS(σ)−BS(0). We also define the vectorq of the quality level, the vector g of the compatibility of the schedulingplans, and the two vectors cN and cS of the energy costs for the sensor andfor the sink, respectively. Specifically, given the assignment SN and SS ,for a given time slot i ∈ [1, σ] let SN [i] = j and SS [i] = k, we have thatq[i] = min{qNj , qSk }, where qNj and qSk are the quality of the plan j and kassigned for the sensor and for the sink, respectively at slot i; g[i] = C(j, k);cN [i] = cNj and cS [i] = cSk .

Our algorithm computes the Quality of Service (QoS) for the sensorand for the sink as the sum of the quality levels of the scheduling plansassigned to all the slots. By maximizing the quality levels of the plansassigned we maximize, in turn, the overall quality of service in the period oftime considered. Thus, the problem of assignment can be formalized as anoptimization problem as follows:

max

σ∑

i=1

q[i] (4)

BN (0) ≤ BN (σ) ∧BS(0) ≤ BS(σ)

BNmin ≤ BN (i) ∧BS

min ≤ BS(i)∀i ∈ [1, σ]σ∏

i=1

g[i] = 1

The first constraint of the above optimization problem state that the assign-ment of the scheduling plans must be energy neutral. The second constraintstate that the battery level of the devices can never be below BX

min becauseotherwise the sensor or the sink would have to stop their operations. Notealso that the expression of BX(i) is not linear, thus leading to a non-linearoptimization problem. Finally, the last constraint means that at each slot,the scheduling plans assigned to the sensor and to the sink must be com-patible.

11

4.1. Power Management Algorithm

Let ΦX be a set of scheduling plans (either of the sensor or of the sink).We define opt(ΦX) as the scheduling plan PX

i ∈ ΦX such that ∀PXj ∈ ΦX

holdsqXicXi

≥qXj

cXjand qXi > qXj if

qXicXi

=qXj

cXj(i.e. PX

i is the most efficient

scheduling plan in ΦX). This means that the function opt(ΦX) returns themost efficient plan among a set of plans available for X. It is important topoint out that we are sorting the plans by their efficiency in descendant orderand not by their quality levels; efficiency allows us to balance quality andcost and to find progressively the next less efficient plan (but with higherquality level) or, alternatively, the next more efficient plan (but with lowerquality level) that keep the system energy neutral. However, find the nextplan with higher (or lower) quality level than the quality level of the currentplan could converge into a non energy-neutral system immediately in thenext step. It should be also noted that a plan PX

j for which qXj < qXi and

cXj ≥ cXi for some i is inefficient, and it can be excluded a priori. Also, we

define the set ΦXq = {PX

i ∈ ΦX : qXi > q} as the set of scheduling plans

in ΦX that have a quality level above q, and ΦXc = {PX

i ∈ ΦX : cXi < c}as the set of scheduling plans in ΦX that have a cost below c. Given ascheduling plan PN

i for the sensor and a set of scheduling plans for the sinkΦ, we define the subset of scheduling plans in Φ compatible with PN

i ascomp(Φ, PN

i ) = {PSj ∈ Φ : C(i, j) = 1}. Finally, we denote with r1 and r2

the slots immediately after the sunrise and the sunset, respectively.We consider a setting in which the scheduling of the plans is executed

periodically by the sink (or, equivalently, by the sensor) at the beginning ofa 24 hours period, in order to assign to both devices the scheduling plan foreach time slot. In order to make this assignment, the sink should solve theoptimization problem of Equation 4. Since an exact solution of the problemrequires computational resources generally not available in the consideredclass of devices, we propose a simple heuristic aimed at finding an admissiblesolution that approximates the optimal solution. In order to simplify theproblem, we make the following assumptions:

Assumption 1. Given the scheduling plans PNi and PN

j , let us consider

two scheduling plans for the sink PSh , P

Sk such that PS

h is the minimum cost

scheduling plan for the sink in the set comp(ΦS, PNi ), and PS

k is the min-

imum cost scheduling plan for the sink in the set comp(ΦS , PNj ). Then,

cNi ≤ cNj iff cSh ≤ cSk .The previous assumption means that, if we execute a ”low cost” schedul-

ing plan for the sensor, it is possible to find a compatible, low cost scheduling

12

Algorithm 1 Assignment Algorithm

1: Let P = opt(ΦN ) and let q, c be the quality level and cost of P .2: Let SN [i] = P ;SS [i] = opt(comp(ΦS , P )) ∀i ∈ [1, σ]3: if (BN (σ) ≥ BN (0) ∧ BS(σ) ≥ BS(0)) ∧ (BN

min ≤ BN(i) ∧ BSmin ≤

BS(i))∀i ∈ [1, σ] then4: % improves the quality of the solution

5: loop

6: ΦN = ΦNq

7: Let P = opt(ΦN ), and let q, c be the quality level and cost of P .8: improved = Upgrade(P )9: while ΦN == ∅ or improved == FALSE

10: else

11: % reduces the cost of the solution

12: loop

13: ΦN = ΦNc

14: Let P = opt(ΦN ), and let q, c be the quality level and cost of P15: improved = Downgrade(P )16: while ΦN == ∅ or improved == FALSE

plan also for the sink. Although this assumption limits the applicability ofour heuristic, we note that this behavior is rather typical and captures ameaningful class of applications. For instance, consider the case in whichthe sensor has the option to sample the environment with two different rates,say 1 and 10 seconds, corresponding to two different scheduling plans (wherethe first scheduling plan costs more than the second). In the first case thesensor will send data to the sink every 1 second and then the sink should beready to receive every 1s., while in the second case the sink may reduce itsduty cycle to receive data every 10s. The result is that the sink should usea more costly scheduling plan in the first case and a less costly plan in thesecond case. This kind of applications fit the Assumption 1. Similarly, wealso make the following assumption for the quality level of the schedulingplans:

Assumption 2. Given the scheduling plan PNi and PN

j , let us consider two

scheduling plans for the sink PSh , P

Sk such that PS

h is the maximum quality

level scheduling plan for the sink in the set comp(ΦS , PNi ), and PS

k is the

maximum quality level scheduling plan for the sink in the set comp(ΦS , PNj ).

Then, qNi ≤ qNj iff qSh ≤ qSk .The pseudocode for the assignment of the scheduling plans to the time

13

slots is presented in Algorithm 1, which progressively achieves a (sub)optimalsolution in several iterations. Initially, it starts assigning to all the slots ofthe sensor the most efficient scheduling plan, and by finding, among thecompatible schedules of the sink, the most efficient one (line 2). After thispreliminary step, if the solution is admissible, then the algorithm enters aloop in which it tries to improve it (line 5). Otherwise, the solution is notadmissible because it is not energy neutral or because the battery level ofthe sensor or of the sink drops below the minimum. In this second case thealgorithm enters a loop (line 12) in which it looks for solutions that cost less(but that may have also a lower QoS).

In the first case (the initial solution is admissible), the algorithm entersa loop in which it considers only the scheduling plans of the sensor that havea better quality level than that of the scheduling plan used for the initialassignment. It selects among these the most efficient and tries to reassignto some slots this new scheduling plan. This reassignment is achieved bythe Upgrade function (in line 8), shown in Algorithm 2. This loop ends onlywhen there are no more better scheduling plans to try. Function Upgrade

reassigns slot by slot (starting from the slot at sunrise, in which the solarcells start producing energy again) the scheduling plan for the sensor and,for each reassignment, it also finds a (new) compatible scheduling plan forthe sink that, according to Assumption 2, must have a better quality level,thus this reassignment improves the overall quality level of the solution.

In the second case (the initial solution is not admissible), the algorithmenters a loop in which it considers only the scheduling plans of the sensorthat have a smaller cost than that of the scheduling plan used for the initialassignment. It selects among these the most efficient and tries to reassign tosome slots this new scheduling plan. This reassignment is achieved by theDowngrade function (in line 15), shown in Algorithm 3. This loops ends onlywhen there are no more scheduling plans with a lower cost to try. Similarly toUpgrade, Function Downgrade reassigns slot by slot (starting from the slotat sunset, in which the solar cells stop producing energy) the scheduling planfor the sensor and, for each reassignment, it also finds a (new) compatible,scheduling plan for the sink that, according to Assumption 1, must have alower cost, reducing thus the overall cost of the solution.

It can be observed that the complexity of Algorithm 1 is O(n · (σ +max{n,m})). In fact, in each iteration of the main loop of Algorithm 1(either the loop that increases the quality of the solution or the loop thatdecreases its cost) a scheduling plan PN

i is selected and assigned to eachone of the σ slots of the sensor by the Function Upgrade (or Downgrade).These functions take complexity O(σ). When a plan PN

i is selected, it is also

14

Algorithm 2 Upgrade Function

Require: P : a scheduling plan for the sensor.Ensure: improved: a boolean value that states weather SS and SN had

been improved1: Let c1 be the cost of P2: improved = FALSE3: Let Q = opt(comp(ΦS , P )), and c2 be the cost of Q4: k = r1; j = 15: while (BN (σ)−BN(0)−c1+cN (k) ≥ 0)∧(BS(σ)−BS(0)−c2+cS(k) ≥

0) ∧ (j ≤ σ) do6: H1 = SN [k]; SN [k] = P7: H2 = SS [k]; SS [k] = Q8: if (BN (i) < BN

min) ∨ (BS(i) < BSmin) for some i then

9: SN [k] = H1; SS [k] = H2 % undo the replacement and exit

10: return improved11: k = (k + 1) mod σ; j ++12: improved = TRUE13: end while

Algorithm 3 Downgrade Function

Require: P : a scheduling plan.Ensure: improved: a boolean value that states weather SS and SN had

been improved1: Let c1 be the cost of P2: improved = FALSE3: Let Q = opt(comp(ΦS , P )), and c2 be the cost of Q4: k = r2; j = 15: while ((BN (σ) −BN (0) < 0) ∨ (BN (i) < BN

min)) ∧ ((BS(σ) −BS(0) <0) ∨ (BS(i) < BS

min)) for some i ∧ (j ≤ σ)) do6: SN [k] = P ; SS [k] = Q7: improved = TRUE8: k = (k + 1) mod σ; j ++9: end while

10: return improved

15

removed from ΦN (along with all the scheduling plans with a lower qualitylevel or higher cost, depending on the case), thus reducing the number ofscheduling plans in ΦN of at least 1 element. As a consequence the mainloop is repeated at most n times. Note that the removal of elements fromΦN can be done in O(n). Furthermore, each time a scheduling plan isreassigned to a slot in SN , the loop also chooses a compatible schedulingplan to reassign to the same slot in SS . The selection of a compatiblescheduling plan can be done in O(m). Consequently, the overall complexityis O(n · (σ+max{n,m})). Considering that, typically σ >> n,m holds, thecomplexity reduces to O(n · σ).

4.2. Communication model

The communication between the sensor and the sink is based on a dis-tributed model where the participants, a sensor and a sink, interchange datain order to implement the algorithms described in the previous subsection.When the initial plan P is selected in the sensor, which occurs in the line1 in Algorithm 1, the first interchange of messages takes place: the sen-sor sends P to the sink, which must select the most efficient plan that iscompatible with P and assign it to all the slots. The second interchange ofmessages occurs after the assignment and before evaluating the condition inAlgorithm 1 (line 3). This message is sent from the sink towards the sensorto communicate the result (true or false) of evaluating the condition of en-ergy neutrality in the sink (i.e. BS(σ) ≥ BS(0) ∧BS

min ≤ BS(i) ∀i ∈ [1, σ]).Based on the information received from the sink and its own information thesensor decides between improving the solution (line 5) or reducing the costof the solution (line 12) and goes into the corresponding loop. The thirdinterchange of messages occurs after line 7 or, alternatively, after line 14, tocommunicate to the sink the new plan selected in the sensor P as well as anadditional field to indicate if doing Upgrade or Downgrade. Once receivedthis message by the sink, both devices proceed individually with the execu-tion of the corresponding function (Upgrade or Downgrade) until one of thenext two things happen in the sink: 1) σ slots were replaced with the newplan; or 2) a number i (i < σ) of slots were replaced (i.e. the assignment ofthe plan to the slot i+1 becomes non-energy neutral the solution). In any ofthe two cases the sink sends a message towards the sensor with the value ofthe variable improved and the value of the last slot assigned i exactly beforeline 10 or 12 (depending on the case) if it executes the function Upgrade, oralternatively, before line 7 or 11 (depending on the case) if it executes thefunction Downgrade. Figure 2 represents the communication protocol to beimplemented in the sensor and in the sink.

16

Sensor Sink

P = opt(ΦN )

Send P

Q = opt(comp(ΦS , P ))

Send e-neutral

P = opt(ΦN − P )

Send P,Up/Down

Upgrade/Downngrade

Upgrade/Downngrade

Send improved, i

msc Communication Protocol 1 Sensor-1 Sink

Figure 2: Communication protocol between 1 sensor and 1 sink.

The information described above is the only data interchanged betweenthe sensor and the sink to execute one iteration of the loop. If the solutioncan be still improved (or it is not energy-neutral) then the sensor starts anew iteration of the loop in line 5 (or line 12) of Algorithm 1 and proceedsas explained above. Thus, the maximum number of messages interchangedbetween the sensor and the sink for each execution of the optimization algo-rithm would be 2(n + 1), where n is the number of scheduling plans in thesensor.

17

Plan T1 T2 T3 T4 T0 c q(%) EfficiencyN1 〈2, 5, 10〉 〈1, 5, 15〉 〈1, 5, 8〉 – T 1

0 7.0 100 14.28N2 〈1, 10, 3〉 〈1, 10, 5〉 〈1, 10, 5〉 〈1, 10, 7〉 T 6

03.2 90 28.12

N3 〈5, 15, 10〉 – – – T 10

02.0 85 42.50

N4 〈2, 20, 3〉 〈4, 20, 4〉 – – T 14

01.75 80 45.71

N5 〈20, 30, 10〉 – – – T 10

01.0 75 75

N6 〈26, 30, 1〉 – – – T 4

00.3 70 233.3

Table 1: Scheduling plans for the sensor employed in the simulation.

5. Evaluation

We have evaluated our approach by using a simulator implemented in C.As described in Section 3.1, we simulate the energy production of the solarcell MSX-005F and the energy consumption of the sensor node platform Mi-caZ. The sensor and the sink can select different execution plans dependingon the energy production and consumption in the sensor and the plans thatare compatible in the sink. We consider a time frame of 24 hours divided in300 slots (σ = 300) with a duration of 288 seconds each one (δ = 288).

To compute the energy production we take the data corresponding tothe average monthly solar irradiance Dmonth in Madrid (data taken fromRetScreen [16]): 84.6, 123.3, 178.8, 212.9, 247.9, 295.4, 300, 264.1, 202.9, 130.4,88.8, 70.8 W/m2, in the months of the year from January to December, re-spectively. For the sake of simplicity, in the evaluation we assume the samevalues of irradiance for the sensor and for the sink and, consequently, anenergy production identical in both (note however that this is not a require-ment of our algorithm). We compute the instantaneous energy productionat any hour t (Ep(t)) by using the energy production model described inSection 3.1 and then we distribute Ep(t) equally among the slots in an hour( σ24 ). We have adapted the number of hours of solar light accordingly to eachmonth varying the sunrise slot r1 and the sunset slot r2 in order to do morerealistic simulations. We fix the maximum capacity of the battery BX

max tobe 2500mAh and the minimum BX

min to be 1950mAh; the battery level atslot 0 is 2000mAh. To validate that the overall system is energy neutral weneed to check the condition BN (300) ≥ BN(0) and BS(300) ≥ BS(0), andthen proceed accordingly to Algorithm 1.

We define six scheduling plans for the sensor N1, . . . , N6 and eightscheduling plans for the sink S1, . . . , S8, whose description is detailed in Ta-ble 1 and 2 respectively. For each plan, the columns from 2 to 5 present thedefinition of the tasks (the notation ”–” means that the plan does not contain

18

Plan T1 T2 T3 T4 T0 c q(%) EfficiencyS1 〈1, 3, 2〉 〈1, 3, 10〉 〈1, 3, 12〉 – T 0

0 8.0 100.0 12.5S2 〈1, 5, 10〉 – – – T 4

03.6 98.0 27.2

S3 〈1, 6, 7〉 〈1, 6, 3〉 〈1, 6, 5〉 〈2, 6, 2〉 T 1

03.16 95.0 30.0

S4 〈2, 10, 3〉 〈6, 10, 10〉 – – T 2

01.7 90.0 52.94

S5 〈7, 10, 10〉 – – – T 3

01.6 85.0 53.13

S6 〈1, 20, 2〉 〈1, 20, 1〉 〈1, 20, 3〉 〈10, 20, 1〉 T 7

01.05 80.0 76.19

S7 〈27, 30, 7〉 〈2, 30, 10〉 – – T 1

00.63 60.0 94.73

S8 〈32, 35, 1〉 – – – T 3

00.2 50.0 250.0

Table 2: Scheduling plans for the sink employed in the simulation.

that task); the column 6 indicates the execution time for the Idle task1; andin the third last columns we specify the cost of the plan per unit of time c, itsquality level q (in percentage), and its efficiency computed as q

c, respectively.

Thus, the order of the plans by efficiency is {N6, N5, N4, N3, N2, N1} inthe sensor and {S8, S7, S6, S5, S4, S3, S2, S1} in the sink. These plans wereselected because they are representative of WSN applications which containa different number of tasks (or activities) with different execution times,delivering different quality levels with a cost, where higher quality level in-volves larger costs.

Not all the plans in the sensor can run together with any plan in the sink.We refer this concept as compatibility, which we described in Section 3.2.To express the compatibility degree between a set of plans of the sensor andof the sink, we use a percentage, which is used to randomly generate thecompatibility matrix. Specifically, we use two compatibility percentages,40% and 80%, to represent that at most the 40% (low compatibility) and80% (high compatibility) of the plans in the sensor are compatible with theplans in the sink, respectively. Table 3 shows the matrix representing acompatibility degree of at most 40% and 80% of the plans in the sensor andin the sink. We execute the initial assignment algorithm for the first day ofeach month of the year, starting at 0:00am that corresponds to the slot 0.

We obtain an overall energy neutral system for the two percentages ofcompatibility considered for all months of the year, which means that thealgorithm finds an assignment of scheduling plans to slots in the sensor andin the sink that verifies BN(300) ≥ BN (0) and BS(300) ≥ BS(0). We il-lustrate this in Figure 3 for the sensor and in Figure 4 for the sink, where

1Remind that T t0 means that the duration of T0 is t units of time.

19

S1 S2 S3 S4 S5 S6 S7 S8% L H L H L H L H L H L H L H L HN1 0 1 0 1 1 1 0 1 0 0 1 1 0 1 1 0N2 1 1 0 1 1 1 0 1 1 1 0 1 0 0 0 0N3 0 1 1 1 1 0 0 1 1 1 0 0 0 1 0 1N4 1 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1N5 0 0 0 1 1 1 1 1 0 1 1 1 0 1 0 0N6 0 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1

Table 3: Compatibility matrix. Legend: L: Low compatibility-40%; H: Highcompatibility-80%.

the battery level for each slot is shown for each month of the year, for acompatibility of 40%. As observed, there is a clear relationship betweenthe energy production and the battery level: the bigger is the production,the larger is the battery level achieved at the last light hour (close slot r2)and the lower is the battery level before r1, due to the fact that the mostconsuming plans can be assigned when the production is larger. Both in thesensor and in the sink, the larger battery level is achieved in July (achieving2015mAh and 2030mAh at slot r2, respectively). Correspondingly, the low-est battery level is achieved (close slot r1) in the same month in the sensor(the most consuming plans are assigned also in that month) while in thesink is achieved in February due to Algorithm 1 assigns the optimal planthat is compatible with the plan in the sensor, which not necessarily is theplan with higher consumption.

We observe the impact of the compatibility on the sink in Figure 4. Asshown, the battery level at slot 300 is rather larger than that at the sameslot of the sensor, which means that a part of the energy production isaccumulated in the battery and it is not used to execute a most consumingplan with a highest quality of service. This effect occurs during the months ofbigger production (from May to September). Remind that the sink executesthe first most efficient plan while compatible with the plan in the sensor.Therefore, in spite of the sensor may change its scheduling plan, if the plan ofthe sink is still compatible with the new selected plan in the sensor, the sinkcontinues executing the same plan, which leads to a biggest production whilethe consumption is kept. This is a direct consequence of the cooperationbetween nodes: while one of them could waste more energy if it executesalone, executing together involves that one of them must restrict to the otherfor the sake of achieving a maximum overall quality level. If we reduce thecompatibility percentage we reduce, in turn, the probability of that a plan inthe sensor be compatible with the most efficient plan in the sink, therefore,

20

0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102108114120126132138144150156162168174180186192198204210216222228234240246252258264270276282288294300

Slots1975

1980

1985

1990

1995

2000

2005

2010

2015

2020

Batte

ry level in the node (m

Ah)

JanFebMarAprMayJun

JulAugSepOctNovDec

Figure 3: Battery level in the sensor during the 1st day of each month of the year with acompatibility of 40%.

forcing to the sink to select another plan that is less efficient but has a higherconsumption and a higher quality. This effect was checked by comparing thebattery level achieved in the sink with 40% and 80% of compatibility: whilethe battery accumulated in the first case achieves 2030mAh (see Figure 4),in the second case is approximately 2022mAh. Note that we are representingthe execution during a day; the excess of production is accumulated alongthe time while the battery level is lower or equal than Bmax; otherwise, thebattery is dissipated.

Figure 5 shows the assignment of plans for the months of January andJuly (on the left) and for May and November (on the right) for the sensor andfor the sink assuming at most 80% of compatibility. The axis y represents theplans in the sensor and in the sink and the axis x represents the slot wherethe plan is assigned. Remember that the order of the plans by efficiency is{N6, N5, N4, N3, N2, N1} in the sensor and {S8, S7, S6, S5, S4, S3, S2, S1}in the sink. Upon a change in the scheduling plan of the sensor, a changein the scheduling plan of the sink occurs unless the plan in the sink be stillcompatible with the new plan selected for the sensor. Consider, for example,

21

0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102108114120126132138144150156162168174180186192198204210216222228234240246252258264270276282288294300

Slots1985

1990

1995

2000

2005

2010

2015

2020

2025

2030

Batte

ry level in the sink (m

Ah)

JanFebMarAprMayJun

JulAugSepOctNovDec

Figure 4: Battery level in in the sink during the 1st day of each month of the year with acompatibility of 40%.

6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102108114120126132138144150156162168174180186192198204210216222228234240246252258264270276282288294300

Slots

S8S7S6S5S4S3S2S10

N1N2N3N4N5N6

Sche

dulin

g Plan

s

JanJan

Jul - NodeJul - Sink

6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102108114120126132138144150156162168174180186192198204210216222228234240246252258264270276282288294300

Slots

S8S7S6S5S4S3S2S10

N1N2N3N4N5N6

Sche

dulin

g Plan

s

MayMay

Nov - NodeNov - Sink

Figure 5: Initial assignment of plans to slots for the months of January and July (on theleft) and May and November (on the right) for a compatibility of at most 80%.

the month of January where, as observed, the algorithm starts assigning themost efficient plan in the sensor (N6) and in the sink (S8). When the firstchange occurs in the sensor at slot 72 and the next plan N5 is selected, thesink looks for the first plan compatible with the new one. Since S8 is notcompatible with N5, the sink selects the next compatible plan, which is S7,and starts to execute it at the same slot. When the sensor selects again N6at slot 204, the sink comes back to S8. The same observation applies for

22

6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102108114120126132138144150156162168174180186192198204210216222228234240246252258264270276282288294300

Slots

S8S7S6S5S4S3S2S10

N1N2N3N4N5N6

Sche

dulin

g Plan

s

JanJan

Jul - NodeJul - Sink

6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102108114120126132138144150156162168174180186192198204210216222228234240246252258264270276282288294300

Slots

S8S7S6S5S4S3S2S10

N1N2N3N4N5N6

Sche

dulin

g Plan

s

MayMay

Nov - NodeNov - Sink

Figure 6: Initial assignment of plans to slots for the months of January and July (on theleft) and May and November (on the right) for a compatibility of at most 40%.

the different months considered. For instance, in May, since N3 and N6 arecompatible with S8, S8 is always selected to be executed. When the sensorchanges to N2, since it is not compatible with S8 neither S7, the sink selectsthe next one compatible plan, which is S6.

We repeat the same experiments with a percentage of compatibility of atmost 40%. Now, since we have more incompatible plans, we are increasingthe probability of change in the sink, which looks for a plan less efficientbut at the same time with a higher quality. Figure 6 shows the results forthe same months of the year. As a consequence of a lower compatibility, thesink assigns plans that are farther from S8 than in Figure 5. In January forexample, when N5 is selected, since N5 is not compatible with S7 and S8, theplan S6 must be selected. In July, the first compatible plan with N2 and N3is S5. Similarly, in May, since N3 is executing in the sensor, S5 is selected.When the sensor downgrades and selects N6, the sink also downgrades andselects N8. As a consequence, this behavior trends to improve the overallquality of service of the assignment with regard to use a higher percentageof compatibility.

Figure 7 shows the overall QoS achieved in the sensor and in the sinkfor compatibilities of 40% and 80%. QoS is computed as the average qualitylevel of the plans assigned and therefore is higher in summer and lower inwinter. We observe that the QoS in the sensor is larger than in the sink,due to the fact that our approach trends to select the highest quality plan aspossible in the sensor and maintain the most efficient compatible plan in thesink. We also observe that the overall QoS with at most 40% of compatibleplans is higher than with a 80% of compatibility. For a compatibility of 40%,in the months of bigger production (from April to September) the QoS inthe sink is similar to the achieved in the sensor. This happens because inthese months the sensor upgrades several times to achieve the plan with the

23

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec0

20

40

60

80

100Qu

ality of S

ervice (%

)

NodeSink - 40% CompatibleSink - 80% Compatible

Figure 7: Comparison of the overall quality of service for the sensor and for the sink.

highest quality that is able to execute and, at the same time, with a lowcompatibility we reduce the possibility of that such a plan be compatiblewith the plan of the sink, forcing it to looks for a plan with a higher quality,which, in turn, improves the overall QoS in the sink. However, with a highercompatibility, the QoS achieved in months of bigger production could belower than in months of lower production. In particular, in the monthsof April, May, and September the overall QoS in the sink is close to 50%.This indicates that the most efficient plan, S8, is compatible with most of theplans selected in the sensor in these months, and therefore, S8 keeps running.To illustrate this, Figure 8 shows the plans assigned in the sensor and in thesink at slot 150, which corresponds to the hour of maximum production(12:00am). As described, the algorithm selects the most consuming plans inthe sensor during the months of bigger production; however, the sink trendsto maintain the most efficient plans while compatible with the selected inthe sensor. Thus, for example, for a 80% of compatibility in April, May, andSeptember, the sink conserves S8, while for a 40% the sink upgrades andselects S4 and S5 (see Table 3).

6. Generalization to an arbitrary number of sensors

The approach described so far considers two networked devices, 1 sensorand 1 sink. Let us consider now a more general scenario with α sensors(α > 1) and one sink. Each sensor k (1 ≤ k ≤ α) employs the energy har-vesting system explained in Section 3.1 and runs the optimization algorithmsdescribed in Section 4. Our model extends naturally to α sensors by im-plementing independently the algorithms for each pair of devices 〈k, sink〉.

24

Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

S8S7S6S5S4S3S2S10

N1N2N3N4N5N6

Sche

duling Plan

s

Node Sink - 40% Sink - 80%

Figure 8: Assignment in the sensor and in the sink at the slot of maximum production(12:00am).

This means that, any sensor k could select (independently from the others)the corresponding plan PNk

i (i.e., the one that improves the solution or re-duces the cost) among the set of their available scheduling plans ΦNk and,lately, communicate its choice to the sink. After receiving this message thesink proceeds as explained previously, computing the most efficient plan thatis compatible with the plan received, i.e., opt(comp(ΦS , PNk

i )) and replyingto the sensor the result of the evaluation of the energy neutrality condition(true or false). Both (the sensor and the sink) could enter in a loop (toimprove the solution or to reduce the cost) that is executed a maximumnumber of nk times, being nk the number of scheduling plans of the sensork. In this situation, a sensor l sends the plan selected PNl

j to the sink. Thesink then should compute the most efficient plan that is compatible withthe two plans received from the sensors l and k, which would lead to twopotentially different assignments of scheduling plans for the sink. The planto be selected for execution in the sink, let say Q, would be the most effi-cient plan that is compatible simultaneously with the plans PNk

i and PNl

j .This process repeats each time that a sensor starts running the optimizationalgorithm by sending its plan to the sink. Thus, the maximum number ofmessages interchanged among α sensors and 1 sink considering one singleexecution of the algorithm is Σα

k=12(nk + 1). It should be noted that, evenconsidering different scheduling plans for different sensors, the transmissiontimes should exhibit some relationship to ensure that they are compatiblewith the reception times in the sink. Note also that while this approachworks for α sensors it could not deliver the optimal quality of service forthe sink; we leave the optimization problem for α sensors as future work.

25

Figure 9 represents the communication protocol between the α sensors andthe sink.

7. Conclusions

In this paper we address the problem of energy management affectingto two cooperating, networked devices, a sensor and a sink, both equippedwith solar cells with the purpose of recharging their batteries to achievepotentially infinite lifetimes. We consider different scheduling plans for thesensor and for the sink, with different costs and quality levels, and a refer-ence period of 24 hours that is divided in time slots of the same duration.Based on this, we have proposed an algorithm to find a (sub)optimal assign-ment of scheduling plans to slots (for the node and for the sink) that aimsat optimizing the overall QoS of the sensor and of the sink while keepingthe system energy neutral, which means that the energy consumption in areference period of time is never greater than the energy produced in thesame period. We have also introduced the concept of compatibility betweena couple of plans, one from the sensor and one from the sink, to express whentwo plans can run together, and which further restricts the set of plans tobe selected.

We have evaluated the algorithm proposed by simulation. We take arepresentative configuration for the plans in the sensor and in the sink andwe assume a low and a high compatibility between plans. Given such re-strictions, the results reflect that our algorithm finds always an admissiblesolution (i.e. keep energy neutral the system) for every month of the year.The algorithm also delivers a high QoS for the sensor close 90% in the monthsof summer, and close 70% in the months of December and January. We ob-serve that the QoS achieved in the sink is dependent on the compatibilitypercentage: with a low compatibility the QoS is larger than using a highcompatibility, due to the fact that the algorithm selects always the mostefficient plan that is compatible with the plan in the sensor and, given a lowcompatibility, we are reducing the probability of that the plan in the sink becompatible with the selected plan in the sensor. Thus, while the QoS tendsto be maximized in the sensor, we use a more conservative approach in thesink that tends to preserve a low cost. This may lead it to accumulate theenergy produced but not consumed into the battery, which, in turn, couldbe further used to execute another tasks or attending a larger number ofsensors. To this regard, although in this paper we have already presentedthe discussion of the generalization of the model to manage α sensors and 1sink, we plan its optimization and its evaluation as future work.

26

Sensor 1 Sensor α Sink

P1 = opt(ΦN1)Send P1

λ = λ ∪ {P1}Q = opt(comp(ΦS , λ))

Send e-neutral

P1 = opt(ΦN1−P1)Send P1, Up/Down

Upgrade/Downngrade

Upgrade/Downngrade

Send improved, i

Pα = opt(ΦNα))Send Pα

λ = λ ∪ {Pα}Q = opt(comp(ΦS , λ))

Send e-neutral

Pα = opt(ΦNα −Pα)

Send Pα, Up/Down

Upgrade/Downngrade

Upgrade/Downngrade

Send improved, i

msc Communication Protocol α sensors-1 Sink

Figure 9: Communication protocol between α sensors and 1 sink.

27

8. Acknowledgments

This work has been funded by the Spanish Ministry of Science and Tech-nology under the grant TIN2010-16497 “Tecnicas Escalables de E/S en En-tornos Distribuidos y de Computacion de Altas Prestaciones”.

References

[1] Alippi, C., Anastasi, G., Di Francesco, M., Roveri, M., 2009. Energy manage-ment in wireless sensor networks with energy-hungry sensors. InstrumentationMeasurement Magazine, IEEE 12, 16 –23. doi:10.1109/MIM.2009.4811133.

[2] Bergonzini, C., Brunelli, D., Benini, L., 2009. Algorithms for harvested energyprediction in batteryless wireless sensor networks, in: Advances in sensors andInterfaces, 2009. IWASI 2009. 3rd International Workshop on, pp. 144 –149.doi:10.1109/IWASI.2009.5184785.

[3] Bhattacharjee, S., Bandyopadhyay, S., 2013. Lifetime maximizing dy-namic energy efficient routing protocol for multi hop wireless net-works. Simulation Modelling Practice and Theory 32, 15 – 29. URL:http://www.sciencedirect.com/science/article/pii/S1569190X12001608,doi:http://dx.doi.org/10.1016/j.simpat.2012.11.006.

[4] Components, F., 2011. Bp solar - msx-005f - solar panel.http://www.farnell.com/datasheets/54658.pdf.

[5] Coorporation, M., 2010. Micaz datasheet.http://www.memsic.com/userfiles/files/Datasheets/WSN/micaz datasheet-t.pdf.

[6] El-Hoiydi, A., 2002. Aloha with preamble sampling for sporadic traf-fic in ad hoc wireless sensor networks, in: Communications, 2002.ICC 2002. IEEE International Conference on, pp. 3418 – 3423 vol.5.doi:10.1109/ICC.2002.997465.

[7] Escolar, S., Chessa, S., Carretero, J., 2012a. Optimization of quality of servicein wireless sensor networks powered by solar cells, in: 10th IEEE InternationalSymposium on Parallel and Distributed Processing with Applications, Madrid,Spain. p. 8.

[8] Escolar, S., Chessa, S., Carretero, J., 2013. Energy managementin solar cells powered wireless sensor networks for quality of ser-vice optimization. Personal and Ubiquitous Computing , 1–16URL:http://dx.doi.org/10.1007/s00779-013-0663-1, doi:10.1007/s00779-013-0663-1.

28

[9] Escolar, S., Chessa, S., Carretero, J., Marinescu, M.C., 2012b. Cross layeradaptation of check intervals in low power listening mac protocols for lifetimeimprovement in wireless sensor networks. Sensors 12, 10511–10535. URL:http://www.mdpi.com/1424-8220/12/8/10511, doi:10.3390/s120810511.

[10] Felemban, E., Lee, C.G., Ekici, E., 2006. Mmspeed: multipath multi-speed protocol for qos guarantee of reliability and. timeliness in wirelesssensor networks. Mobile Computing, IEEE Transactions on 5, 738 – 754.doi:10.1109/TMC.2006.79.

[11] He, T., Stankovic, J., Lu, C., Abdelzaher, T., 2003. Speed: a statelessprotocol for real-time communication in sensor networks, in: DistributedComputing Systems. Proc. 23rd International Conference on, pp. 46 – 55.doi:10.1109/ICDCS.2003.1203451.

[12] Hill, J., Culler, D., 2002. Mica: a wireless platform for deeply embeddednetworks. Micro, IEEE 22, 12 – 24. doi:10.1109/MM.2002.1134340.

[13] Iyer, R., Kleinrock, L., 2003. Qos control for sensor networks, in: Communi-cations, 2003. ICC ’03. IEEE International Conference on, pp. 517 – 521 vol.1.doi:10.1109/ICC.2003.1204230.

[14] Jeong, J., Culler, D., 2012. A practical theory of micro-solar power sensor networks. ACM Trans. Sen. Netw. 9, 9:1–9:36. URL: http://doi.acm.org/10.1145/2379799.2379808,doi:10.1145/2379799.2379808.

[15] Kansal, A., Hsu, J., Zahedi, S., Srivastava, M.B., 2007. Power managementin energy harvesting sensor networks. ACM Trans. Embed. Comput. Syst. 6.doi:10.1145/1274858.1274870.

[16] meteorology, N.S., Energy, S., 2011. Retscreen.http://eosweb.larc.nasa.gov/sse/RETScreen/.

[17] Mora-Merchan, J., Larios, D., Barbancho, J., Molina, F., Sevillano, J., Len,C., 2013. mtossim: A simulator that estimates battery lifetime in wirelesssensor networks. Simulation Modelling Practice and Theory 31, 39 – 51. URL:http://www.sciencedirect.com/science/article/pii/S1569190X12001517,doi:http://dx.doi.org/10.1016/j.simpat.2012.10.009.

[18] Moser, C., Chen, J.J., Thiele, L., 2009. Power management in energy harvest-ing embedded systems with discrete service levels, in: Proceedings of the 14thACM/IEEE international symposium on Low power electronics and design,ACM, New York, NY, USA. pp. 413–418. doi:10.1145/1594233.1594338.

[19] Sohrabi, K., Gao, J., Ailawadhi, V., Pottie, G., 2000. Protocols for self-organization of a wireless sensor network. Personal Communications, IEEE 7,16 –27. doi:10.1109/98.878532.

29

[20] Uthra, R.A., Raja, S.V.K., 2012. Qos routing in wire-less sensor networks-a survey. ACM Comput. Surv. 45, 9:1–9:12. URL: http://doi.acm.org/10.1145/2379776.2379785,doi:10.1145/2379776.2379785.

[21] Yigitel, M.A., Incel, O.D., Ersoy, C., 2011. Qos-aware mac protocolsfor wireless sensor networks: A survey. Comput. Netw. 55, 1982–2004.doi:http://dx.doi.org/10.1016/j.comnet.2011.02.007.

30