# An Energy-Efficient Approach to Enhance Virtual Sensors Provisioning in Sensor Clouds Environments
## 4 The Proposed Approach  
As cited earlier in Section 1, the provisioning task consists of selecting the physical sensor nodes to compose the user's virtual sensors. However, as one of the main requirements, this process should avoid redundant nodes, in order to save WSN constrained resources. For that reason, AC\(\times\)SIMv2 defines two phases to achieve a properly provisioning. In phase 1, an algorithm called _Adaptive Clustering Algorithm Based on Similarity_ (ACASIMv2) performs clustering of the physical sensor nodes that are inside of the user's interest region. The physical nodes are clustered based on the similarity of their measurements. Hence, all nodes within a specific cluster have measurements close to each other according to an acceptable error threshold parameter, defined by the user. This process is dynamic (adaptive) once the clusters can be recreated as the measurement values of nodes within a given cluster begin to exceed the acceptable error threshold. As the cluster formation is mainly controlled by the error threshold, there is no need to know in advance the number of clusters, as in k-means algorithm [46; 47], for instance. In Phase 2, performed by the _Ant Colony Optimization for Sensor Selection Based on Similarity_ (ACOSIMv2), only an optimal subset of physical nodes of each cluster is selected to form the virtual sensor requested by the user. This optimal subset attempts to minimize the energy consumption of physical sensors (Section 4.2). An ant colony optimization (ACO) system is used to perform this operation. The choice of an ACO system is made because of its successful application in several WSN previous works [27; 48; 49; 50]. Figure 4a depicts an example of a sensor cloud comprised of two WSN from different providers (\(WSN_{1}\) is represented by yellow circles and \(WSN_{2}\) by green squares). The nodes are heterogeneous, which means that they do not have the same types of sensors. The middleware, based on the user's request parameters, sends a query to the cloud. For example, consider that a user wants to receive the temperature, humidity, and light from a specific region which encompasses Nodes 1, 2, 3, and 4. Then, each node starts transmitting its measurements towards the middleware, using its sink node as a gateway. The middleware waits for a predefined length of time to receive the measurements from the nodes. A dashed grey square shows the sensors devices each node has and the values in given instant of time (\(T,H,L\) stands for Temperature, Humidity, and Light respectively). Then, it runs the ACASIMv2 algorithm, which is responsible for clustering the nodes. However, different from our previous work, ACASIMv2 clusters the nodes based on similarity of the nodes' measurements for each dimension (variable). Hence, the same node will be in different clusters of different dimensions. For example, Figure 4b shows that Node 1 is in the same cluster as Node 2 in the temperature dimension, but alone in humidity dimension, while in super-group with all other three nodes in light dimension. After running ACASIMv2, the middleware records the formation of the clusters and starts ACOSIMv2 (Figure 4c). ACOSIMv2 defines a subset of nodes and which sensors devices will be used to measure the environment. (we will explore how ACOSIMv2 works in Section 4.2). These nodes will be active, while the others enter into a power-saving mode (in this work, the nodes in this mode will be considered as inactive). The active sensor nodes will send only the measurements of the sensors devices defined by ACOSIMv2. For example, Node 4 does not need to send its light measurements, since Node 1 represents it. This behavior will help to save energy from the nodes. The middleware will consider the measurements of the each active (selected) node to represent all others nodes inside of its clusters. This is possible since each cluster contains only nodes whose measurements are below  
a THRESHOLD defined by the user.