Keywords

1 Introduction

Internet of Things (IoT) has the ability to connect any physical object to the Internet. It is expected that more than 50 billion devices will be connected to the Internet by 2020 [10]. The existing infrastructure to deploy IoT applications relies mainly on cloud computing. The Cloud offers external computing capabilities to overcome resource constraints of some IoT devices in terms of storage capacity and processing power. Recently, edge computing also provides a miniaturized external computing capability for IoT devices. Edge computing consists of micro datacenters implemented one hop away from the end user. There is an increasing trend to moving computation resources even much closer to the user which makes the computation and storage resources available locally [5].

A broad range of IoT devices comprise significant resources like processing, storage, communication, and energy. These capabilities leverage IoT devices to be possible computing resources. Crowdsourcing IoT resources provides unprecedented opportunities to create a self-sustained IoT ecosystem. Example of crowdsourcing IoT resources are WiFi hotspot sharing [9]. We propose a new approach for crowdsourcing energy in IoT environment. We consider a particular set of IoT devices called wearables. This set refers to any smart thing which can be worn or hand-held like smart shirts, smart glasses, smart watches, smartphones etc [12]. Energy could be easily available from harvested power of wearables or just spare energy from smartphones. Nowadays, wireless power transfer technologies are broadly used in sensor networks and IoT [8]. Crowdsourcing energy relies mainly on wireless power transfer for the delivery of energy from the providing wearables to the consuming IoT devices.

We harness the service paradigm as a powerful mechanism to abstract the functional and non-functional properties (QoS) of IoT based energy resources [1, 2]. Therefore, an IoT based energy resource is provisioned as a service, called Crowdsourced Energy as a Service (EaaS). Connectivity and mobility are two key challenges to unlock the full potential of crowdsourcing energy from wearable IoT devices [4]. For an energy request, nearby IoT devices need to be discovered. In addition, delivering energy services from an IoT device to another relies on ensuring the connectivity between IoT devices. A short range distance is required for a successful wireless delivery of energy. As a result, space and time attributes are of paramount importance to define and select energy services. The main contributions of this paper are: (i) a service model for crowdsourcing energy from IoT devices, (ii) A Quality of Service QoS model to distinguish between energy services, (iii) a temporal composition algorithm which is a variation of a fractional knapsack and temporal knapsack algorithms offering required energy and (iv) experiments are conducted based on a real dataset to illustrate the performance and effectiveness of the temporal composition approach.

The remainder of the paper is organized as follow: Sect. 2 presents the crowdsourced energy service and QoS model. Section 3 details the proposed temporal composition algorithm. Section 4 discussed the experimental results. Section 5 concludes the paper and highlights some future work.

Motivating Scenario

We consider a scenario of depleting battery of a smartphone user in a public place like a coffeeshop where it is challenging to find a vacant power point. We assume that the user needs to extend the lifetime of their smartphone’s battery to run some critical applications e.g., make a call or look for a destination in the Google map. Users may have different requirements in terms of energy capacity and time availability. In our scenario, energy is offered by nearby wearable IoT devices provided by the crowd. Some wearable IoT devices like smart shirts and smart shoes can harvest and store energy for a long time. Wearables consume a tiny amount of their harvested energy. They can share their energy wirelessly as a service with nearby IoT devices [8]. Getting energy from one single service may not fulfill a user’s requirement. In such case, multiple energy services need to be combined to satisfy the user’s requirements. We propose to reformulate the problem of finding and crowdsourcing energy in a coffeeshop as a spatiotemporal service composition.

2 System Model and Problem Formulation

In this section, we first define the key concepts of a crowdsourced energy service. We then give a formal definition for the problem of crowdsourced energy service composition.

Definition 1:

Crowdsourced Energy Service. A crowdsourced energy service ES is a tuple of \(< Eid, Eownerid, F, Q>\) where:

  • Eid is a unique service ID,

  • Eownerid is a unique owner ID,

  • F is the function of sharing energy by an IoT device owner Eownerid via an IoT device d

  • Q is a tuple \(<q_1, q_2, ..., q_n>\) where each \(q_i\) denotes a QoS property of ES e.g., energy capacity.

The energy service is available just when the energy capacity is higher than a predefined threshold by the provider Thr. This capacity will definitely change overtime. It decreases because of the use of the IoT device while delivering the energy to the service consumer. On the other hand, some IoT devices may not be affected by delivering energy because they are either plugged to a power point or self-harvesting. An example of such an IoT device is smart shirt which harvests energy from a body heat. An energy consumption model is required to estimate the real availability of the energy service. The real availability of an energy service is affected by three factors, (i) the usage of the IoT device by the providers themselves, (ii) the energy delivery to the consumer, and (iii) the preference of the provider. Carroll et al. [3] define different usage patterns of IoT devices. According to these patterns the energy consumption of the device can be estimated. Providers who want to share their energy have to follow one of these patterns as follows: Suspend i.e., not using their devices , Casual i.e., using them casually with few functionalities, or Regular i.e., using them with a predictable usage behavior. We define \(\alpha \) as a parameter related to the usage pattern. We set \(\alpha = 1\) if the usage pattern is “Suspend”, \(\alpha = 0.75\) for “Casual”, and \(\alpha = 0.50\) for “Regular”.

QoS parameters allow users to distinguish among crowdsourced energy services. In the following, we propose quality attributes for an ES.

Definition 2:

Crowdsourced Energy Service Quality Attributes.

  • Intensity: Intensity shows the intensity of the wirelessly transfered current. The current is transferred under a certain voltage. We assume that all IoT devices related to energy services are functioning under a voltage between 3 and 5 V. These IoT devices are also compatible in term of voltage.

  • Transmission success rate: Transmission success rate is the ratio between the transmitted energy from an energy provider and the received energy by an energy consumer [8]. The transmission success rate Tsr is calculated based on the following formula.

    $$ Tsr = \frac{G_{t} \gamma }{L_{p}} \left( \frac{\lambda }{4\pi (D+\beta )} \right) ^{\theta }$$

    where \(G_t\), \(L_{p}\),\(\gamma \), \(\lambda \), \(\beta \), \(\theta \), and D represent the transmission gain, polarization loss, rectifier efficiency, wave length, short distance energy transmission parameter, path-loss coefficient, and the distance between devices, respectively.

  • Deliverable energy capacity: The energy capacity that a consumer realistically receives is affected by the Transmission success rate Tsr and the state-of-charge of the IoT device battery EC, the usage pattern \(\alpha \), and the predefined threshold by the device user Thr. It is given by milliAmpere hour mAh. Deliverable energy capacity DEC is defined as follows.

    $$ DEC= \alpha (EC- Thr)Tsr $$
  • Location is the GPS location of ES that can transfer energy.

  • Start time: Start time st is the time of launching an energy service by an IoT device. It is assumed to be announced by energy service providers.

  • End time: End time et is the time where the energy capacity remains higher than the predefined threshold. If \(et < aet\) (aet means the announced end time of the service by the provider), et is calculated based on an estimation formula and not the end time announced by the service provider aet. Otherwise, et is considered as the real end time of the energy service. Given the initial energy capacity EC, intensity of the transferred current I, the start-time of the energy service st, the usage pattern \(\alpha \), and the predefined threshold Thr, the service real end time et can be estimated by the following formula:

    $$ et= st + \alpha (EC- Thr)/I $$

Definition 3:

Crowdsourced Energy Service Consumer Query. An energy service query is defined as a tuple \(Q< t, l, re, d>\):

  • t refers to a timestamp when the query is launched,

  • l refer to a location of an energy service consumer. We assume that a consumer stays fixed after launching a query,

  • re represents the required amount of energy,

  • d refers to a user-defined charging period of time designated by its start time and end time.

Definition 4:

Temporal crowdsourced energy service composition problem. Given a set of crowdsourced energy services \( S_{ES}=\{ ES_{1}, ES_{2}, \dots ES_{n} \} \) and a query \(Q< t, l, Re, d>\), the aim of our work is to transfer the required energy Re in the time period d by selecting the optimal composition of nearby energy services \( ES_{i} \in S_{ES}\).

3 Temporal Crowdsourced Energy Service Composition Approach

We propose a deterministic spatiotemporal service composition framework for crowdsourcing energy services. We assume that service providers are fixed in space and they can transfer energy wirelessly inside a micro-region e.g., a coffeeshop. There is also an assumption that crowdsourced energy services are deterministic i.e., there is a knowledge about service availability and QoS values a-priori. First, we need an efficient indexing method for the fast discovery of energy services. Location and time are intrinsic parts of energy services. Therefore, we index energy services based on spatiotemporal characteristics The 3D R-tree is a spatiotemporal index data structure which deals with range queries of the type “report all objects within a specific area during the given time interval” [7]. Time is added as the third axis to spatial axes. When a query Q arrives, an area is defined by the location of the consumer Q.l and a range allowing the wireless power transmission between IoT devices. In our framework, we use 3D R-tree to select energy services located in this defined area at the time interval \([Q.t, Q.t+d]\) (see Sect. 3.1). Then, we need a greedy approach to search through all of available services and select an optimal composition plan along the query duration (see Sect. 3.2). Figure 1 shows the time intervals of the five ES and the query Q.

Fig. 1.
figure 1

Time intervals for nearby energy services for a query Q (Color figure online)

Fig. 2.
figure 2

Energy service composition (Color figure online)

3.1 Crowdsourced Energy Service Selection

Each energy service has a time interval [stet] and a location loc. Services are filtered spatially by selecting just the services inside the area defined by the consumer location Q.l and the user defined range r which allows a successful wireless energy transfer. Services also are filtered temporally by choosing just those having time interval within or overlapping with the query duration \([Q.t, Q.t+d]\) (see Fig. 1). Each leaf in the 3D R-tree is considered as ES. A search cube SC is determined by the energy query location Q.l and duration Q.d. All leaves inside or which overlap with the search cube are selected. The color in overlapping services in Fig. 1 illustrates their new availability lifetime. For partially available services, we recalculate the provided energy capacity according to their availability lifetime. We consider a uniform distribution in term of energy consumption for an IoT device and its delivery. We use the following formula to update DEC of the partially available services.

$$ES_i.DEC = (ES_i.et-ES_i.st)~.~ES_i.I~.~ES_i.Tsr$$

where \(ES_i.st\) and \(ES_i.et\) are the new start time and end time of ES respectively. \(ES_i.I\) is the intensity of the wirelessly transferred current. \(ES_i.Tsr\) is the wireless transmission success rate. We define a function called Service Selector. The function has as an input, the position of the consumer Q.l, the starting time of the query Q.t, and the duration of the query Q.d. The output is the set of all nearby available services NearbyS within the query duration (Line 3 in Algorithm 1).

figure a

3.2 Temporal Composition Algorithm

A single energy service may not satisfy the required amount of energy. As a result, we require to compose the optimal nearby energy services to fulfill the required amount of energy within the query duration. We assume that an energy service consumer does not receive more than one service at a time. The composition in this situation is an optimal sequence of services or partial services along a query time which fulfills the required energy.

We formulate our composition problem as a knapsack problem. A knapsack problem [11] is the selection of a set of items having weights and values by maximizing the total value of selected items and considering the limited weight capacity of the knapsack. We interpret each ES as an item. The time intervals [stet], DEC, and the query duration are considered as weights, values, and the knapsack weight capacity, respectively. Conversely to the classic knapsack problem where the items cannot be fractioned, time intervals of energy services can be chunked. As a result, we reformulate our composition problem as a fractional knapsack problem FKP [6]. We propose a greedy function Crowdsourcer which aims to select an optimal set of ES based on their deliverable energy capacity and time intervals. The inputs of Crowdsourcer are the query start time Q.t, end time e.g., \( Q.t+d \), and the required energy Q.re. The output of Crowdsourcer is an optimal composition plan in which component energy services are ordered based on their start times.

The Crowdsourcer first calls Service Selector. Service Selector returns all available energy services within Q.d (Line 3 in Algorithm 1). In the previous example in Fig. 1, ES3, ES4, are selected as available services. ES1, ES2, ES5 are selected as partially available services \(NearbyS= \{ ES1, ES2, ES3, ES4, ES5 \}\). After selecting candidate services, the Crowdsourcer searches if there exist an energy service which fulfills the required energy Q.re. If the result is one or multiple services, the function can take the shortest duration service, the earliest start time service, or a service providing the maximum of energy according to a consumer’s preferences (Line 6 in Algorithm 1). It is possible that there exist multiple services providing less than the required energy. A service composition is needed to achieve the required amount of energy. Sometimes, it is not possible to get the required energy from all the available service. In this situation, Crowdsourcer returns a set of available services which provides the maximum available amount of energy within the query duration.

Our composition problem is formulated as a fractional knapsack problem to find an optimal set of energy services providing the maximum amount of energy within the query duration. The proposed approach selects the best composition of services or parts of services (e.g., fractions) which provides the maximum energy in the query duration. Our approach relies on dividing the query duration into several time slots. Each time slot is limited either by the start time of an available service or its end time (Lines 10 to 15 in Algorithm 1), see vertical lines in Fig. 2. For example, start time of ES3 and ES4 define the first and second time slots, respectively. All energy services are fractioned into mini services, one mini service per time slot. ES3 is fractioned into three mini services, because ES3 crosses three time slots. Solving fractional knapsack problem relies on choosing mini services with highest density value ratio per each time slot (Lines 16 to 20 in Algorithm 1). In our case, the density value ratio refers to the deliverable energy capacity DEC on a unit of time hour. This ratio is the effectively transferred current effI from an energy service:

$$ effI = Tsr~.~ \frac{ES_i.DEC}{ES_i.et-ES_i.st} $$

The blue segments in Fig. 2 represent the mini service providing the maximum DEC in each time slot. The composition is the set of selected mini services from the query start time Q.t to the end of its duration \(Q.t+d\).

4 Experiment Results

We evaluate effectiveness and feasibility of the proposed composition framework in terms of the number of served queries. We define different scenarios (see Tables 1, 2, 3 and 4). To the best of our knowledge, there is limited research investigating temporal service selection. We compare the proposed temporal composition algorithm and a greedy selection algorithm as our baseline to show the feasibility of our approach. The greedy selection algorithm selects the energy service providing the maximum DEC among the available services within the query duration Q.d.

 

Table 1. Different query scenarios for short services providing small amounts of energy
Table 2. Different query scenarios for short services providing large amounts of energy

 

Table 3. Different query scenarios for long services providing small amounts of energy
Table 4. Different query scenarios for long services providing large amounts of energy

All algorithms are implemented in Java. The experiments are conducted on a 3.60 GHZ Core i7 processor and 8 GB RAM under Windows 10. We use Yelp which contains people’s check-ins into coffee places and restaurants. We assume that people who offer energy services from their wearables are lingering in a coffee place. We define spatiotemporal features of energy services by check-in and check-out times of customers at the coffee place. These times reflect start time st and end time et of energy services at the coffee place. We augment our real dataset with the synthetic QoS parameters. The energy service QoS parameters including deliverable energy capacity DEC, intensity of the transferred current I, and the transmission success rate Tsr are randomly generated. Similarly, energy queries time Q.t and duration Q.d are generated from check-in and check-out times of coffee place customers. The required energy Q.re is also randomly generated for each query.

Tables 1, 2, 3 and 4 illustrate different query scenarios in terms of the required energy and the query duration for services with short duration (Scen. 1 to Scen. 8). The same scenarios are defined with long services (Scen. 9 to Scen. 16) in Fig. 4. For each scenario, energy queries are served by either the greedy selection or the temporal composition algorithm. We assess the number of served queries by both algorithms to conclude the best scenarios of our temporal composition algorithm. Figures 3 and 4 show the number of served queries by energy services with short and long duration. The results indicate the necessity of temporal composition for almost all the queries requiring high amounts of energy when the existing services have short duration and provide low amounts of energy like the energy provided by wearables (e.g. Scen 2, Scen 4 in Fig. 3). Paradoxically, the temporal composition is also required for short duration queries requiring small amount of energy from long duration services (e.g. Scen 10, Scen 12 in Fig. 4). This is because of the property of fractioning energy services into mini services (see Sect. 3).

Fig. 3.
figure 3

Served queries with short services

Fig. 4.
figure 4

Served queries with long services

5 Conclusion

This paper proposed a novel approach for crowdsourcing energy services from IoT devices. We defined an energy as a service model for crowdsourcing energy from wearables. We defined a new quality model for energy services. We devised a temporal composition framework to meet users’ energy requirements. A set of experiments is conducted on a real dataset to illustrate the feasibility of the temporal composition framework for energy services. The results also show that the proposed framework deals effectively with the resource limitation of IoT devices which is reflected by the services providing small amounts of energy. Future work includes mobility-aware composition of crowdsourced energy services.