Study on a High-Accuracy Real-Time Algorithm to Estimate SOC of Multiple Battery Cells Simultaneously

In traditional battery equalization strategy, open-circuit voltage (OCV) of battery cells was used to judge the difference of SOC between them. However, OCV is not only determined by SOC but also influenced by internal resistance, polarization voltage, capacity, and other nonlinear factors. As a result, OCV is not an ideal indicator of SOCdifferences, especially in transient conditions. In order to control battery consistency accurately, it is best to use SOC directly as standard for battery consistency judgment and control. To achieve this, an algorithm that can estimate SOC of multiple battery cells simultaneously with low computational complexity and high accuracy is needed. Limited by computing speed of Battery Control Unit (BCU), existing SOC estimation method is hard to estimate SOC of each battery cell simultaneously with high accuracy. In this research, a new SOC estimation strategy was proposed to estimate SOC of multiple battery cells simultaneously for battery equalization control. Battery model is established based on experimental data, and a processor-in-the-loop test systemwas established to verify the actual performance of the proposed algorithm. Results of simulation and test indicate that the proposed algorithm can estimate SOC of multiple battery cells simultaneously and achieved good real-time performance and high accuracy.


Introduction
Battery pack on EV is formed by connecting multiple battery cells together; since performance parameters of battery cells are different from one another, State of Charge (SOC) of these battery cells will be different in the process of using the battery pack.In the process of charging or discharging, battery cells with higher SOC or lower SOC are easier to get overcharged or overdischarged, resulting in a decline of performance and fatigue life of battery pack.The purpose of battery equalization control is to maintain the uniformity of SOC in all battery cells, so as to avoid overcharge or overdischarge of battery cells, and extend the fatigue life of battery pack [1].
In traditional battery equalization strategy, open-circuit voltage (OCV) of battery cells was used to judge the difference of SOC between battery cells.The main reason is that OCV is easy to measure and reflects SOC of battery cells in some extent.However, OCV of battery cell is determined not only by SOC but also by internal resistance, polarization voltage, capacity, and other nonlinear factors.As a result, OCV is not an ideal indicator of battery consistency.In order to control the battery consistency accurately, it is best to estimate SOC of each battery cell and use SOC as the standard for battery consistency judgment and control.
To use SOC as the indicator of consistency in battery equalization management, it is necessary to estimate SOC of each battery cell accurately in real time [2][3][4].Typical structure of battery management system on electric vehicles is shown in Figure 1; Battery Module is composed of several battery cells, the Battery Monitoring Circuit (BMC) collects voltage and current data of battery cells and sends them to Battery Control Unit (BCU), and algorithm to estimate SOC is operated in BCU.As computing speed of BCU is limited, the SOC estimation algorithm which can estimate SOC of multiple battery cells simultaneously with high accuracy is a key issue.Traditional SOC estimation algorithms such as open-circuit voltage method and AH counting method have low computational complexity, but SOC estimation accuracy of these algorithms is low and cannot meet the requirements of battery equalization management.Extended Kalman filter algorithm can estimate SOC with high accuracy, but it has high computational complexity, and it is hard to use this algorithm to estimate SOC of multiple battery cells simultaneously with limited computing speed of BCU [5][6][7].A new algorithm that can estimate SOC of multiple battery cells simultaneously with low computational complexity and high accuracy is needed for next generation of battery equalization management strategy.
In this research, a new SOC estimation strategy that can estimate SOC of multiple battery cells simultaneously with low computational complexity and high accuracy was proposed.In this strategy, the initial value of SOC is determined by open-circuit voltage, AH counting algorithm which has low computational complexity is used as the main procedure to estimate SOC of each battery cell, and extended Kalman filter algorithm was operated intermittently to correct the accumulated error of AH counting algorithm.Battery model is established based on experimental data, accuracy, and computational complexity of the proposed algorithm and traditional algorithms were compared with each other to verify the effectiveness of the new algorithm.The proposed algorithm was then transformed to C code and downloaded to BCU, based on which a processor-in-the-loop test system was established to verify the actual performance of the proposed algorithm.Results of simulation and processorin-the-loop test indicate that the proposed algorithm can estimate SOC of multiple battery cells simultaneously and can achieve good real-time performance and high accuracy.The proposed algorithm is suitable for next generation battery equalization control based on SOC of each battery cell.

A New Algorithm Used for Estimating SOC of Multiple Battery Cells Simultaneously
There are some shortcomings in the existing SOC estimation algorithms.Open-circuit voltage algorithm has low computational complexity, but it is only suitable for static condition when the vehicle is stopped.counting algorithm is one of the most widely used algorithms because it is easy to implement.However, AH counting algorithm has accumulated measurement error as time passes by.Furthermore, initial value of SOC is needed when AH counting algorithm is used; it is important to get an accurate initial value of SOC.The core concept of extended Kalman filter algorithm is to make optimal variance estimation of system dynamic.Extended Kalman filter can correct the initial error and has a strong noise suppression effect.However, extended Kalman filter algorithm has high computational complexity and cannot used to estimate SOC of multiple battery cells simultaneously with limited computing speed of BCU.
A new strategy is proposed to estimate SOC of multiple battery cells simultaneously with high accuracy and low computational complexity for battery equalization control.The new strategy operates as follows: (1) open-circuit voltage algorithm is used to get accurate initial value of SOC when vehicle is just starting up and battery cells were in static conditions; (2) after obtaining accurate initial value of SOC, SOC of multiple battery cells were estimated simultaneously by operating AH counting algorithm with low computational complexity for each battery cell; (3) accumulation error of AH counting algorithm increases with time passing by; extended Kalman filter algorithm is implemented to eliminate accumulation error of AH counting algorithm; (4) in order to keep computational complexity low, the extended Kalman filter algorithm operates for one battery cell after another and circles to the first battery cell after the last battery cell.As a result, only one extended Kalman filter algorithm is running at any moment; SOC of all battery cells were estimated with high accuracy and limited computational complexity.
Taking an example, when SOC of six battery cells is needed, time sequence of SOC estimation algorithm of six battery cells is shown in Table 1.Time sequence of SOC estimation algorithm in a single battery cell is shown in Figure 2.

Implementation of the Proposed Strategy
3.1.Battery Model Selection.The purpose of the proposed algorithm is to find a method to estimate the SOC with low computation and high precision, so it is necessary to take care of both computation and precision when choosing battery model.EKF algorithm contains matrix inversion steps; since first-order ECM has less matrix dimension compared to second-order ECM, using first-order ECM can reduce time complexity of the algorithm to a certain extent.Meanwhile, many researches and literature indicate that using secondorder ECM in EKF led to a slightly higher accuracy in SOC estimation than using first-order ECM.Generally speaking, using second-order ECM has higher SOC estimation accuracy but lower time efficiency and using first-order ECM has lower SOC estimation accuracy but higher time efficiency.
In the proposed algorithm, EKF and AH method were operated one after another in a circle loop; SOC estimation results of EKF will be used as the initial value of the following AH algorithm.Since SOC estimation accuracy of AH algorithm greatly depends on the accuracy of initial value, SOC estimation accuracy of EKF is a key issue in the proposed strategy.Based on these considerations, secondorder ECM which has slightly higher estimation accuracy is recommended.
In practical applications of the proposed SOC estimation strategy, we can choose to use first-order ECM or secondorder ECM in EKF according to the calculation speed of the BMS we use.If calculation speed of BMS is high enough, we can choose to use second-order ECM with higher accuracy; if calculation speed of BMS we use is not high enough to operate second-order ECM, we can choose to use first-order ECM with higher time efficiency and lower accuracy.In this paper, second-order ECM is selected.

Battery Modeling.
High-precision battery model is needed when using extended Kalman filter algorithm to estimate SOC.Battery model is established by theoretical analysis and we use experimental data to obtain parameters in the theoretical model.Second-order RC circuit model is a widely used theoretical battery model [8,9]; the model is shown in Figure 3, where   represents ohm resistance,  1 and  2 represent polarized resistance, and  1 and  2 represent equivalent capacitance.
According to the battery model, state equation and output equation of second-order RC model can be represented as follows: State variable in the battery model can be represented as State equation and observation equation of the secondorder RC circuit model can be represented as where   represents system state vector with time index k, input of the system is   , output of system is   ,   represents process noise, ]  is sensor noise, and , , , and  describe dynamics of the system.Charge and discharge experiment were carried out to obtain parameters in the theoretical model; battery testing device was shown in Figure 4. Parameters of second-order RC battery model obtained from experimental data were shown in Table 2.
In actual working conditions, current of batteries on EV changes drastically; an irregular discharge curve is used to verify the response speed and stability of the second-order RC battery model.Comparison of tested voltage and voltage  estimated by second-order RC model under the irregular discharge working conditions was shown in Figure 5.The difference of estimated voltage and tested voltage is shown in Figure 6.We can see from the result that the difference of estimated voltage and tested voltage is less than 0.048.Test results indicated that the proposed model can estimate voltage of the battery cells accurately.

Algorithm of the Proposed Strategy to Estimate SOC of
Multiple Battery Cells Simultaneously.In the proposed strategy, SOC of multiple battery cells were firstly estimated by operating AH counting algorithm with low calculation complexity for each battery cell simultaneously.AH counting algorithm can be represented as  AH counting algorithm has accumulated error and cannot correct by itself.Accumulated error of AH counting algorithm increases with time passing by; extended Kalman filter algorithm is implemented to eliminate accumulation error of AH counting algorithm.In order to keep computational complexity low, the extended Kalman filter algorithm operates for one battery cell after another and circles to the first battery cell after the last battery cell [10,11].The correction process can be represented as follows.
(1) State variable in the battery model can be represented as Formula ( 5) can be rewritten as a matrix, and a state equation can be obtained as The second-order RC circuit model has the following relationships: System observation equation can be represented as (2) Computation is carried out as follows: where x+1/ and  +1/ represent value of the state and error covariance at time k, x+1 and  +1 represent value of the state and error covariance after correction,   represents system process noise matrix,   represents measurement noise error matrix, and E represents unit matrix.

Control Logic of Timing
Sequence.The purpose of the proposed strategy is to estimate SOC of multiple battery cells simultaneously with low calculation complexity and high accuracy.Open-circuit voltage algorithm, AH counting algorithm, and extended Kalman filter algorithm used in the proposed strategy are coded in the Enabled-Subsystem.These algorithms were controlled to operate following the proposed strategy to reach low calculation complexity; thus timing sequence to control the operation of these algorithms is a key issue in the system.Control logic of timing sequence is consisting of a Timing-Sequence Module and an Output-Selection Module.
Operating principle of Timing-Sequence Module is shown in Figure 8.A clock is taken as the basis of Timing-Sequence Module to switch SOC estimation algorithm.In the first five seconds of vehicle start-up, open-circuit voltage algorithm operated to estimate initial SOC of all battery cells.After five seconds, Timing-Sequence Module generates control signals to control AH counting algorithm and extended Kalman filter algorithm to operate intermittently.
Taking a battery pack with twelve battery cells, for example, a twelve-number sequence from zero to eleven with interval time  is generated by Timing-Sequence-Generate Module. is the time to operate extended Kalman filter algorithm to eliminate accumulation error of AH counting method; the length of  is determined by converging speed of extended Kalman filter algorithm.Each battery cell has a Selection-Enable Module; these Selection-Enable Modules revive the number sequence generated by Timing-Sequence Module.When the revived number is the same as the number of the battery cells, the Selection-Enable Module then outputs enable or disable signals at three output ports according to the proposed SOC estimation strategy.The three SOC estimation algorithms are controlled by signals generated by Selection-Enable Module.
The operating principle of Output-Selection Module is shown in Figure 9.The function of Output-Selection Module is to change the output signal path so as to output the SOC estimate result of the algorithm which is operating.

Definition of Battery Pack SOC. SOC of battery pack is an
important parameter for vehicle control.The proposed SOC estimation algorithm has estimated SOC of each battery cell in a battery pack.Furthermore, it is necessary to convert SOC of each battery cell to SOC of the whole battery pack.The definition of pack capacity can be represented as follows [12,13]: where  pack represents the capacity of battery pack, min 1≤≤ (SOC    ) represents the minimum remaining capacity, min 1≤≤ ((1 − SOC  )  ) represents the minimum charging capacity, n is the number of cells in the battery pack, and i and  are the battery number.The definition of battery pack SOC can be expressed as The calculation principle of SOC pack is shown in Figure 10.

System Modeling and Simulation
A simulation model of a battery pack consisting of twelve battery cells was built using Matlab/Simulink.Model of this battery pack was built based on experimental data and second-order RC circuit model as in Section 3.1 of this paper.The proposed algorithm that can estimate SOC of multiple battery cells simultaneously was also coded using Matlab/Simulink.The system simulation model is shown in Figure 11.
FUDS is a battery discharge working condition usually used to test battery characteristic; the modeled battery pack and proposed algorithm were tested under FUDS.A comparison of SOC of battery cells estimated by proposed algorithm and true SOC of battery cells was illustrated in Figure 11.The proposed algorithm can estimate SOC of all twelve  battery cells simultaneously; only 3 of them were illustrated in Figure 11 so as to save space.The true SOC illustrated in Figure 11 is calculated from the experimental data recorded by CT-4002 charge-discharge test device as shown in Figure 4.
As we can see from Figure 12, SOC of all twelve battery cells were estimated by the proposed algorithm simultaneously.Usually, SOC of battery cells were estimated by the AH counting algorithm; as time goes by, accumulated error of AH counting algorithm increases, so estimation of SOC deviated from the tested one.At particular times controlled by control logic of timing sequence of proposed SOC estimate strategy, extended Kalman filter intermittently operates to correct accumulation error of the AH counting algorithm.As a result, errors between SOC estimated by the proposed

Yes Yes Yes Yes No No
No No strategy and true SOC tested by the experiment stayed in a relatively small range.Accuracy and computational efficiency of the proposed algorithm were verified.
SOC of battery pack is an important parameter for vehicle control strategy.SOC of battery pack was estimated according to the definition in Section 3.5.Comparison of SOC of battery pack estimated by the proposed algorithm, AH counting method, open-circuit voltage method, and extended Kalman filter and true SOC of battery pack tested by experiment under FUDS was illustrated in Figure 13.SOC estimation error is shown in Figure 14.The SOC estimation error of open-circuit voltage method is shown in Figure 14(a).The SOC estimation error of AH counting method is shown in Figure 14(b    Figure 14(c).The SOC estimation error of proposed algorithm is shown in Figure 14(d).As shown in Figure 14(a), the accuracy of SOC estimated by OCV method is low, but it can get accurate initial value of SOC when vehicle is just starting up and battery cells were in static conditions.As shown in Figure 14(b), AH counting algorithm cannot correct error by itself; as time goes by, the error of SOC estimation will be bigger and bigger.As shown in Figure 14(c), the error between estimated SOC of EKF and true SOC tested by experiment is less than 0.025.As shown in Figure 14(d), the proposed algorithm operates extended Kalman filter intermittently to correct accumulation error of the AH counting algorithm, so its SOC estimation accuracy is a little lower than EKF alone but higher than AH counting algorithm alone.Excluding SOC below 0.17, the error between the estimated SOC of the proposed algorithm and true SOC is less than 0.035.
We can see from Figure 14 that EKF has the highest accuracy, but EKF algorithm has high computational complexity and cannot be used to estimate SOC of multiple battery cells simultaneously with limited computing speed of BCU.The accuracy of the proposed algorithm is a bit lower than EKF but the computational complexity of proposed algorithm is much better and suitable for estimating SOC of multiple battery cells simultaneously for battery equalization control.Taking both accuracy and computational complexity into consideration, the proposed algorithm has the most potential to use in battery equalization control that uses SOC directly as standard for battery consistency judgment.The computational complexity of EKF and the proposed algorithm will be analyzed and tested in detail in the next section.

Time Complexity Analysis of the Proposed Algorithm.
Computational efficiency of C program depended greatly on time complexity of the intrinsic functions of the program [14].Computational efficiency of C code not only is decided by microcontroller's response capability to various emergency interrupt requests, but also depends on calculation speed of the microcontroller.The purpose of the proposed algorithm is to estimate SOC of multiple battery cells with high accuracy and low computational complexity; it is necessary to evaluate computational complexity of the proposed algorithm.
The discrete difference formula of traditional AH counting algorithm can be represented as where  represents input of the integral, y represents output, K represents gain of input signal, and   represents the interval time of sampling.
From (12), we can see that the execution frequency of AH counting algorithm is  1 () = .The execution frequency of extended Kalman filter algorithm can be calculated according to formula of extended Kalman filter in Section 3.2; it is  2 () =  2 + 1.In the proposed algorithm, only one cell of the twelve battery cells operates the extended Kalman filter algorithm at any specific time, and the rest of the battery cells operate AH counting algorithm.As a result, execution frequency of the proposed algorithm can be represented as  3 () =  2 + .On the basis of order of magnitude, computational complexity of the proposed algorithm can be represented as follows: Computational complexity of extended Kalman filter algorithm to estimate one battery cell is  2 () = ( 2 ()) = ( 2 ).
In conclusion, the computational complexity of the proposed algorithm is of the same order of magnitude as that of extended Kalman filter algorithm, but it can estimate SOC of twelve battery cells simultaneously.Therefore, the proposed algorithm has great advantages in reducing the use of microcontroller computing resources and is suitable for battery equalization control.

Processor-in-the-Loop Tests.
A processor-in-the-loop (PIL) test was carried out to verify the effectiveness of the proposed algorithm.In the test, C code of the proposed algorithm was downloaded to an actual microcontroller of BCU [15].A high-precision battery model built based on test data was operated in an industrial computer.The microcontroller is connected to the industrial computer through a serial port to achieve data exchange.The PIL system provides a platform close to real working environment to verify the effectiveness of the proposed algorithm.
In the PIL test system, Spansion MB9BF568R 32-bit microcontroller is used as BCU.Battery model based on test data was built with Simulink and transformed to C code and downloaded to industrial computer.SOC estimation algorithms were built with Simulink and transformed to C code; IAR Embedded Workbench compiler and J-link are used to compile and download C code to BCU.The industrial computer and BCU were connected with a serial port to transmit data.Processor-in-the-loop test platform is shown in Figure 15.
To verify the computational efficiency of the proposed algorithm, two tests were carried out on the PIL system:  ( other, which indicates that the proposed algorithm can run in BCU effectively and accurately.Meanwhile, in test two, the BCU operating twelve traditional extended Kalman filter algorithms at the same time to estimate SOC of twelve battery cells was unable to give a result, which indicates that the calculation quantity exceeds the calculation ability of BCU.
PIL test results indicate that the proposed algorithm achieved good real-time performance and high SOC estimation accuracy.The computational complexity of the proposed algorithm is much better than EKF alone and suitable for estimating SOC of multiple battery cells simultaneously.Taking both accuracy and computational complexity into consideration, the proposed algorithm has the most potential to use in battery equalization control which uses SOC directly as standard for battery consistency judgment.

Conclusions
(1) In traditional battery equalization strategy, opencircuit voltage (OCV) of battery cells was used to judge the difference of SOC between them.However, OCV is not only determined by SOC, but also influenced by internal resistance, polarization voltage, capacity, and other nonlinear factors.As a result, OCV is not an ideal indicator of SOC differences, especially in transient conditions.In order to control battery consistency accurately, it is best to use SOC directly as standard for battery consistency judgment and control.To achieve this, an algorithm that can estimate SOC of multiple battery cells simultaneously with low computational complexity and high accuracy is needed.
(2) Limited by computing speed of Battery Control Unit (BCU), existing SOC estimation method is hard to estimate SOC of each battery cell simultaneously with high accuracy.In this research, a new SOC estimation strategy was proposed, in which AH counting algorithm with low computational complexity is used as the main procedure to estimate SOC of each battery cell, and extended Kalman filter algorithm with high accuracy was operated intermittently to correct accumulated error of AH counting algorithm.
(3) Battery model is established based on experimental data, and the proposed algorithm was programmed by Simulink.Simulation and test results indicate that, excluding the SOC below 0.17, error between estimated SOC and true SOC tested by experiment is less than 0.035.
(4) A processor-in-the-loop test system was established to verify the actual performance of the proposed algorithm.Results of simulation and tests indicate that the proposed algorithm can estimate SOC of multiple battery cells simultaneously and achieved good realtime performance and high accuracy.

Figure 6 :
Figure 6: The difference of estimated voltage and tested voltage.

Figure 10 :
Figure 10: The calculation flow chart of SOC pack .

Figure 13 :
Figure 13: Comparison of SOC estimated by the proposed algorithm, EKF, AH counting method, and OCV method and true SOC tested by experiment under FUDS.
(c) SOC estimation error of EKF method alone SOC error SOC (d) SOC estimation error of the proposed method

Figure 16 :
Figure 16: PIL test results of test one.

Table 1 :
Time sequence of new SOC estimation strategy for multiple battery cells.

Table 2 :
Parameters of second-order RC battery model obtained by experimental data.