Battery residual life prediction method and system based on false nearest neighbor and three-parallel attention network
By combining the fake nearest neighbor method and the three-parallel attention network, the problem of low battery residual service life prediction accuracy is solved, and more efficient and accurate battery life prediction is achieved.
Patent Information
- Application Number
- CN202510155169.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art is difficult to accurately predict the remaining service life of the battery, especially under the influence of capacity recovery phenomena during battery degradation, resulting in low prediction accuracy and complex networks and a large amount of training time.
The battery residual life prediction method based on the fake nearest neighbor and the three-parallel attention network is adopted. The sliding window size is calculated by the fake nearest neighbor method, and the characteristics of the battery charge and discharge capacity sequence are extracted using the three-parallel attention network to generate prediction data to calculate the remaining service life of the battery.
It improves the prediction accuracy of the remaining battery life, reduces the empirical setting of sliding window size, shortens the time required for model prediction, and improves the training efficiency and prediction ability of the model.
Smart Images

Figure CN120065038A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method and system for predicting the remaining life of a battery, and particularly to a method and system for predicting the remaining life of a battery based on false nearest neighbors and a three-parallel attention network. Background Art
[0002] As a key energy storage device in the new energy field, batteries are known for their advantages such as light weight, small size, high energy density, and long cycle life. However, with the increase in the number of charge-discharge cycles, complex electrochemical processes inside the battery (such as side reactions like lithium-ion deposition, thickening of the solid electrolyte interface layer, and electrolyte oxidation) may cause its performance to decline irreversibly. When the battery degrades to the failure threshold, continued use may lead to abnormal operation of the device and even catastrophic accidents. Therefore, accurately predicting the remaining service life of the battery is crucial.
[0003] During the battery degradation process, as the number of charge-discharge cycles increases, the battery storage capacity gradually decreases. However, when the battery is in a static state, the internal side reaction products dissipate, resulting in a capacity recovery phenomenon. Since the suddenly increased battery capacity will affect the accuracy of the remaining service life prediction, the consideration of this part cannot be ignored. And for long-life batteries, the impact of this part on the overall remaining service life prediction will be gradually amplified, and its incorrect prediction will seriously affect the subsequent overall prediction trend.
[0004] Considering that model-based methods are difficult to be widely applied in practical applications. Therefore, a large number of researchers have studied the prediction of the remaining service life of batteries using data-driven methods. The data-driven methods analyze historical degradation data and use various algorithms to construct the forward and backward mapping relationships of the battery degradation trend, so as to achieve the prediction of the remaining service life. However, most of the current data-driven methods define the sliding window size according to experience, which will affect the prediction accuracy, and a complex network and a large amount of training time are required to obtain an accurate prediction result. Summary of the Invention
[0005] Object of the Invention: The object of the present invention is to propose a method and system for predicting the remaining life of a battery based on false nearest neighbors and a three-parallel attention network, which can accurately predict the remaining service life of the battery and improve the prediction accuracy.
[0006] Technical Solution: The present invention includes the following steps:
[0007] Select multiple batteries in series to form a module, and conduct charge-discharge cycle test experiments under specified working conditions to collect battery charge-discharge test data;
[0008] Based on the battery charge and discharge test data, obtain the charge and discharge capacity data during the battery charge and discharge cycle, and generate a battery charge and discharge capacity sequence;
[0009] Process the battery charge and discharge capacity to construct a model training sample;
[0010] Based on the battery training sample data, calculate the sliding window size using the false nearest neighbor method;
[0011] Based on the sliding window size reference value calculated by the false nearest neighbor method, input the battery training sample data into the constructed three-parallel attention network, and optimize the network using an activation function. The parameters of the network are updated through a loss function, where the activation function is:
[0012]
[0013] where x is the input value, tanh is the hyperbolic tangent function, and β is an adjustable parameter used to control the shape or amplitude of the function;
[0014] The loss function is:
[0015]
[0016] where α, β, and λ are weight coefficients, C i is the actual capacity, is the predicted capacity, and φ(·) represents the mapping function that maps to the Hilbert space;
[0017] Input the battery charge and discharge data to be predicted into the trained three-parallel attention network to generate battery charge and discharge prediction data;
[0018] According to the future battery charge and discharge capacity data and the set battery failure threshold, calculate the remaining service life of the battery to obtain the prediction result.
[0019] The activation function enables the network to learn and simulate complex data relationships while controlling the activation state of neurons.
[0020] The loss function can measure the difference between the model prediction and the actual result, and guide the adjustment of parameters by minimizing the difference during model training.
[0021] The false nearest neighbor method is specifically:
[0022] The battery capacity degradation sequence data is represented by X:
[0023] X = [X Train , X Test
[0024] where X Train = [x(1), x(2), …, x(j)], X Test = [x(j + 1), x(j + 2), …, x(n)] are the training set data and the test set data respectively, j represents the number of training samples, and n represents the length of the original data; set the sliding window size to d., X (q) (i) is the vector closest to X(i), and the Euclidean distance between them is:
[0025]
[0026] Among them, τ is the time delay; when the sliding window increases from d to d + 1, the vector X (q) The distance expression between (i) and the vector X(i) is as follows:
[0027]
[0028] Judge whether the vector X (q) (i) is a false nearest neighbor point of X(i), and the calculation expression is as follows:
[0029]
[0030] Among them, R tol is a pre-set threshold;
[0031] In order to determine the optimal embedding dimension, Takens' theorem is introduced to supplement the judgment of false nearest neighbor points, and the calculation expression is as follows:
[0032]
[0033] R d+1 (t, q) > 2R A
[0034] Among them, As the embedding dimension d increases from 1 to j - d, the above formula can calculate the number and percentage of false nearest neighbor points.
[0035] During the process of increasing the d dimension, the percentage of false nearest neighbor points gradually decreases and approaches zero. When the percentage is close to zero, the size of the dimension at that time is the optimal dimension size, and this optimal dimension size is the value of the sliding window size.
[0036] The reference value of the sliding window size calculated by the false nearest neighbor method is input into the constructed three-parallel attention network with battery training sample data, specifically including:
[0037] The convolutional layer consists of filters that extract features from the input signal and kernels that specify the filter height, and its calculation expression is as follows:
[0038]
[0039] wherein is the m-th sub-vector of X, m ∈ [1, N], W (i) and B k respectively represent the weight and bias coefficient of the k-th layer, k represents the output of the m-th sub-vector in the k-th layer; The function of the pooling layer is to perform non-linear data downsampling. The max pooling layer slides a fixed-size window on the feature map and selects the maximum value within the window as the output result. Its expression is as follows:
[0040] where g
[0041]
[0042] is the pooling size, k and represents the sliding stride;
[0043] The fully connected layer calculates the weighted sum and activation function through weights and biases, and further operates on the above output result. Its expression is as follows:
[0044]
[0045] where W ds and B ds respectively represent the weight and bias;
[0046] An attention unit layer is introduced, taking the output of the fully connected layer as the input, and then calculating the attention weights through the Softmax function. Its expression is as follows:
[0047]
[0048] Finally, the final time-step attention vector is obtained through a product operation:
[0049]
[0050] The overall calculation process expression of the three parallel attention networks is as follows:
[0051] y 1 = Mul(Softmax(FC 1 (MaxPool(Conv))))
[0052] y 2 = Mul(Softmax(FC 1 (Conv)))
[0053] y 3 = Mul(Softmax(FC 1(MaxPool(Conv))))
[0054] y = FC 2 (Flatten(ADD[y 1 ,y 2 ,y 3 ))
[0055] Among them, Mul represents the dot product operation.
[0056] The calculation expressions of the DTW and TDI are as follows:
[0057]
[0058] Among them, γ is the smoothing coefficient, A is the binary matrix, and n and m are dimensions.
[0059] The input of the three-parallel attention network model is the battery charge and discharge capacity data, and the output is the future battery charge and discharge capacity data.
[0060] The remaining useful life of the battery is the number of charge and discharge cycles from the current time to the preset failure threshold, denoted as RUL = T EOL -T i , where RUL is the remaining useful life of the battery, and T EOL is the number of charge and discharge cycles when the battery capacity drops to the failure threshold, and T i is the number of cycle periods of the current battery capacity.
[0061] A battery remaining life prediction system based on false nearest neighbors and a three-parallel attention network, comprising:
[0062] Sliding window module: Obtain battery training sample data, calculate the sliding window size using the false nearest neighbor method, and determine the sliding window reference value;
[0063] Model prediction module: Input the battery charge and discharge data to be predicted into the trained three-parallel attention network to generate battery charge and discharge prediction data;
[0064] Calculation prediction module: Calculate the remaining useful life of the battery according to the future battery charge and discharge capacity data and the set battery failure threshold to obtain the prediction result.
[0065] Beneficial effects: The present invention has the following advantages:
[0066] (1) The present invention adopts a custom activation function and a custom loss function. The custom activation function enables the network to learn and simulate complex data relationships, while controlling the activation state of neurons and affecting the training efficiency and convergence of the model; the custom loss function measures the difference between the model prediction and the actual result, guiding the model to adjust parameters by minimizing the difference during training to improve the model performance;
[0067] (2) The present invention uses the false nearest neighbor method to provide a reference value for the sliding window size in the battery charge and discharge capacity data. It overcomes the problem that most data-driven methods rely on empirical setting of the sliding window size. The appropriate sliding window size reduces the frequency of sliding operations, improves the accuracy of model prediction, and shortens the time required for model prediction;
[0068] (3) The present invention adopts a new three-parallel attention network, which can better extract the charge and discharge capacity sequence features through a parallel mechanism. By introducing attention units in each parallel branch of the convolutional neural network, it can enhance the capture of the capacity regeneration phenomenon and the long-distance dependence on the input data. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 is a flowchart of the present invention;
[0070] Figure 2 is a flowchart of the three-parallel attention network of this embodiment. DETAILED DESCRIPTION OF THE INVENTION
[0071] The present invention will be further described below with reference to the accompanying drawings.
[0072] Embodiment 1
[0073] As Figure 1 and Figure 2 shown, the battery remaining life prediction method based on the false nearest neighbor and the three-parallel attention network of this embodiment includes the following steps:
[0074] S1. Select multiple batteries connected in series to form a module, and conduct charge and discharge cycle test experiments under specified working conditions to collect battery charge and discharge test data;
[0075] S2. Based on the battery charge and discharge test data, obtain the charge and discharge capacity data during the battery charge and discharge cycle, and generate a battery charge and discharge capacity sequence;
[0076] S3. Process the battery charge and discharge capacity to construct a model training sample;
[0077] S4. Based on the battery training sample data, use the false nearest neighbor method to calculate the sliding window size
[0078] In this embodiment, the description of the false nearest neighbor method is as follows:
[0079] The battery capacity degradation sequence data is represented by X, and the specific expression is as follows:
[0080] X = [X Train , X Test
[0081] where XTrain = [x(1), x(2), …, x(j)], X Test = [x(j + 1), x(j + 2), …, x(n)] are the training set data and the test set data respectively, where j represents the number of training samples and n represents the length of the original data. Set the sliding window size to d., X (q) (i) is the vector closest to X(i), and the Euclidean distance between them is:
[0082]
[0083] where τ is the time delay. When the sliding window increases from d to d + 1, the distance expression between vector X (q) (i) and vector X(i) is as follows:
[0084]
[0085] Judge whether vector X (q) (i) is a false nearest neighbor point of X(i) with the following calculation expression:
[0086]
[0087] where R tol is a pre-set threshold. The default setting is R tol ≥ 10. In practical applications, due to the fact that data often contains noise, it may be difficult to identify or misjudge a false nearest neighbor point using the above formula. To determine the optimal embedding dimension, Takens' theorem is introduced to supplement the judgment of false nearest neighbor points, and the calculation expression is as follows:
[0088]
[0089] R d+1 (t, q) > 2R A
[0090] where As the embedding dimension d increases from 1 to j - d, the above formula can calculate the number of false nearest neighbor points and their percentages. During the increasing process of the d dimension, the percentage of false nearest neighbor points gradually decreases and approaches zero. When the percentage is close to zero, the size of the dimension at that time is the optimal dimension size. This optimal dimension size is also the value of the sliding window size. Therefore, the constructed training set and test set expressions are as follows:
[0091] L Train = [(X (1) , x(d + 1)), …, (X (i) , x(d + i), …, (X (j-d) , x(j)]
[0092] L Test= [(X (j-d+1) , x(j + 1)), …, (X (s) , x(d + s)), …, (X (n-d) , x(n))]
[0093] where X (i) represents the input vector after being processed by the sliding window. Its expression is:
[0094] X (i) = [x(i), x(i + 1), …, x(i + d - 1)], i = 1, 2, …, k - 1
[0095] For a training sample (X (i) , x(d + i)), where X (i) represents the input data and x(d + i) is the label corresponding to the input data. However, for a test sample (X (s) , x(d + s)), s = j - d + 1, j - d + 2, …, n - d, it is different from the training sample because the capacity of the test set is unknown. The test sample contains the battery charge and discharge capacity values estimated by the sliding window mechanism. The expression of the input data of the test set is as follows:
[0096]
[0097] S5. The reference value of the sliding window size calculated based on the false nearest neighbor method. Input the battery training sample data into the constructed three - parallel attention network, specifically:
[0098] S51: The convolutional layer consists of filters that extract features from the input signal and kernels that specify the filter height. Its calculation expression is as follows:
[0099]
[0100] where is the m - th sub - vector of X (i) , where m ∈ [1, N], W k and B k represent the weight and bias coefficient of the k - th layer respectively. represents the output of the m - th sub - vector in the k - th layer.
[0101] S52: The function of the pooling layer is to perform non - linear data downsampling to reduce the data scale while retaining key information. The max - pooling layer slides a fixed - size window over the feature map and selects the maximum value within the window as the output result. Its expression is as follows:
[0102]
[0103] where g kis the pooling size. represents the sliding stride.
[0104] S53: The fully connected layer calculates the weighted sum and activation function through certain weights and biases, and performs further linear and non-linear operations on the above output results, which can improve the modeling ability of the neural network to learn multi-layer abstract data. Its expression is as follows:
[0105]
[0106] where W ds and B ds represent weights and biases respectively.
[0107] S54: Introducing the attention unit layer enables the model to capture the dependency relationships of the long sequence capacity and improve the accuracy of the prediction in the capacity regeneration part. Specifically, taking the output of the fully connected layer as the input, and then calculating the attention weights through the Softmax function. Its expression is as follows:
[0108]
[0109] Finally, the final time step attention vector is obtained through a multiplication operation.
[0110]
[0111] S55: The overall calculation process expression of the three parallel attention networks is as follows:
[0112] y 1 = Mul(Softmax(FC 1 (MaxPool(Conv))))
[0113] y 2 = Mul(Softmax(FC 1 (Conv)))
[0114] y 3 = Mul(Softmax(FC 1 (MaxPool(Conv))))
[0115] y = FC 2 (Flatten(ADD[y 1 ,y 2 ,y 3 ))
[0116] where Mul represents the dot product operation.
[0117] In this embodiment, a custom activation function is used to optimize the network. The network applies different non-linear transformations in different input ranges, so as to better adapt to the complexity of the data. The specific expression is as follows:
[0118]
[0119] Among them, x is the input value, tanh is the hyperbolic tangent function, and β is an adjustable parameter used to control the shape or amplitude of the function. In the formula, the custom activation function uses different processing methods when x < 0 and x ≥ 0, introducing non-linearity, controlling the activation state of neurons, improving gradient flow, enhancing the model's expression ability, and improving training efficiency, thus optimizing the performance of the neural network. This defined activation function enables the network to better learn and simulate complex data relationships, thereby improving the model's prediction ability and generalization ability.
[0120] The parameters of the network are updated through a custom loss function, and the specific expression is as follows:
[0121]
[0122] Among them, α, β, and λ are weight coefficients, C i is the actual capacity, is the predicted capacity, φ(·) represents the mapping function that maps to the Hilbert space, and the calculation expressions of DTW and TDI are as follows:
[0123]
[0124] Among them, γ is the smoothing coefficient, A is the binary matrix, and n and m are dimensions.
[0125] Through the backpropagation algorithm, the gradient of the loss function is used to update the weights and biases of the network. This includes adjusting weight coefficients such as α, β, and λ to minimize the overall loss. Each term in the loss function can be regarded as different constraints and regularizations on the model, helping to prevent overfitting and improve the generalization ability.
[0126] S6. Input the battery charge and discharge data to be predicted into the trained three-parallel attention network to generate battery charge and discharge prediction data; the input of the three-parallel attention network model is the battery charge and discharge capacity data, and the output is the future battery charge and discharge capacity data.
[0127] Step S7. Based on the battery capacity failure threshold, deduce the remaining service life of the battery. The battery capacity failure threshold refers to the battery charge and discharge capacity dropping to 70% of its rated capacity; the remaining service life of the battery is the number of charge and discharge cycles from the current time to the preset failure threshold, denoted as RUL = T EOL -T i where RUL is the remaining service life of the battery, T EOLis the number of charge-discharge cycles when the battery capacity drops to the failure threshold, T i is the number of cycle periods of the current battery capacity.
[0128] Embodiment 2
[0129] The battery remaining life prediction system based on false nearest neighbor and three parallel attention networks in this embodiment includes:
[0130] A sliding window module, configured to obtain battery training sample data, calculate the sliding window size using the false nearest neighbor method, and determine the sliding window reference value;
[0131] A model prediction module, configured to input the charge-discharge data of the battery to be predicted into the trained three parallel attention networks to generate battery charge-discharge prediction data;
[0132] A calculation prediction module, configured to calculate the remaining service life of the battery according to the future battery charge-discharge capacity data and the set battery failure threshold to obtain a prediction result.
Claims
1. A method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks, characterized in that: The following steps are involved: Select multiple batteries to be connected in series into a module, perform charge and discharge cycle test experiments under specified working conditions, and collect battery charge and discharge test data; Based on the battery charge and discharge test data, the charge and discharge capacity data of the battery during the charge and discharge cycle is obtained to generate a battery charge and discharge capacity sequence; Process the battery charge and discharge capacity to build model training samples; Based on the battery training sample data, the sliding window size is calculated using the pseudo nearest neighbor method; Based on the sliding window size reference value calculated by the false nearest neighbor method, the battery training sample data is input into the constructed three-parallel attention network, and the activation function is used to optimize the network. The parameters of the network are updated through the loss function, where the activation function is: Among them, x is the input value, tanh is the hyperbolic tangent function, and β is an adjustable parameter; The loss function is: Among them, α, β, λ are weight coefficients, C i is the actual capacity, To predict the capacity, φ(·) represents the mapping function to the Hilbert space; Input the battery charge and discharge data to be predicted into the trained three-parallel attention network to generate battery charge and discharge prediction data; Calculate the remaining service life of the battery based on future battery charge and discharge capacity data and the set battery failure threshold.
2. According to claim 1, a method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks is characterized in that: The activation function enables the network to learn and simulate complex data relationships while controlling the activation state of neurons.
3. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 1, characterized in that: The loss function can measure the difference between the model prediction and the actual result, and guide the adjustment of parameters by minimizing the difference during model training.
4. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 1, characterized in that: The false nearest neighbor method is specifically as follows: The battery capacity degradation sequence data is represented by X: X=[X Train ,X Test ] Among them, X Train =[x(1),x(2),…,x(j)],X Test =[x(j+1),x(j+2),…,x(n)] are the training set data and the test set data respectively, j represents the number of training samples, and n represents the length of the original data; the sliding window size is set to d. ,X (q) (i) is the vector closest to X(i), then the Euclidean distance between them is: Where τ is the time delay; when the sliding window increases from d to d+1, the vector X (q) The distance expression between (i) and vector X(i) is as follows: Judgment vector X (q) The calculation expression of whether (i) is a false neighbor of X(i) is as follows: Among them, R tol is a pre-set threshold; In order to determine the optimal embedding dimension, Takens theorem is introduced to make supplementary judgments on false neighbor points. The calculation expression is as follows: R d+1 (t,q)>2R A in, As the embedding dimension d increases from 1 to jd, the above formula can calculate the number of false neighbor points and their percentage.
5. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 4, characterized in that: As the d dimension increases, the percentage of false neighbor points gradually decreases and approaches zero. When the percentage is close to zero, the dimension size is the optimal dimension size, which is the value of the sliding window size.
6. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 5, characterized in that: The sliding window size reference value calculated based on the false nearest neighbor method is input into the battery training sample data into the constructed three parallel attention networks, specifically including: A convolutional layer consists of a filter that extracts features from the input signal and a kernel that specifies the height of the filter, which is calculated as follows: in For X (i) The mth subvector of k and B k Represent the weight and bias coefficient of the kth layer respectively, Represents the output of the mth subvector in the kth layer; The function of the pooling layer is to implement nonlinear data downsampling. The maximum pooling layer slides a fixed-size window on the feature map and selects the maximum value in the window as the output result. Its expression is as follows: Among them, g k is the pooling size, Indicates the sliding stride; The fully connected layer performs weighted and activation function calculations through weights and biases, and further operates on the above output results. The expression is as follows: Where W ds and B ds Represent weight and bias respectively; The attention unit layer is introduced, the output of the fully connected layer is used as input, and the attention weight is calculated by the Softmax function. The expression is as follows: Finally, the final time-step attention vector is obtained through the product operation: The overall calculation process of the three parallel attention networks is expressed as follows: y1=Mul(Softmax(FC1(MaxPool(Conv)))) y2=Mul(Softmax(FC1(Conv))) y3=Mul(Softmax(FC1(MaxPool(Conv)))) y=FC2(Flatten(ADD[y1,y2,y3])) Among them, Mul represents the dot product operation.
7. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 1, characterized in that: The calculation expressions of DTW and TDI are as follows: Where γ is the smoothing coefficient, A is a binary matrix, and n and m are dimensions.
8. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 6, characterized in that: The input of the three-parallel attention network model is the battery charging and discharging capacity data, and the output is the future battery charging and discharging capacity data.
9. The method for predicting remaining battery life based on pseudo nearest neighbor and three parallel attention networks according to claim 1, characterized in that: The remaining service life of the battery is the number of charge and discharge cycles from the current time to the preset failure threshold, denoted by RUL = T EOL -T i , where RUL is the remaining battery life, T EOL is the number of charge and discharge cycles when the battery capacity drops to the failure threshold, T i The number of cycles for the current battery capacity.
10. A battery remaining life prediction system based on pseudo nearest neighbor and three parallel attention networks, characterized in that: include: Sliding window module: obtain battery training sample data, use the false nearest neighbor method to calculate the sliding window size, and determine the sliding window reference value; Model prediction module: input the battery charge and discharge data to be predicted into the trained three-parallel attention network to generate battery charge and discharge prediction data; Calculation prediction module: Calculate the remaining service life of the battery based on the future battery charge and discharge capacity data and the set battery failure threshold to obtain the prediction result.
Citation Information
Patent Citations
Lithium battery remaining life prediction method
CN110188920A
Bearing residual life prediction model and method based on deep transfer learning
CN112949097A
Lithium battery health condition monitoring method based on feature transfer learning
CN113536676A
Residual life prediction method for mechanical equipment
CN116579233A
Lithium ion battery remaining service life prediction method based on TCN-GRU-BNDNN model
CN117172106A