A Regression-Based Technique for Capacity Estimation of Lithium-Ion Batteries

: Electric vehicles (EVs) and hybrid vehicles (HEVs) are being increasingly utilized for various reasons. The main reasons for their implementation are that they consume less or do not consume fossil fuel (no carbon dioxide pollution) and do not cause sound pollution. However, this technology has some challenges, including complex and troublesome accurate state of health estimation, which is affected by different factors. According to the increase in electric and hybrid vehicles’ application, it is crucial to have a more accurate and reliable estimation of state of charge (SOC) and state of health (SOH) in different environmental conditions. This allows improving battery management system operation for optimal utilization of a battery pack in various operating conditions. This article proposes an approach to estimate battery capacity based on two parameters. First, a practical and straightforward method is introduced to assess the battery’s internal resistance, which is directly related to the battery’s remaining useful life. Second, the different least square algorithm is explored. Finally, a promising, practical, simple, accurate, and reliable technique is proposed to estimate battery capacity appropriately. The root mean square percentage error and the mean absolute percentage error of the proposed methods were calculated and were less than 0.02%. It was concluded the geometry method has all the advantages of a recursive manner, including a fading memory, a close form of a solution, and being applicable in embedded systems.


Introduction
The availability of new energy sources to different countries is fundamental for their economic development [1]. It is well known that petrol and diesel fuel vehicles lead to a significant amount of greenhouse gasses such as CO 2 , which has severe and dangerous effects on the environment cause global warming [2]. Currently, lithium-ion batteries for electric vehicles (EVs) and hybrid electric vehicles (HEVs) are the most promising propulsion alternative to internal combustion engines (ICEs) due to not producing carbon dioxide and sound pollution. Thus, in the not-too-distant future, we will essentially see the replacement of many ICE vehicles with EVs and HEs and this replacement process has already started. The central part of these vehicles is a rechargeable battery that must have reasonable and acceptable efficiency [3]. Lithium-ion batteries have many benefits in comparison to other types of batteries, such as higher energy capacity, longer functional life, and less self-discharge in comparison with different kinds of rechargeable batteries, such as Ni-Cd batteries, which makes them attractive for many different applications, such as portable electronic devices, electric vehicles, and stationary storage [4,5]. Therefore, this battery is attracting the attention of the electric vehicle industry [5].
A lithium-ion battery pack consists of a considerable number of battery cells, which are connected in series and parallel. Despite the above-mentioned advantages, there are also some challenges, such as costs, cycling stability, and safe operation. Parameters such as charge and discharge rate, temperature, and voltage range will influence the safety of the battery. If critical limits of these parameters are exceeded, this will accelerate the degradation, and thus reduce the battery performance, and may even become dangerous due to the increased risk of a thermal runaway.
Furthermore, it is crucial to have an exact measurement of lithium-ion battery total capacity and to provide the ability to predict the remaining useful life (RUL) over the entire service duration in order to ensure the trusted and safe operation of these batteries [6]. This RUL prediction ability represents an essential part of the battery management system (BMS), which is needed to keep the battery operational in a safe, trusted, and reliable state under all conditions. This unit includes complex electronic circuitry and dedicated algorithms, which control the battery function [7].
Batteries age through regular use and during storage and transport with (simultaneous) exposure to temperature. For example, changes in the crystal chemistry of the active materials occur due to frequent cycling combined with cracking of the particles and formation of a new solid-state electrolyte interface SEI (consumption of electrolyte and lithium). Two parameters show the ageing status of a battery. The first is the battery's total capacity, which is given by Q, and the second is equivalent internal resistance R e . When Q has decreased to 80% of the initial (or nominal) capacity in an electric car, it is recommended to replace the battery because it cannot satisfy the high requirements for such applications. However, it could still be used in a second life application. Such an application could be, e.g., a stationary battery for peak shaving, which needs a lower depth of discharge (DOD) and less power. Similarly, if R e grows to 160% of its initial value, the battery in an EV needs to be replaced as well [8,9].
The state of health (SOH) is defined as the ratio of the currently measured maximum battery charge to its nominal capacity. The following equation shows how the SOH parameter is expressed as a percentage: in which Q act and Q nom are the total capacity and the nominal capacity, respectively [9]. The most general and common method, which is used in the laboratory to estimate SOH, is coulomb counting (CC). At first, the fully charged battery is discharged to the 0% state of charge defined by the manufacturer in particular conditions, and the whole ampere-hour, which is discharged, is being measured. Then SOH is calculated by dividing discharged ampere-hour value by the initial capacity [10]. As mentioned above, this method is only used to collect data in the laboratory. Existing capacity estimation methods and SOH estimation could be categorized into three groups.
The first group includes the physics-based methods that use partial differential equations to model battery electrochemical properties and thermal behavior. Even though these methods have high accuracy, they are not suitable for online use because of the high calculation load [11].
The second group includes data-driven models that estimate battery capacity by analyzing such characteristics as voltage and extracting some unique features. This method is strongly correlated to battery ageing without any mathematical model. In the ICA method, for instance, the IC curve is obtained by the following equation: Plateaus observed in the voltage curve are transformed to characteristics as identifiable peaks. Some particular features of these peaks, such as height, area, and position, are directly related to battery capacity and make the battery state of health estimation  [12]. Differential voltage analysis (DVA) is another method of this group. The differential voltage (DV) curve is defined as voltage gradient divided by actual capacity: Then SOH is analytically calculated by making a relationship between DV and SO. characteristics [13]. However, despite their advantages, these methods face fundamental challenges that limit their application. For example, IC and DV curves are subjected to noise and should be smoothed before using for estimation. The smoothing process needs some computational effort. Temperature variation affects their accuracy and makes capacity prediction infected with error. In addition, charging and discharging characteristics used to extract IC and DV curves are different from the actual usage profile. Other data-driven methods exist that use algorithms such as fuzzy logic and neural network. Experimental data of complicated and nonlinear systems can be processed by a fuzzy rule set of the fuzzy logic (FL) method. There are two sets of data: crisp and fuzzy. When data are divided by definite values, they belong to a crisp group, and if they are categorized by uncertainty, they belong to the fuzzy group. Membership functions determine members of fuzzy sets. The more the appropriate membership function is defined, the better prediction of SOH will be obtained [14,15]. In [15], a relationship between several cycles and the normalized value of battery capacity is received by an exponential curve-fitting on NASA data as follows: It uses the local estimation form of y = ae −βx to reduce the number of parameters. Then it applies the impact of parameters such as temperature, current, and DOD by three membership functions of fuzzy logic that modify a and β factors. A disadvantage of this model is that a significant number of data are needed to define membership functions, and thus, many laboratory tests are necessary to obtain enough data in particular operating conditions. A neural network (NN) is a powerful tool that can manage a significant amount of data in a highly complex nonlinear system. One of the advantages of a NN is that it is not necessary to have detailed knowledge about battery characteristics. A robust algorithm that can accurately predict SOH in different working conditions is another benefit of NN [16]. High computational load and cost are the main obstacles in implementing the NN algorithm. Another limitation to obtaining accurate answers is data training that must work with a considerable amount of different data [17]. Sample entropy (SE) is a method that records oscillation, instability, and complication of the battery's voltage response in capacity fade duration. Therefore, it is a kind of diagnostic tool that can record battery capacity. This method commonly uses other ways to have more accurate results [18].
The third group is empirical-based methods that describe battery behavior by employing phenomenological elements such as equivalent circuit models (ECM). The accuracy of these strategies is not as high as physics-based methods, but the computational load is much lower. In addition, empirically based approaches do not face the aforementioned challenges of the data-driven process. An example of these kinds of models is the impedance spectroscopy method that estimates SOH using a broad frequency spectrum. Computing equivalent circuit model parameters make estimation easier [19].
Algorithms and filters are used to achieve faster and more accurate results. Kalman Filter (KF) is a powerful algorithm that can precisely estimate SOH parameters. For nonlinear systems, the KF is more reasonable. In addition, nonlinear systems use some modified types of this algorithm, such as dual extended Kalman filter (DEKF) and unscented Kalman filter (UKF) [20]. Particle filter (PF) uses sampling and resampling (Sequential Monte Carlo) algorithm, and a collection of weighted particles to solve filtering problems is used to estimate the probability density function (PDF) [21].
The main factor determining whether electric vehicles (EVs) earn their place in daily applications is batteries lifetime. Choosing a mathematical model that models the physical dynamics and constraints of a battery with high precision is crucial to increase estimation accuracy. Therefore, the chosen model should be able to cover errors from uncontrollable working conditions, sensor inaccuracies, and other noise sources to enable an accurate estimation. This paper used an ECM of the battery, which gave the relationship between SOC and the total capacity Q. In addition, the SOC data were obtained by providing voltage and current data as input to this model. Then, this relationship was rearranged to a form of y = Qx that made it possible to estimate Q by the regression (least squares) method. Different forms of the least-squares method are proposed in this article, and the results are compared.
The main contributions of the proposed methods are as follow: • Current measurement error and SOC estimation error are considered in the proposed method.

•
The proposed methods are closed-form and recursive. This means they do not need high computational effort and high memory space.

•
In addition, a proposed method is fading memory. This gives weight to recent data and fades the effect of early data. This makes proposed methods applicable in online applications and increases capacity estimation during several cycles for SOH estimation.
The following three sections of the article provide some reasons for the ageing of lithium-ion batteries, describe the capacity estimation method, and show the validation of the model using experimental data. In the end, some conclusions are given.

Reasons for Lithium-Ion Batteries Ageing
Capacity decrease and power fade of lithium-ion batteries are complicated phenomena that originated for various reasons. Processes influence the calendar life of the battery during storage, such as impedance rise and self-discharge. Whereas ageing processes occur during use, such as lithium metal plating, mechanical degradation affects cycle life. It should be considered that ageing processes with cycle life and calendar life originated from changes of:
A straightforward model of electrodes is shown in Figure 1. Battery power results from ion transition between electrodes. The power will decay if this transition is disrupted or damaged. Side reactions include structural decay and are the main cause of disruption of the ion current [22,23].
This phenomenon degrades lithium-ion batteries over time and changes their parameters. It is well established that SEI growth and lithium plating are essential ageing mechanisms in modern lithium batteries. Therefore, it is necessary to estimate ageing parameters and adjust some of them to manage battery packs. These estimations algorithms are part of the BMS unit.
One of the approaches to evaluate lithium-ion battery ageing is to model its behavior by electrical elements, known as equivalent circuit model. This is a prevalent method due to a tradeoff between accuracy in open-circuit voltage estimation and computational load [24][25][26][27]. The equivalent circuit method is shown in Figure 2, and our approach to estimating SOC is to calculate the value of equivalent-series resistance and total capacity. Both side reaction and structural decay will reduce the lithium-ion storage capability in one or both electrodes, reducing total capacity, known as capacity fade. The cell's series resistance will increase with ageing and result in power fade. Some ageing mechanisms, such as structural decay and SEI growth, could happen even in the rest time of the battery. This phenomenon degrades lithium-ion batteries over time and changes their parameters. It is well established that SEI growth and lithium plating are essential ageing mechanisms in modern lithium batteries. Therefore, it is necessary to estimate ageing parameters and adjust some of them to manage battery packs. These estimations algorithms are part of the BMS unit.
One of the approaches to evaluate lithium-ion battery ageing is to model its behavior by electrical elements, known as equivalent circuit model. This is a prevalent method due to a tradeoff between accuracy in open-circuit voltage estimation and computational load [24][25][26][27]. The equivalent circuit method is shown in Figure 2, and our approach to estimating SOC is to calculate the value of equivalent-series resistance and total capacity. Both side reaction and structural decay will reduce the lithium-ion storage capability in one or both electrodes, reducing total capacity, known as capacity fade. The cell's series resistance will increase with ageing and result in power fade. Some ageing mechanisms, such as structural decay and SEI growth, could happen even in the rest time of the battery.

Calculation of
The equivalent circuit model for the battery is shown in Figure 2; the relationship between circuit parameters are given by the following equation:  This phenomenon degrades lithium-ion batteries over time and changes their parameters. It is well established that SEI growth and lithium plating are essential ageing mechanisms in modern lithium batteries. Therefore, it is necessary to estimate ageing parameters and adjust some of them to manage battery packs. These estimations algorithms are part of the BMS unit.
One of the approaches to evaluate lithium-ion battery ageing is to model its behavior by electrical elements, known as equivalent circuit model. This is a prevalent method due to a tradeoff between accuracy in open-circuit voltage estimation and computational load [24][25][26][27]. The equivalent circuit method is shown in Figure 2, and our approach to estimating SOC is to calculate the value of equivalent-series resistance and total capacity. Both side reaction and structural decay will reduce the lithium-ion storage capability in one or both electrodes, reducing total capacity, known as capacity fade. The cell's series resistance will increase with ageing and result in power fade. Some ageing mechanisms, such as structural decay and SEI growth, could happen even in the rest time of the battery.

Calculation of
The equivalent circuit model for the battery is shown in Figure 2; the relationship between circuit parameters are given by the following equation:

Capacity Estimation
The equivalent circuit model for the battery is shown in Figure 2; the relationship between circuit parameters are given by the following equation: In the above equation, v b,k and i b,k are the battery voltage and current, OCV(SOC k ) is the open-circuit voltage that is a function of state of charge, Mh k is hysteresis voltage, R i i R i,k is the multiple of i th resistance of capacitor-resistance nets in the corresponding current, and i b,k R e is the multiple of series resistance in the battery current.
If we define S Re vb as the sensitivity of voltage to rate of change in resistance R e , we have: The equation shows that bigger i b,k leads to higher sensitivity to changes in R e . In this part a method is described for estimating of R e by subtracting v b,k of two adjacent samples: As can be seen, the rate of change in R e is impressively bigger than other variables in the equation:R whereR e,k is the estimated and not exact value of R e,k . It should be considered thatR e could be estimated only when ∆i b,k = 0. In this regard, a minimum limit value has been considered in the simulation as the threshold in order to not consider minimal values of ∆i b,k . Therefore, using a filter simply can reduce the error: where 0 α < 1. The equivalent series resistance is SOC-dependent and temperaturedependent. By defining a vector of R e in different SOC levels, the first problem will be solved, and by adopting a matrix of resistance for various temperature and SOC levels, both will be solved.

Proposed Methods to Estimate Q
Here we define a parameter that shows voltage variation proportional to capacity, similar to the last part: The derivative of components in parenthesis was computed as the following equation: In most battery cells, is very small. The equation which was derived from SOC relationships can be rewritten as the following equation: In which SOC[k] is state of charge, η[k] is columbic efficiency, which shows the consumer will not receive the whole charge stored in the battery due to some unwanted side reactions. In addition, a tiny part of it is being lost. Usually, this parameter is very near to one. ∆t is sampling time for discretization, i b [k] is battery current, and Q is the total capacity of the battery.
It can be derived from the following equation that the sensitivity of voltage to capacity through hysteresis term is minor and zero through other terms. So total capacity is not observable [28].
It can be seen from the above equation that increases while the direction of i b [k] does not change in a considerable period. This is because of ∆t (by order of 1/3600 or less).
In this part, a procedure is described to analyze some possible methods of estimating Q and their disadvantages. Finally, an approach is proposed to have an accurate, robust estimate of Q.
Considering Equation (13), we have: The above equation could be rewritten as: By defining Y = −∆t , it could be written in a linear format: Y = QX.

The First Type of Least Squares Method
The standard (weighted least squares) linear regression is the first investigated method to solve the above equation. By considering ∆y as the noise on measurement and uncertainties of y, the form of the problem is: In the above equation, ∆y includes zero-mean Gaussian random variables with variances of σ 2 y i . The estimated Q could be shown byQ, then y ≈Qx, can be solved by using vectors of measured data of x and y: In this level, theQ is estimated which minimizes the following first type of leastsquares (LS1) cost function: In which Y i is the exact value of Y without noise (Y i =Qx i ). By differentiating the above cost function concerningQ and setting it to zero, the following equations could be determined: , the following statement can be derived: C 1 and C 2 could be updated recursively by the following equations. Those as mentioned above could be determined when each new (x i ,y i ) datum is received: Minimum storage requirement and computational load are advantages of the recursive manner in equations, and it is essential for implementing in BMS and other embedded units.
By increasing the number of data pairs, data volumes are weighted, and new data pairs cannot significantly affect the results. Therefore, there is a need to change the method to fade older data pairs' power on results as the number of data pairs increases. Therefore, a coefficient such as 0 γ < 1 can solve this issue: This method (LS1) could be an acceptable method if there were no measurement noise or uncertainty of x i , but in reality, the error in SOC estimation will never be totally eliminated. The solution could be the second type of least squares.

The Second Type of Least Squares Method
By considering noise of x i , the linear form of the problem changes as: where ∆y and ∆x are white noise with zero mean and known variances of σ 2 y i and σ 2 x i . The cost function is rewritten as: In which the last term applies constraint of Y i =QX i with Lagrange multipliers of λ i . By differentiating cost functions with respect to X i , Y i , and λ i , setting them to zero, and placing the results in the cost function, new equations can be derived. The function with known and straightforward terms can be reached by employing the following equations: By replacing these quantities in cost function: The partial derivative of the cost function can be calculated with respect toQ, and it can be considered zero in order to find optimizedQ by employing the following equations: Numerical methods are able to solve this equation, and the Newton-Raphson method is one of them. A noise of x i can be considered, but the equation has not reached a close form, which means deriving an equation withQ on one side and other parameters on the other side. Subsequently,Q cannot be updated in a recursive manner, and it means a huge computational load and a need for large storage memory. Thus, this method is not practical and not applicable in embedded systems. Therefore, the third type of least squares method is proposed in the following.

The Third Type of Least Squares Method
Another method to simply achieve an exact estimation ofQ, is a kind of least squares in which σ x i and σ y i are proportional for every i. If σ x i = Kσ y i , the previous cost function changes as: and then the derivative of the function is rewritten as follows: In which C 3,n is defined as: . The above second-order equation can be easily solved by employing the following equations: By utilization of the Routh array, it can be proven that there is one positive and one negative root for the above equation in two sides of the imaginary (vertical) axis. If the term under the radical sign is negative, there are two complex roots for the equation where both of them are on the right side of the vertical axis, which cannot be accurate. Due to the last fact, there are two real roots, and one of them is positive. So, the positive root in recursive fading manner is calculated as: In which C 1,n = γ C 1,n−1 + x 2 n /σ 2 y i , C 2,n = γ C 2,n−1 + x n y n /σ 2 y i , and C 3,n = γ C 3,n−1 + y 2 n /σ 2 y i . For initial values, it is known from the equation Y i =QX i if the cell's charge is equal to 1 (100%), then Y = Q nom . So C 1,0 = 1/σ 2 y i , C 2,0 = Q nom /σ 2 y i and C 3,0 = Q nom 2 /σ 2 y i .

Confidence Intervals
In order to validate the certainty of the answer, a range of assurance could be defined that guarantees the certainty of the estimated capacity if it lies in the range and is in a reasonable span. In this regard, the least-squares problem is rearranged to the following format in order to have a maximum likelihood optimization problem and to be able to calculate δQ 2 with Cramer-Rao theorem.
Minimizing cost function is identical to maximizing the following maximum likelihood problem: In which y and x are vectors including y i and x i elements and ∑ y is a diagonal matrix including diagonal elements of σ 2 y i . If we consider a d vector that joins y and x together, and ad vector which joins corresponding elements of Y i and X i , and ∑ d which is a diagonal matrix including σ 2 y i and sequentially σ 2 x i , then: Retrieved from Cramer-Rao theorem, the lower limit ofQ variance is obtained by following inequality, in which the right-side term will maximize maximum likelihood problem equations for the first and second type of least squares:

Geometry Method
The next proposed method is feasible to perform, but in practice, the noise of σ x i and σ y i are not necessarily proportional. An approach is suggested in which noise of σ x i and σ y i can adopt any free independent value, reaching a recursive close form solution based on geometry relationships. The geometry method is illustrated in Figure 3. In Figure 3 there is a pair of data, ( ) leads to less space to its map i A particular state of this method is to consider equal errors, which means In this form, the line connects ( )  In Figure 3 there is a pair of data, (x i , y i ), which are measured x and y, and (X i , Y i ) is the optimized image of that pair on Y =QX. The arrows of δx i and δy i indicate uncertainties for each dimension and are proportional to σ x i and σ y i . The variances of σ 2 x i and σ 2 y i are free as mentioned above. Therefore, the distance of (x i , X i ) is not necessarily the same as (y i , Y i ). More quality in the data measurement of x i (or y i ) leads to less space to its map X i (Y i ).
A particular state of this method is to consider equal errors, which means σ x i =σ y i . In this form, the line connects (x i , y i ) and (X i , Y i ) is perpendicular to Y =QX line. As can be seen in Figure 3, the gradient (or slope) of Y =QX line isQ = ∆y i /∆x i and the angle of θ is equal to tan −1Q . The length of the perpendicular line between the data point and the line is R i = ∆y i cos θ = ∆y i / 1 +Q 2 . Moreover, there are δx i = R i sin θ and δy i = R i cos θ. A cost function is defined as: By considering sin θ 2 = 1 − cos θ 2 =Q 2 1+Q 2 : Moreover, by considering ∆y i = y i −Qx i , the cost function will be rewritten as: By applying the assumption of σ x i = σ y i the following equation is reached: The above equation is equal to the Equation number (38). By adding γ as a fading memory element to the cost function, the following equation can be achieved: As in the previous sections, the derivative of the cost function with respect toQ must be calculated and be set to zero in order to find the optimal value forQ.

Total Geometry Method
As the last method the total geometry method is proposed, which can be considered as a general form of the geometry method by assuming equality in σ x i and σ y i values. Nevertheless, there should be a solution while these two values are not equal. When σ x i = kσ y i (with variable k in different pairs of data) y i axis could be scaled as y i = ky i to use the mentioned trigonometric relations of this method. Therefore, we have σ y i = σ x i and the estimated value of capacity by the scaled data isQ c =Q/k, and clearly k is estimated as k = σ x i /σ y i .

Validation by Experimental Data
In order to evaluate the proposed Re and capacity estimation methods, experimental data of laboratory tests at 25 • C from [29] were utilized; afterwards, a third type of leastsquares method, including geometry method and total geometry method, were simulated in MATLAB. It should be noted that other types of least squares were not simulated due to not being applicable in the BMS unit. The state of charge has been estimated by the method introduced in [30]. The parameters are quantified in Table 1. The diagram for Re estimation is shown in Figure 4.  Figures 5 and 6 demonstrate the current and voltage characteristic of the battery, correspondingly. As can be seen, a specific load pattern was applied to the batteries. Unfiltered and filtered Re results are shown in Figure 7. The diagram of the simulation process for capacity estimation is given in Figure 8. The simulation results and the comparison of the different techniques are illustrated in Figures 9 and 10, respectively. The blue and red lines represent the confidence interval of the estimated value. As observable in these diagrams, the simulation results of all methods are very close together. The total geometry method shows an initial rise, but it converges to the nominal value as with other methods in the continuation. The geometry method has all the advantages of a recursive manner, a fading memory, a close form of solution, and is considering both errors of i x σ and i y σ . Therefore, it is applicable in embedded systems and is the most practical method.  Experimental data of laboratory tests from [29] were utilized. Figures 5 and 6 demonstrate the current and voltage characteristic of the battery, correspondingly. As can be seen, a specific load pattern was applied to the batteries. Unfiltered and filtered Re results are shown in Figure 7. The diagram of the simulation process for capacity estimation is given in Figure 8. The simulation results and the comparison of the different techniques are illustrated in Figures 9 and 10, respectively. The blue and red lines represent the confidence interval of the estimated value. As observable in these diagrams, the simulation results of all methods are very close together. The total geometry method shows an initial rise, but it converges to the nominal value as with other methods in the continuation. The geometry method has all the advantages of a recursive manner, a fading memory, a close form of solution, and is considering both errors of σ x i and σ y i . Therefore, it is applicable in embedded systems and is the most practical method.            (c) Figure 9. The results of simulation for (a) least squares method, (b) geometry method, (c) total geometry method. The RMSPE (root mean square percentage error) and the MAPE (mean absolute percentage error) of the proposed methods were calculated by discharge cycle data of a roughly 9 h-long experiment, and are shown in Table 2. The value of the results is based on random noise produced in MATLAB. These varied in each simulation time but were always less than 0.02%, which is a favorable method accuracy.

Conclusions
Lithium-ion batteries are widely used in electric vehicles due to their advantages, such as higher capacity and long cycle life, in comparison with other batteries. In this article, the lithium-ion battery capacity estimation was investigated. Analysis of state of health and remaining useful life is essential for the battery management system unit to The RMSPE (root mean square percentage error) and the MAPE (mean absolute percentage error) of the proposed methods were calculated by discharge cycle data of a roughly 9 h-long experiment, and are shown in Table 2. The value of the results is based on random noise produced in MATLAB. These varied in each simulation time but were always less than 0.02%, which is a favorable method accuracy.

Conclusions
Lithium-ion batteries are widely used in electric vehicles due to their advantages, such as higher capacity and long cycle life, in comparison with other batteries. In this article, the lithium-ion battery capacity estimation was investigated. Analysis of state of health and remaining useful life is essential for the battery management system unit to better manage the cells in the battery pack and for better power estimation. For this purpose, a practical and confident method was proposed to estimate two essential parameters, R e and Q, which together represent battery state of health.
The battery's current and voltage are the only data needed to estimate both R e and Q parameters. Different approaches to the least-squares method were analyzed, and finally, the least-squares-based-geometry method was chosen. It was concluded that the leastsquares techniques have many advantages. Some of the benefits of least squares methods in comparison with other methods are as follows:

•
This method can estimate state of health of the battery in an online condition while the battery is being used in the vehicle (it is not only a method for the laboratory); • It does not need extensive experiments in the laboratory to obtain charge and discharge curves; • It does not need a significant number of datasets and learning processes; • Even if it is better to have a more accurate model of the battery, this method can provide satisfying results without precise knowledge of the model; • It does not have a high computational load and does not need a large data memory.
In addition, the advantage of the geometry method in comparison with other approaches of least squares is that noise of both x i and y i are considered, and it has fading memory recursive close form solution. Therefore, it is applicable in embedded systems.
The validation of the proposed methods was accomplished by using experimental data from a laboratory test of a battery. The proposed methods were applied to these data using MATLAB Simulink, the results were compared, and the errors evaluated.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.