State of Charge Estimation for Rechargeable Lithium-ion Battery using ANFIS MATLAB

Download Full-Text PDF Cite this Publication

Text Only Version

State of Charge Estimation for Rechargeable Lithium-ion Battery using ANFIS MATLAB

Manish Mawatwal Electrical and Electronics Engineering

R.V. College of Engineering Bengaluru, India

Aayush Mohanty Electrical and Electronics Engineering

R.V. College of Engineering Bengaluru, India

Anitha G. S

Asst. Prof. Electrical and Electronics Engineering

    1. College of Engineering Bengaluru, India

      Abstract State of Charge determination has become an important issue in all the applications that include a battery for improved battery control. Inference fuzzy systems provide an intuitive, high-level mechanism to represent knowledge using IF/THEN rules, neural networks are adaptable and can perform learning and generalization. This paper presents an adaptive SOC estimation for rechargeable 3.6V Li-ion battery cell using Adaptive Neuro-Fuzzy Inference System. ANFIS tool will use discharging current and battery voltage samples as ANFIS inputs and SOC as the output. This paper will depend on ANFIS toolbox in MATLAB program.

      KeywordsState of Charge, ANFIS, Estimation Method, Li-ion battery, Fuzzy, Artificial Intelligence, MATLAB, ANN


        Li-ion battery advantages include high cell voltage compared to other chemistry batteries, no requirement of priming, variety of types, high energy density, long cycle life, low self- discharge, low maintenance, no memory effect, no pollution, high usability, good load characteristics etc. Eventually it is expected that Li-ion will replace the other battery chemistries in electric vehicles and hybrid electric vehicle. States of extremely high or extreme low SOC can lead to irreversible damage in the battery. It is important to control battery- powered systems. e.g. the battery of hybrid car should be charged between 20 % < SOC < 95%, which improves the performance and reliability of the battery systems. It is essential to be able to estimate the state of charge as well as state of health of the battery to maintain SOC within safe limits. The classical methods to estimate the SOC can be categorized into two approaches:

        1. Making a mathematical relation between SOC and one or more battery variables such as battery open-circuit voltage, battery EMF, electrolyte specific gravity, and DC internal resistance or AC internal impedance.

        2. Measuring the energy which gets into or out from the battery like the coulomb counting method.

        Classical methods to compute SOC have many drawbacks because they use equivalent circuit battery models which have many negative aspects including the fact that they cannot represent the behavior of the battery exactly. The models are not universal because they may give wrong SOC estimates in different battery types and certain discharge conditions while producing adequate results with other battery types or

        discharge conditions. Any kind of a battery is highly nonlinear in characteristic.

        Battery behavior depends strongly on battery age and operating conditions such as temperature, discharge rate and spread in behavior of the batteries of the same type.

        ANN can simply adapt to any recent conditions by updating the training data.

        Fuzzy logic can handle uncertainties and imprecision in the real battery management system.

        A combination of ANN and the fuzzy logic system, the SOC estimator based on ANFIS technique will present an adaptive and accurate SOC estimator under different battery operating conditions and can easily be implemented by a low-cost microcontroller.

        Adaptive Neuro-Fuzzy Inference Systems (ANFIS) is a combination of Artificial Neural Network (ANN) and Fuzzy Logic which can predict SOC of the battery.

        Battery management system (BMS) refers to the software and hardware designed to maximize each discharge cycle of a battery while maximizing the lifetime of the battery.


        1. Continuous Discharging

          The battery continuously delivers energy to the load which lead to a continuous drop in the battery capacity [5].

        2. Intermittent Discharging

          The battery delivers energy at regular or irregular intervals of time. The energy is drawn by the motor for some period followed by the voltage recovery period [5].

        3. Rate of charge and discharge

        To extend the service life of the battery, the rate of charge or discharge should not be too high. The frequency of charging and discharging cycles also affects the battery life significantly.


        Precise knowledge of SOC exerts additional control over the charging and discharging processes, which is employed to increase battery life.

        1. SOC Definitions

          1. General definition: Ratio of the available capacity to the rated capacity.

          2. Physical definition: Ratio of remaining active material to the total active material inside the battery that can be converted into electrical energy from chemical energy.

          3. Mathematical definition:

            () = ( 1) +

            D. Methods for determining SOC



            Model Based

            Data Driven


            Adaptive Filter

            SOC(t): Battery state of charge at time t SOC(t-1): Battery initial state of charge I: Charge/Discharge current

            t: Time(hr.)

        2. Relation between absorbed charging current and SOC When charging any battery, the charging current absorbed by the battery changes according to the SOC of battery at the same operating conditions.

          When the battery has a low SOC, the absorbed charging current is relatively high and when the battery has a high

          Equivalent cicuit model

          Electroche mical model

          Fuzzy based neural network

          Genetic Algorithm

          Artificial neural network



          Open circuit voltage

          Internal Resistance

          Recursive Least squares

          Particle Filter

          Kalman Filter

          SOC, the absorbed charging current is relatively low.

          At high SOC the battery voltage is relatively high and opposite because of the change of active materials amount in the anode and cathode electrodes with the different SOC.

        3. Reasons for Battery Degradation

          During the working process, the batterys SOC would be affected by many factors, such as environmental temperature, initial voltage, battery resistance, working hours, etc. The battery power source is also influenced by acceleration, climbing, cold, heat, rain etc.

          The loss in battery capacity is the main reason in changing the battery behavior which creates complexity in computing an accurate SOC.

          The battery capacity is the measure of the amount of free charge generated by active material at the negative electrode and consumed by the positive electrode at 100% SOC. It is expressed in Ampere-hour (Ah).

          1. Ageing

          2. Self-Discharge

          3. Discharge Rate

          4. Temperature

        Fig 1: Various ageing factors leading to Lithium-ion battery degradation.

        Fig 2: Various methods for determining SOC

        Table 1: Various techniques and their advantages and disadvantages.


        Online, cheap


        Field of Application



        Discharge test

        All battery systems

        Easy and accurate, independent of SOH

        Offline, time- intensive, loss of energy

        Open circuit Voltage

        Lead, Lithium, Zn/Br and Va

        Low dynamic,

        error if acid stratification, sensitivity to temperature and sensor

        Linear model

        Lead PV

        Online, cheap

        Needs inference data for fitting parameters

        Artificial neural network

        All battery systems


        Needs training data for a similar battery

        Impedance spectroscopy

        All systems

        Gives information about SOH and quality.

        Possibility of online measurement. Easy

        Temperature- sensitive cost- intensive

        Kalman Filter

        All battery systems, PV

        Online, dynamic

        Needs a large computing capacity. Needs a suitable battery model. The

        problem of determining the initial parameter.

        D.C Internal Resistance

        Lead, Ni/Cd

        Provides information regarding SOH, cheap.

        Possibility of online measurement, Easy.

        Good accuracy, but only for low SOC


        A measurement that reflects the general condition of a battery and its ability to deliver the specified performance compared with a fresh battery. It depends on factors such as charge acceptance, internal resistance, voltage and self-discharge.

        It is a measure of the long-term capability of the battery and gives an "indication", not an absolute measurement of how

        much of the available "lifetime energy throughput" of the battery has been consumed, and how much is left.

      5. END OF LIFE

        The moment when the battery reaches the end of its usefulness or lifespan and can no longer operate anywhere close to its peak capacity. It has three different parameters

        1. Total energy throughput: Total amount of energy that will pass through the battery throughout its lifespan and measured in megawatt-hours.

        2. Cycle life: It is the total number of times that a battery can be charged and discharged during its lifetime.

        3. Warrantied life: A battery with a x-year life under warranty is typically expected to reach the true end of life by that time.


        It measures how deeply discharged a battery is. Manufacturers generally use an 80% DOD formula for a battery's overall rating which means that around 80% of the available energy in a battery is delivered, while about 20% is in reserve.

        This technique efficiently increases a battery's overall service life, extending its lifespan significantly. The larger the DOD every cycle, the smaller the available cycle times will become. It affects the life expectancy of a battery, and it is common to most rechargeable batteries: lithium-ion, lead-acid or nickel- iron.

      7. FUZZY LOGIC

        Fuzzy Logic helps to draw definite conclusions from vague, ambiguous or imprecise information and it resembles human decision making, it allows complex systems to be modelled using a higher level of abstraction created from our knowledge and experience. Fuzzy logic allows expressing knowledge with abstract concepts such as big, small, very hot, fast or slow etc. It is often used in automatic control systems. It is used for a battery to derive a more accurate estimation of its SOC or the SOH. Following are the steps to design a fuzzy rule-based model.

        First step, the input and output variables of fuzzy are determined.

        Second, the fuzzy sets are determined for each variable.

        In the third step, the membership functions of all fuzzy inputs and outputs are created.

        There are many different kinds of membership functions such as triangular, Gaussian, trapezoidal etc. Since the type of membership functions impact the design of the fuzzy logic controller, they should be chosen carefully.

        Fourth, the fuzzy IF-THEN rules are generated to relate input and output variables.

        Fifth, the inference process is set.

        Two of the most common FIS types are the Sugeno and Mamdani. The output of the Sugeno is linear or constant, but the output of Mamdani comprises of membership functions that may be trapezoidal, triangular, and so on. Sugeno is trained by using a data set. Mamdani does not require a data set and relies on expert knowledge. The Mamdani type comprises the following processes. The input variables are fuzzified so that to the degree they fit each of the fuzzy set is established over membership functions. Next, an "AND" or "OR" fuzzy operator is used to combine the inputs resulting in

        a single number. Next, the rule's weight is set before the implication that is implemented tor each rule. Then all the fuzzy rules are combined and evaluated. The outputs are aggregated by the aggregation methods including max (maximum), probabilistic OR, and sum (simply the sum of each rule's output set).

        Thus, the outputs of each rule are combined into a fuzzy set that needs defuzzification.

        The sixth step is the defuzzification in which the results are converted to crisp output values from the fuzzy output. Some of the commonly used defuzzification methods are mean of maximum (MOM), smallest of maximum (SOM) and largest of maximum (LOM) [11].

        Fig 3: Fuzzy Logic System


        Computer architecture which is modelled upon the human brain's neurons. It mimics its information processing, memory and learning processes, it imitates the brain's ability to learn from trial and error. Each neuron has one or more inputs with a weighting factor and produces an output, which modifies the value entering the neuron, these neurons manipulate the inputs and output the result.

        Since the neural network establishes a relationship between input/output data of any kind, this method can be utilized for all battery systems and all applications Errors depend strongly on the training data and the training method.


A single fuzzy predictive can simply realize the learning heuristic knowledge but can't get the accurate result because the performance of self-learning and adaptive capacity is weak, it is difficult to form automatically and adjust the fuzzy rules of the membership function. Combination of both (ANN and Fuzzy) can get the exact value at any conditions, and meanwhile can also understand the estimation process.

In the fuzzy control system, fuzzy reasoning is a map to the relationship of input-output. The neurons can map any function relationships, it also can be used to make the fuzzy inference come true. Also, the neural network can realize fuzziness and non- fuzziness. Hence the neural network can represent all fuzzy control [2].

ANFIS is used to construct an input-output mapping based on the initial given fuzzy system and available input-output data pairs by using learning procedures. Two of the most commonly employed fuzzy inference system (FIS) which are used in various applications are the Mamdani inference system and Sugeno inference system.

Let us assume that the system includes two inputs, x1 and x2, output y and the rule base contain two fuzzy if-then rules; then the representation of rules for the first-order Sugeno FIS are

Rule 1: If (x1=A1) and (x2=B1) then

1 = 1 1 + 1 2 + 1

Rule 2: If (x1=A2) and (x2=B2) then

1 = 1 1 + 1 2 + 1

where pi, qi, and ri are the linear parameters. The architecture of ANFIS consists of five different layers. Each layer of the

network contains several nodes described by the node function. Adaptive nodes, denoted by squares, represent the adjustable parameter sets. Below is a description of each layer is given below.

Layer 1 is called the fuzzification layer in which each node represents membership grade of the crisp inputs and each nodes output 1 is computed by


p>1 = (1), = 1, 2

1 = (2), = 3, 4


where xi and x2 are the crisp input to the node i, Ai and Bi are the linguistic labels characterized by the proper membership functions and , respectively. The Gaussian membership function is given by

Fig 4: ANFIS Model Structure


(1) =

(2) =




where, ai, bi is the parameter set of the membership function in the premise part of fuzzy if-then rules that modify the shapes of membership functions.

In layer 2, each node provides the strength of rules using the multiplication operator given. The output of this layer if firing strength 2 as the products of the corresponding degree obtained from layer 1.

2 = = (1)(2), = 1, 2

The membership values represented by (1) and (2) are multiplied to find the strength of the rule where the variable xi has linguistic value A and x2 has linguistic value B. Layer 3 is the normalization node, which normalizes the strength of all rules according to the equation given below:

Fig 5: Training FIS model with epoch 10 and hybrid optimization method.

3 =


, = 1, 2

Layer 4 is a layer of an adaptive node, and every node in this layer computes the contribution of each ith rule towards the overall output and the function defined as

4 = = ( + 2 + ), = 1, 2 where, is the output of layer 3 and pi, qi, bi are the parameter set.

Layer 5 is called the output layer in which the single node computes the overall output by summing all the rules from the previous layer. The output, 5 is computed as,

5 = = =

ANFIS applies the hybrid-learning algorithm, which consists of the combination of gradient descent and least squares methods to update the model parameters.

Fig 6: Fuzzy rule viewer (X is current, Y is voltage and Z is SOC)

Fig 7: Actual data set

Fig 8: Training data set loaded in ANFIS toolbox

Fig 9: Surface viewer (X is current, Y is voltage and Z is SOC)


ANFIS makes full use of fuzzy logic reasoning which is simple, strong, robust and accurate along with neural networks. ANFIS model was able to estimate with an average testing error of 0.092696. It can be used in real-time applications for estimating the SOC of the battery in case of missing data/unavailability of data. Its much simpler to implement and provides an accurate SOC value.

Any battery data can be used to estimate the outcome irrespective of the specifications, its really handy in situations where other methods give error and are application-specific. Different battery conditions can be estimated with ease. The results have a high practical value. The artificial neural network can be implemented for any battery system provided enough training data is supplied. The SOC estimator based on ANFIS technique succeeds to compute the SOC with relatively low error.

4 Member Functions

16 Rules generated

Average testing error: 0.092696 plotting against generated FIS REFERENCES

  1. Hesham M.Fekry, M.A. Moustafa Hassan, The State of Charge Estimation for Rechargeable Batteries Using Adaptive Neuro Fuzzy Inference System (ANFIS), 2012 First Conference on Innovative Engineering Systems.

  2. Tiezhou Wu, Mingyue Wang, Qing Xiao, The SOC Estimation of Power Li-ion Battery based on ANFIS Model, 2012 Smart Grid and Renewable Energy.

  3. Sabine Piller, Marion Perrin, Andreas Jossen, Methods for State of Charge determination and their applications, 2001 Journal of Power Sources.

  4. Miguel A.Cristin Valdz, Jaime A, Ma. Jojutla, Estimating SOC in Lead- Acid batteries using Neural Networks in a Microcontroller-based charge- controller, 2006 International Joint Conference on Neural Networks.

  5. Baskar Vairamohan, Estimating the State of Charge of a Battery, 2003 Proceedings of the American Control Conference Denver.

  6. Martin Murnane, A closer look at State of Charge (SOC) and State of Health (SOH) estimation techniques for Batteries, Analog Devices Technical Article.

  7. Anirban Mukherjee, Advances in Battery Management using Neural Networks and Fuzzy Logic, 2002 Cornell University.

  8. Sharad Tiwari, Richa Babbar and Gagandeep Kaur, Performance evaluation of two ANFIS Models for predicting water quality index of river Satluj (India), 2018 Hindawi Advances in Civil Engineering.

  9. Mehmet Sahin and Rizvan Erol, Prediction of Attendance Demand in European Football Games: Comparison of ANFIS, Fuzzy logic and ANN.

  10. Krishna Veer Singh, Hari Om Bansal, Dheerendra Singh, Hardware in Loop Implementation of ANFIS based Adaptive SOC Estimation of Lithium-ion Battery for Hybrid Vehicle Applications, 2020 Journal of Energy Storage.

  11. Nidhi Kataria, A Comparative Study of the Defuzzification Methods in an Application, 2010 The IUP Journal of Computer Sciences.


Manish Kumar Mawatwal

B.E. (Electrical and Electronics)

R V College of Engineering

Aayush Mohanty

B.E. (Electrical and Electronics)

R V College of Engineering

Dr. Anitha G.S Associate Professor R V College of Engineering

Leave a Reply

Your email address will not be published. Required fields are marked *