# Predictive Power Management for Wind Powered Wireless Sensor Node
## 4 Predictive Power Manager for EH-WSN
### Optimal Working Point
#### 4.1.2 Step 2
Hence, the energy allocation mechanism only has to regulate \(D_{\mathbb{C}}\) to satisfy the \"ENO\" working constraint. As for the wind energy prediction method, there already exists few studies [24]. However, energy prediction for EH-WSN has not been extensively explored, which calls for further research. Here we propose an energy harvesting prediction algorithm based on Weather-Conditioned Selective Additive Decomposition model (WCSAD): We first set the weather conditions of every day into three categories: Strong breeze, Moderate breeze, and Breeze; then we proceed to forecast the weather that only belongs to the same sort. In addition, we combine both the season variations during all the year and weather changes over one day together to calculate the energy that could be harvested in the next EH-rounds. Firstly, the EH-nodes need to record the harvested energy \(E_{cal}(d,s)\) in work round \(s\) of day \(d\), hence for the three categories there should be three matrixes \(\left|E_{cal}(d,s)\right|_{D}\) that saves \(D\) days data independently. The average harvested energy in three kinds are:

\[ \begin{array}{l}\overline{E}_{Str}=\left[\sum\limits_{i=1}^{D}\sum\limits_{ j=1}^{S}E_{Str}(i,j)\right]/D\\ \overline{E}_{Mod}=\left[\sum\limits_{i=1}^{D}\sum\limits_{j=1}^{S}E_{Mod}(i, j)\right]/D\\ \overline{E}_{Bre}=\left[\sum\limits_{i=1}^{D}\sum\limits_{j=1}^{S}E_{Bre}(i, j)\right]/D\end{array}  \tag{17}\]

where \(E_{Str}\), \(E_{Mod}\) and \(E_{Bre}\) are the harvested energy in Strong breeze days, Moderate breeze days, and Breeze days, respectively. Equation (17) should be updated every 24 h to ensure the weather classification process. The detailed calculation rules are shown below in Algorithm 3. ```
1 BEGIN
2 If\((\sum\limits_{j=1}^{S}E(i,j)>(1+Diff)\overline{E}_{Str})\)
3{day \(i\) is a Strong breeze day, update \(E_{Str}\)}
4 Elseif\((\sum\limits_{j=1}^{S}E(i,j)<(1-Diff)\overline{E}_{Bre})\)
5{day \(i\) is a Breeze day, update \(E_{Bre}\)}
6 Else
7{day \(i\) is a Moderate breeze day, update \(E_{Mod}\)}
8 END
```
**Algorithm 3** Harvested energy classification algorithm for different weather conditions

Here \(Diff(i,j)\) is a parameter concerns the seasonal changes:

\[Diff(i,j)=v\cdot\left[E_{cal}(i-1,j)-E_{cal}(i-2,j)\right]+(1-v)\cdot\left[E_{ cal}(i-2,j)-E_{cal}(i-3,j)\right] \tag{18}\]\(v\) is just a tuning coefficient. After these corresponding classifications of former days, then we can start to predict the up-coming energy, which would be harvested during work round \(s\) in the present day. The prediction value \(E_{est}(i,j)=\overline{P}_{Harro}\cdot\chi KT_{W}\) equals:

\[ \begin{array}{ll}E_{est}(i,j)&=\tau\cdot E_{x}(i,j)+(1-\tau)\cdot\frac{[E_{ cal}(i,j-1)+E_{sol}(i,j-2)+E_{all}(i,j-3)]}{3}\\ &+\varepsilon\cdot[E_{cal}(i,j-2)-E_{x}(i,j-2)]+(1-\varepsilon)\cdot[E_{cal} (i,j-1)-E_{x}(i,j-1)]\end{array}  \tag{19}\]

here \(\tau,\varepsilon\) are other adjustment coefficients. The four items in the above formula intend to represent the applicable harvesting energy's dynamic changes caused by different EH-rounds in different days. \(E_{x}(i,j)\) is a weighted sum of corresponding rounds' harvested energy in the past reference days that belong to the same weather kind: \(E_{x}(i,j)=\omega\cdot E_{x-1}(i,j)+\omega^{2}\cdot E_{x-2}(i,j)\). \(\omega\) is also a debug parameter. \(E_{x-1}(i,j)\) just shows the corresponding round' energy in the last time with the same weather kind, in turn \(E_{x-2}(i,j)\) stands for the day before last time within the same weather type. By default, we can take present day' weather type as the same as yesterday. However, a detecting mechanism is also designed to test the default hypothesis: we set up four testing points in a single day and we compute the average harvested energy during the time from the beginning of the day to the test point moment, if the value has a great difference with the last day's data, we should regulate the weather type immediately.