Lithium battery SOC estimation method and device based on PCA-RF model
Through feature screening and dimensionality reduction of the PCA-RF model, combined with the training of the random forest model, the problem of efficiency, accuracy and generalization ability in lithium battery SOC estimation is solved, and more efficient and accurate SOC estimation is achieved.
Patent Information
- Application Number
- CN202210791221.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-04
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-07-04
AI Technical Summary
The existing SOC estimation method of lithium batteries is difficult to take into account the estimation efficiency, accuracy and generalization capabilities. The traditional method has many external restrictions and complex calculations; the adaptive filtering method relies on high model accuracy and low calculation efficiency; the data-driven method ignores internal reaction characteristics and accuracy Not high.
The SOC estimation method of lithium battery based on PCA-RF model is used to construct a feature matrix by obtaining external feature parameters, screening and dimensionality reduction, and combining random forest models for training and testing, so as to estimate SOC in real time.
It improves the estimation efficiency and accuracy of the model, and at the same time enhances the generalization ability, which can more accurately reflect the lithium battery SOC, and is suitable for real-time applications.
Smart Images

Figure CN115128482B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of battery technology, and in particular to a lithium battery SOC estimation method and device based on a PCA-RF model. Background Art
[0002] With the rapid development of pure electric vehicles around the world, lithium batteries are being used more and more widely, but at the same time, lithium batteries are also facing safety issues. Therefore, if we want to vigorously develop the application of lithium batteries in social life, we must solve the problem of their safe use. This requires the establishment of a complete battery management system (BMS), and one of the most important parameters in the battery management system is the battery SOC. The estimation accuracy of the battery SOC directly affects the performance of the system. It can be seen that accurately estimating the lithium battery SOC is of great significance to improving the safety of lithium batteries.
[0003] Common lithium battery SOC estimation methods can be divided into three categories: traditional methods, adaptive filtering methods, and data-driven methods. Traditional methods are mainly based on open circuit voltage method, ampere-hour integration method, and impedance method. The general idea is to calculate the current battery SOC based on the measured external characteristics of the battery and internal reaction-related parameters. This type of method is more accurate for battery SOC estimation, but there are many external restrictions, making it difficult to achieve efficient online measurement; the adaptive filtering method is mainly based on Kalman filtering and its derivative algorithms, that is, using state equations to describe dynamic processes, and using measurement equations to describe observation information. By continuously iterating predicted values and observed values, the prediction of battery SOC is updated. This type of method can achieve high-precision estimation, but it is too dependent on the accuracy of the model itself, and the calculation is complex, resulting in low estimation efficiency; the data-driven method is also mainly based on algorithms, and the general idea is to use existing external characteristic parameters to estimate the battery SOC. The method of estimating the SOC of lithium batteries using the traditional random forest (RF) algorithm also belongs to the data-driven method, which can be roughly divided into two categories: one is to improve the algorithm or model parameter adjustment process. In terms of the construction of the feature matrix, this method uses the traditional battery external characteristic parameters to construct the feature matrix, which can simplify the model and reduce the amount of calculation, but at the same time ignores the relationship between other parameters and other special points and the battery SOC, resulting in low estimation accuracy; the second is to establish an electrochemical model of the battery, extract the internal chemical reaction characteristics, and use this as the model input. This method takes into account the internal reaction mechanism of the battery, which can make the model estimation more accurate, but at the same time there are problems such as complex calculations and difficulty in real-time estimation.
[0004] In summary, the existing technology has the technical problem of being unable to take into account the estimation efficiency, accuracy and generalization ability when estimating the SOC of a lithium battery. Summary of the invention
[0005] In view of this, it is necessary to provide a lithium battery SOC estimation method and device based on the PCA-RF model to solve the technical problem in the prior art that the estimation efficiency, accuracy and versatility cannot be taken into account at the same time.
[0006] On the one hand, the present invention provides a lithium battery SOC estimation method based on a PCA-RF model, comprising:
[0007] Obtain external characteristic parameters of the lithium battery at each time point of charging and discharging as an initial sample set;
[0008] Constructing a first characteristic matrix based on the external characteristic parameters, and screening the first characteristic matrix to obtain a second characteristic matrix;
[0009] Using a principal component analysis method to reduce the dimension of the second feature matrix, obtaining a third feature matrix as a target sample set, and dividing the target sample set into a training set and a test set;
[0010] Constructing an initial lithium battery SOC estimation model based on a random forest model, and training and testing the initial lithium battery SOC estimation model using the training set and the test set to obtain a target lithium battery SOC estimation model;
[0011] The target characteristic parameters of the lithium battery are acquired in real time, and the target characteristic parameters are input into the target lithium battery SOC estimation model to obtain the lithium battery SOC estimation result.
[0012] In some possible implementations, constructing a first feature matrix based on the external feature parameters includes:
[0013] The mean, standard deviation, maximum and range of the external characteristic parameters at different time points of charging and discharging are counted to obtain the characteristics of the external characteristic parameters of the lithium battery at different time points, and a first characteristic matrix is constructed based on the characteristics of the external characteristic parameters.
[0014] In some possible implementations, screening the first feature matrix to obtain the second feature matrix includes:
[0015] The variance of each column of the first feature matrix is calculated, the median of the variance is used as the variance threshold, and the features whose variance is less than the variance threshold are deleted to obtain a second feature matrix.
[0016] In some possible implementations, the step of reducing the dimension of the second feature matrix by using a principal component analysis method to obtain a third feature matrix as a target sample set includes:
[0017] Represent each feature in the second feature matrix using a vector, and recombine the vectors to form a centralized matrix;
[0018] Calculating a covariance matrix based on the centering matrix;
[0019] Calculate eigenvalues and eigenvectors based on the covariance matrix, and form a first mapping matrix according to the size combination of the eigenvalues, retain the top-ranked eigenvalues and eigenvectors corresponding to the top-ranked eigenvalues in the first mapping matrix that are greater than a preset reconstruction threshold, and use the eigenvectors as a set of orthogonal bases to obtain a second mapping matrix;
[0020] The second feature matrix is projected onto the second mapping matrix based on matrix multiplication to obtain the reduced-dimensional third feature matrix as the target sample set.
[0021] In some possible implementations, the initial lithium battery SOC estimation model is constructed based on the random forest model, and the initial lithium battery SOC estimation model is trained and tested using the training set and the test set to obtain a target lithium battery SOC estimation model, including:
[0022] Build at least two independent decision tree models;
[0023] Using the at least two independent decision tree models as initial base evaluators to construct an initial lithium battery SOC estimation model;
[0024] Extracting a number of training samples with replacement from a number of samples included in the training set, the same number as the number of samples, and performing rounds of extraction based on the number of initial base evaluators to obtain at least two independent sampling sets;
[0025] Training the at least two initial base evaluators based on the at least two independent sampling sets to obtain at least two target base evaluators, wherein the target lithium battery SOC estimation model is jointly constituted by the at least two target base evaluators;
[0026] The at least two target-based evaluators identify the input data to obtain at least two regression results, and use an average or voting method to determine a final output result for the at least two regression results as the output of the model;
[0027] Among them, the number of decision tree models, base evaluators, sampling sets, target base evaluators and regression results are all equal.
[0028] In some possible implementations, obtaining the decision tree model includes:
[0029] Divide the sampling set based on each feature of the sampling set, calculate the information entropy or Gini coefficient after the division, and record the optimal division feature;
[0030] Select the optimal partition feature to generate a node, and use the corresponding partition method as the final partition method, and remove the optimal partition feature after partitioning;
[0031] Repeat the above operation on the sample set without the optimal partitioning feature until the sample set cannot be divided any further or meets a preset condition;
[0032] The optimal partitioning feature at each partitioning is used as the node, and the result of each partitioning is used as the left and right subtrees to build a decision tree model, and the results of the leaf nodes are recorded, and the results of the leaf nodes are used as the regression results of the decision tree model.
[0033] In some possible implementations, the using the training set and the test set to train and test the initial lithium battery SOC estimation model includes:
[0034] Using a grid search method to adjust the input parameters of the initial lithium battery SOC estimation model multiple times, and comparing the regression results after adjusting the parameters with the true values, until a parameter adjustment result that meets the preset conditions is selected;
[0035] The test set is imported into the lithium battery SOC estimation model after parameter adjustment to obtain the estimation results of the test set samples.
[0036] In some possible implementations, the training and testing the initial lithium battery SOC estimation model using the training set and the test set further includes:
[0037] After the initial lithium battery SOC estimation model is trained, a test is performed. Based on the estimation results of the test set samples, mean square error, average determination error, and determination coefficient are selected as evaluation indicators to evaluate the estimation accuracy of the lithium battery SOC estimation model after the training is completed.
[0038] In some possible implementations, the step of obtaining the external characteristic parameters of the lithium battery at each time point of charging and discharging as an initial sample set further includes:
[0039] Based on the ratio of the number of missing values, outliers and invalid values in the initial sample set to the sample capacity, the missing values, outliers and invalid values are processed by deletion, filling or replacement.
[0040] On the other hand, the present invention provides a lithium battery SOC estimation device based on a PCA-RF model, comprising:
[0041] Data acquisition module: used to obtain the external characteristic parameters of the lithium battery at each time point of charging and discharging as the initial sample set;
[0042] A first data processing module: used for constructing a first characteristic matrix based on the external characteristic parameters, and screening the first characteristic matrix to obtain a second characteristic matrix;
[0043] A second data processing module is used to reduce the dimension of the second feature matrix by using a principal component analysis method to obtain a third feature matrix as a target sample set, and divide the target sample set into a training set and a test set;
[0044] Model training module: used to construct an initial lithium battery SOC estimation model based on the random forest model, and use the target sample set to train and test the initial lithium battery SOC estimation model to obtain a target lithium battery SOC estimation model;
[0045] Determination module: used to obtain the target characteristic parameters of the lithium battery in real time, input the target characteristic parameters into the target lithium battery SOC estimation model, and obtain the lithium battery SOC estimation result.
[0046] The beneficial effect of adopting the above embodiment is: the lithium battery SOC estimation method based on the PCA-RF model provided by the present invention, on the one hand, reduces the data dimension by using feature screening and dimensionality reduction operations, reduces the number of calculation parameters while retaining feature information, thereby improving the estimation efficiency of the model; on the other hand, the model is trained and tested using a randomly sampled sampling set based on the random forest model, thereby improving the estimation accuracy of the model for the lithium battery SOC, and at the same time enabling the model to have stronger generalization capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 A schematic flow chart of an embodiment of a lithium battery SOC estimation method based on a PCA-RF model provided by the present invention;
[0049] Figure 2 The present invention provides Figure 1 A flow chart of an embodiment of step S102;
[0050] Figure 3 The present invention provides Figure 1 A schematic diagram of a flow chart of an embodiment of step S103;
[0051] Figure 4 The present invention provides Figure 1A schematic diagram of another embodiment of step S103;
[0052] Figure 5 The present invention provides Figure 1 A schematic diagram of a flow chart of an embodiment of step S104;
[0053] Figure 6 The present invention provides Figure 5 A schematic diagram of a flow chart of an embodiment of step S501;
[0054] Figure 7 A working principle diagram of an embodiment of a random forest model provided by the present invention;
[0055] Figure 8 A working principle diagram of a decision tree embodiment provided by the present invention;
[0056] Fig. 9 A schematic structural diagram of an embodiment of a lithium battery SOC estimation device based on a PCA-RF model provided by the present invention. DETAILED DESCRIPTION
[0057] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0058] It should be understood that the schematic drawings are not drawn to scale. The flow chart used in the present invention shows the operations implemented according to some embodiments of the present invention. It should be understood that the operations of the flow chart can be implemented out of order, and the steps without logical context can be reversed or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flow chart under the guidance of the content of the present invention, and can also remove one or more operations from the flow chart.
[0059] Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor systems and / or microcontroller systems.
[0060] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0061] Before describing the embodiments, the following definitions are given for the relevant terms:
[0062] Battery SOC: State of charge, is used to reflect the remaining capacity of the battery. Its value is defined as the ratio of the remaining capacity to the battery capacity, usually expressed as a percentage.
[0063] PCA: Principal Component Analysis. Principal component analysis is a mathematical dimensionality reduction method that uses orthogonal transformation to convert a series of possibly linearly correlated variables into a set of linearly unrelated new variables, also called principal components, so that the new variables can be used to display the characteristics of the data in a smaller dimension.
[0064] RF: Random Forest, a flexible and easy-to-use machine learning algorithm, refers to a classifier that uses multiple decision trees to train and predict samples. It contains multiple decision tree classifiers, and its output category is determined by the majority of the categories output by individual trees.
[0065] Gini coefficient: It is a method to measure information uncertainty. The Gini coefficient of a data set reflects the probability that two samples randomly selected from the data set have inconsistent category labels. Therefore, the smaller it is, the higher the purity of the data set.
[0066] Information entropy: used to measure the purity of a data set. Information entropy represents uncertainty. When the data is evenly distributed, the uncertainty is the largest, and the entropy is the largest at this time.
[0067] Information gain: When a feature is selected to classify a data set, the information entropy of the data set after classification will be smaller than that before classification. The difference is expressed as information gain, which can measure the influence of a feature on the classification result.
[0068] Based on the description of the above technical terms, in the prior art, when estimating the SOC of a lithium battery, a large number of parameters often need to be considered and complex algorithms are involved. Although the estimation accuracy is guaranteed to a certain extent, the processing efficiency and generalization ability of the model are sacrificed. Other SOC estimation methods are designed to reduce the number of parameters and improve the processing efficiency of the model, which affects the estimation accuracy of the model. Therefore, the present invention aims to propose a lithium battery SOC estimation method that can take into account estimation efficiency, accuracy and generalization ability.
[0069] The specific embodiments are described in detail below:
[0070] The embodiments of the present invention provide a lithium battery SOC estimation method and device based on the PCA-RF model, which are described below.
[0071] Figure 1 A schematic flow chart of an embodiment of a lithium battery SOC estimation method based on a PCA-RF model provided by the present invention is shown in FIG. Figure 1 As shown in the figure, the lithium battery SOC estimation method based on the PCA-RF model includes:
[0072] S101, obtaining external characteristic parameters of the lithium battery at each time point of charging and discharging as an initial sample set;
[0073] S102, constructing a first characteristic matrix based on the external characteristic parameters, and screening the first characteristic matrix to obtain a second characteristic matrix;
[0074] S103, using a principal component analysis method to reduce the dimension of the second feature matrix to obtain a third feature matrix as a target sample set, and dividing the target sample set into a training set and a test set;
[0075] S104, constructing an initial lithium battery SOC estimation model based on the random forest model, and using the training set and the test set to train and test the initial lithium battery SOC estimation model to obtain a target lithium battery SOC estimation model;
[0076] S105 , acquiring target characteristic parameters of the lithium battery in real time, inputting the target characteristic parameters into the target lithium battery SOC estimation model, and obtaining a lithium battery SOC estimation result.
[0077] Compared with the prior art, the lithium battery SOC estimation method based on the PCA-RF model provided in the embodiment of the present invention reduces the data dimension by utilizing feature screening and dimensionality reduction operations, and performs training and testing based on the random forest model, thereby improving the estimation efficiency of the model while ensuring that the model has better estimation accuracy and stronger generalization ability.
[0078] In a specific embodiment of the present invention, in step S101, the external characteristic parameters of the lithium battery at each time point of charging and discharging are obtained, wherein the charging and discharging processes during actual measurement are all carried out within the rated value range of the battery, and when charging, a strategy of first charging in a constant current mode and then charging in a constant voltage mode is adopted, and when discharging, a strategy of discharging in a constant current mode is adopted, wherein the charging and discharging voltage and current depend on the battery's own parameters.
[0079] More specifically, the time interval of the monitoring process is set to 2 minutes, the monitored external characteristic parameters of the battery are the battery terminal voltage, the battery voltage under load, the battery output current, the battery current under load and the battery temperature, and the monitoring process lasts for 1 hour.
[0080] Furthermore, in some embodiments of the present invention, step S101 also includes: based on the ratio of the number of missing values, outliers and invalid values in the initial sample set to the sample capacity, the missing values, outliers and invalid values are processed by deletion, filling or replacement to complete data cleaning and preprocessing.
[0081] In a specific embodiment of the present invention, different processing methods are as follows according to the proportion of the number of missing values, abnormal values and invalid values in the sample to the sample capacity:
[0082] If the number of three-category values of a feature is less than or equal to 5% of the sample capacity, samples with three-category values of the feature will be deleted;
[0083] If the number of three types of values of a feature is greater than 5% of the sample size and less than or equal to 30% of the sample size, the mean of the remaining samples under this feature is used for filling or replacement;
[0084] When the number of three-category values of a feature is greater than 30% of the sample capacity, relevant machine learning algorithms are used to fill in or replace them.
[0085] The process of filling the three-category values using the relevant machine learning algorithm is as follows: for each column of features in which the three-category values account for a relatively large proportion, the features in that column are used as the values to be predicted, and the true values of the original samples are imported into the established model as new features. The required predicted values are calculated by the model, and the predicted three-category values are used to predict the three-category values in the next column of features. This process is repeated multiple times until the three-category values are filled or completely replaced.
[0086] The embodiment of the present invention cleans and preprocesses the data, removes or fills in abnormal data and missing data, so that the data in the sample set has better correlation, and the estimation accuracy of the model obtained by subsequent training is guaranteed.
[0087] In some embodiments of the present invention, see Figure 2 , Figure 2 The present invention provides Figure 1 The flowchart of step S102 in an embodiment of the present invention is shown in FIG. 1 , wherein step S102 includes steps S201 to S202:
[0088] S201: Counting the mean, standard deviation, maximum and range of the external characteristic parameters at different time points of charging and discharging, obtaining the characteristics of the external characteristic parameters of the lithium battery at different time points, and constructing a first characteristic matrix based on the characteristics of the external characteristic parameters;
[0089] S202: Calculate the variance of each column of the first feature matrix, use the median of the variance as the variance threshold, delete features whose variance is less than the variance threshold, and obtain a second feature matrix.
[0090] In a specific embodiment of the present invention, 25 characteristics of the battery in a monitoring cycle are obtained by statistically analyzing the mean, standard deviation, maximum value, minimum value, and range of the lithium battery terminal voltage, the battery voltage under load, the battery output current, the battery current under load, and the battery temperature during the monitoring process. According to the characteristics of the external characteristic parameters of the lithium battery at different time points, a first characteristic matrix is constructed;
[0091] Furthermore, the variances of the 25 columns of features in the first feature matrix are calculated respectively, and the median of the 25 variances is found. The median is used as the variance threshold, and the features with variances less than the variance threshold are deleted, and 18 features are retained to obtain the second feature matrix.
[0092] Compared with the prior art, the lithium battery SOC estimation method based on the PCA-RF model provided in the embodiment of the present invention takes into account the characteristics of the five external characteristic parameters of the lithium battery changing over time during operation, so that the model can refer to more key factors affecting the lithium battery SOC in the subsequent estimation process, and the parameters can be mutually verified, thereby reducing the influence of some data noise and improving the estimation accuracy and stability of the model.
[0093] In some embodiments of the present invention, see Figure 3 , Figure 3 The present invention provides Figure 1 The flowchart of step S103 in an embodiment of the present invention is shown in FIG. 1 , wherein step S103 includes steps S301 to S304:
[0094] S301, representing each feature in the second feature matrix using a vector, and recombining the vectors to form a centralized matrix;
[0095] S302, calculating a covariance matrix based on the centralization matrix;
[0096] S303, calculating eigenvalues and eigenvectors based on the covariance matrix, and forming a first mapping matrix according to the size combination of the eigenvalues, retaining a plurality of top-ranked eigenvalues and eigenvectors corresponding to the plurality of top-ranked eigenvalues in the first mapping matrix that are greater than a preset reconstruction threshold, and using the eigenvectors as a set of orthogonal bases to obtain a second mapping matrix;
[0097] S304: Project the second feature matrix onto the second mapping matrix based on matrix multiplication to obtain the reduced-dimensional third feature matrix as a target sample set, and divide the target sample set into a training set and a test set.
[0098] In the specific embodiment of the present invention, in order to more intuitively reflect the principle of the principal component analysis method, please refer to Figure 4 , Figure 4 The present invention provides Figure 1 A flow chart of another embodiment of step S103, wherein:
[0099] Each feature in the second feature matrix is represented by a vector, and the vectors are recombined to form a centralized matrix. The covariance matrix is calculated according to the centralized matrix, and the covariance matrix is decomposed by eigenvalues to calculate the eigenvalues and eigenvectors, and 18 eigenvalues (λ1, λ2, ..., λ 18 ) and the corresponding 18 eigenvectors (α1, α2, ..., α 18 ), sort the 18 eigenvalues to obtain the first mapping matrix, and use 0.95 as the reconstruction threshold, retaining the first k eigenvalues λ′ that meet the reconstruction threshold i The first k eigenvectors α′ corresponding to i (i=1,2,...,k), and the eigenvector is used as a set of orthogonal bases {u1,u2,...,u k}, get the second mapping matrix, and finally project the second feature matrix to the orthogonal basis {u1, u2, ..., u based on matrix multiplication. k}, the third feature matrix after dimension reduction is obtained as the target sample set, and the target sample set is divided into a training set and a test set.
[0100] It should be noted that the training set and test set account for 70% and 30% of the target sample set respectively.
[0101] The principal component analysis method used in the above embodiment realizes the process of dimensionality reduction, and the principle is as follows:
[0102] Let A be the matrix after centering the feature matrix, then the covariance matrix of matrix A is:
[0103]
[0104] remember u i is the i-th orthogonal basis (u i T u i =1), then the divergence of the sample point on the orthogonal basis is:
[0105]
[0106] Construct the Lagrangian function:
[0107] L(u i ,λ i )=ui T Covu i +λ i (1-u i T u i ) (3)
[0108] Taking partial derivative of (3) we get:
[0109]
[0110] Obviously, when λ i 、u i When it is the eigenvalue and eigenvector of the covariance matrix Cov, the divergence S i 2 There is an extreme value. Substituting (4) into (2) yields:
[0111] S i 2 =u i T Covu i =u i T λ i u i =λ i (5)
[0112] Combining equations (4) and (5), it can be seen that for the second feature matrix X with n columns of features, the process of reducing it to k dimensions (1≤k<n) based on the principal component analysis method is as follows: after centering X, use eigenvalue decomposition to find the eigenvalues and eigenvectors of its covariance matrix, sort the eigenvalues, select the eigenvectors corresponding to the first k eigenvalues as a set of new orthogonal bases, and project X onto the orthogonal base to achieve the dimensionality reduction process. The selection of eigenvalues can be based on the set reconstruction threshold. Here, the reconstruction threshold is set to 0.95, that is, the features corresponding to the first several eigenvalues selected should contain at least 95% of the information.
[0113] Compared with the prior art, the lithium battery SOC estimation method based on the PCA-RF model provided in the embodiment of the present invention realizes feature screening and dimensionality reduction by using variance filtering and principal component analysis methods, and reduces the data dimension to about one third of the original dimension while retaining most of the important information, thereby improving the model operation efficiency.
[0114] In some embodiments of the present invention, see Figure 5 , Figure 5 The present invention provides Figure 1 The flowchart of step S104 in an embodiment of the present invention is shown in FIG. 1 , wherein step S104 includes steps S501 to S505:
[0115] S501, constructing at least two independent decision tree models;
[0116] S502, using the at least two independent decision tree models as initial base evaluators to construct an initial lithium battery SOC estimation model;
[0117] S503, extracting a number of training samples with replacement from the samples included in the training set, the number of training samples being the same as the number of samples, and performing rounds of extraction based on the number of initial base evaluators to obtain at least two independent sampling sets;
[0118] S504, training the at least two initial base evaluators based on the at least two independent sampling sets to obtain at least two target base evaluators, wherein the target lithium battery SOC estimation model is jointly constituted by the at least two target base evaluators;
[0119] S505, the at least two target-based evaluators identify the input data to obtain at least two regression results, and use an average or voting method to determine a final output result for the at least two regression results as the output of the model;
[0120] The number of decision tree models, base evaluators, sampling sets, target base evaluators and regression results are all equal.
[0121] In some embodiments of the present invention, see Figure 6 , Figure 6 The present invention provides Figure 5 The flowchart of step S501 in an embodiment of the present invention is shown in FIG. 5 , wherein step S501 includes steps S601 to S604:
[0122] S601, dividing the sampling set based on each feature of the sampling set, calculating the information entropy or Gini coefficient after the division, and recording the optimal division feature;
[0123] S602, selecting the optimal partition feature to generate a node, and taking the corresponding partition mode as the final partition mode, and removing the optimal partition feature after the partition;
[0124] S603, repeating the above operation on the sample set without the optimal partitioning feature until the sample set cannot be divided any further or meets a preset condition;
[0125] S604, using the optimal partitioning feature at each partitioning as a node, and the result of each partitioning as a left and right subtree to construct a decision tree model, recording the result of the leaf node, and using the result of the leaf node as the regression result of the decision tree model.
[0126] In a specific embodiment of the present invention, in order to more intuitively reflect the principle of the random forest model, Figure 7 As shown, Figure 7 The working principle diagram of the random forest model provided by the present invention is as follows; in order to more intuitively reflect the principle of the decision tree, Figure 8 As shown, Figure 8 This is a working principle diagram of an embodiment of a decision tree provided by the present invention.
[0127] Specifically, we set the number of base evaluators to p, record the number of samples in the training set as m, extract m samples from the training set with replacement, and repeat the process p times to obtain p sampling sets containing m samples, where the i-th sampling set is recorded as T i (i=1, 2, ..., p);
[0128] Construct n decision tree models, where the construction process of the i-th model is as follows (i=1, 2, ..., p):
[0129] Set the number of features f i , from the i-th sampling set T i Randomly select f from all the features i features and delete the remaining features;
[0130] Traverse f i Features, based on each feature, the sample set after deleting the feature is divided;
[0131] Calculate the information entropy or Gini coefficient after partitioning and record the optimal partitioning features;
[0132] Select the optimal partition feature to generate a node, and use the corresponding partition method as the final partition method, and remove the optimal partition feature after partitioning;
[0133] Set the maximum tree depth d i , minimum number of leaf node samples l i , repeat the above operation on the subset after removing the features until the subset cannot be divided any further or the parameter conditions are met;
[0134] The optimal partitioning feature at each partition is used as the node, and the result of each partition is used as the left and right subtrees to build a decision tree model;
[0135] Record the results of the leaf nodes and use them as the regression results of the decision tree model;
[0136] The regression results of p decision tree models are combined into the regression results of the random forest model through averaging or voting.
[0137] In some embodiments of the present invention, the input parameters of the initial lithium battery SOC estimation model are adjusted multiple times using a grid search method, and the regression results after adjusting the parameters are compared with the true values until a parameter adjustment result that meets the preset conditions is selected;
[0138] The test set is imported into the lithium battery SOC estimation model after parameter adjustment to obtain the estimation results of the test set samples.
[0139] In some embodiments of the present invention, the initial lithium battery SOC estimation model is tested after training is completed, and the mean square error, average determination error, and determination coefficient are selected as evaluation indicators based on the estimation results of the test set samples to evaluate the estimation accuracy of the lithium battery SOC estimation model after training is completed.
[0140] Specifically, the calculation formula of the mean square error is:
[0141]
[0142] The calculation formula of the average decision error is:
[0143]
[0144] The calculation formula of the determination coefficient is:
[0145]
[0146] Where m is the number of samples, y j is the true value of the jth sample, is the estimated value of the jth sample, is the mean of the true values of the samples.
[0147] Compared with the prior art, the lithium battery SOC estimation method based on the PCA-RF model provided in the embodiment of the present invention is based on the ideas of extracting features, screening features, and projecting dimensionality reduction. On the one hand, it enhances the diversity of the selected features, thereby increasing the number of battery-related parameters that can be considered, thereby enabling the model to have better generalization capabilities. On the other hand, it reduces the data dimension to about one-third of the original dimension while retaining most of the important information, thereby improving the operating efficiency of the model while ensuring the accuracy of model estimation.
[0148] In order to better implement the lithium battery SOC estimation method based on the PCA-RF model in the embodiment of the present invention, on top of the lithium battery SOC estimation method based on the PCA-RF model, the embodiment of the present invention also provides a lithium battery SOC estimation device based on the PCA-RF model, such as Fig. 9 As shown, the lithium battery SOC estimation device 900 based on the PCA-RF model includes:
[0149] Data acquisition module 901: used to acquire external characteristic parameters of the lithium battery at each time point of charging and discharging as an initial sample set;
[0150] The first data processing module 902 is used to construct a first characteristic matrix based on the external characteristic parameters, and screen the first characteristic matrix to obtain a second characteristic matrix;
[0151] The second data processing module 903 is used to reduce the dimension of the second feature matrix by using the principal component analysis method to obtain a third feature matrix as a target sample set, and divide the target sample set into a training set and a test set;
[0152] Model training module 904: used to construct an initial lithium battery SOC estimation model based on a random forest model, and train and test the initial lithium battery SOC estimation model using the target sample set to obtain a target lithium battery SOC estimation model;
[0153] Determination module 905: is used to obtain the target characteristic parameters of the lithium battery in real time, input the target characteristic parameters into the target lithium battery SOC estimation model, and obtain the lithium battery SOC estimation result.
[0154] The lithium battery SOC estimation device 900 based on the PCA-RF model provided in the above embodiment can implement the technical solution described in the above embodiment of the lithium battery SOC estimation method based on the PCA-RF model. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above embodiment of the lithium battery SOC estimation method based on the PCA-RF model, which will not be repeated here.
[0155] The above is a detailed introduction to the lithium battery SOC estimation method and device based on the PCA-RF model provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A lithium battery SOC estimation method based on PCA-RF model, characterized in that: include: Obtain external characteristic parameters of the lithium battery at each time point of charging and discharging as an initial sample set; Constructing a first characteristic matrix based on the external characteristic parameters, and screening the first characteristic matrix to obtain a second characteristic matrix; Using a principal component analysis method to reduce the dimension of the second feature matrix, obtaining a third feature matrix as a target sample set, and dividing the target sample set into a training set and a test set; Constructing an initial lithium battery SOC estimation model based on a random forest model, and training and testing the initial lithium battery SOC estimation model using the training set and the test set to obtain a target lithium battery SOC estimation model; Acquire target characteristic parameters of the lithium battery in real time, input the target characteristic parameters into the target lithium battery SOC estimation model, and obtain a lithium battery SOC estimation result; The step of constructing a first feature matrix based on the external feature parameters includes: Counting the mean, standard deviation, maximum and range of the external characteristic parameters at different time points of charging and discharging, obtaining the characteristics of the external characteristic parameters of the lithium battery at different time points, and constructing a first characteristic matrix based on the characteristics of the external characteristic parameters; The step of screening the first characteristic matrix to obtain a second characteristic matrix includes: Calculate the variance of each column of the first feature matrix, use the median of the variance as the variance threshold, delete the features whose variance is less than the variance threshold, and obtain a second feature matrix; The step of reducing the dimension of the second feature matrix by using the principal component analysis method to obtain a third feature matrix as a target sample set includes: Represent each feature in the second feature matrix using a vector, and recombine the vectors to form a centralized matrix; Calculating a covariance matrix based on the centering matrix; Calculate eigenvalues and eigenvectors based on the covariance matrix, and form a first mapping matrix according to the size combination of the eigenvalues, retain the top-ranked eigenvalues and eigenvectors corresponding to the top-ranked eigenvalues in the first mapping matrix that are greater than a preset reconstruction threshold, and use the eigenvectors as a set of orthogonal bases to obtain a second mapping matrix; The second feature matrix is projected onto the second mapping matrix based on matrix multiplication to obtain the reduced-dimensional third feature matrix as the target sample set.
2. The lithium battery SOC estimation method based on the PCA-RF model according to claim 1 is characterized in that: The initial lithium battery SOC estimation model is constructed based on the random forest model, and the initial lithium battery SOC estimation model is trained and tested using the training set and the test set to obtain a target lithium battery SOC estimation model, including: Build at least two independent decision tree models; Using the at least two independent decision tree models as initial base evaluators to construct an initial lithium battery SOC estimation model; Extracting a number of training samples with replacement from a number of samples included in the training set, the same number as the number of samples, and performing rounds of extraction based on the number of initial base evaluators to obtain at least two independent sampling sets; Based on the at least two independent sampling sets, the at least two initial base evaluators are trained respectively to obtain at least two target base evaluators, wherein the target lithium battery SOC estimation model is jointly constituted by the at least two target base evaluators; The at least two target-based evaluators identify the input data to obtain at least two regression results, and use an average or voting method to determine a final output result for the at least two regression results as the output of the model; Among them, the number of decision tree models, base evaluators, sampling sets, target base evaluators and regression results are all equal.
3. The lithium battery SOC estimation method based on the PCA-RF model according to claim 2 is characterized in that: Obtaining the decision tree model includes: Divide the sampling set based on each feature of the sampling set, calculate the information entropy or Gini coefficient after the division, and record the optimal division feature; Select the optimal partition feature to generate a node, and use the corresponding partition method as the final partition method, and remove the optimal partition feature after partitioning; Repeat the above operation on the sample set without the optimal partitioning feature until the sample set cannot be divided any further or meets a preset condition; The optimal partitioning feature at each partitioning is used as the node, and the result of each partitioning is used as the left and right subtrees to build a decision tree model, and the results of the leaf nodes are recorded, and the results of the leaf nodes are used as the regression results of the decision tree model.
4. The lithium battery SOC estimation method based on the PCA-RF model according to claim 1, characterized in that: The using the training set and the test set to train and test the initial lithium battery SOC estimation model includes: Using a grid search method to adjust the input parameters of the initial lithium battery SOC estimation model multiple times, and comparing the regression results after adjusting the parameters with the true values, until a parameter adjustment result that meets the preset conditions is selected; The test set is imported into the lithium battery SOC estimation model after parameter adjustment to obtain the estimation results of the test set samples.
5. The lithium battery SOC estimation method based on the PCA-RF model according to claim 4 is characterized in that: The using the training set and the test set to train and test the initial lithium battery SOC estimation model also includes: After the initial lithium battery SOC estimation model is trained, it is tested. Based on the estimation results of the test set samples, mean square error, average determination error, and determination coefficient are selected as evaluation indicators to evaluate the estimation accuracy of the lithium battery SOC estimation model after the training is completed.
6. The lithium battery SOC estimation method based on the PCA-RF model according to claim 1, characterized in that: The step of obtaining the external characteristic parameters of the lithium battery at each time point of charging and discharging as an initial sample set further includes: Based on the ratio of the number of missing values, outliers and invalid values in the initial sample set to the sample capacity, the missing values, outliers and invalid values are processed by deletion, filling or replacement.
7. A lithium battery SOC estimation device based on PCA-RF model, characterized in that: include: Data acquisition module: used to obtain the external characteristic parameters of the lithium battery at each time point of charging and discharging as the initial sample set; A first data processing module: used for constructing a first characteristic matrix based on the external characteristic parameters, and screening the first characteristic matrix to obtain a second characteristic matrix; A second data processing module is used to reduce the dimension of the second feature matrix by using a principal component analysis method to obtain a third feature matrix as a target sample set, and divide the target sample set into a training set and a test set; Model training module: used to construct an initial lithium battery SOC estimation model based on the random forest model, and use the target sample set to train and test the initial lithium battery SOC estimation model to obtain a target lithium battery SOC estimation model; Determination module: used for acquiring target characteristic parameters of lithium battery in real time, inputting the target characteristic parameters into the target lithium battery SOC estimation model, and obtaining the lithium battery SOC estimation result; The step of constructing a first feature matrix based on the external feature parameters includes: Counting the mean, standard deviation, maximum and range of the external characteristic parameters at different time points of charging and discharging, obtaining the characteristics of the external characteristic parameters of the lithium battery at different time points, and constructing a first characteristic matrix based on the characteristics of the external characteristic parameters; The step of screening the first characteristic matrix to obtain a second characteristic matrix includes: Calculate the variance of each column of the first feature matrix, use the median of the variance as the variance threshold, delete the features whose variance is less than the variance threshold, and obtain a second feature matrix; The step of reducing the dimension of the second feature matrix by using the principal component analysis method to obtain a third feature matrix as a target sample set includes: Represent each feature in the second feature matrix using a vector, and recombine the vectors to form a centralized matrix; Calculating a covariance matrix based on the centering matrix; Calculate eigenvalues and eigenvectors based on the covariance matrix, and form a first mapping matrix according to the size combination of the eigenvalues, retain the top-ranked eigenvalues and eigenvectors corresponding to the top-ranked eigenvalues in the first mapping matrix that are greater than a preset reconstruction threshold, and use the eigenvectors as a set of orthogonal bases to obtain a second mapping matrix; The second feature matrix is projected onto the second mapping matrix based on matrix multiplication to obtain the reduced-dimensional third feature matrix as the target sample set.
Citation Information
Patent Citations
Method for estimating health state of lithium battery based on health characteristics of charging stage
CN110187281A
Power lithium battery SOC estimation method based on self-adaptive Kalman filtering method
CN110395141A
Hot continuous rolling strip steel width prediction method based on cooperation of principal component analysis and random forest
CN113011491A
Method for predicting state of charge of vehicle-mounted lithium ion battery based on random forest model
CN113125960A
Lithium ion battery life span prediction method, discharge capacity retention rate prediction method, life span prediction program, discharge capacity retention rate prediction program, and information processing device
WO2022080377A1
