# An Energy Aware Adaptive Sampling Algorithm for Energy Harvesting WSN with Energy Hungry Sensors
## 6 Simulation Results and Discussion  
The state machines presented in Figures 1 and 6 were implemented and executed in MATLAB, following the node energy model described by the equations in Section 5, and using the infield power consumption measurements and sensor data from the both deployments. For deployment (I), Equation (5) was used to calculate the energy spent in the active state. Using Equation (11) the energy spent after each cycle \(T\) was calculated, and using Equation (7) the energy available in the battery after each cycle was found. The cycle was \(T=10\) s. In this case we analyze a custom made WSN node with only one energy harvesting source (_i.e._, wind) and one power hungry sensor (_i.e._, ultrasonic wind sensor). The harvested energy was calculated using a real field data and Equations (3) and (8). For the deployment (II), the energy model is described with Equations (7), (11) and (12). In this case, we analyze an off the shelf WSN node with five power hungry gas sensors that require long warm up periods. From an energy harvesting prospective, in this case, we have one energy source (_i.e._, solar). The harvested energy was estimated through the battery level using Equation (13) with the methodology described in Section 5. In both the simulations we assume that the ASA is running on the base station evaluating, for each period, the maximum frequency. The node is capable of recharging its battery by harvesting energy from the wind or sun, respectively, with the scaled wind turbine described in Section 4 and the solar panel described in Section 5. We also assume that the nodes are aware of the available energy. The EASA was implemented in MATLAB with the following values for its relevant parameters: \(c=2.1\), \(h=5\), \(W=400\), \(\delta=0.1\%\) and \(X_{level}=70\%\). \(X_{level}\) is the critical level of the battery at which the sampling rate is adapted according to Equations (1) and (2). Finally, the capacity of the battery in both of the deployments is 800 mAh. Figure 8 shows the sampling rate of ASA (\(f_{ASA}\)) _vs._ the sampling rate of the EASA (\(f_{EASA}\)) for deployment (I) and (II), respectively, for different values of \(m\). In Figure 7(a), the maximum frequency of the measured average wind speed is also presented. In both cases (Figure 7(a),b), the sampling rate of ASA is adjusted by the energy aware routine, according to Equations (1) and (2). As mentioned earlier, a potential disadvantage of the EASA is the possibility aliasing occurring. When the energy level of the node is critical, the EASA could reduce the sampling frequency (rate) to a level at which it will no longer comply with the _Nyquist_ criterion. This could cause under-sampling of the sensor signal to occur, in which case the maximum frequency of the signal will be greater than half the sampling rate. Such event is more likely to happen when the EASA is more conservative, which depends on the value of the parameter \(m\). As depicted in Figure 7(a), in the case when \(m=1/3\), in some occasions, the maximum frequency of the measured signal (wind speed) is higher than the sampling rate of EASA. Figure 7: Harvested power from sun—deployment (II). This will introduce an error in the measurement, which could be taken as a trade-off for staying active in the network, rather than continuing to sample at full rate and discharging the battery completely. In Figure 9, a comparison of the energy profiles of the nodes is presented. For both deployments (I) and (II), we consider the following cases: (i) the node is using the sampling rate from ASA; and (ii) when the node is adjusting the sampling frequency according to its available energy using Equations (1) and (2) with three different values of the parameter \(m\). For deployment (II), the energy profile of the node with fixed sampling rate \(E_{FSR}\) is also presented.