# The Optimal Dispatch of a Power System Containing Virtual Power Plants under Fog and Haze Weather
## 2 F-H Impacts on Photovoltaic Output and Load Forecasts
### Prediction Model of the Wavelet Neural Network
If the input signals are \(x_{i}\) (\(i\) = 1,2,...,\(n\)), the output \(h(j)\) of node \(j\) in the hidden layer is shown as follows:  
\[h(j)=h_{j}\left(\frac{\sum\limits_{i=1}^{n}w_{ij}x_{i}-b_{j}}{a_{j}}\right),j =1,2,...,l \tag{7}\]  
where \(w_{ij}\) is the connection weight between node \(i\) in the input layer and node \(j\) in the hidden layer; \(h_{j}\) is the wavelet basis function; and \(a_{j}\) and \(b_{j}\) are the scalability factor and shift factor of \(h_{j}\). Several wavelet basis functions have been proposed in the wavelets theory. Each basis function has its suitable application. In the WNN model of this paper, the Morlet wavelet, which is a non-orthogonal wavelet base without a scaling function, serves as the wavelet basis function because it is symmetrical and has a simple expression as below:  
\[h_{j}(x)=\cos(\delta x)e^{-x^{2}/2} \tag{8}\]  
where \(\delta\) = 1.75, generally. The output of node \(k\) in the output layer is shown as follows:  
\[y(k)=\sum\limits_{j=1}^{l}w_{jk}h(j),k=1,2,...,m \tag{9}\]  
where \(w_{jk}\) is the connection weight between node \(j\) in the hidden layer and node \(k\) in the output layer. (5) Realization process of photovoltaic output (or load) forecast:  
Step 1. Start. Step 2. Import data on photovoltaic output (or load) and relative factors, which should be normalized or mapped to the range of [0,1]. Step 3. Select similar days of F-H for photovoltaic output (or load) forecast based on the PCA, the GCA and the WSF. Step 4. Organize photovoltaic output (or load) data of similar days, three days before the day to predict and 3 h before the moment to predict to form the input and output data of the WNN. Step 5. Initialize the parameters of the WNN, according to demand, such as node numbers (\(n\), \(l\) and \(m\)), connection weights (\(w_{ij}\), \(w_{jk}\)), wavelet parameters (\(a_{j}\) and \(b_{j}\)), error limit (\(e_{0}\)), iteration precision (\(\Delta y_{0}\)) and maximum number of iterations (\(N_{\max}\)). Step 6. Repeatedly train the WNN through input and output data, according to Formulas (10) and (11). When the total forecast error \(e<e_{0}\) or the iteration number \(r>N_{\max}\), the training stops, and the network parameters that have a better fitting capacity for the original data are obtained. \[e^{\prime}=\sum\limits_{k=1}^{m}\left[y_{0}(k)-y^{\prime}(k)\right] \tag{10}\]  
\[w_{ij}^{r+1}=w_{ij}^{r}+\eta_{1}\frac{\partial e^{\prime}}{\partial w_{ij}^{r }},w_{jk}^{r+1}=w_{jk}^{r}+\eta_{2}\frac{\partial e^{\prime}}{\partial w_{jk}^ {r}}\]  
\[a_{j}^{r+1}=a_{j}^{r}+\eta_{3}\frac{\partial e^{\prime}}{\partial a_{j}^{r}},b _{j}^{r+1}=b_{j}^{r}+\eta_{4}\frac{\partial e^{\prime}}{\partial a_{j}^{r}}\]  
\[i=1,2,...,n,j=1,2,...,l,k=1,2,...,m\]where \(y_{0}(k)\) is the real values; \(\eta_{1}\), \(\eta_{2}\), \(\eta_{3}\) and \(\eta_{4}\) are the learning rates of \(w_{ij}\), \(w_{jk}\), \(a_{j}\) and \(b_{j}\), which are set according to demand. Step 7. Conduct the forecast for photovoltaic output (or load) using the WNN trained by Step 6 and analyze the results. Step 8. The mean absolute percentage error (MAPE) and the mean squared error (MSE) are employed in this section to evaluate the forecast accuracy, which are shown as Formulas (12) and (13):  
Figure 6.0  
Figure 6.1  
where \(N\) is the number of samples; \(y_{i}\) is the real value; \(y^{\prime}_{i}\) is the forecast value. The MAPE and the MSE will be small if the predicted values are very close to the true values and will be large if for some of the observations, the predicted and true values differ substantially. Step 9. End.