Open access peer-reviewed chapter

Battery Internal Fault Monitoring Based on Anomaly Detection Algorithm

By Nassim Sabri, Abdelhalim Tlemçani and Aissa Chouder

Submitted: April 12th 2019Reviewed: November 14th 2019Published: April 1st 2020

DOI: 10.5772/intechopen.90497

Downloaded: 306


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.


  • 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.

Figure 1.

Typical SAPV system.

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 Iphis the light generated current, I0 is the reverse saturation current of diode, nis the diode ideality factor, Rs and Rsh are the series and shunt resistance of panel respectively, and Vt 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 Vbatt is the voltage of battery (V), E0 is the constant voltage of battery (V), kis the polarization resistance (ohm), Qis the capacity of battery (Ah), itis the present battery charge (Ah), iis 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 μjand σj2. The Gaussian probability density is defined as:


3.2 Estimation parameters for Gaussian distribution

The parameters of Gaussian distribution μjand σj2for 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:

Figure 2.

Flowchart of the procedure to select the threshold.


where precis the precision and recis the recall, they can be obtained by:


Where tpis the true positive that means that the algorithm successfully classified as positive or anomaly, fpis the false positive that means that the algorithm incorrectly classify it as positive or anomaly, when it is not an anomaly, finally fnis 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.

Figure 3.

SimPowerSystem model of SAPV system with battery.

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.

Figure 4.

Captured irradiance and temperature.

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.

Figure 5.

Simulation test result: normal operation.

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.

Figure 6.

Simulation test result: ground fault upper cell.

Figure 7.

Simulation test result: ground fault middle cell.

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 8.

Simulation test result: short-circuit of 2 cells.

Figure 9.

Simulation test result: short-circuit of 2 cells (Rf  0).

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.

Figure 10.

Simulation test result: short-circuit of 5 cells.


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.

© 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution-NonCommercial 4.0 License, which permits use, distribution and reproduction for non-commercial purposes, provided the original is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Nassim Sabri, Abdelhalim Tlemçani and Aissa Chouder (April 1st 2020). Battery Internal Fault Monitoring Based on Anomaly Detection Algorithm, Advanced Statistical Modeling, Forecasting, and Fault Detection in Renewable Energy Systems, Fouzi Harrou and Ying Sun, IntechOpen, DOI: 10.5772/intechopen.90497. Available from:

chapter statistics

306total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Advanced Statistical Modeling, Forecasting, and Fault Detection in Renewable Energy Systems

Edited by Fouzi Harrou

Next chapter

Forecasting of Photovoltaic Solar Power Production Using LSTM Approach

By Fouzi Harrou, Farid Kadri and Ying Sun

Related Book

First chapter

Potential of the Solar Energy on Mars

By Dragos Ronald Rugescu and Radu Dan Rugescu

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us