## Abstract

Battery internal faults are one of the major factors causing safety concern, performance degradation, and cost increases. To extend the lifetime of the battery and bring more security in the system, internal fault detection of solar battery is proposed in this paper using an unsupervised machine learning algorithm based on anomaly detection method. The advantages of adopting such a method consist of using unlabeled data that meet the battery case in the difficulty of obtaining the fault data. In contrast, healthy data can easily be obtained from the battery and therefore allows building the anomaly detection algorithm. The effectiveness of the proposed method is validated using a simulation platform of a stand-alone photovoltaic system developed in Matlab/Simulink that takes as system input a real profile of irradiance and temperature captured from the Centre de Development des Energies renewable (CDER), Algeria. The test results in real-time data show the ability of the proposed approach to detect the fault occurrence in the battery.

### Keywords

- anomaly detection
- internal faults
- battery
- simulation
- data

## 1. Introduction

The future development of stand-alone photovoltaic (SAPV) systems will know a progression in all countries, especially in remote areas and islands [1]. The battery is the main component in SAPV system, since it represents 43% of lifecycle costs for this system [2], where this lifecycle could significantly reduce in badly work conditions. To check continuously the status of battery and aging, monitoring of internal resistance is proposed in [3, 4] proposed an estimation of solar irradiation to monitor the overcharge and internal resistance in Battery. Other studies [5, 6, 7, 8] focusing to assess the performance of the whole SAPV system using energy parameters. This latter provides an analysis of SAPV system, where the battery takes a part in this system. Fault diagnosis in SAPV system including the specific fault battery external short-circuit is proposed in [9, 10] using Artificial Neural Network, the study is experimentally validated an additionally integrated with the system using Matlab Graphical User Interface (GUI) [11]. Battery performance evaluation in PV-diesel hybrid system is proposed in [12] where the analysis requires many days and provides inaccurate results concerning the battery state.

The failure developed in battery, in particular, the internal faults could bring a difficulty to eliminate them by electrical protection elements such as fuse or circuit-breaker by reason of absence an appropriate selection of fuse for this circuit [13]. This will result in undetected faults that conduct the battery to work in low performance and decrease its lifecycle, furthermore, it increases the risk of fire hazard and even an explosion, without account the contamination of equipment’s beside [13]. To solve this problem and overcome the limitation of existed battery fault analysis, this paper proposes internal faults detection of solar battery using anomaly detection technique. This method is commonly utilized for fault detection [14] specifically in the photovoltaic system [15, 16], where the proposed anomaly detection prediction model has the ability of development with only normal data and using the readily available battery voltage and current without requiring extra sensor circuit. Furthermore, it could recognize any non-specific failure in battery which makes them a promising choice for practical application.

The training and test for validation have been performed using data from the simulation platform of SAPV system, the battery is adequately represented in Matlab\SimPowerSystem to allows the creation of fault such as short-circuit and ground-fault. In addition, to make the simulation varies along with irradiance level and temperature, a real climatic measurements profile captured from CDER is used as input to estimate the output.

The test results of fault detection using anomaly detection method in real-time data show the capability of anomaly detection to recognize all the faults in the battery.

## 2. Modeling of SAPV system

A typical SAPV system as shown in Figure 1 consists mainly of PV panels, Battery, load, and charge regulator [17]. The PV panels are the DC power source, and the battery is the storage element.

### 2.1 Output PV panel modeling

The output current and voltage of PV panel is obtained using the common one-diode model [18], in which the relationship I-V is given as follow:

where *Iph* is the light generated current, *I*_{0} is the reverse saturation current of diode, *n* is the diode ideality factor, *R*_{s} and *R*_{sh} are the series and shunt resistance of panel respectively, and *V*_{t} is the thermal voltage.

### 2.2 Battery modeling

The charge and discharge models of lead-acid battery implemented in SimPowerSystems simulation environment [19] are summarized in the following:

#### 2.2.1 Model for charge

#### 2.2.2 Model for discharge

where *V*_{batt} is the voltage of battery (V), *E*_{0} is the constant voltage of battery (V), *k* is the polarization resistance (ohm), *Q* is the capacity of battery (Ah), *it* is the present battery charge (Ah), *i* is the current of battery (A), *i** is the filtered (A) current and exp. (*t*) is the exponential zone voltage (V).

### 2.3 Load and charge regulator representation

The load is represented by a resistance connected in parallel with the PV panels and battery. The charge regulator consists of a simple switch on/off placed in one side between PV panels and battery in our case.

## 3. Proposed fault detection method

Anomaly detection or known as novelty detection or outlier detection [20] is one the most machine learning technique used in fault detection [21], which aim to detect abnormalities or unusual operation that can come up, it makes the assumption that the data are distributed according to Gaussian (or Normal) distribution and this latter can be modeled based on two parameters: the mean μ and the variance σ^{2}.

Three phases are required to build an anomaly detection model, the first is training phase, where the Gaussian distribution is estimated by the parameters μ and σ^{2}, the second is validation phase, in this step, some threshold ε is selected as a limit of being an anomaly (outlier) compared to the Gaussian probability function, the third is testing phase, in which a test is performed to check the performance of the model. In the following, Mathematical equations behind this approach are given.

### 3.1 Gaussian distribution

Fit a model of Gaussian distribution from data relies on the assumption that huge number of data used is normal data. For each feature *xj* (*j* = 1,…,*n*) an estimation of Gaussian distribution parameters *μj* and *σj2*. The Gaussian probability density is defined as:

### 3.2 Estimation parameters for Gaussian distribution

The parameters of Gaussian distribution *μj* and *σj2* for the *j*-th feature are estimated respectively as follow:

### 3.3 Choosing the value of threshold ε

To decide if new examples are anomalies or not, the procedure consists to compare the value of Gaussian probability density with a threshold or limit, if the probability is lower than a certain threshold then these examples are anomalies. However, the selection of the threshold ε could be done by the trial-error method using the F1 score (Eq. (7)) metric as criteria. As shown in Figure 2, the algorithm proceeds to try several values of ε, where the chosen value of ε corresponds to the maximum F1 score [14] defined below:

where *prec* is the precision and *rec* is the recall, they can be obtained by:

Where *tp* is the true positive that means that the algorithm successfully classified as positive or anomaly, *fp* is the false positive that means that the algorithm incorrectly classify it as positive or anomaly, when it is not an anomaly, finally *fn* is the false negative that means that the algorithm wrongly classify it as not anomaly, while this sample is an anomaly.

## 4. Case study

A small SAPV system composed of 2 PV panels (212 Wp) connected with a battery of 1200 Ah and a load of 50 W is considered in this work. The PV panel used is Isofoton 106 W-12 V, where the parameters for this panel are obtained from [22]. Industrial lead-acid battery of 12 V contains six cells connected in series, in order to investigate internal faults in the battery, each cell is represented by a single battery of 2 V connected in series to model a real battery of 12 V, we point out that the cells are assumed has identical electrical characteristics.

The object of this paper is detecting internal faults that occur in the battery, where two faults are considered: ground fault and short-circuit (Figure 3), in which ground fault situate at three locations: upper, middle and lower, and short-circuit between cells consist of 1, 2, 3, 4 or 5 cells circuited. These faults are used to test and evaluate the detection approach.

## 5. Results and discussion

A real environmental measurement (irradiance and temperature) illustrated in Figure 4, taken from CDER, Bouzareah, Algeria, In which nine clear days are used as input to simulate the SAPV system under Matlab/Simulink.

In the following, some scenarios of faults are performed in order to test the capability of anomaly detection to recognize these faults using the last 4 days of data constituted of battery voltage and current, The Gaussian probability density is calculated and plotted with the threshold ε before and after occurring the fault.

In Figure 5 a test for the Normal operation is realized, it can be seen that the probability does not drop below the threshold ε apart three false alarms noticed, which means there is no fault detected by the detector system.

As illustrated in Figure 6, when a ground fault in the upper cell occurs, the probability decrease under the threshold ε after a certain time, and Figure 7 shows a ground fault in the middle cell, which takes longer time than the previous fault before to be detected.

In Figure 8 a short-circuit between 2 cells is created and as illustrated this fault take much time to descend under the threshold ε, while in Figure 9 a similar fault is created with Rf ≈ 0, then the probability drop below the threshold instantly and detected.

Figure 10 indicates the detection of short-circuit of 5 cells after a specific time of occurring this fault. From all these figures, it shows that all the faults are detected, whereas some faults take much time to detected than other, and this by the fact that the faulted voltage and current of Battery is reduced gradually and not immediately, and this depend on the external circuitry at moment of fault, in our case this is due to the value of Rf.

## 6. Conclusions

In this paper, a detection of battery cell interconnection fault is proposed using anomaly detection algorithm. The method has the benefits of using only the steady-state of battery and uses the easily available battery voltage and current to predict the internal fault in battery. Based on simulation data, the anomaly detection is developed and tested for validation, where in the simulation environment, the battery unit is viewed as series-connected battery cells. In this way, several typical faults such as internal short and ground fault are carried out. The proposed method is capable to effectively predict the battery internal faults, where the analysis finding reveal that as more battery cell are involved at faults or the fault circuit has negligible resistance, the fault detection becoming much faster to indicate the fault occurrence. The future work consists to implement this method on real battery as well as extend the application of battery fault detection to include battery EV and other appliances. Furthermore, another method based on a statistical approach to select the threshold ε in a better way would be proposed in the future, these techniques will perfectly manage to find the outlier of battery operation.