# Early Detection of Photovoltaic Panel Degradation through Artificial Neural Network
## 5 Configuration of the Proposed Double Level ANN Architecture  
This work uses a multi-layer feed-forward neural network. It comprises one input layer, one hidden layer, and one output layer. The number of neurons in the input layer is equal to the number of parameters that compound the input vector. The number of neurons in the output layer is fixed by the number of parameters to identify, in this case, five neurons (equal to the set of five parameters). The number of neurons in the hidden layer is not fixed. It depends on the complexity of the problem, but some works conclude that the best option is to choose the smallest configuration that reaches the desired performance and accuracy [26].  
The developed ANN is shown in Figure 5; it is composed of two levels trained independently. The first level is devoted to estimate the parameters of the single diode model by using as input only the irradiance and the PV panel temperature. It is trained by using as target values the SDM parameters extracted with the MATLAB fitting procedure associated to the healthy _1-V_ curve. A number of \(N_{trial}=5000\) experimental curves are selected randomly from the NREL database in order to cover the different environmental conditions. The selected dataset is distributed as 70% for the training set, 15% for the validation set and 15% for the testing set. An inner layer with 20 neurons is used.  
The second level of the ANN architecture is trained by using as target values the SDM parameters associated to the degraded _1-V_ curves. In this case, the input is a vector of eight elements, including the irradiance, temperature, and voltages and currents of the three points around MPP. They are equally spaced of 1 volt with respect to the MPP, as shown in Figure 4.  
A number of \(5\cdot N_{trial}\) curves are selected randomly from the degraded database in order to cover the different environmental conditions and different kinds of parameter  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Degradation Factor** & \(\mathbf{\alpha_{k,min}}\) & \(\mathbf{\alpha_{k,max}}\) \\ \hline \(l_{ph}^{deg}=\alpha_{1}I_{ph}\) & 0.95 & 0.9 \\ \(l_{sat}^{deg}=\alpha_{2}I_{sat}\) & 2 & 10 \\ \(\eta^{deg}=\alpha_{3}\eta\) & 0.98 & 0.9 \\ \(R_{s}^{deg}=\alpha_{4}R_{s}\) & 2 & 6 \\ \(R_{sh}^{deg}=\alpha_{5}R_{sh}\) & 1/3 & 1/20 \\ \hline \hline \end{tabular}
\end{table}
Table 4: SDM parameters variation for generating degraded _1-V_ curves.  
Figure 4: Healthy and degraded _1-V_ curves with the selected points passed to the ANN.  
degradation. Additionally, in this case, the selected dataset is distributed as 70% for the training set, 15% for the validation set and 15% for the testing set. An inner layer with 50 neurons is used.  
The MATLAB Neural Network Toolbox(r) is employed for configuring, training and testing the proposed architecture.  
It is worth noting that, although in this manuscript all the elaborations are performed on a PC, the trained ANNs can be exported in the Open Neural Network Exchange files [35] and executed by the most common open-source platforms (e.g., TensorFlow(r)) for running on embedded systems.  
Alternatively, the MATLAB Compiler SDK(r) [36] can be used for compiling the MATLAB(r) functions into a shared library for C/C++,.NET, Java, or Python projects and executed on the most common development boards, e.g., Raspberry(r), BeagleBone(r) or DSP/FPGA-based architectures.  
Moreover, microcontroller manufactures allow to train ANNs and develop optimized codes directly by using their programming tools, thereby optimizing performance and reducing development costs [37].