## 4 Data Aggregation
### Spatiotemporal
* Streaming mode, on the other hand, exploits both spatial and temporal correlation of the sensing data to form clusters. This mode is designed especially for less dynamic environments, in which the sensor readings do not fluctuate shortly over wide ranges. While the query phases of both modes are identical, the response phase of streaming mode is its major difference with interactive mode. The query message of streaming mode includes another clause _\"epoch duration i\"_, which defines the sampling frequency. Therefore, CHs respond to each query message once per epoch, as opposed to the one-time response in interactive mode. In addition to the number of responses by CHs per each query, there are two other major differences between interactive and streaming modes, which enable streaming mode to produce results with higher accuracy and reliability than interactive mode. First, the aggregated data by each CH is assigned a weight according to the number of nodes within the cluster. Hence, the achieved results using aggregation operators such as AVG is better bounded by the user provided error threshold. Second, to minimize the cluster formation and to keep the accuracy level persistently within the error threshold range, the clusters are dynamically updated and repaired by changes of the sensor readings. In this respect, nodes snoop on the broadcast medium during the response transmission phase; and when the variance of sensor reading value of a node against CR exceeds the allowed clustering range, it leaves the cluster and joins a consistent neighbouring or creates a new cluster with itself. The analytical results of the paper and test-bed implementations of CAG in indoor and outdoor environments show the high level of efficiency and accuracy of the protocol by unifying the query routing and query processing of data aggregation in both spatial and temporal data correlation aspects. With the aim of improving the energy efficiency of monitoring operations of sensor networks, the PREdiction-based MONitoring (PREMON) paradigm is proposed in [122]. PREMON is designed to visualize data aggregation process of WSNs as \"_watching of a sensor movie_\" and to apply the encoding concepts of MPEG [123] (a standard for audio and video compression) to improve the energy efficiency of network. Based on this analogy, sensor nodes or interpolation of several nodes in a grid point resembles a pixel in an image, while sensor readings are thought as the intensity values of pixels in the image. In addition, one round of monitoring operation corresponds to a snapshot of sensor network as a frame of a movie and the continuous of monitoring process is a continuous of snapshots, which can be interpreted as \"_video of sensed values_\". Based on this analogy and considering the fact that sensors in close proximity are likely to have highly correlated readings, the common update-mode sensor-report strategy is improved to a novel prediction based monitoring paradigm. In the PREMON paradigm, based on the spatiotemporal correlation of sensor readings, the BS monitors the readings of sensors for four frames and according to the activity-image of the monitored region, divides the image into macro-blocks (Figure 9) and generates a prediction model using the block-matching algorithm. Meanwhile, nodes follow the update-mode strategy (a technique that at initial round all nodes send a full frame of their readings, and in following rounds, each node transmits its readings only when it is changed) until receiving the prediction model. Then, the BS, using the achieved prediction model, estimates a few frames in future and transmits it to sensors. From now on, each node transmits its reading only when it differs from the predicted value, not when it changes.