A Novel Optimal Charging Algorithm for Lithium-Ion Batteries Based on Model Predictive Control

Lithium-ion (Li-ion) batteries play a substantial role in portable consumer electronics, electric vehicles and large power energy storage systems. For Li-ion batteries, developing an optimal charging algorithm that simultaneously takes rises in charging time and charging temperature into account is essential. In this paper, a model predictive control-based charging algorithm is proposed. This study uses the Thevenin equivalent circuit battery and transforms it into the state-space equation to develop the model predictive controller. The usage of such models in the battery optimal control context has an edge due to its low computational cost, enabling the realization of the proposed technique using a low-cost Digital Signal Processor (DSP). Compared with the widely employed constant current-constant voltage charging method, the proposed charging technique can improve the charging time and the average temperature by 3.25% and 0.76%, respectively.


Introduction
As portable electronics and electric vehicles flourish, the importance of secondary batteries has gradually increased. Among the secondary batteries, the lithium-ion (Li-ion) battery has become the mainstream due to its features of a high energy density, long cycle life, and having no memory effect. Due to the reduction in the Li-ion battery's cost, it has been widely applied to portable consumer electronics, electric vehicles, and large power energy storage systems. A good charging method is essential to Li-ion batteries for it is related to many factors, such as charging efficiency of the battery, charging temperature rise, charging time, and cycle life. All factors need to be taken into consideration while conduct battery charging; it is imperative to develop the optimal charging technology. Currently, the constant current-constant voltage (CC-CV) charging technique is the most commonly used charging method. It firstly charges the Li-ion battery with the constant current; when the battery voltage reaches the upper limit voltage (e.g., 4.2 V), it switches to a constant voltage to charge the battery until the charging current drops to the preset cutoff condition (e.g., 0.02 C). However, the CC-CV charging method has the problem of higher temperature rise and a longer charging time. As a result, the literature has proposed different charging methods aiming to solve the problems of a long charging time, low charging efficiency, and charging temperature rise in the CC-CV method at present. In terms of the modified CC-CV-based charging method, open-circuit voltage and charging current are inputted into a fuzzy controller to improve the CV mode of the CC-CV charging method in [1], allowing more charged capacity in the same charging time. A double-loop control method is adopted in [2], allowing a charging curve similar to those created from the CC-CV method to be realized; this does not require measuring the charging current, which can lower the realization cost. In [3], a phase-locked loop control method is proposed, allowing a charging performance similar to the CC-CV charging method to be achieved by taking phase error as a command and sending it to the current source to generate an appropriate charging current. Intending to improve the drawbacks of [3] in terms of the constant voltage charging, ref. [4] proposed a current pumped battery charging method; the current pump was used to charge in constant current mode; the impulse current was used to charge in constant voltage mode. As experimental results indicate, its charging time is comparable with conventional CC-CVs; it also has an outstanding performance in charging efficiency. In [5], the rise in charging temperature and its rate of change were taken as the input of fuzzy controller and the charging current was taken as the fuzzy controller's output, and the experimental results show that the charging efficiency and the charging temperature rise can both be improved. On the other hand, the pulse charging method conducts charging by adjusting the pulse width and the pulse frequency. For instance, ref. [6,7] change the current amplitude, pulse width, and rest periods between pulses, diversifying the charging methods. Ref. [8] and [9] achieve the highest charging current by changing the constant voltage pulse frequency and the duty cycle of the constant voltage pulse, respectively. Ref. [10] proposed an adaptive pulse charging method to enhance the charging speed and efficiency. Ref. [11] combines model predictive control and a second-order RC model to realize the following two charging methods-pulse-amplitude-modulated and pulse-width-modulated methods.
The multistage constant current (MSCC) charging method charges the battery by utilizing different amplitudes of constant current. According to the literature, it can increase the cycle life, achieving high charging efficiency and attaining a short charging time. Currently, the MSCC charging method sets two methods as the conditions for switching stages: judging state of charge (SOC), and upper limit of terminal voltage [12][13][14][15][16][17][18][19]. Regarding the MSCC, which takes the terminal voltage as the stage switching condition, many works proposed methods that use soft computing or the design of experiments technique to find the optimal charging profile (OCP). These methods include the orthogonal array [12], Taguchi method [13,14], particle swarm optimization [15], and ant colony optimization methods [16], etc. However, the mentioned methods all require lots of experimental time to find the OCP and also fail to charge the SOC to 100%. On the other hand, SOC is guaranteed to be charged to 100% with SOC as the stage switching condition; for instance, [17] adopts the orthogonal array to acquire the OCP, while [18] uses the Taguchi method to acquire the OCP and utilizes ASGSMO to estimate the SOC. Compared with the conventional CC-CV charging method, these methods can improve the charging efficiency, charging time, and temperature rise. However, plenty of experiments are still required in these methods to find the OCP; moreover, the SOC estimation is still a challenging problem.
Since battery charging can be regarded as an optimization problem with linear constraints, different constraint control approaches such as control barrier functions (CBFs), explicit reference governor (ERG), and model predictive control (MPC) can be utilized to solve such kind of problems. CBFs use optimization-based controllers to explicitly combine barrier functions with control Lyapunov functions, which allows for the unification of safety and stability in the context of an optimization-based controller [20]. ERG ensures constraint-handling capabilities by manipulating the rate of variations applied. In this way, the transient dynamics are guaranteed to remain within the boundaries. These schemes have less computational stress at the expense of reduced performance [21]. On the other hand, MPC is regarded as the most used optimization-based methodology for charging of Li-ion batteries. MPC is especially suitable for controlling multivariable nonlinear systems while taking the objective function and constraints on both inputs and states into consideration. Hence, MPC is adopted in this study to achieve the optimal charging of Li-ion batteries. In the context of Li-ion battery charging, MPC is capable of shortening the charging time while satisfying temperature and voltage constraints simultaneously [22][23][24][25][26][27][28][29][30]. In [22], a rapid charging framework that is derived from MPC is proposed. The future SOC is predicted by the utilization of the RC model. Additionally, a lumped-parameter thermal model and a neural network (NN) trained by real experimental data are applied to the prediction of the future temperature in simulations and experiments, respectively. A genetic algorithm (GA) is subsequently applied to find the optimal charging sequence under a specified fitness function, which is composed of two objectives: minimizing the charging duration as well as the increase in temperature. The approach proposed in [23] adopts a modified form of the MPC algorithm catering for direct feed-through signals with a view to modeling near-instantaneous battery ohmic resistance. The implementation adopts a second-order equivalent circuit discrete-time state-space model on the basis of actual cell parameters; the control methodology is used to calculate a fast charging profile that complies with input, output, and state constraints. In [24], an MPC scheme based on a linearized version of the P2D model is proposed in order to track a SOC reference value while taking into account the system's aging dynamics as well as temperature and voltage constraints. Simulations indicate the effectiveness of the approach. Additionally, the tuning of the control parameters allows controlled operation with different tradeoffs between charging time and battery lifetime boosts. In [25], an algorithm for optimal charging of a valve-regulated lead-acid (VRLA) battery stack based on MPC is proposed. The proposed technique can charge the battery stack as fast as possible without violating the constraints on the charging current, the battery voltage and the battery temperature, representing the main target of the proposed algorithm. In order to manage battery charging which use an MPC approach, a novel algorithm is proposed in ref. [26]. On the basis of a fully coupled electrothermal model, a fast charging strategy is constructed as a linear-timevarying model predictive control problem. Constraints are directly imposed to prevent the battery from overcharging and overheating. As a means to enable the state-feedback control, unmeasurable battery internal states, which include SOC and core temperature, are estimated via a nonlinear observer. Simulation results indicate that the proposed approach can optimally balance both time and temperature increases. A new methodology for battery charging control, enabling an optimal tradeoff between the charging time and battery state-of-health (SOH), is proposed in ref. [27]. The optimal fast charging problem is constructed in the framework of tracking MPC. This explicitly considers the tracking performance for provided SOC and SOH references, and directly addresses constraints imposed on input current and battery internal state. Ref. [28] develops a minimal capacity fade MPC framework, helping in Li-ion batteries' identification and realization of optimum charge-discharge cycles. In [29], a sensitivity-based MPC (sMPC) is demonstrated for optimally charging the battery pack while taking voltage and temperature limits on each cell into consideration; this model, adopted by sMPC, can be realized by linearizing the dynamics along a nominal trajectory, which are updated over time. In [30], reduced order electrochemical life models are developed and validated against experimental data that were collected at different currents and temperatures and subsequently used to find out optimal temperatures, which provided charging currents regarding degradation rates. Optimal charging current at different SOCs has been evidenced using nonlinear MPC and then the optimal temperature has been determined from the relationship obtained by the models. All the results show that MPC is well-suited to the dynamics of the battery charging problem. Table 1 lists the comparison of the mentioned MPC-based charging methods; as Table 1 indicates, the proposed MPC methods in the literature all used more complicated battery models and/or advanced optimization solvers. Therefore, they can only be realized by PC rather than a low-cost microcontroller unit (MCU). Furthermore, most of the literature did not offer experimental results. This paper is organized as follows: The battery model and the MPC-based charging strategy are formulated in Section 2. The identification and of battery parameters, the battery experimental setup, proposed MPCbased charging algorithm and battery charger are presented in Section 3. Section 4 presents the experimental results. Finally, Section 5 concludes this paper. This study combines the Thevenin equivalent circuit battery and transforms it into a state-space equation to develop the MPC. The usage of such models in the battery optimal control context has an edge in terms of low computational cost, allowing for real-time implementation. Once the quadratically constrained quadratic program is solved, the optimal charging current can be acquired. Compared with the other methods in the literature, which need the optimal SOC and/or SOH trajectory, this study only utilizes OCV as the control target of MPC; therefore, it further decreases the complexity of the proposed method. In order to boost the charging performance, the temperature limit weight is added in the constraints to decrease the charging temperature rise in this study. The application of the renowned ECM and MPC to the optimal charging of Li-ion battery stands as the main contribution of this work, which takes safety constraints such as temperature and voltage limits into account. To the best of the authors' knowledge, this is the first time that such a method is implemented in a low-cost MCU instead of PC. As the experimental results indicate, compared with the conventional CC-CV charging method, the proposed method can effectively improve the average and maximum charging temperatures as well as the charging time.

Battery Modeling
The commonly used battery models can be divided into equivalent circuit models and electrochemical models; the equivalent circuit model is composed of resistances, capacitors, and inductances with the advantages of simplicity and high computing efficiency; the electrochemical model uses the partial differential equation to establish the models of the electrolytic solution and two electrodes models with a view to analyzing the more complicated internal parameters, which require more precision in the models. In order to simplify the complexity of MPC so that it can be realized by a low-cost MCU, this study adopts the equivalent circuit model. As Figure 1 illustrates, the Thevenin equivalent circuit model utilized in this paper is comprised of a battery equivalent capacitor (C eq ), shunt equivalent resistance (R p ), shunt equivalent capacitor (C p ), and series equivalent resistance (R o ). Aiming to combine the battery equivalent model into the model predictive control, V ocv was selected as the output state variable; the charging current i was selected as the input state variable. According to Kirchhoff's law, V 1 can be expressed as Equation (1); T s represents the sampling time [23,[31][32][33][34].
In order to indicate the capacitors' voltage change in batteries, V ocv can be written as Equation (2).

State-Space Representation of Li-Ion Battery Equivalent Circuit Model
The MPC is mainly realized based on plants' mathematical models [35]. With the aim of allowing the mathematical models to be applied in the control systems, the equivalent circuit models were devised as state-space models. Equations (3) and (4) show the generalized state-space equation; u is the input variable; y stands for the process output; X m represents the state variable vector with dimension n; A m is the state matrix; B m is the input matrix; C m is the output matrix; D m is the feed-forward matrix.

Cost Function of the Proposed MPC
The reference value and cost function are defined as Equations (7) and (8), respectively. The first item in the cost function represents the deviation between the reference value and the predicted output; the ∆U in the second item is used to limit the rate of change in the input U; R s is the diagonal matrix, R s = r w × I Nc × Nc (r w > 0), and r w is the weight; when the weight is smaller, a higher rate of change ∆U is allowed.

Derivation of the Proposed MPC Charging Algorithm
According to Section 2.1, it is notable that MPC can predict the future states with the state-space equation and current information. Subsequently, to obtain the optimal predicted input, the following will introduce how to find the optimal solution through the optimizer.
First of all, assuming the sampling time is k i , and k i > 0, the state variable x(k i ) can be obtained by measuring the plants' current information; the definition of the input parameter is shown in Equation (9), and N c represents the control length.
i(k i ), i(k i + 1), · · · , i(k i + N C − 1) With the current x(k i ) information, the state variable of N p sampling time can be predicted; N p is the prediction length; the predicted state variable of the plant is shown in Equation (10). x(k i + m|k i ) stands for the prediction of the state variables of m steps in the future at the sampling time of k i ; the control length should be lesser than the predicted length, N p .
The predicted state variable can be calculated through the predicted input parameter, as Equation (11) presents.
The predicted output variable in Equation (12) can be calculated through the predicted state variable in Equation (9).
A new output and input vector were defined, as demonstrated in Equation (13) and Equation (14). In terms of the single-input single-output (SISO) system, the dimensions of vector Y and ∆U are N p and N c , respectively; Equations (11)- (14) were merged into Equation (15).
For the purpose of calculating the ∆I that can minimize the cost function, Equation (15) can be substituted into Equation (8) to obtain Equation (16); then, Equation (16) can be partially differentiated with respect to ∆I, as in Equation (17). The minimum value of the cost function occurs when Equation (17) is equal to zero; therefore, the optimal predicted value ∆I can be obtained as Equation (18). Lastly, the obtained ∆U from Equation (18) can be utilized to calculate the next state's input, as Equation (19) presents.

Constraints
As a means to reduce the charging temperature rise, the constraints shown in Equation (20) were added into the model predictive control. By having this restriction, the proposed algorithm can change the upper limit of the charging current according to the temperature rises during the charging process, which allows the temperature rise to be improved. In this equation, ∆T is the temperature rise and W T is the weight of the temperature rise.

Identification of Parameters of the Utilized Li-Ion Battery
This study utilized AC Impedance analysis (ACZ) to obtain the internal parameter values of the equivalent circuit models. ACZ uses small amplitude AC sinusoid waveform voltage or current to perturb and analyze the battery chemical reactions under differ-ent conditions. In response, the AC impedance values of the battery in different states can be obtained, and curve fitting was conducted on these data to acquire the battery's circuit parameters.
The test battery selected in this study is the UR18650ZY Li-ion battery launched by SANYO Company, and its specifications are shown in Table 2. In this study, the multifunctional potentiostat VSP-300 from Bio-Logic Corp. was used for ACZ analysis. The block diagram and the flowchart of the ACZ experiments are illustrated in Figures 2 and 3, respectively. In this study, ACZ was measured once every 1% of the SOC. After the measurement, the Nyquist impedance diagrams of different SOCs could be obtained; then, the Z-Fit impedance fitting tool function in EC-Lab was utilized to perform parameter fitting. An illustration of the Z-Fit parameter fitting tool is shown in Figure 4. As Figure 4 illustrates, this study selected the Thevenin equivalent circuit model composed of two resistances and one capacitor to perform parameter fitting. The Z-Fit tool used the selected optimization method to perform curve fitting for the selected measurement points by selecting the curve range to be fitted. The fitting method chosen in this study is the randomized Simplex method and the maximum number of iterations was set to 4000.  Table 3.

The Proposed MPC Charger
This study realized a digital battery charger prototyping circuit to conduct the experiments on the 6-series-1-parallel battery set composed of six SANYO UR18650ZY Li-ion batteries; the power stage of the realized charger adopts the synchronous buck converter; its specifications are shown in Table 4. The low-cost TMS320F280049 microcontroller produced by Texas Instruments (TI) was adopted in this paper. All experiments in this study were carried out by placing the battery in an isothermal chamber at 25 • C. Figure 8 displays the block diagram of the proposed MPC charger.     Figure 9 illustrates the flowchart of the realized MPC charging method in this study; the utilized parameters are shown in Table 5. First, the charging current (I), rate of change in temperature (DT), and terminal voltage (V T ) are measured; then, the present battery SOC through the Coulomb integral method is obtained. Next, the appropriate series resistance (R o ), shunt capacitor (C p ), and shunt resistance (R p ) based on the current SOC are obtained. With the new series resistance (R o ), shunt capacitor (C p ), and shunt resistance (R p ), the A, B, and C matrixes in Equations (9) and (10) can be updated. Afterward, Equations (22) and (23) are used to calculate the charging current of the next step; then, whether the battery voltage exceeds the upper limit (4.2 V) through the equivalent circuit model is determined. If not, the next step's charging current should keep being calculating until the battery voltage equals the upper limit voltage; then, the constant voltage mode is changed to charge until the current is less than the battery's fully charged condition (I < 0.05 C); then, charging stops.   Figure 10 shows the photo of the realized digital MPC charger proposed by this study; this prototyping circuit will then be used to perform the experiments and compare the charging time, charging efficiency, average temperature rise, and the maximum temperature rise of different charging methods. The CV segment in the proposed charging algorithm is the same as the one of the conventional CC-CV charging method; both use a constant voltage (4.2 V) to charge the battery until the battery charging current is less than or equal to the set condition (0.05 C) as the end charging condition. Therefore, this study only compares the temperature rise data in the CC part. The experimental results of the proposed charging method and the different CC-CV charging methods are shown in Table 6; the voltage, current, and the temperature rise waveforms are illustrated in Figures 11-13. From Figure 11, since the charging constraint of the Li-ion battery is that OCV cannot surpass the upper limit voltage (4.2 V), compared with the conventional CC-CV charging method, the proposed charging method adopts the Li-ion battery equivalent circuit model to compute whether the battery OCV exceeds the upper limit voltage in the charging process. Therefore, its CC stage can last for a longer time to accelerate its charging speed.

Experimental Results
The experimental results are summarized in Table 7. From Table 7, compared with the 1.0 C CC-CV charging method, the proposed charging method can reduce the average temperature rise and the maximum temperature rise by 0.76% and 3.87%, respectively. It also improves the charging time by 3.25%. The proposed MPC charging technique can attain lower maximum temperature rise and shorter charging time with comparable average temperature rise compared to the 1.0 C CC-CV charging method. In order to further verify the efficacy of the proposed charging method, this study also implemented the 1.05 C CC-CV charging method. As Table 7 shows, compared with the 1.05 C CC-CV charging method, the proposed method improves the charging time, the maximum temperature rise, and the average temperature rise by 0.13%, 18.69%, and 15.03%, respectively. To further validate the effectiveness of the proposed MPC charger, a comparison between the realized scheme and other MPC charging algorithms presented in the literature is provided in Table 8. From Table 8, the proposed MPC charger has the lowest computational complexity as well as the lowest realization cost at the expense of a slightly reduced performance. To sum up, the proposed MPC charging method can obtain a much lower temperature rise and charging time compared with 1.05 C CC-CV charging method. In other words, the proposed method can achieve the goal of reducing the temperature rise at a similar charging speed, thereby achieving the purpose of extending the cycle life of the Li-ion battery.

Conclusions
This study devised a model predictive control-based Li-ion battery charging algorithm; the proposed MPC charger calculates the charging current suitable for the current SOC by utilizing the battery equivalent circuit model and model predictive control. Compared with the conventional 1.0 C CC-CV charging method, the charging time, the maximum temperature rise, and the average temperature rise can be improved by 3.25%, 3.87%, and 0.76%. As the experimental results indicate, the charging method proposed by this study can improve the charging temperature rise and charging speed of Li-ion batteries. It should be noted that the proposed method implements only the CC part of the charging algorithm using MPC; the CV stage can also be realized by taking into account the voltage constraints in the optimization problem, which will be considered in future works. The method proposed by this study has advantages as follows: 1.
The optimal charging current can be calculated by the model predictive control, thereby achieving the optimal effect. 2.
Compared with the conventional CC-CV charging method, the model predictive charging method can effectively improve the charging temperature rise, charging speed, and charging efficiency. 3.
In comparison with the MPC method proposed in the literature, the model and constraint used in the proposed method are much more straightforward; thus, it is suitable for being realized by a low-cost MCU. Funding: This research received no external funding.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

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

Conflicts of Interest:
The authors declare no conflict of interest.