**8. Solar radiation prediction using NARX model**

In this part, solar radiation will be predicted using the NARX model. As presented in the previous paragraph, to predict a future value, NARX model is based on the historical data related to this value and involves some exogenous data. As temperature influences the solar radiation variation, it is chosen as an exogenous data. So the NARX model inputs will be the historical solar radiation data and temperature data as presented in **Figure 11**.

The hidden layers number and their neurons must be chosen in such a way that they offer the best network performances in learning and in generalization. So in this paragraph, the network performances will be treated for different neural network architecture. Inputs for NARX model correspond to the historical solar radiations (R(t−1) and R(t−2)) and the ambient temperatures (T(t−1) and T(t−2)). The output will be the predicted solar radiation at time t (R(t)) as presented in **Figure 12**. The transfer functions used for the hidden layer and for the output layer are respectively "tansig" and "purelin."

**Figure 11.** Inputs and output for the NARX model.

First, the network performances will be studied with just one neuron in the hidden layer; then, number of neurons will be incremented and the network performances will be restudied. Network performances are treated by the compute of the mean square error of learning and test (MSE). The optimal neural structure corresponds to the one which presented the minimal MSE. Simulations results for this study are presented in **Table 3** and in **Figure 13**. The optimal neural architecture obtained is the one which its hidden layer contains five neurons as presented in **Figure 14**.

Based on this neural network, solar radiation is predicted by NARX model. Simulation results are presented in **Figure 15**. The blue curve corresponds to the real solar radiation, and the red curve corresponds to the predicted one. As obtained with the static neural network, the predicted solar radiation follows the evolution of the real one. Furthermore, an approximation between the real and predicted curves is remarked, the two curves are overlapped for certain period of time especially when the solar radiation fluctuations are low. So an improvement in the quality of solar radiation prediction with NARX model is remarked compared to that obtained with the static neural network.

To the best evaluation of the NARX model performances, the solar radiation prediction error is presented in **Figure 16**. The different error MSE, MAE, and RMSE are computed and presented in **Table 4**. As presented in **Figure 16**, the maximum error reaches the value of 0.42, and the

**Figure 12.** Neural architecture for the NARX model.

minimum one is equal to 0. MSE is always the lowest one. It indicates a value of 0.0348. It is low compared to this one obtained with static neural network. Therefore, the performance of NARX model is proven in this work to predict the solar radiation.

**Table 3.** MSE versus neurons in hidden layer for NARX model.

**Figure 13.** Learning, test and validation of NARX model.

R(t)

NARX

First, the network performances will be studied with just one neuron in the hidden layer; then, number of neurons will be incremented and the network performances will be restudied. Network performances are treated by the compute of the mean square error of learning and test (MSE). The optimal neural structure corresponds to the one which presented the minimal MSE. Simulations results for this study are presented in **Table 3** and in **Figure 13**. The optimal neural architecture obtained is the one which its hidden layer contains five neurons as presented in **Figure 14**.

NARX

Radiation (G)

Based on this neural network, solar radiation is predicted by NARX model. Simulation results are presented in **Figure 15**. The blue curve corresponds to the real solar radiation, and the red curve corresponds to the predicted one. As obtained with the static neural network, the predicted solar radiation follows the evolution of the real one. Furthermore, an approximation between the real and predicted curves is remarked, the two curves are overlapped for certain period of time especially when the solar radiation fluctuations are low. So an improvement in the quality of solar radiation prediction with NARX model is remarked compared to that

To the best evaluation of the NARX model performances, the solar radiation prediction error is presented in **Figure 16**. The different error MSE, MAE, and RMSE are computed and presented in **Table 4**. As presented in **Figure 16**, the maximum error reaches the value of 0.42, and the

> R(t-1) R(t-2)

**Figure 12.** Neural architecture for the NARX model.

T(t-2) T(t-1)

obtained with the static neural network.

Radiation (G)

260 Advanced Applications for Artificial Neural Networks

Temperature (T)

**Figure 11.** Inputs and output for the NARX model.

**Figure 14.** Optimal neural architecture for the NARX model.

**Figure 15.** Solar radiation predicted by NARX.

**Figure 16.** Solar radiation prediction error with NARX model.

**Table 4.** MSE, MAE, and RMSE for solar radiation prediction with NARX model.