A Heuristic Diagnostic Method for a PV System: Triple-Layered Particle Swarm Optimization–Back-Propagation Neural Network

: This paper proposes a heuristic triple layered particle swarm optimization–back-propagation (PSO-BP) neural network method for improving the convergence and prediction accuracy of the fault diagnosis system of the photovoltaic (PV) array. The parameters, open-circuit voltage (V oc ), short-circuit current (I sc ), maximum power (P m ) and voltage at maximum power point (V m ) are extracted from the output curve of the PV array as identiﬁcation parameters for the fault diagnosis system. This study compares performances of two methods, the back-propagation neural network method, which is widely used, and the heuristic method with MATLAB. In the training phase, the back-propagation method takes about 425 steps to convergence, while the heuristic method needs only 312 steps. In the fault diagnosis phase, the prediction accuracy of the heuristic method is 93.33%, while the back-propagation method scores 86.67%. It is concluded that the heuristic method can not only improve the convergence of the simulation but also signiﬁcantly improve the prediction accuracy of the fault diagnosis system.


Introduction
The latest report from the International Energy Agency shows that, with the rapid development of photovoltaic (PV) technology, PV has become a major actor in the electricity sector in several countries; 1.3% of the world's electricity generation is covered by PV up to January 2016 [1].With the increase in the scale of PV power generation and the instability of the working surroundings, PV faults become more serious and are attracting wide attention.Faults affect a PV system's performance and reliability.The causes of PV system faults are mainly temperature fault, partial shading fault, modules aging, the open-circuit or short-circuit of PV modules, and cell damage [2][3][4].Temperature faults mainly stem from the PV modules' high surface temperature after absorbing sunlight in contrast to PV array partial shading faults, which are either unpreventable but fluctuating, like clouds, or eliminable, such as fallen leaves and dust.Short-circuit and open-circuit faults are mainly caused by aging problems of PV modules after long-term operation.Determining the fault type in a PV system quickly and effectively is important to maintaining safe and reliable PV power generations.
Several diagnostic methods for PV system have been introduced by scholars, as follows: Takashima et al. proposed two kinds of fault diagnosis methods for PV arrays: time domain reflectometry (TDR) and earth capacitance measurement (ECM) [5,6].In the TDR method, with the aid of a normative pulse pump signal in the series PV array, the change in the reflected electrical property Energies 2017, 10, 226 2 of 11 is used to judge the fault type [5].In the ECM method, the earth capacitance of the series PV array is used to determine the module's fault in the PV array [6].
Chao et al. developed a portable fault diagnosis meter by applying an extension neural network, chip microcontroller and a ZigBee wireless sensor network module [7].In the method proposed by Chao et al., the fault characteristics of PV array in different fault conditions were obtained first by simulation, after which the real-time illumination and module temperatures were extracted.The data from the simulation and experiment were imported into the extension neural network as the weight matrix to identify the fault types.
Hsieh et al. proposed an intelligent fault diagnostic scheme based on the theory of chaotic signal synchronization [8].In their diagnostic scheme, MATLAB (Manufacturer: Natick, MA, USA) was used to establish a PV system under different fault conditions.The fault characteristic parameters from the current-voltage (U-I) curve of the PV system were used and recorded, the dynamic error of the fault signals was derived by chaotic signal synchronization, and the captured output voltage signal was used as the recognition characteristic to determine the fault type.
A fault diagnostic method for a PV system based on a back-propagation (BP) artificial neural network has also been proposed [9].An artificial neural network [10] is a machine learning mechanism for simulating how the human brain learns and identifies problems, and is applicable to fault diagnosis.The BP neural network is the common approach [9][10][11][12][13], being a multilayer fed forward network of three or more layers.The forward network is trained by an error back propagation algorithm, and the front-and back-layer neurons are connected by different weights; however, there is no connection between the neurons of the same layers.In the BP method, when the learning mode is provided to the training network of the BP, the activation value of the neuron is delivered from the input layer to the output layer via the hidden layers, and the input responses of the network are reflected in each neuron of the output layer.The connection weights are revised from the output layer to the input layer via the hidden layer, with the aim of reducing error between the expected and the actual value.With the correction of the error, the accuracy of the input responses of the BP neural network also increases.However, the disadvantage in a BP neural network is that a sample database with large volumes and long training periods is required for convergence.Additionally, improper sample selection or a longer training phase can lower prediction accuracy of a PV fault diagnosis system.
The contributions of our work are: (1) We analyze the performance of PVs under various fault conditions, using open-circuit voltage (V oc ), short-circuit current (I sc ), maximum power (P m ) and voltage at maximum power point (V m ) to construct feature recognition criteria.The criteria reduce the running space and shorten the program execution time of the heuristic diagnostic method.(2) We evaluate the performance of a heuristic particle swarm optimization-back-propagation (PSO-BP) neural network method applied in PV fault diagnosis.The method has the merits of global search ability for particle swarm optimization (PSO) and local search ability for BP.
The PSO-BP neural network ameliorates the convergence of the diagnostic method and improves the prediction accuracy of the photovoltaic diagnosis system effectively.
The remainder of this paper is organized as follows.Section 2 describes the fault diagnosis system used in this study and the fault recognition parameters.Section 3 presents our proposed approach: a triple-layered PSO-BP neural network for forecasting faults in PV systems.Section 4 describes the data used in this study.Fault recognition and predictions using PSO-BP are examined with MATLAB in Section 5. Section 6 concludes the paper.

Configuration of Proposed System
The schematic diagram of our proposed fault diagnosis system is shown in Figure 1.It is mainly composed of a 4 × 3 (4 in series, 3 in parallel) PV array module, with DC load, alarm systems, and data processing modules acquiring and recording the state of the PV system.A triple-layered heuristic PSO-BP neural network is used as the diagnostic tool.In order to analyze changing of PV parameters in different fault conditions, a PV module simulation platform based on MATLAB/Simulink was used in this paper, in accordance with the mathematical model in [14].The specification of this module under a standard test condition (STC) is presented in Table 1.The simulation was carried out under different fault conditions, including temperature faults, partial shade faults, and faults due to aging cells (different series resistances imply differently aging cells [15]).I-U and voltage-power (U-P) characteristic curves were produced, as shown in Figures 2-4, respectively.
(a) (b) In order to analyze changing of PV parameters in different fault conditions, a PV module simulation platform based on MATLAB/Simulink was used in this paper, in accordance with the mathematical model in [14].The specification of this module under a standard test condition (STC) is presented in Table 1.The simulation was carried out under different fault conditions, including temperature faults, partial shade faults, and faults due to aging cells (different series resistances imply differently aging cells [15]).I-U and voltage-power (U-P) characteristic curves were produced, as shown in Figures 2-4, respectively.
With the increase of the cell's temperature, as seen in Figure 2, I sc increases while the V oc , P m and V m decrease.The main causes of these changes are as follows: the bandgap is negatively correlated with the ambient temperature; with increasing ambient temperature, the Fermi energy of the PV gradually approaches the center of the forbidden band; and the PV diffusion coefficient is positively correlated with the I sc and Fermi energy.
As Figure 3 shows, due to the PV effect, the photons exceeding the PV cells' bandgap excite a large number of electron hole pairs, which then generate electromotive force and current.Therefore, with increasing illumination of the PV cells, the I sc , V oc , P m and V m increase.
Current at maximum power point 1.17 (A) The simulation was carried out under different fault conditions, including temperature faults, partial shade faults, and faults due to aging cells (different series resistances imply differently aging cells [15]).I-U and voltage-power (U-P) characteristic curves were produced, as shown in Figures 2-4, respectively.
(a) (b)  With the increase of the cell's temperature, as seen in Figure 2, Isc increases while the Voc, Pm and Vm decrease.The main causes of these changes are as follows: the bandgap is negatively correlated with the ambient temperature; with increasing ambient temperature, the Fermi energy of the PV gradually approaches the center of the forbidden band; and the PV diffusion coefficient is positively correlated with the Isc and Fermi energy.
As Figure 3 shows, due to the PV effect, the photons exceeding the PV cells' bandgap excite a large number of electron hole pairs, which then generate electromotive force and current.Therefore, with increasing illumination of the PV cells, the Isc, Voc, Pm and Vm increase.With the increase of the cell's temperature, as seen in Figure 2, Isc increases while the Voc, Pm and Vm decrease.The main causes of these changes are as follows: the bandgap is negatively correlated with the ambient temperature; with increasing ambient temperature, the Fermi energy of the PV gradually approaches the center of the forbidden band; and the PV diffusion coefficient is positively correlated with the Isc and Fermi energy.

Series resistances increment
As Figure 3 shows, due to the PV effect, the photons exceeding the PV cells' bandgap excite a large number of electron hole pairs, which then generate electromotive force and current.Therefore, with increasing illumination of the PV cells, the Isc, Voc, Pm and Vm increase.These results indicate that V oc , I sc , P m and V m can be used to determine whether there is a fault in the PV array, as well as the corresponding cause of the fault.Here, V oc , I sc , P m and V m are used as identification parameters for the PV fault diagnosis system, and are expressed as an input matrix X. X = [V oc I sc P m V m ].

Proposed Fault Diagnosis Method
The PSO-BP neural network is a model combining features of the global search ability of PSO with the local search ability of a BP neural network [16].In order to get the solution of PSO quickly, a heuristic model of the PSO-BP neural network is used in this paper to predict the faults of the PV array.In our model, the test data are normalized and delivered to the benchmark input layer, and are subsequently trained and proceed with a sigmoid function in the benchmark training layer, on which the classification and learning mechanism are built.In practice, the recorded real-time fault data of the PV system proceed in the same way and are imported into the PSO processing layer to optimize fault classification.The results of the optimization are obtained in the output layer.The schematic diagram of the triple-layered heuristic diagnostic method is shown in Figure 5. (1) Normalize the different magnitudes of the recorded fault characteristics Owing to the different units and magnitudes of Voc, Isc, Pm and Vm, we normalize the input matrix X by the linear transformation method [17]: where ij x and ij z are the initial and normalized input matrices, min To verify the feasibility of the PV fault diagnosis system, this paper investigates seven kinds of PV faults and encodes them by 0 and 1 for identification purposes, as shown in Table 2.  (1) Normalize the different magnitudes of the recorded fault characteristics Owing to the different units and magnitudes of V oc , I sc , P m and V m , we normalize the input matrix X by the linear transformation method [17]: where x ij and z ij are the initial and normalized input matrices, x min and x max are the minimum and maximum values of each row of X respectively, and y min and y max are the minimum and maximum values of each row in the normalized matrix.In this paper y min = −1, y max = 1.
(2) Encode the fault states of the PV fault diagnosis system To verify the feasibility of the PV fault diagnosis system, this paper investigates seven kinds of PV faults and encodes them by 0 and 1 for identification purposes, as shown in Table 2.
(3) Process the normalized fault characteristics using sigmoid function, and select the optimal results as the multi-dimensional search space of PSO A suitable number of neurons in the hidden-layer and activation functions are conducive for the PSO-BP neural network to quickly and effectively complete the training with less training times and higher convergence rates [18,19].
The sigmoid function is expressed as (3) The linear function is expressed as The required number of hidden neurons of the BP neural network is calculated by the following formula [9,20]: where f loor(×) is a round-down function, such as f loor(1.2) = 1, n is the number of neurons in the hidden layer, n i is the number of neurons in the input layer, n o is the number of neurons in the output layer, and a is an empirical constant.
The connection weight C ij connects neuron i of the hidden layer and neuron j of the input layer of the BP neural network by the sigmoid function, while the connection weight W ij connects the output layer and the hidden layer by the linear function.The training deviation and epochs corresponding to the neurons are illustrated in Figure 6.The line with red dots indicates the number of epochs when the BP neural network is trained by increasing the neurons of the hidden layer, while the line with black squares illustrates the training accuracy of the BP neural network with the increase of the hidden layer neurons.As shown in Figure 6, when the number of neurons in the hidden layer is 12, the training accuracy of the BP neural network is over 80%, and the number of epochs is about 100 steps.A suitable number of neurons in the hidden-layer and activation functions are conducive for the PSO-BP neural network to quickly and effectively complete the training with less training times and higher convergence rates [18,19].
The sigmoid function is expressed as The linear function is expressed as The required number of hidden neurons of the BP neural network is calculated by the following formula [9,20]: × floor is a round-down function, such as ( )

=1 floor
, n is the number of neurons in the hidden layer, i n is the number of neurons in the input layer, o n is the number of neurons in the output layer, and a is an empirical constant.
The connection weight ij C connects neuron i of the hidden layer and neuron j of the input layer of the BP neural network by the sigmoid function, while the connection weight W ij connects the output layer and the hidden layer by the linear function.The training deviation and epochs corresponding to the neurons are illustrated in Figure 6.The line with red dots indicates the number of epochs when the BP neural network is trained by increasing the neurons of the hidden layer, while the line with black squares illustrates the training accuracy of the BP neural network with the increase of the hidden layer neurons.As shown in Figure 6, when the number of neurons in the hidden layer is 12, the training accuracy of the BP neural network is over 80%, and the number of epochs is about 100 steps.The expression of the output matrix that is transmitted from the input layer to the output layer via the hidden layers is as follows: ( ) The expression of the output matrix that is transmitted from the input layer to the output layer via the hidden layers is as follows: L in = P out (9) where Z in is a normalized input matrix, Z in = [z xy ], Z out is the output matrix processed by transposed matrix C T and sigmoid function between the input layer and the sigmoid processing layer; P in is the input matrix from the sigmoid processing layer to the PSO processing layer, P out is the output matrix optimized by PSO, f 1 is the PSO processing method, L in is the input matrix from the PSO processing layer to the output layer, and L out is the output matrix processed by transposed matrix W T and the linear function between the PSO processing layer and output layer.
(4) Update the position and velocity of the particles processed by sigmoid function, and the parameters in PSO In the PSO method, the optimal training results are selected as the initial N-dimensional search space.The particles processed by the sigmoid function start from the initial position S i with the velocity V i .The initial best position of the particles is set as pbest 0 , and the initial best position of the whole swarm is set as gbest 0 [21].
In the updating phase, supposing pbest and gbest of the i-th particle in N-dimensional space are the updating rule of the particle's position s i•n and velocity v i•n is given by following equation series [22][23][24]: ) where ω min ≤ ω ≤ ω max is defined as inertia weight factor.When ω → ω max the particle has stronger global searching ability, has a bigger search space, and can find a new solution domain.However, higher values of ω may skip the optimal solution domain.While ω → 0 , the particle has stronger searching ability locally, which is beneficial to obtain the optimal solution of the particle in the solution space, but the search time will be accordingly long.0 < t ≤ T max is the iteration time.c 1 and c 2 are constants for the cognitive factor and social factor, respectively.When c 1 = 0, the particle does not have cognitive ability and lacks local search, the particle has the ability to expand the search space, and the PSO is known as a social-only model, which has faster convergence and global optimization capability, but falls more easily into the local optimum.When c 2 = 0, there is no interaction between the particles in the particle swarm, and the PSO is known as a cognition-only model.Because the particles moves blindly, the model easily leads the convergence slowly, and it is difficult to obtain the global optimal solution [24,25].Independent random numbers r 1 and r 2 are uniformly distributed in the range of [0, 1].v i•n ∈ {−v max , v max }, where v max is the maximum particle velocity, p i•n (t) is the best previous position of particle i along the n-th dimension in iteration t, g i•n (t) is the best previous position among all the particles along the n-th dimension in iteration t, and a is the constraint factor, a = (5) Calculate and evaluate the particles' fitness in the particle swarm To calculate the particles' initial fitness in the PSO method, take the mean square error of the network as the fitness function, the current position of the particle as the particle's own best position, and the current position of the particle swarm as the initial particle swarm best position.The mean square error is defined as follows: where j is the fault states code of PV system, j = 1, 2, • • • , 7. MSE j is the error for the j-th pattern vector, y ij•rel the desired value of the output, and y ij•out the actual output of the j-th output neuron.
If the new particle position is better than the current pbest, update the particle's new position with the latest pbest.If the particle swarm's new position is better than gbest, update the particle swarm's new position with the latest gbest.
(5) Judge whether the maximum iterations are achieved or the training error is less than the prescribed standard error in PSO If the maximum iterations are achieved or the training error is less than the prescribed standard error, search for the best position of the particle swarm in the vicinity of the current gbest using the BP neural network; if the search result is better than the current gbest, then output the search result.Otherwise, output the current gbest to obtain the optimized neural network, or go back to step 3, until the requirements of the fault diagnosis method are met.

Data Collection
To verify the reliability of the PV array model built in MATLAB/Simulink (R2012a, MathWorks, Natick, MA, USA), simulation was performed under the standard conditions.210 set of the values of V oc , I sc , P m and V m when Illumination ∈ 100 W/m 2 , 2000 W/m 2 , Temperature ∈ [273.15K, 373.15 K] and the series resistance of cells R s ∈ [0.5 Ω, 5.5 Ω] are used as the data sample of the PSO-BP neural network, 150 sets were used as the training sample for the PSO-BP neural network, and the remaining 60 sets were used as the test sample.The values used for important parameters of the PSO-BP neural network are shown in Table 3.

Results and Analysis
The collected data were introduced to the BP neural network proposed in [9,11] and the PSO-BP neural network proposed in this paper and analyzed by MATLAB.The training mean squared error based on 150 training samples and the prediction results of the 60 test samples in the fault diagnosis system, are shown in Figures 7 and 8.As can be seen from Figure 7, in the training phase, the BP neural network method takes about 425 steps to achieve convergence, while the heuristic PSO-BP method only needs 312 steps.The mean squared error of the heuristic method is also smaller than that of the BP neural network method.The heuristic PSO-BP neural network method gives a quick and effective optimization training process, and ensures that the fault diagnosis system has greater accuracy.
In Figure 8, it is shown that for the 60 test samples in the fault diagnosis system, there are six misprediction points and the predictive accuracy is only 86.67% with the BP neural network method, while there are only four misprediction points with the heuristic method, which has predictive accuracy of 93.33%.Therefore, the heuristic PSO-BP neural network method can be used to more accurately predict fault type in a PV array.
In order to compare the advantages and disadvantages of the two algorithms, we selected 10 set of typical data from the test samples.The results are shown in Table 4.As can be seen from Figure 7, in the training phase, the BP neural network method takes about 425 steps to achieve convergence, while the heuristic PSO-BP method only needs 312 steps.The mean squared error of the heuristic method is also smaller than that of the BP neural network method.The heuristic PSO-BP neural network method gives a quick and effective optimization training process, and ensures that the fault diagnosis system has greater accuracy.
In Figure 8, it is shown that for the 60 test samples in the fault diagnosis system, there are six misprediction points and the predictive accuracy is only 86.67% with the BP neural network method, while there are only four misprediction points with the heuristic method, which has predictive accuracy of 93.33%.Therefore, the heuristic PSO-BP neural network method can be used to more accurately predict fault type in a PV array.
In order to compare the advantages and disadvantages of the two algorithms, we selected 10 set of typical data from the test samples.The results are shown in Table 4.As can be seen from Figure 7, in the training phase, the BP neural network method takes about 425 steps to achieve convergence, while the heuristic PSO-BP method only needs 312 steps.The mean squared error of the heuristic method is also smaller than that of the BP neural network method.The heuristic PSO-BP neural network method gives a quick and effective optimization training process, and ensures that the fault diagnosis system has greater accuracy.
In Figure 8, it is shown that for the 60 test samples in the fault diagnosis system, there are six misprediction points and the predictive accuracy is only 86.67% with the BP neural network method, while there are only four misprediction points with the heuristic method, which has predictive accuracy of 93.33%.Therefore, the heuristic PSO-BP neural network method can be used to more accurately predict fault type in a PV array.
In order to compare the advantages and disadvantages of the two algorithms, we selected 10 set of typical data from the test samples.The results are shown in Table 4.

Figure 1 .
Figure 1.Schematic diagram of the fault diagnosis system.

Figure 2 .Figure 1 .
Figure 2. PV characteristic curve under different temperature conditions: (a) U-I characteristic curve of PV array; (b) U-P characteristic curve of PV array.

Figure 2 .Figure 2 .Figure 3 .
Figure 2. PV characteristic curve under different temperature conditions: (a) U-I characteristic curve of PV array; (b) U-P characteristic curve of PV array.

Figure 4 .
Figure 4. PV characteristic curve under different series resistance conditions: (a) U-I characteristic curve of PV array; (b) U-P characteristic curve of PV array.

Figure 3 .Figure 3 .
Figure 3. PV characteristic curve under different illumination conditions: (a) U-I characteristic curve of PV array; (b) U-P characteristic curve of PV array.

Figure 4 .
Figure 4. PV characteristic curve under different series resistance conditions: (a) U-I characteristic curve of PV array; (b) U-P characteristic curve of PV array.

Figure 4 .
Figure 4. PV characteristic curve under different series resistance conditions: (a) U-I characteristic curve of PV array; (b) U-P characteristic curve of PV array.

Figure 4
Figure 4  graphs the PV array with different series resistances.As the series resistance decreases I sc and V oc have minor changes, while P m and V m increase.

Figure 5 .
Figure 5. Schematic diagram of the triple-layered heuristic PSO-BP neural network method.

x 2 )
and max x are the minimum and maximum values of each row of X respectively, and min y and max y are the minimum and maximum values of each row in the normalized matrix.In this paper Encode the fault states of the PV fault diagnosis system

Figure 5 .
Figure 5. Schematic diagram of the triple-layered heuristic PSO-BP neural network method.

Figure 6 .
Figure 6.The training deviation and epochs corresponding to the neurons.

Figure 6 .
Figure 6.The training deviation and epochs corresponding to the neurons.

Figure 7 .Figure 8 .
Figure 7.The training mean squared error in two methods.The blue solid line is the mean squared error in the training process, while the dot line is the target mean squared error in the MATLAB.(a) The training mean squared error of the BP neural network; (b) the training mean squared error of the PSO-BP neural network.

Figure 7 .Figure 7 .Figure 8 .
Figure 7.The training mean squared error in two methods.The blue solid line is the mean squared error in the training process, while the dot line is the target mean squared error in the MATLAB.(a) The training mean squared error of the BP neural network; (b) the training mean squared error of the PSO-BP neural network.

Figure 8 .
Figure 8.The prediction results for the two methods.The blue triangles are the prediction results of the two diagnostic methods, and the red asterisks are the actual fault classifications of the 60 test samples.(a) The prediction results of the BP neural network; (b) the prediction results of the PSO-BP neural network.

Table 2 .
The operative states of the PV array and its corresponding 0-1 coding matrix.

Table 2 .
The operative states of the PV array and its corresponding 0-1 coding matrix.

Table 3 .
Some important parameters in the PSO-BP neural network.