## 3 Data-Driven Adaptive Sampling Algorithm  
The core idea behind the DDASA is to design a data accuracy-driven strategy of power utilization in water quality monitoring using autonomous sensor nodes, depending on the environmental changes. It is clear that a higher sampling frequency is desired where the water quality is vulnerable to rapid environmental change or pollution, particularly in a post-industrial city. Particularly, the researchers and water quality observers of such areas might be more concerned and sensitive to the sudden changes of certain key parameters in the water. Correspondingly, however, if the monitored parameters hardly fluctuate, meaning no significant changes are taking place, it is believed a lower sampling frequency is preferred, and as a result, less energy will be needed for data sampling, data processing and transmission. Based on these assumptions, a revised sigmoid function is proposed in the present DDASA. This function is used to dynamically change the sampling frequency, which is expressed as:  
\[y(D)\ =\ \frac{2}{1+e^{-(D-t)}} \tag{1}\]  
\[D\ =\ \frac{|X_{i+1}-X_{i}|}{\frac{1}{N}\sum\limits_{i-N+1}^{i}X_{i}} \tag{2}\]  
Here, \(t\) is a pre-determined threshold; and \(D\) is the absolute difference between \(X_{i+1}\) and \(X_{i}\) over the average value of a number of \(N\) sliding-window based most recent data. Since we are interested in knowing whether there exists a sudden environmental change or not, it is reasonable to compare the latest sensed data \(X_{i+1}\) with the former data \(X_{i}\) in the signal sequence, and then divide the absolute difference between with the mean value of the most recent \(N\) data. If \(D\) is sufficiently large, it indicates a sudden environmental change. Then a somewhat higher sampling frequency is desired. Additionally, if the value of \(D\) is smaller than the threshold \(t\), which means the value changes are not significant enough, the sampling frequency can be reduced in view of the relative stability of the monitored data. Hence, the theoretical value of \(y\) is actually smaller than 2 but greater than \(y(0)\), that is, since the smallest value of \(D\) will not be a number smaller than 0 in data sensing process, the value of \(y(0)\) is essentially greater than 0 regardless of the value of \(t\). A representation of the revised sigmoid function is presented in Figure 1. It is found the value of \(y\) in the simulation is mostly a number either slightly smaller than 1 (e.g., when \(D\) equals to \(D_{1}\)) when the sensed data numerically remain stable or greater than 1 (e.g., when \(D\) equals to \(D_{2}\)) when the sensed data abruptly change. Since the value of \(y(D)\) dynamically changes depending on the latest sampled data, the sampling frequency should also be changed accordingly. If the current sampling frequency is denoted by \(f_{curr}\), which is used to acquire latest data, then the new sampling frequency, denoted by \(f_{new}\) is represented as:  
\[f_{new}\ =\ f_{curr}\times y(D) \tag{3}\]  
Hence, a new sampling frequency for the next iteration is a function of the newly sampled data and the average value of the latest \(N\) sliding window-based data, which satisfy the needs for a reasonable manner of sampling as well as the needs for energy conservation. In summary, a pseudo code for implementing the DDASA is represented in Algorithm 1 as below:  
```
1. Initialize a constant sampling frequency denoted as \(f_{const}\), sample a number of \(N\) for later use; store the samples in a sequence as \(S\);
2. Predetermine a threshold t according to the characteristics of the monitored parameter;
3. Define \(D\ =\ \frac{|X_{i+1}-X_{i}|}{\frac{N}{N}\sum_{i-N+1}X_{i}}\);
4. Define \(f_{curr}\ =f_{const}\);
5. for(\(i=N;i+\)) {
6.