Open access peer-reviewed chapter

Battery Internal Fault Monitoring Based on Anomaly Detection Algorithm

Written By

Nassim Sabri, Abdelhalim Tlemçani and Aissa Chouder

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

DOI: 10.5772/intechopen.90497

Chapter metrics overview

593 Chapter Downloads

View Full Metrics


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 Iph is the light generated current, I0 is the reverse saturation current of diode, n is 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), 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:

Figure 2.

Flowchart of the procedure to select the threshold.


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.

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.


  1. 1. IEA-PVPS. Trends 2018 in Photovoltaics Applications. Report IEA PVPS T1-34:2018. 2018. pp. 73-91
  2. 2. Luque A, Hegedus S. Handbook of Photovoltaic Science and Engineering. John Wiley Sons, Ltd; 1 Jan 2003;92-100
  3. 3. Kim M, Hwang E. Monitoring the battery status for photovoltaic systems. Journal of Power Sources. 1997;64(97):193-196
  4. 4. Tadj M, Benmouiza K, Cheknane A. An innovative method based on satellite image analysis to check fault in a PV system lead-acid battery. Simulation Modelling Practice and Theory. 2014;47(14):236-247
  5. 5. Mayer D, Heidenreich M. Performance analysis of stand alone PV systems from a rational use of energy point of view. In: 3rd World Conference on Photovolt Energy Conversion; 2003
  6. 6. Muñoz FJ, Almonacid G, Nofuentes G, Almonacid F. A new method based on charge parameters to analyse the performance of stand-alone photovoltaic systems. Solar Energy Materials & Solar Cells. 2006;90(06):1750-1763
  7. 7. Muñoz FJ, Echbarthi I, Nofuentes G, Fuentes M, Aguilera J. Estimation of the potential array output charge in the performance analysis of stand-alone photovoltaic systems without MPPT (Case study: Mediterranean climate). Solar Energy. 2009;83(09):1985-1997
  8. 8. Torres M, Muñoz FJ, Muñoz JV, Rus C. Online monitoring system for stand-alone photovoltaic applications—Analysis of system performance from monitored data. Journal of Solar Energy Engineering. 2012;134:034502-1
  9. 9. Sabri N, Tlemçani A, Chouder A. Faults diagnosis in stand-alone photovoltaic system using artificial neural network. In: 2018 6th International Conference on Control Engineering & Information Technology (CEIT); 2018. pp. 1-6
  10. 10. Sabri N, Tlemcani A, Chouder A. Intelligent fault supervisory system applied on stand-alone photovoltaic system. In: Proceedings of the 2018 International Conference on Applied Smart Systems (ICASS 2018); 2019
  11. 11. Sabri N, Tlemçani A, Chouder A. Monitoring Tool for Stand-Alone Photovoltaic System Using Artificial Neural Network BT—Renewable Energy for Smart and Sustainable Cities. In: Hatti M, editor. Cham: Springer International Publishing; 2019. p. 114-21
  12. 12. IEA-PVPS. A User Guide to Simple Monitoring and Sustainable Operation of PV-Diesel Hybrid Systems. Report IEA PVPS T9-16:2015. 2015
  13. 13. Nailen RL. Battery protection-where do we stand? IEEE Transactions on Industry Applications. 1991;27(4):658-667
  14. 14. Purarjomandlangrudi A, Ghapanchi AH, Esmalifalak M. A data mining approach for fault diagnosis: An application of anomaly detection algorithm. Measurement [Internet]. 2014;55:343-352
  15. 15. Zhao Y, Lehman B, Ball R, Mosesian J, de Palma J. Outlier detection rules for fault detection in solar photovoltaic arrays. In: 2013 Twenty-Eighth Annual IEEE Applied Power Electronics Conference and Exposition (APEC); 2013. pp. 2913-2920
  16. 16. Zhao Y, Balboni F, Arnaud T, Mosesian J, Ball R, Lehman B. Fault experiments in a commercial-scale PV laboratory and fault detection using local outlier factor. In: 2014 IEEE 40th Photovoltaic Specialist Conference (PVSC); 2014. pp. 3398-3403
  17. 17. Castaner L, Silvestre S, Castaaner L. Modelling Photovoltaic Systems Using PSpice. Chichester: John Wiley & Sons, Ltd; 2002
  18. 18. Villalva MG, Gazoli JR, Filho ER. Comprehensive approach to modeling and simulation of photovoltaic arrays. IEEE Transactions on Power Electronics. 2009;24(5):1198-1208
  19. 19. Tremblay O, Dessaint LA. Experimental validation of a battery dynamic model for EV applications. World Electric Vehicle Journal. 2009;03:0289-0298
  20. 20. Marsland S. Novelty detection in learning systems. Neural Computing Surveys. 2002;03:1-39
  21. 21. Markou M, Singh S. Novelty detection: A review—Part 1: Statistical approaches. Signal Processing [Internet]. 2003;83(12):2481-2497
  22. 22. Chouder A, Silvestre S. Automatic supervision and fault detection of PV systems based on power losses analysis. Energy Conversion and Management. 2010;51(10):1929-1937

Written By

Nassim Sabri, Abdelhalim Tlemçani and Aissa Chouder

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