A Lithium-ion Battery SOC Prediction Method Based on the Fusion of Genetic Algorithm and Unscented Kalman Filter
By integrating genetic algorithm with unscented Kalman filter, adaptive genetic algorithm is used to update the observation noise covariance matrix and noise matching method is used to update the state noise covariance matrix, which solves the accuracy and stability problems caused by nonlinear and time-varying characteristics in lithium-ion battery SOC prediction, and achieves higher prediction accuracy and better time-varying tracking capability.
Patent Information
- Application Number
- CN202310376653.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-11
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-04-11
AI Technical Summary
Existing lithium-ion battery state-of-charge (SOC) prediction methods suffer from insufficient prediction accuracy and poor algorithm stability when faced with nonlinear and time-varying characteristics. In particular, traditional methods have large errors, model methods are not universal, data-driven methods are computationally intensive, and existing filtering methods fail to effectively cope with the time-varying nature of system noise.
A genetic algorithm and unscented Kalman filter (UKF) fusion method is adopted. The observation noise covariance matrix R is updated by the adaptive genetic algorithm (AGA), and the state noise covariance matrix Q is updated in combination with the noise matching method. This realizes the real-time update of UKF parameters and dynamic matching of noise, thereby improving the algorithm's predictive ability for nonlinear and time-varying systems.
The accuracy of lithium-ion battery SOC prediction and the stability of the algorithm are improved, which can effectively track the time-varying characteristics of system noise, avoid algorithm divergence caused by parameter fluctuations, and achieve higher prediction accuracy and better time-varying tracking capabilities.
Smart Images

Figure CN116381507B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of lithium battery state assessment, and in particular relates to a lithium-ion battery state of charge (SOC) prediction method that integrates a genetic algorithm with an unscented Kalman filter. Background Art
[0002] Lithium-ion batteries, with their high energy density, high output voltage, and compact size, are frequently used in new energy vehicles and smart grid energy storage systems. In practical applications, batteries are managed and controlled within a battery management system, and estimating the battery's state of charge is a fundamental function of such a system. Obtaining the state of charge (SOC) of a lithium-ion battery provides information on the remaining charge, alerting users to timely charge and discharge; the battery SOC is also crucial to its safety and reliability.
[0003] Currently, SOC prediction methods primarily focus on traditional methods, model-based methods, filtering algorithms, data-driven methods, and fusion methods. Traditional methods include the open-circuit voltage method (OCV), the AC impedance method, and the ampere-hour integral method (AHI). Models include the equivalent circuit model (ECM), the electrochemical model (EM), and the electrochemical impedance model (EIM). Filtering methods include the Kalman filter (KF), the particle filter (PF), and the H∞ filter (HIF). Data-driven methods include support vector machines (SVM), Gaussian process regression (GPR), neural network algorithms (NN), and random forest algorithms (RFA). According to the paper "A review of lithium-ion battery state-of-charge estimation and management system in electric vehicle applications: Challenges and recommendations," traditional methods offer simple and easy predictions but suffer from high errors. Model-based methods suffer from computational complexity and accuracy, and the resulting models are often not universal across different battery types. Filtering methods require the integration of models for SOC prediction, and prediction accuracy is affected by model accuracy. Data-driven methods rely on historical data to build network models, resulting in high computational complexity and prediction accuracy that is dependent on training data. The fusion method combines traditional methods, models and algorithms, and combines two or more algorithms to achieve complementary advantages of the methods and obtain better calculation speed or prediction accuracy.
[0004] The fusion method has better time-varying tracking and state prediction capabilities, achieving the complementary advantages of the algorithms. The SOC prediction of lithium batteries is affected by internal and external factors. The lithium battery system exhibits strong nonlinearity and time-varying characteristics, which makes SOC prediction difficult. The Kalman filter method is often used to evaluate the state quantity of the system and has good prediction performance. Among them, the unscented Kalman filter used in nonlinear systems has great application potential in the field of SOC prediction. In actual application, the system noise changes with time, and the time-varying nature of the noise needs to be further considered. The genetic algorithm has ergodicity and randomness in intelligent optimization, has good global optimization capabilities, and can perform global optimization on the optimal solution problem. Summary of the Invention
[0005] The present invention provides a lithium-ion battery SOC prediction method that integrates a genetic algorithm and an unscented Kalman filter. The method uses an AFFRLS to update model parameters in real time, predicts SOC through a UKF, and updates the UKF noise covariance matrix through an AGA and noise matching method, thereby improving the algorithm's prediction capability for nonlinear and time-varying systems and improving the algorithm's SOC prediction accuracy.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] A lithium-ion battery SOC prediction method integrating a genetic algorithm and an unscented Kalman filter comprises the following steps:
[0008] Step 1: Obtain the relationship between OCV and SOC of lithium-ion batteries through HPPC test and perform parameter fitting of the two;
[0009] Step 2: Measure the voltage and current of lithium batteries of the same specifications in working state;
[0010] Step 3: Organize the measured values into the AFFRLS input parameter matrix to prepare for parameter estimation of the second-order RC equivalent circuit model;
[0011] Step 4: Estimate the parameter vector using AFFRLS, and then calculate the second-order RC equivalent circuit model parameters R0, R1, R2, C1, and C2 using the parameter vector;
[0012] Step 5: Establish the state equation and observation equation based on the model parameters obtained in step 4;
[0013] Step 6: Initialize the UKF noise covariance matrix R, Q, error covariance matrix P, and state vector x0;
[0014] Step 7: Obtain the iterative error of step 6. If the error is greater than the set value, adaptive update of Q and R will be performed.
[0015] Step 8: Perform adaptive matching on R using the AGA algorithm;
[0016] Step 9: Adaptively update Q using the noise matching method;
[0017] Step 10: Calculate the terminal voltage prediction value based on the SOC in step 6, the OCV-SOC fitting relationship in step 1, and the model parameters estimated in step 4, and output the SOC and voltage prediction values; then return to step 2 to start the next prediction until the prediction demand is completed.
[0018] Furthermore, an HPPC test is performed on the selected lithium-ion battery to establish a relationship between OCV and SOC, and a polynomial fitting method is used to fit the mapping relationship, or a composite fitting expression is used to fit the relationship.
[0019] Furthermore, the polynomial fitting method is used to fit the mapping relationship, and the fitting formula is: U ocv =a1SOC+a2SOC 2 +…+a n SOC n , is the n-order fitting, where a1, ···, a n is the fitting parameter.
[0020] Furthermore, a composite fitting expression is used for fitting: U ocv =k0-k1 / SOC-k2SOC+k3 ln[SOC]+k4[1-SOC], where k1,···,k n is the fitting parameter.
[0021] Furthermore, in step 4, AFFRLS estimates the model parameters, including the following steps:
[0022] Step S4-1: Initialize the reference error e0, the initial value of the parameter vector θ0, and the error covariance matrix P0;
[0023] Step S4-2: Input parameter vector and calculate gain by input parameter matrix;
[0024] Step S4-3: Then calculate the predicted terminal voltage and the predicted error using the gain value of step S4-1;
[0025] Step S4-4: combining the gains and prediction errors of steps S4-1 and S4-2 to update the parameter vector;
[0026] Step S4-5: combining the error covariance matrix of the gain update algorithm in step S4-2;
[0027] Step S4-6: Calculate the model parameter values using the parameter vector from step S4-2;
[0028] Step S4-7: Reversely calculate the voltage prediction value based on the model parameters in step S4-6 to obtain the prediction error;
[0029] Step S4-8: Adaptively update the forgetting factor value based on the prediction error in step S4-6, and return the new forgetting factor value to step S4-2.
[0030] Furthermore, in step 6, the UKF noise covariance matrices R and Q, the error covariance matrix P, and the state vector x0 are initialized, which includes the following steps:
[0031] Step S6-1: Update the model parameters in real time through step 4, and the obtained parameters are used to establish the model state equation and observation equation;
[0032] Step S6-2: Perform UT transformation on the state vector x(k), construct the sigma point set, and calculate the sampling point weights;
[0033] Step S6-3: Calculate the state vector prediction value x by the sigma point and the sampling point weight - (k) and the state error covariance matrix P - x ;
[0034] Step S6-4: Perform UT transformation on the state prediction value of step S5-3 again, construct a new sigma point, and then calculate the sampling point weight;
[0035] Step S6-5: Calculate the observed value y using the new sigma point in step S6-4 - (k), observation error covariance matrix P - y , cross-covariance matrix P xy ;
[0036] Step S6-6: The observation error covariance matrix P in step S6-5 is obtained - y , cross-covariance matrix P xy Calculate the Kalman gain K k ;
[0037] Step S6-7: Let k = k + 1, let k = 0, combine the measurement data of step 2, and the state vector prediction value x of step S5-3 - (k) and the state error covariance matrix P - x Step S6-5: Observation value prediction value y - (k), observation error covariance matrix P - y Step S6-6 Kalman gain K k , update the state prediction value x(k) and the state error covariance Px (k);
[0038] Step S6-8: Combine the state prediction value x(k) and the state error covariance P in step S6-7 x (k) Return to step S6-1 until the iteration ends, and continuously update the lithium battery SOC value through UKF.
[0039] Furthermore, the state equation and observation equation of the model established in step S6-1 are:
[0040]
[0041] Where T = 1, ω(k) represents process noise, ν(k) represents observation noise, both of which are uncorrelated white noise with zero mean; U1(k) and U2(k) are the voltages across the RC network, η is the Coulomb efficiency, Q N is the rated capacity.
[0042] Furthermore, in step 8, R is adaptively matched using the AGA algorithm. The process of AGA updating R includes the following steps:
[0043] Step S8-1: Initialize AGA parameters, determine the termination number L, individual size M, and initial crossover probability P c , mutation probability P m , the upper and lower bounds of R values;
[0044] Step S8-2: Combine the upper and lower bounds of R in step S8-1 and the size of the individual M, randomly construct M individuals, and the values are in line with the range of R values. Then judge the individuals and make sure that the values of the two individuals are less than the difference between the upper and lower bounds L. m (L m / (10·M)) times, then reconstruct a new individual that meets the requirements;
[0045] Step S8-3: Calculate the individual fitness function values for the M individuals in step S8-2 and determine the best individual;
[0046] Step S8-4: The best individual in step S8-3 is exempted from selection and crossover mutation, and the area of the individual sectors of the remaining individuals is calculated. A roulette wheel is constructed, and the roulette wheel is randomly rotated M-1 times to obtain a new population;
[0047] Step S8-5: Replace the worst individual in the new population, replace the best individual in step S8-3 with the worst individual in step S8-4, and proceed to the next step;
[0048] Step S8-6: In step S8-5, the new population undergoes a crossover operation, generates random numbers, randomly selects two individuals from the population, and then determines whether the individuals meet the crossover probability. If they meet the crossover probability, arithmetic crossover is performed between the individuals, and the number of determinations is M times; and the maximum and minimum fitness values of the individuals in the new population are determined, and the crossover probability P is adaptively updated. c ,After the crossover is completed, the new population proceeds to the next step;
[0049] Step S8-7: Perform mutation operation on the new population in step S8-6. First, generate randomness and judge whether the mutation probability is met. If the probability is met, perform mutation operation on the individual. The number of judgments is M times. And confirm the maximum and minimum fitness values of the individuals in the new population, the best individual and the average fitness value of the individuals, and adaptively update the crossover probability P. m ;
[0050] Step S8-8: When the algorithm iteration meets the individual fitness value requirements, or reaches the termination generation number, the iteration is terminated and the best individual is determined;
[0051] Step S8-9: Return the best individual in the algorithm as the new R value to participate in the UKF iteration step S6-3.
[0052] Furthermore, in step S8-3, the individual fitness function value is calculated using the formula: In the formula, N is the sum of the UKF prediction iterations k plus the current individual, N = k + 1, y(k) is the true value of the voltage, is the predicted voltage value.
[0053] Furthermore, in step 9, Q is adaptively updated by a noise matching method, including the following steps:
[0054] Step S9-1: Input the observation error covariance matrix P in step S6-5 - y , minus the current Q value;
[0055] Step S9-2: Combine the optimal R value in step S8-9 to calculate the error cumulative covariance matrix H and update the Kalman gain K k ;
[0056] Step S9-3: Combined with step S6-5, the error cumulative covariance matrix H and Kalman gain K obtained in step S9-2 are k Calculate Q;
[0057] Step S9-4: Determine whether the Q value range meets the upper and lower limits of the Q value to prevent improper Q value selection caused by system calculation and algorithm iteration errors. If the value requirements are met, update the Q value; if not, use the initial Q value;
[0058] Step S9-5: Return the calculated Q value to the UKF iteration step S6-5 to participate in the iterative operation.
[0059] Compared with the prior art, the present invention has the following significant beneficial effects:
[0060] 1. The present invention addresses the problem that offline parameter estimation models for lithium-ion batteries have low accuracy and poor time-varying characteristics, which in turn leads to a decline in the UKF state prediction capability. A new AFFRLS is used to perform online estimation of model parameters. The offline method estimates model parameters on offline battery charge and discharge data through HPPC tests or algorithms. The established model is not sufficient to reflect the time-varying characteristics of model parameters that change with voltage and current. The AFFRLS method estimates model parameters on the voltage and current collected from the battery in actual working conditions, and adaptively adjusts the forgetting factor based on the error between the predicted voltage and the measured voltage to improve the algorithm's time-varying tracking capability. The method is simple and easy to implement on a microcontroller, and can obtain results with both excellent model accuracy and parameter stability. On the basis of both excellent accuracy and parameter stability, it helps to improve the state prediction capability of UKF and helps to prevent the algorithm divergence problem caused by excessive parameter fluctuations. Based on the online high-precision model established by AFFRLS, prediction by UKF can effectively improve the SOC prediction accuracy.
[0061] 2. The UKF algorithm of the present invention sets the noise covariance to a fixed value, while system noise changes dynamically. Using a fixed noise covariance, the UKF's state tracking capability for dynamic systems is insufficient. Dynamically matching the noise covariance using a GA can improve the UKF's state tracking capability. While the GA simultaneously updates both the state noise covariance and the observation noise covariance, the individual populations are complex. Using a GA to update the observation noise covariance can reduce algorithmic complexity. Based on the obtained R, updating the state covariance using a noise matching method can simultaneously update both the state noise covariance and the observation noise covariance.
[0062] 3. The crossover and mutation probability of the GA method of the present invention affects the algorithm's local search capability and the efficiency of searching for the optimal solution. A fixed crossover and mutation probability makes it difficult to guarantee the algorithm's search probability. Adaptive adjustment of the crossover probability can improve the algorithm's optimization efficiency and accuracy. The crossover probability is determined by the gap between the individual fitness value and the average fitness value. When the gap is large, a larger crossover probability is used, and when the difference is small, the crossover probability is reduced. The mutation probability is adjusted with the individual, reducing the mutation probability for dominant individuals and increasing the mutation probability for disadvantaged individuals. The AGA algorithm has a stronger local search capability than the GA algorithm, which helps to avoid the algorithm from falling into local convergence problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 This is the flow chart of AGA and GA fusion prediction of lithium battery SOC;
[0064] Figure 2 This is the second-order RC equivalent circuit model diagram of a lithium battery;
[0065] Figure 3 This is the parameter estimation flow chart of the AFFRLS model;
[0066] Figure 4 This is the UKF prediction SOC flow chart;
[0067] Figure 5 This is the flow chart of AGA updating observation noise covariance. DETAILED DESCRIPTION
[0068] The present invention is directed to a lithium-ion battery SOC prediction method that integrates a genetic algorithm and an unscented Kalman filter, comprising the following steps:
[0069] Step 1: Obtain the relationship between OCV and SOC of lithium-ion batteries through HPPC test and perform parameter fitting of the two. The fitting accuracy of the relationship between OCV and SOC affects the U in the second-order RC equivalent circuit model. oc The flow chart of the fusion algorithm to predict the overall SOC is as follows Figure 1 .
[0070] Step 2: Measure the voltage and current of lithium batteries of the same specifications in working state to obtain high-precision measurement parameters.
[0071] Step 3: Organize the measured values into the AFFRLS input parameter matrix to prepare for parameter estimation of the second-order RC equivalent circuit model.
[0072] Step 4: Estimate the parameter vector through AFFRLS, and then calculate the second-order RC equivalent circuit model (such as Figure 2 ) parameters R0, R1, R2, C1, C2. The flow chart of AFFRLS estimation model parameters is as follows Figure 3 .
[0073] Step S4-1: Initialize the reference error e0, the initial value of the parameter vector θ0, and the error covariance matrix P0.
[0074] Step S4-2: Input parameter vector and calculate gain by input parameter matrix;
[0075] Step S4-3: Then calculate the predicted terminal voltage and the predicted error using the gain value of step S4-1;
[0076] Step S4-4: combining the gains and prediction errors of steps S4-1 and S4-2 to update the parameter vector;
[0077] Step S4-5: combining the error covariance matrix of the gain update algorithm in step S4-2;
[0078] Step S4-6: Calculate the model parameter values using the parameter vector from step S4-2;
[0079] Step S4-7: Reversely calculate the voltage prediction value based on the model parameters in step S4-6 to obtain the prediction error;
[0080] Step S4-8: Adaptively update the forgetting factor value based on the prediction error in step S4-6, and return the new forgetting factor value to step S4-2.
[0081] Step 5: Based on the model parameters obtained in step 4, establish the state equation and observation equation. The UKF SOC prediction flow chart is as follows: Figure 4 .
[0082] Step 6: Initialize the UKF noise covariance matrices R, Q, the error covariance matrix P, and the state vector x0, and set k=0.
[0083] Step S6-1: Update the model parameters in real time through step 4, and the obtained parameters are used to establish the model state equation and observation equation;
[0084] Step S6-2: Perform UT transformation on the state vector x(k), construct the sigma point set, and calculate the sampling point weights;
[0085] Step S6-3: Calculate the state vector prediction value x by the sigma point and the sampling point weight - (k) and the state error covariance matrix P - x ;
[0086] Step S6-4: Perform UT transformation on the state prediction value of step S5-3 again, construct a new sigma point, and then calculate the sampling point weight;
[0087] Step S6-5: Calculate the observed value y using the new sigma point in step S6-4 - (k), observation error covariance matrix P - y , cross-covariance matrix P xy ;
[0088] Step S6-6: The observation error covariance matrix P in step S6-5 is obtained - y , cross-covariance matrix P xy Calculate the Kalman gain K k ;
[0089] Step S6-7: Let k = k + 1, and combine the measurement data of step 2 and the state vector prediction value x of step S5-3 - (k) and the state error covariance matrix P- x Step S6-5: Observation value prediction value y - (k), observation error covariance matrix P - y Step S6-6 Kalman gain K k , update the state prediction value x(k) and the state error covariance P x (k).
[0090] Step S6-8: Combine the state prediction value x(k) and the state error covariance P in step S6-7 x (k) Return to step S6-1 until the iteration ends, and continuously update the lithium battery SOC value through UKF.
[0091] Step 7: Obtain the iterative error of step 6. If the error is greater than the set value, adaptive update of Q and R will be performed.
[0092] Step 8: To solve the problem that the observation noise covariance R in step 6 cannot be updated adaptively, R is adaptively matched through the AGA algorithm. The AGA update R flow chart is as follows: Figure 5 , the specific steps are as follows:
[0093] Step S8-1: Initialize AGA parameters, determine the termination number L, individual size M, and initial crossover probability P c , mutation probability P m , the upper and lower bounds of R values;
[0094] Step S8-2: Combine the upper and lower bounds of R in step S8-1 and the size of the individual M, randomly construct M individuals, and the values are in line with the range of R values. Then judge the individuals and make sure that the values of the two individuals are less than the difference between the upper and lower bounds L. m (L m / (10·M)) times, then reconstruct a new individual that meets the requirements;
[0095] Step S8-3: Calculate the individual fitness function values for the M individuals in step S8-2 and determine the best individual;
[0096] Step S8-4: The best individual in step S8-3 is exempted from selection and crossover mutation, and the area of the individual sectors of the remaining individuals is calculated. A roulette wheel is constructed, and the roulette wheel is randomly rotated M-1 times to obtain a new population;
[0097] Step S8-5: Replace the worst individual in the new population, replace the best individual in step S8-3 with the worst individual in step S8-4, and proceed to the next step;
[0098] Step S8-6: In step S8-5, the new population undergoes a crossover operation, generates random numbers, randomly selects two individuals from the population, and then determines whether the individuals meet the crossover probability. If they meet the crossover probability, arithmetic crossover is performed between the individuals, and the number of determinations is M times; and the maximum and minimum fitness values of the individuals in the new population are determined, and the crossover probability P is adaptively updated. c After the crossover is complete, the new population proceeds to the next step;
[0099] Step S8-7: Perform mutation operation on the new population in step S8-6. First, generate randomness and judge whether the mutation probability is met. If the probability is met, perform mutation operation on the individual. The number of judgments is M times. And confirm the maximum and minimum fitness values of the individuals in the new population, the best individual and the average fitness value of the individuals, and adaptively update the crossover probability P. m ;
[0100] Step S8-8: When the algorithm iteration meets the individual fitness value requirements, or reaches the termination generation number, the iteration is terminated and the best individual is determined;
[0101] Step S8-9: Return the best individual in the algorithm as the new R value to participate in the UKF iteration step S6-3.
[0102] Step 9: To address the problem in step 6 where the state noise covariance Q cannot be adaptively updated, and considering the algorithm complexity caused by AGA optimizing both Q and R simultaneously, Q is adaptively updated using the noise matching method. The specific steps are as follows:
[0103] Step S9-1: Input the observation error covariance matrix P in step S6-5 - y , minus the current Q value;
[0104] Step S9-2: Combine the optimal R value in step S8-9 to calculate the error cumulative covariance matrix H and update the Kalman gain K k ;
[0105] Step S9-3: Combined with step S6-5, the error cumulative covariance matrix H and Kalman gain K obtained in step S9-2 are k Calculate Q;
[0106] Step S9-4: Determine whether the Q value range meets the upper and lower limits of the Q value to prevent improper Q value selection caused by system calculation and algorithm iteration errors. If the value requirements are met, update the Q value; if not, use the initial Q value;
[0107] Step S9-5: returning the calculated Q value to the UKF iteration step S6-5 to participate in the iterative operation;
[0108] Step 10: Calculate the terminal voltage prediction value based on the SOC from step 6, the OCV-SOC fitting relationship from step 1, and the model parameters estimated from step 4. Output the SOC and voltage prediction values. Return to step 2 to begin the next prediction until the prediction requirement is complete.
[0109] In order to make the present invention more fully disclosed, the following is a description of the present invention through a more specific technical solution:
[0110] 1. First, obtain the relationship between OCV and SOC of lithium-ion batteries through experiments. Perform HPPC tests on the selected lithium-ion batteries to establish the relationship between OCV and SOC. Use polynomial fitting method to fit the mapping relationship. The fitting formula is: U ocv =a1SOC+a2SOC 2 +…+a n SOC n , is the n-order fitting, where a1, ···, a n is the fitting parameter, generally the 6th order fitting is taken;
[0111] You can also use a composite fitting expression for fitting: U ocv =k0-k1 / SOC-k2SOC+k3 ln[SOC]+k4[1-SOC], where k1,···,k n is the fitting parameter.
[0112] 2. Use voltage and current sensors to collect output voltage and current data from lithium-ion batteries of the same specifications to form an input data set. It is necessary to ensure that the OCV and SOC relationship of the lithium-ion battery corresponds to the collected lithium-ion battery, and ignore the battery differences caused by the manufacturing process of similar batteries.
[0113] 3. The lithium battery measurement terminal voltage is taken as Y(k), and the measurement current is taken as I(k), forming the measurement input parameter matrix φ(k) = [Y(k-1), Y(k-2), I(k), I(k-1), I(k-2)] T , and the corresponding UKF algorithm, the terminal voltage is y(k) and the current is u(k).
[0114] 4. Based on the measured data, use AFFRLS to estimate the parameters of the second-order RC equivalent circuit model. AFFRLS's estimation of model parameters includes the following:
[0115] 4-1. The parameter vector to be estimated for AFFRLS is: θ(k) = [a0, a1, a2, a3, a4] T , the estimation formula is:
[0116]
[0117] In the formula, e(k) is the correction error, Y(k) is the input data volume, and φ(k) = [Y(k-1), Y(k-2), I(k), I(k-1), I(k-2)] T , K k is the gain, P(k) is the error covariance, and λ is the forgetting factor, which generally ranges from 0.95 to 1. λ is updated with the prediction process, and the formula is:
[0118]
[0119] In the formula, λ max is the maximum λ value, λ min is the minimum λ value, e0 is the preset benchmark error, and round(·) is the rounding function.
[0120] 4-2. The estimated parameter vector is used to calculate the intermediate variables k1, k2, k3, and the time constants τ1 and τ2. τ1 = R1C1, τ2 = R2C2. The calculation formula is:
[0121]
[0122] 4-3. And further calculate the model parameters:
[0123]
[0124] The estimated parameter vector is used to further calculate model parameters, including R0, R1, R2, C1, and C2. These parameters reflect the electrochemical dynamics and polarization effects within the battery as the battery undergoes charge and discharge voltage and current fluctuations. The model parameters R0, R1, R2, C1, and C2 derived from AFFRLS exhibit good dynamic characteristics and offer higher simulation accuracy. This improves model accuracy by establishing the state and observation equations for the second-order RC equivalent circuit model.
[0125] 5. Based on the model parameters obtained in AFFRLS and the OCV-SOC relationship obtained in step 1, the state equation and observation equation of the second-order RC equivalent circuit model are established, and then the SOC is predicted by UKF.
[0126] 6. The UKF iteration includes the following:
[0127] 6-1. The state equation and observation equation based on the second-order RC equivalent circuit model are:
[0128]
[0129]
[0130] Where T = 1, ω(k) represents process noise, ν(k) represents observation noise, both of which are uncorrelated white noise with zero mean; U1(k) and U2(k) are the voltages across the RC network, η is the Coulomb efficiency, Q N is the rated capacity.
[0131] It can be further expressed as:
[0132] Equation of state: x k+1 =f(x k ,u k )+w k
[0133] Observation equation: y k =g(x k ,u k )+v k
[0134] 6-2. UKF can be used to make the optimal estimate of the state value by correcting the external observation data. The iterative steps are:
[0135] First initialize the state variables and covariance matrix: P0=P x0
[0136] 6-3. Construct sigma points by UT transformation. The symmetric sampling method is as follows:
[0137]
[0138] in is the mean of the state vector, n is the dimension of the state vector, P x is the state vector covariance, is the square root of the matrix, where i represents the i-th column of the matrix.
[0139] 6-4. The sigma point weight distribution is as follows, i is the i-th column, λ = α 2 (n+k)-n is the scaling factor, α is the scale parameter, which takes a value between 0 and 1, and k is the scaling factor, which is generally 0. β is 0 when the parameter is a single variable and 2 under Gaussian distribution.
[0140]
[0141] 6-5. Calculate the predicted value of the sampling point by sigma point and weight:
[0142] 6-6. Calculate the state prediction value and error covariance prediction value from the sampling point prediction value:
[0143]
[0144] Where Q(k) is the state noise covariance matrix.
[0145] 6-7. Perform UT transformation again to obtain a new sigma point set and calculate the predicted value of the observation sampling point:
[0146]
[0147] 6-8. Calculate the observation prediction value and the observation equation error covariance prediction value:
[0148]
[0149] Where R(k) is the observation noise covariance matrix.
[0150] 6-9. Calculate the Kalman gain K k :
[0151] 6-10. Update the state prediction value and error covariance prediction value at time k+1:
[0152]
[0153] 7. The UKF noise covariance is set to a constant value. However, the noise of the nonlinear system changes dynamically over time. The noise covariance matrix under a fixed value cannot well reflect the time-varying characteristics of the noise. The error of the UKF iterative process is judged. When it is greater than the set error, Q and R are updated through an adaptive method.
[0154] 8. Use AGA to optimize the observation noise covariance matrix R. The noise optimization of UKF includes the following:
[0155] 8-1. Initialize the GA and select the number of iterations to terminate and the number of individuals in the population. The number of iterations to terminate affects the accuracy and computational speed of the fusion algorithm. A larger number of iterations increases the computational time, while a smaller number may prevent the algorithm from reaching the optimal solution. The number of iterations to terminate should be determined based on data fluctuations; a typical value is 50. The population size also affects the accuracy and speed of the algorithm. A larger number of individuals increases the time required to calculate the fitness function. The population size range is 20-100.
[0156] 8-2. Construct the initial population using real-number encoding, which better reflects the solution space for the noise value problem and effectively avoids frequent decoding. Randomly construct i individuals based on the upper and lower bounds of the population. The individuals in the population are judged. If individual values are too close, the randomness of the initial values will be affected and there is a risk of premature convergence. Try to keep the initial individuals evenly distributed within the value range. If individual values are too close, reconstruct the individuals.
[0157] 8-3. Calculate the individual fitness function value. The formula is: In the formula, N is the sum of the UKF prediction iterations k plus the current individual, N = k + 1. y(k) is the true value of the voltage, is the predicted voltage value.
[0158] 8-4. Determine the optimal individual and the minimum value of the fitness function, and adopt the optimal retention strategy. The optimal individual is exempted from crossover and mutation operations to prevent the loss of dominant individuals. The remaining individuals are selected using the roulette method. Calculate the area of the individual sector. Under the roulette method, the smaller the fitness value, the larger the sector area, and the greater the probability of being selected. i is the i-th individual, L is the individual size, and the total area of the sector is S:
[0159]
[0160] The probability J of an individual being selected is:
[0161] J(i)=1 / (fit(i)*S)
[0162] The roulette method retains the superior individuals and eliminates the inferior individuals.
[0163] 8-5. Crossover strategy uses arithmetic crossover to perform crossover operations on selected individuals under the crossover probability. The arithmetic crossover formula is:
[0164] α and β are random numbers, ranging from 0 to 1.
[0165] The crossover probability is adaptively processed, and the crossover probability is selected to be 0.4-0.9, and is adaptive as the individual iteration process progresses. The formula is as follows:
[0166]
[0167] Where pc is the crossover probability, F max 、F min are the maximum and minimum values of fitness, F avg is the average fitness value, F i is the fitness value of chromosome in generation i.
[0168] 8-6. The mutation strategy uses non-uniform mutation, and the formula is as follows:
[0169]
[0170] Where M and N are the left and right bounds of the optimization parameters, γ is a random number in the range (0, 1), k is in the range (0, 1), and d is a random number 0 or 1. The probability of individual mutation should vary from individual to individual. Advantageous individuals reduce the probability of mutation, while disadvantaged individuals increase the probability of mutation, thereby enhancing the algorithm's search capability.
[0171]
[0172] Where M represents the chromosome length, D is the Euclidean distance between parents, and F best is the fitness value of the dominant individual.
[0173] 9. Based on the R value obtained by AGA, the Q matrix is updated by the noise covariance matching method.
[0174] The noise covariance matching formula is:
[0175]
[0176] By combining the noise matching method with R obtained by (8), the Q update formula is:
[0177]
[0178] The R updated by AGA has good randomness, and the Q matrix is updated based on the obtained optimal R, which avoids the selection of the time window value of the adaptive formula of the noise matching method, reduces the amount of calculation caused by the simultaneous iterative update of R and Q by AGA, and reduces the complexity of the algorithm.
[0179] 10. Using the SOC obtained in step 6, the OCV-SOC curve in step 1, and the model parameters in step 4, calculate the terminal voltage prediction value and output the final SOC and terminal voltage values. Return to step 2 to start the next prediction until the prediction demand is completed.
Claims
1. A lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter, characterized in that: The following steps are involved: Step 1: Obtain the relationship between OCV and SOC of lithium-ion batteries through HPPC test and perform parameter fitting of the two; Step 2: Measure the voltage and current of lithium batteries of the same specifications in working state; Step 3: Organize the measured values into the AFFRLS input parameter matrix to prepare for parameter estimation of the second-order RC equivalent circuit model; Step 4: Estimate the parameter vector using AFFRLS, and then calculate the second-order RC equivalent circuit model parameters R0, R1, R2, C1, and C2 using the parameter vector; Step 5: Establish the state equation and observation equation based on the model parameters obtained in step 4; Step 6: Initialize the UKF noise covariance matrix R, Q, error covariance matrix P, and state vector x0; Step 7: Obtain the iterative error of step 6. If the error is greater than the set value, adaptive update of Q and R will be performed. Step 8: Perform adaptive matching on R using the AGA algorithm; Step 9: Adaptively update Q using the noise matching method; Step 10: Calculate the terminal voltage prediction value based on the SOC in step 6, the OCV-SOC fitting relationship in step 1, and the model parameters estimated in step 4, and output the SOC and voltage prediction values; then return to step 2 to start the next prediction until the prediction demand is completed.
2. The lithium-ion battery SOC prediction method combining genetic algorithm and unscented Kalman filter according to claim 1 is characterized in that: Perform HPPC test on the selected lithium-ion battery, establish the relationship between OCV and SOC, and use polynomial fitting method to fit the mapping relationship, or use composite fitting expression to fit.
3. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 2 is characterized in that: The polynomial fitting method is used to fit the mapping relationship, and the fitting formula is: U ocv =a1SOC+a2SOC 2 +…+a n SOC n , is the n-order fitting, where a1, ···, a n is the fitting parameter.
4. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 2, characterized in that: Fitting is performed using a composite fitting expression: U ocv =k0-k1 / SOC-k2SOC+k3 ln[SOC]+k4[1-SOC], where k1,···,k n is the fitting parameter.
5. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 1, characterized in that: In step 4, AFFRLS estimates the model parameters, including the following steps: Step S4-1: Initialize the reference error e0, the initial value of the parameter vector θ0, and the error covariance matrix P0; Step S4-2: Input parameter vector and calculate gain by input parameter matrix; Step S4-3: Then calculate the predicted terminal voltage and the predicted error using the gain value of step S4-1; Step S4-4: combining the gains and prediction errors of steps S4-1 and S4-2 to update the parameter vector; Step S4-5: combining the error covariance matrix of the gain update algorithm in step S4-2; Step S4-6: Calculate the model parameter values using the parameter vector from step S4-2; Step S4-7: Reversely calculate the voltage prediction value based on the model parameters in step S4-6 to obtain the prediction error; Step S4-8: Adaptively update the forgetting factor value based on the prediction error in step S4-6, and return the new forgetting factor value to step S4-2.
6. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 1, characterized in that: In step 6, the UKF noise covariance matrices R and Q, the error covariance matrix P, and the state vector x0 are initialized, which includes the following steps: Step S6-1: Update the model parameters in real time through step 4, and the obtained parameters are used to establish the model state equation and observation equation; Step S6-2: Perform UT transformation on the state vector x(k), construct the sigma point set, and calculate the sampling point weights; Step S6-3: Calculate the state vector prediction value x by the sigma point and the sampling point weight - (k) and the state error covariance matrix P - x ; Step S6-4: Perform UT transformation on the state prediction value of step S5-3 again, construct a new sigma point, and then calculate the sampling point weight; Step S6-5: Calculate the observed value y using the new sigma point in step S6-4 - (k), observation error covariance matrix P - y , cross-covariance matrix P xy ; Step S6-6: The observation error covariance matrix P in step S6-5 is obtained - y , cross-covariance matrix P xy Calculate the Kalman gain K k ; Step S6-7: Let k = k + 1, let k = 0, combine the measurement data of step 2, and the state vector prediction value x of step S5-3 - (k) and the state error covariance matrix P - x Step S6-5: Observation value prediction value y - (k), observation error covariance matrix P - y Step S6-6 Kalman gain K k , update the state prediction value x(k) and the state error covariance P x (k); Step S6-8: Combine the state prediction value x(k) and the state error covariance P in step S6-7 x (k) Return to step S6-1 until the iteration ends, and continuously update the lithium battery SOC value through UKF.
7. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 1, characterized in that: The state equation and observation equation of the model established in step S6-1 are: Where T = 1, ω(k) represents process noise, ν(k) represents observation noise, both of which are uncorrelated white noise with zero mean; U1(k) and U2(k) are the voltages across the RC network, η is the Coulomb efficiency, Q N is the rated capacity.
8. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 1, characterized in that: In step 8, R is adaptively matched using the AGA algorithm. The process of AGA updating R includes the following steps: Step S8-1: Initialize AGA parameters, determine the termination number L, individual size M, and initial crossover probability P c , mutation probability P m , the upper and lower bounds of R values; Step S8-2: Combine the upper and lower bounds of R in step S8-1 and the size of the individual M, randomly construct M individuals, and the values are in line with the range of R values. Then judge the individuals and make sure that the values of the two individuals are less than the difference between the upper and lower bounds L. m (L m / (10·M)) times, then reconstruct a new individual that meets the requirements; Step S8-3: Calculate the individual fitness function values for the M individuals in step S8-2 and determine the best individual; Step S8-4: The best individual in step S8-3 is exempted from selection and crossover mutation, and the area of the individual sectors of the remaining individuals is calculated. A roulette wheel is constructed, and the roulette wheel is randomly rotated M-1 times to obtain a new population; Step S8-5: Replace the worst individual in the new population, replace the best individual in step S8-3 with the worst individual in step S8-4, and proceed to the next step; Step S8-6: In step S8-5, the new population undergoes a crossover operation, generates random numbers, randomly selects two individuals from the population, and then determines whether the individuals meet the crossover probability. If they meet the crossover probability, arithmetic crossover is performed between the individuals, and the number of determinations is M times; and the maximum and minimum fitness values of the individuals in the new population are determined, and the crossover probability P is adaptively updated. c ,After the crossover is completed, the new population proceeds to the next step; Step S8-7: Perform mutation operation on the new population in step S8-6. First, generate randomness and judge whether the mutation probability is met. If the probability is met, perform mutation operation on the individual. The number of judgments is M times. And confirm the maximum and minimum fitness values of the individuals in the new population, the best individual and the average fitness value of the individuals, and adaptively update the crossover probability P. m ; Step S8-8: When the algorithm iteration meets the individual fitness value requirements, or reaches the termination generation number, the iteration is terminated and the best individual is determined; Step S8-9: Return the best individual in the algorithm as the new R value to participate in the UKF iteration step S6-3.
9. The lithium-ion battery SOC prediction method combining genetic algorithm and unscented Kalman filter according to claim 8, characterized in that: In step S8-3, the individual fitness function value is calculated using the formula: In the formula, N is the sum of the UKF prediction iterations k plus the current individual, N = k + 1, y(k) is the true value of the voltage, is the predicted voltage value.
10. The lithium-ion battery SOC prediction method integrating genetic algorithm and unscented Kalman filter according to claim 1, characterized in that: In step 9, Q is adaptively updated using a noise matching method, including the following steps: Step S9-1: Input the observation error covariance matrix P in step S6-5 - y , minus the current Q value; Step S9-2: Combine the optimal R value in step S8-9 to calculate the error cumulative covariance matrix H and update the Kalman gain K k ; Step S9-3: Combined with step S6-5, the error cumulative covariance matrix H and Kalman gain K obtained in step S9-2 are k Calculate Q; Step S9-4: Determine whether the Q value range meets the upper and lower limits of the Q value to prevent improper Q value selection caused by system calculation and algorithm iteration errors. If the value requirements are met, update the Q value; if not, use the initial Q value; Step S9-5: Return the calculated Q value to the UKF iteration step S6-5 to participate in the iterative operation.