Battery state of charge estimation method and device based on local weighted regression

By combining local weighted regression and enhanced convolutional hybrid neural network with a multi-layer self-attention mechanism, the volatility problem of lithium-ion battery state of charge estimation is solved, achieving more accurate and stable SOC prediction.

CN119199557BActive Publication Date: 2025-09-30STATE GRID SICHUAN ELECTRIC POWER CORP ELECTRIC POWER RES INST +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411558352.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-09-30
Estimated Expiration
2044-11-04

AI Technical Summary

Technical Problem

Existing lithium-ion battery state-of-charge estimation models find it difficult to accurately capture the relationship between input data and state-of-charge, resulting in volatility and instability in the estimation results.

Method used

The local weighted regression algorithm is used to smooth the current and voltage data and merge them with the original data as an extended input. Regression prediction is performed through an enhanced convolutional hybrid neural network, combining a multi-layer self-attention mechanism and grouped convolution operations to generate the SOC prediction value.

Benefits of technology

It improves the accuracy and stability of state-of-charge estimation, reduces output fluctuations, enhances the understanding of the mapping relationship of internal battery characteristics, reduces the risk of overfitting, and improves the performance of the model on unseen data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119199557B_ABST
    Figure CN119199557B_ABST
Patent Text Reader

Abstract

The present invention discloses a battery state of charge estimation method and device based on local weighted regression. The method uses local weighted regression to smooth current and voltage as extended input for neural network training, thereby enhancing the implicit connection between data and the actual SOC value of lithium-ion batteries, improving the prediction ability of the model, and effectively reducing SOC output fluctuations. A grouped convolutional neural network prediction model with a multi-layer self-attention mechanism is proposed, which effectively reduces the number of model parameters and the amount of calculation, while better capturing local feature information. The introduction of the multi-layer self-attention mechanism enables the network to dynamically establish associations between different positions, thereby better capturing long-distance dependencies within the voltage and current series, while having good flexibility and interpretability, and is very suitable for battery SOC estimation modeling tasks. The proportional integral and differential search algorithms are introduced for hyperparameter optimization, and the optimal network parameters are obtained through continuous iterative optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of lithium-ion battery state prediction, and in particular to a battery state of charge estimation method and device based on local weighted regression. Background Art

[0002] With the gradual depletion of non-renewable fossil fuels and the frequent occurrence of extreme climate events, the world has significantly increased its attention to clean energy since the 21st century. Thanks to continuous technological advancements and effective cost control, lithium-ion batteries have become one of the key drivers of global energy transformation. An increasing number of countries and regions are increasing investment and R&D in this technology to promote the innovation and application of green energy technologies and address the dual challenges of climate change and energy security. In the development and application of lithium-ion batteries, the battery management system (BMS) is crucial to ensuring battery safety, stability, and performance. It has become a core component of key technologies such as electric vehicles, portable electronic devices, and energy storage systems. The BMS can monitor battery parameters such as voltage, current, temperature, and state of charge in real time, manage and control the charge and discharge process of lithium-ion batteries, avoid problems such as overcharging, over-discharging, and thermal runaway, and ensure the long-term safe and stable operation of lithium-ion batteries. In particular, the state of charge (SOC), a core parameter of the BMS, is crucial to the performance and lifespan of lithium-ion batteries. If the estimated SOC is lower than the actual value, the battery's full capacity cannot be fully utilized, hindering efficiency. Conversely, if the estimated SOC is higher than the actual value, it can be misleading and easily lead to over-discharge of the battery. Therefore, accurate SOC estimation is crucial to ensuring safe and reliable battery operation.

[0003] While current machine learning techniques can achieve high accuracy in state-of-charge prediction, the models employed struggle to accurately capture the relationship between lithium-ion battery input data and the state of charge (SOC), leading to high volatility and instability in SOC estimates. Consequently, short-term output fluctuations in lithium-ion battery state assessment using this method are significant, severely limiting its practical application. Therefore, there is an urgent need to develop an estimation method with high accuracy and low volatility to address this issue. Summary of the Invention

[0004] Based on the problems raised by the above background technology, the purpose of the present invention is to provide a battery state of charge estimation method and device based on local weighted regression, which solves the problem that the existing model is difficult to accurately capture the relationship between lithium-ion battery input data and state of charge, thereby causing high fluctuation and instability in state of charge estimation.

[0005] The present invention is achieved through the following technical solutions:

[0006] A first aspect of the present invention provides a battery state of charge estimation method based on local weighted regression, comprising the following steps:

[0007] Obtaining the original current and voltage of the battery, and smoothing the original current and voltage using a local weighted regression algorithm to obtain a smoothed current and voltage;

[0008] The original current and voltage are combined with the smoothed current and voltage to form extended data and input into the enhanced convolutional hybrid neural network for regression prediction to obtain the SOC prediction value; wherein,

[0009] The enhanced convolution hybrid neural network sequentially performs ordinary convolution and grouped convolution operations on the extended data to generate a feature map;

[0010] The feature map is processed based on a multi-layer self-attention mechanism, and the processed feature map is linked to a fully connected layer for nonlinear combination to obtain a SOC prediction value.

[0011] In the above technical solution, the current and voltage under different working conditions and temperatures are obtained through the experimental platform, and then the current and voltage are smoothed using local weighted regression. The data are then merged with the original current and voltage data to form a new extended neural network input. This extended input can help the neural network learn the relevant internal characteristics of the battery when the battery parameters change rapidly, effectively reducing the fluctuation of the network output SOC.

[0012] The expanded input undergoes convolution to form a feature map, which is then followed by grouped convolution. Grouped convolution divides the input feature map into several groups, each of which undergoes independent convolution. The results are then recombined to form the final output feature map. Each group of convolutions improves the model's performance on unseen data by limiting the number of parameters and connections within different groups, reducing the risk of overfitting. Following grouped convolution, a multi-layer self-attention mechanism is introduced. The self-attention layers are stacked in multiple layers, each receiving input from the previous layer and passing it to the next. The output of this hierarchical structure not only reflects the network's deep understanding of the current data point, but also integrates information from the previous layer, thereby enhancing the network model's ability to capture complex patterns and long-term dependencies in time series. Finally, the output is linked to a fully connected layer for nonlinear combination to obtain the final SOC prediction value.

[0013] In an optional embodiment, the smoothing process of the original current and voltage using a local weighted regression algorithm includes the following steps:

[0014] Dividing the original current and voltage into a plurality of intervals, determining a proportion parameter covered by the fitting of each interval, wherein the proportion parameter is used to determine the proportion of current and voltage data points contained in a local neighborhood around each current and voltage data point;

[0015] For each current and voltage data point, calculate the weights of each current and voltage data point in its domain;

[0016] A weighted least squares method is used to fit and generate a quadratic term model, and a weighted error process is performed on the quadratic term model using the weights of each current and voltage data point in the field to obtain a weighted least squares equation;

[0017] The weighted least squares equation is used to solve the smoothing parameter to obtain the smoothed value of the current and voltage data points.

[0018] In an optional embodiment, the enhanced convolution hybrid neural network sequentially performs convolution and group convolution operations on the extended data, including:

[0019] Performing ordinary convolution on the extended data to generate a first feature map;

[0020] The first feature map is divided into g groups of sub-feature maps, where the size S of the sub-feature maps is:

[0021]

[0022] Among them, W is the width of the input feature map, H is the height of the input feature map, and C is the number of channels of the input feature map;

[0023] The convolution kernels of the grouped convolution are divided into g groups, where the kernel size of each group of convolution kernels is S k for:

[0024]

[0025] Among them, k is the convolution kernel size;

[0026] The sub-feature map is input into the convolution kernel of the corresponding group convolution for group convolution, and the sub-feature maps obtained by each group convolution are combined to obtain a second feature map, wherein the feature map size S of the second feature map is f for:

[0027] S f =W'×H'×g

[0028] Wherein, W' is the width of the second feature map, and H' is the height of the second feature map.

[0029] In an optional embodiment, processing the feature map based on a multi-layer self-attention mechanism includes the following steps:

[0030] Flattening the feature graph into sequence data, and performing linear transformation on the sequence data to generate a query matrix, a key matrix, and a value matrix;

[0031] calculating an attention score between the query matrix, the key matrix, and the value matrix;

[0032] Calculating the attention scores using a softmax function to obtain an attention weight matrix, and multiplying the attention weight matrix by the value matrix to obtain a weighted matrix;

[0033] Constructing a multi-layer self-attention layer based on a multi-layer attention mechanism, wherein the self-attention mechanism of each self-attention layer is constructed using the weighting matrix;

[0034] The sequence data is input into the multi-layer self-attention layer, the output data of each layer is spliced, and the spliced ​​output data is linearly transformed to obtain the final output data.

[0035] In an optional embodiment, a mask operation is used to set the attention weights of the filled positions in the query matrix, the key matrix and the value matrix to zero before calculating the attention scores between the query matrix, the key matrix and the value matrix.

[0036] In an optional embodiment, the enhanced convolutional hybrid neural network performs hyperparameter adjustment by a search algorithm based on a PID algorithm, wherein the hyperparameter adjustment process includes the following steps:

[0037] Initialize the population:

[0038] x ij =(u j -l j )·round1,i=1,2,...,n; j=1,2,...,d

[0039] Among them, x ij represents the jth hyperparameter of the i-th population individual, u j is the upper limit of the jth hyperparameter, l j is the lower limit of the jth hyperparameter, and round1 is a random number between 0 and 1;

[0040] The individual corresponding to the historical minimum value of the population at the tth iteration is taken as the best individual x * (t) Calculation of system deviation:

[0041]

[0042] Among them, e k represents the overall deviation of the kth iteration, e k-1 represents the overall deviation of the k-1th iteration;

[0043] The system deviation is adjusted in the simulated PID algorithm, and the population is updated: wherein the adjustment formula is as follows:

[0044] Δu(t)=Kp ·r1·[e k (t)-e k-1 (t)]+K i ·r2·e k (t)+K d ·r3·[e k (t)-2e k-1 (t)+e k-2 (t)]

[0045] Among them, K p ,K i ,K d are the adjustment coefficients of the proportional factor, integral factor and differential factor respectively, r1, r2, r3 are random number vectors with n rows and 1 column values ​​between 0 and 1.

[0046] In an optional embodiment, a zero-input condition factor is introduced into the PID algorithm, wherein the zero-input condition factor is shown in the following formula:

[0047] o(t)=(cos(1-t / T)+λr4·L)·e k (t)

[0048] λ=[ln(T-t+2) / ln(T)] 2

[0049] Where o(t) is the conditional factor for zero input, r4 is a random number vector with n rows and 1 column values ​​between 0 and 1, λ is the adjustment coefficient, T is the sampling period, t is the discrete independent variable, and L is the Levy flight function.

[0050] A second aspect of the present invention provides a battery state of charge estimation system based on local weighted regression, comprising:

[0051] A smoothing module is used to obtain the original current and voltage of the battery, and smooth the original current and voltage using a local weighted regression algorithm to obtain a smoothed current and voltage;

[0052] A prediction module is configured to combine the raw current and voltage with the smoothed current and voltage into extended data and input the data into an enhanced convolutional hybrid neural network for regression prediction to obtain a predicted SOC value; wherein the prediction module includes:

[0053] A convolution unit, wherein the enhanced convolution hybrid neural network sequentially performs ordinary convolution and grouped convolution operations on the extended data to generate a feature map;

[0054] A self-attention unit is used to process the feature map based on a multi-layer self-attention mechanism, link the processed feature map to a fully connected layer for nonlinear combination, and obtain an SOC prediction value.

[0055] A third aspect of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a battery state of charge estimation method based on local weighted regression is implemented.

[0056] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a battery state of charge estimation method based on local weighted regression.

[0057] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0058] 1. Using local weighted regression to smooth current and voltage as extended input for neural network training. This extended input information has a slowly time-varying characteristic, which helps the neural network understand the mapping relationship between the internal characteristics of the battery when the battery voltage and current change dramatically. It is then integrated with the original voltage and current data, enhancing the implicit connection between the data and the actual SOC value of the lithium-ion battery, improving the model's predictive ability, and effectively reducing SOC output fluctuations.

[0059] 2. A grouped convolutional neural network prediction model with a multi-layer self-attention mechanism is proposed. Grouped convolution divides the input feature map and convolution kernel into several groups. The convolution kernel in each group only performs convolution operations with the input feature map of the corresponding group, rather than with the entire input feature map. This effectively reduces the number of model parameters and computational complexity, while better capturing local feature information.

[0060] 3. The introduction of a multi-layer self-attention mechanism enables the network to dynamically establish associations between different positions, thereby better capturing long-range dependencies within the voltage and current series. At the same time, it has good flexibility and interpretability, making it very suitable for battery SOC estimation modeling tasks;

[0061] 4. Introduce proportional integral and differential search algorithms to optimize hyperparameters, and continuously iterate to obtain the optimal network parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required for use in the examples. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be considered as limiting the scope. A person of ordinary skill in the art can also derive other relevant drawings based on these drawings without inventive effort. In the drawings:

[0063] Figure 1 A schematic flow chart of a battery state of charge estimation method based on local weighted regression provided in Example 1 of the present invention;

[0064] Figure 2 The SOC estimation results and error diagram for the BBDST operating condition at 25 degrees Celsius provided in Example 1 of the present invention;

[0065] Figure 3 The SOC estimation results and error diagram for the DST operating condition at 25 degrees Celsius provided in Example 1 of the present invention;

[0066] Figure 4 This is a structural diagram of an electronic device provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0067] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with examples and drawings. The exemplary embodiments of the present invention and their descriptions are only used to explain the present invention and are not intended to limit the present invention.

[0068] Example 1

[0069] Figure 1 This is a flow chart of a battery state of charge estimation method based on local weighted regression provided in Example 1 of the present invention, as shown in FIG. Figure 1 As shown, the battery state of charge estimation method based on local weighted regression includes the following steps:

[0070] Obtaining the original current and voltage of the battery, and smoothing the original current and voltage using a local weighted regression algorithm to obtain a smoothed current and voltage;

[0071] The original current and voltage are combined with the smoothed current and voltage to form extended data and input into the enhanced convolutional hybrid neural network for regression prediction to obtain the SOC prediction value; wherein,

[0072] The enhanced convolution hybrid neural network sequentially performs ordinary convolution and grouped convolution operations on the extended data to generate a feature map;

[0073] The feature map is processed based on a multi-layer self-attention mechanism, and the processed feature map is linked to a fully connected layer for nonlinear combination to obtain a SOC prediction value.

[0074] It should be noted that the battery state of charge estimation method provided in Example 1 of the present invention obtains the current and voltage under different working conditions and temperatures through the experimental platform, and then uses local weighted regression to smooth the current and voltage, and merges them with the original current and voltage data to form a new extended neural network input. This extended input can help the neural network learn the relevant internal characteristics of the battery when the battery parameters change rapidly, and effectively reduce the fluctuation of the network output SOC.

[0075] The expanded input undergoes convolution to form a feature map, which is then followed by grouped convolution. Grouped convolution divides the input feature map into several groups, each of which undergoes independent convolution. The results are then recombined to form the final output feature map. Each group of convolutions improves the model's performance on unseen data by limiting the number of parameters and connections within different groups, reducing the risk of overfitting. Following grouped convolution, a multi-layer self-attention mechanism is introduced. The self-attention layers are stacked in multiple layers, each receiving input from the previous layer and passing it to the next. The output of this hierarchical structure not only reflects the network's deep understanding of the current data point, but also integrates information from the previous layer, thereby enhancing the network model's ability to capture complex patterns and long-term dependencies in time series. Finally, the output is linked to a fully connected layer for nonlinear combination to obtain the final SOC prediction value.

[0076] In an optional embodiment, the smoothing process of the original current and voltage using a local weighted regression algorithm includes the following steps:

[0077] Dividing the original current and voltage into a plurality of intervals, determining a proportion parameter covered by the fitting of each interval, wherein the proportion parameter is used to determine the proportion of current and voltage data points contained in a local neighborhood around each current and voltage data point;

[0078] For each current and voltage data point, calculate the weights of each current and voltage data point in its domain;

[0079] A weighted least squares method is used to fit and generate a quadratic term model, and a weighted error process is performed on the quadratic term model using the weights of each current and voltage data point in the field to obtain a weighted least squares equation;

[0080] The weighted least squares equation is used to solve the smoothing parameter to obtain the smoothed value of the current and voltage data points.

[0081] It should be noted that when using machine learning methods to estimate the SOC of lithium-ion batteries, battery current and voltage are usually selected as network training inputs. However, since the current and voltage required by the test conditions will change dramatically in a short period of time, the neural network can only learn the mapping relationship between input data and output data, and cannot learn the internal characteristics of the lithium-ion battery. As a result, although the final output SOC has a good fitting trend and accuracy, it also has the disadvantage of violent fluctuations in a short period of time.

[0082] To address these shortcomings, an embodiment of the present invention proposes a local regression (Loess) network input expansion using a weighted linear least squares and quadratic polynomial model. By applying the Loess smoothing algorithm to the wildly fluctuating current and voltage, a current and voltage with slowly varying information is generated, named L-Current and L-Voltage, respectively. This is then merged with the current and voltage data to produce the final network input expansion.

[0083] The Loess curve smoothing algorithm is a non-parametric method for local regression analysis. It mainly divides the samples into small intervals, performs polynomial fitting on the samples in the intervals, and repeats this process to obtain weighted regression curves in different intervals. Finally, the centers of these regression curves are connected together to synthesize a complete regression curve.

[0084] Specifically, the sampled raw current and voltage data are first divided into several small intervals. A scaling parameter is then determined. This scaling parameter determines the proportion of current and voltage data points included in the local neighborhood surrounding each current and voltage data point. For example, if the scaling parameter is 0.5, each local neighborhood includes approximately half of the current and voltage data points in the raw current and voltage dataset.

[0085] For each current and voltage data point, calculate the weight of each current and voltage data point in its neighborhood. The weight is usually inversely proportional to the distance between the data points, that is, the closer the distance, the greater the weight. The calculation formula is as follows:

[0086]

[0087] where w i (x) is the weight function, x i is the current and voltage data point, the bandwidth is h, if the observation point x j If the distance exceeds the bandwidth h, the weight is 0.

[0088] The quadratic term model is obtained by fitting using the weighted least squares method. The quadratic term model is shown as follows:

[0089] y=β0+β1(xx i )+β2(xx i) 2

[0090] Here β0, β1, β2 are the parameters of the local quadratic model, which need to be solved by minimizing the weighted sum of squared errors.

[0091] The weighted sum of squared errors of the quadratic polynomial model is minimized to obtain the weighted least squares equation, which is shown as follows:

[0092]

[0093] Use the normal equation of weighted least squares to solve for the parameters β0, β1, β2:

[0094]

[0095] Finally, we get i Smoothed value at

[0096]

[0097] This process is repeated for each current and voltage data point in the original current and voltage dataset, ultimately generating a smoothed curve for the entire dataset. The Loess algorithm maintains the local characteristics of the data while generating a smooth curve, effectively capturing both the overall trend and local variations in the data.

[0098] In an optional embodiment, the enhanced convolution hybrid neural network sequentially performs convolution and group convolution operations on the extended data, including:

[0099] Performing ordinary convolution on the extended data to generate a first feature map;

[0100] The first feature map is divided into g groups of sub-feature maps, where the size S of the sub-feature maps is:

[0101]

[0102] Among them, W is the width of the input feature map, H is the height of the input feature map, and C is the number of channels of the input feature map;

[0103] The convolution kernels of the grouped convolution are divided into g groups, where the kernel size of each group of convolution kernels is S k for:

[0104]

[0105] Among them, k is the convolution kernel size;

[0106] The sub-feature map is input into the convolution kernel of the corresponding group convolution for group convolution, and the sub-feature maps obtained by each group convolution are combined to obtain a second feature map, wherein the feature map size S of the second feature map is f for:

[0107] S f =W'×H'×g

[0108] Wherein, W' is the width of the second feature map, and H' is the height of the second feature map.

[0109] It should be noted that the extended data is first subjected to ordinary convolution to generate a first feature map, and then the first feature map is grouped and input into the convolution kernel of the corresponding group convolution for separate convolution. The sub-feature maps generated by all separate convolutions are spliced ​​together to obtain the second feature map, that is, the feature map required by the present invention.

[0110] The number of parameters params for grouped convolution is as follows:

[0111]

[0112] The total computational load FLOPs is as follows:

[0113] FLOPs = k 2 ×C×W×H'

[0114] Compared to traditional convolution, grouped convolution reduces both the number of parameters and the total computational effort by (g-1) / g, making it more lightweight. Grouped convolution also allows convolution operations to be performed in parallel on multiple groups, fully leveraging the parallel computing capabilities of hardware. This is particularly true in scenarios where a balance between model performance and computational resources is crucial. These advantages can effectively reduce hardware resource consumption in battery management systems.

[0115] In an optional embodiment, processing the feature map based on a multi-layer self-attention mechanism includes the following steps:

[0116] Flattening the feature graph into sequence data, and performing linear transformation on the sequence data to generate a query matrix, a key matrix, and a value matrix;

[0117] calculating an attention score between the query matrix, the key matrix, and the value matrix;

[0118] Calculating the attention scores using a softmax function to obtain an attention weight matrix, and multiplying the attention weight matrix by the value matrix to obtain a weighted matrix;

[0119] Constructing a multi-layer self-attention layer based on a multi-layer attention mechanism, wherein the self-attention mechanism of each self-attention layer is constructed using the weighting matrix;

[0120] The sequence data is input into the multi-layer self-attention layer, the output data of each layer is spliced, and the spliced ​​output data is linearly transformed to obtain the final output data.

[0121] It should be noted that the attention mechanism is a technique that has been widely used in neural networks in recent years. It improves the model's performance when processing long sequences of data by assigning different weights to different parts of the input data. This paper introduces multiple self-attention heads to capture the relationships between different positions in the input sequence. This allows the model to fully capture the various dependencies and feature representations in the input sequence, while also enhancing the model's expressiveness.

[0122] Input sequence data X∈R in the multi-layer self-attention mechanism n×d , where n is the sequence length and d is the dimension of each input vector. The input data undergoes three different linear transformations to generate query, key, and value matrices, as shown in the following formula:

[0123]

[0124] Among them, W q ,W k ,W v is the trainable weight matrix.

[0125] Then calculate the attention score score(Q,K) between each vector in the input sequence as shown below:

[0126]

[0127] Where W is the weight matrix between the input layer and the hidden layer, and U is the weight matrix between the hidden layers. L ] T is a matrix composed of L query matrices, K=[k1,k2,...,k L ] T is a matrix composed of L key matrices, V=[v1,v2,...,v L ] T is a matrix of L value matrices, where L is the time step, d k is the scale factor, controlling the scaling.

[0128] After obtaining the attention score, the attention weight matrix α is obtained through the softmax function, as shown in the following formula:

[0129] α=softmax(score(Q,K))

[0130] The attention weight matrix is ​​multiplied by the value matrix to obtain the weighted value Attention, as shown in the following formula:

[0131] Attention(Q,K,V)=αV

[0132] Multi-layer self-attention is used to extract features from the input time series by constructing multiple layers of self-attention. Each layer of self-attention mechanism i As shown in the following formula:

[0133] Layer i =Attention(Q,W i Q ,K,W i K ,V,W i V ),1<i<h

[0134] Among them, W i Q ,W i K ,W i V is the parameter matrix of the i-th layer, and h is the number of attention layers.

[0135] Finally, the outputs of all layers are concatenated together and transformed by linear transformation W. o The final output is as follows:

[0136]

[0137] Where H represents the matrix containing the outputs of all layers.

[0138] Through multiple attention heads, the network model can capture the relationships between different levels and positions in the input sequence, thereby obtaining richer feature representations, and by flexibly allocating attention, the model can more effectively capture long-range dependencies and complex structures.

[0139] In an optional embodiment, a mask operation is used to set the attention weights of the filled positions in the query matrix, the key matrix and the value matrix to zero before calculating the attention scores between the query matrix, the key matrix and the value matrix.

[0140] It should be noted that when processing long sequence data, the input sequence may contain some invalid filled positions. These filled positions should not affect the attention calculation. The mask operation can be used to set the attention weights of these filled positions to zero, thereby shielding their influence on the results. The mask operation is shown in the following formula:

[0141]

[0142] Among them, mask ij Represents the element in the i-th row and j-th column of the mask matrix.

[0143] In an optional embodiment, the enhanced convolutional hybrid neural network performs hyperparameter adjustment by a search algorithm based on a PID algorithm, wherein the hyperparameter adjustment process includes the following steps:

[0144] Initialize the population:

[0145] x ij =(u j -l j )·round1,i=1,2,...,n; j=1,2,...,d

[0146] Among them, x ij represents the jth hyperparameter of the i-th population individual, u j is the upper limit of the jth hyperparameter, l j is the lower limit of the jth hyperparameter, and round1 is a random number between 0 and 1;

[0147] The individual corresponding to the historical minimum value of the population at the tth iteration is taken as the best individual x * (t) Calculation of system deviation:

[0148]

[0149] Among them, e k represents the overall deviation of the kth iteration, e k-1 represents the overall deviation of the k-1th iteration;

[0150] The system deviation is adjusted in the simulated PID algorithm, and the population is updated: wherein the adjustment formula is as follows:

[0151] Δu(t)=K p ·r1·[e k (t)-e k-1 (t)]+K i ·r2·e k (t)+K d ·r3·[e k (t)-2e k-1 (t)+e k-2 (t)]

[0152] Among them, K p ,K i ,K d are the adjustment coefficients of the proportional factor, integral factor and differential factor respectively, r1, r2, r3 are random number vectors with n rows and 1 column values ​​between 0 and 1.

[0153] In this embodiment, the objective function f of the i-th population individual in the enhanced convolutional hybrid neural network is i The build is as follows:

[0154] f i =MSE train +MSE test

[0155] Among them, MSE train Represents the mean square error of the training set, MSE test represents the mean squared error of the test set.

[0156] In this embodiment, the adjustment coefficients of the proportional factor, the integral factor, and the differential factor are set to 1, 0.5, and 1.2, respectively.

[0157] The formula for updating the population is as follows:

[0158]

[0159] Among them, r5 is a random matrix.

[0160] It should be noted that hyperparameter tuning is a critical process, the goal of which is to find the optimal network configuration to improve model performance and generalization. To solve complex real-world optimization problems, metaheuristic algorithms have been proposed to address optimization challenges by simulating observed phenomena. The PID search algorithm used in this method is inspired by the classic incremental PID algorithm in the control field. This algorithm, based on an incremental proportional integral and differential algorithm, continuously adjusts system deviations to converge the entire population to the optimal state and obtain the optimal network parameters. An enhanced group convolutional hybrid neural network prediction method for lithium-ion battery state of charge estimation, named EI-PSA-GCNN-MSA, is proposed.

[0161] In Example 1 of the present invention, the parameters of the enhanced group convolutional hybrid neural network for lithium-ion battery state of charge estimation are set as shown in Table 1:

[0162] Table 1 Parameter settings of enhanced group convolutional hybrid neural network for lithium-ion battery state of charge estimation

[0163]

[0164] In this algorithm, the historical best individual in the population is abstracted as the target value, and each individual is abstracted as the true value. By simulating the PID adjustment process, the deviation of each individual relative to the best individual is corrected, so that the entire population reaches a better state. In this study, the PID search algorithm was introduced to adjust the initial learning rate and L2 regularization parameter of the neural network model, avoiding the tedious process of manual parameter adjustment. The PID search algorithm continuously adjusts the control variable so that the system output gradually approaches the target value algorithm. It has strong global search capabilities and can effectively avoid the problem of local optimal solutions.

[0165] In an optional embodiment, a zero-input condition factor is introduced into the PID algorithm, wherein the zero-input condition factor is shown in the following formula:

[0166] o(t)=(cos(1-t / T)+λr4·L)·e k (t)

[0167] λ=[ln(T-t+2) / ln(T)] 2

[0168] Where o(t) is the conditional factor for zero input, r4 is a random number vector with n rows and 1 column values ​​between 0 and 1, λ is the adjustment coefficient, T is the sampling period, t is the discrete independent variable, and L is the Levy flight function.

[0169] It should be noted that the purpose of introducing the zero input conditional factor is to prevent the PID algorithm from falling into a local optimal solution. λ decreases as t increases, which is conducive to the PID search algorithm finding the global optimal solution.

[0170] Among them, the Levy flight function is shown as follows:

[0171]

[0172] Among them, u and v are random number matrices and conform to the normal distribution, and β is set to 1.5.

[0173] PID-based search optimization algorithms have great potential for neural network parameter tuning. Their powerful global search capabilities, adaptive adjustment, and robustness can effectively improve neural network training and performance. Combining PID search algorithms with neural networks can further leverage the advantages of PID control algorithms, achieving a more efficient and stable neural network training process.

[0174] In order to verify the effectiveness of the method provided by the present invention, Example 1 built a lithium-ion battery operating condition test platform, the core of which is a lithium-ion battery power cell tester (NEWARE-CT-4016), with a constant voltage control range of 0.025V to 5V and a current output range of 0.5A to 100A per channel. The constant temperature control device (DGBELL-BTT-331C) is used to simulate a constant temperature environment, which can control the ambient temperature of the lithium-ion battery charge and discharge test within the set temperature range. Both devices are connected to a control computer, and the experimental data of the lithium-ion battery under the set working conditions are set, monitored and recorded through the TCP / IP protocol.

[0175] The experiment selected a 3.7V / 75Ah lithium-ion battery as the test object. Its parameters are shown in Table 2. The Beijing Bus Dynamic Test Condition (BBDST) and Dynamic Stress Test (DST) conditions were tested. BBDST is a test method designed to evaluate and optimize the performance of urban buses under actual operating conditions. This condition simulates various driving conditions of urban bus lines, such as starting and stopping, acceleration, deceleration, idling, etc., and is a test condition that conforms to common conditions in real use. DST is a test method that evaluates the performance of a vehicle under different stress conditions. By simulating various dynamic stress conditions that a vehicle may encounter in actual operation, such as high loads, steep slopes, high-speed driving, etc., the vehicle's structural strength, power system reliability and overall performance are tested.

[0176] The current and voltage data of the BBDST and DST test conditions at ambient temperatures of -5°C, 10°C, 25°C, and 35°C were obtained using the test platform. Then, a data set was formed. The holdout method was used to take 70% of the samples as training data and 30% of the samples as test data. The SOC estimation results and error figures are shown in the figure below. Figure 2 、 Figure 3 An ablation experiment was designed to verify the performance of the proposed lithium-ion battery SOC estimation algorithm, and the performance was compared with the commonly used long short-term memory neural network to verify the effectiveness of the proposed algorithm.

[0177] Table 2 3.7V / 75Ah lithium-ion battery parameters

[0178]

[0179] Example 2

[0180] Embodiment 2 of the present invention provides a battery state of charge estimation system based on local weighted regression, including:

[0181] A smoothing module is used to obtain the original current and voltage of the battery, and smooth the original current and voltage using a local weighted regression algorithm to obtain a smoothed current and voltage;

[0182] A prediction module is configured to combine the raw current and voltage with the smoothed current and voltage into extended data and input the data into an enhanced convolutional hybrid neural network for regression prediction to obtain a predicted SOC value; wherein the prediction module includes:

[0183] A convolution unit, wherein the enhanced convolution hybrid neural network sequentially performs ordinary convolution and grouped convolution operations on the extended data to generate a feature map;

[0184] A self-attention unit is used to process the feature map based on a multi-layer self-attention mechanism, link the processed feature map to a fully connected layer for nonlinear combination, and obtain an SOC prediction value.

[0185] Example 3

[0186] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Example 3 of the present invention, such as Figure 4 As shown, the electronic device includes a processor 21, a memory 22, an input device 23 and an output device 24; the number of processors 21 in the computer device can be one or more. Figure 4 In the figure, a processor 21 is taken as an example; the processor 21, memory 22, input device 23 and output device 24 in the electronic device can be connected by a bus or other means. Figure 4 The bus connection is taken as an example.

[0187] Memory 22, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules. Processor 21 executes the software programs, instructions, and modules stored in memory 22 to perform various electronic device functions and data processing, thereby implementing the battery state of charge estimation method based on local weighted regression in Example 1.

[0188] The memory 22 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function; the data storage area may store data created based on the use of the terminal, etc. Furthermore, the memory 22 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some instances, the memory 22 may further include a memory remotely located relative to the processor 21, and these remote memories may be connected to the electronic device via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0189] The input device 23 can be used to receive the ID and password input by the user, etc. The output device 24 is used to output the network configuration page.

[0190] Example 4

[0191] Embodiment 4 of the present invention further provides a computer-readable storage medium, wherein the computer-executable instructions, when executed by a computer processor, are used to implement the battery state of charge estimation method based on local weighted regression as provided in embodiment 1.

[0192] An embodiment of the present invention provides a storage medium containing computer-executable instructions, wherein the computer-executable instructions are not limited to the method operations provided in Example 1, but can also execute related operations in the battery state of charge estimation method based on local weighted regression provided in any embodiment of the present invention.

[0193] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A battery state of charge estimation method based on local weighted regression, characterized in that: The steps include: Obtaining the original current and voltage of the battery, and smoothing the original current and voltage using a local weighted regression algorithm to obtain a smoothed current and voltage; Combining the raw current and voltage with the smoothed current and voltage into extended data and inputting the data into an enhanced convolutional hybrid neural network for regression prediction to obtain a predicted SOC value; wherein the enhanced convolutional hybrid neural network sequentially performs ordinary convolution and group convolution operations on the extended data to generate a feature map; The feature map is processed based on a multi-layer self-attention mechanism, and the processed feature map is linked to a fully connected layer for nonlinear combination to obtain an SOC prediction value; The enhanced convolutional hybrid neural network is subjected to hyperparameter adjustment by a search algorithm based on the PID algorithm. The hyperparameter adjustment process includes the following steps: Initialize the population: x ij =(u j -l j )·round1,i=1,2,...,n;j=1,2,...,d Among them, x ij represents the jth hyperparameter of the i-th population individual, u j is the upper limit of the jth hyperparameter, l j is the lower limit of the jth hyperparameter, and round1 is a random number between 0 and 1; The individual corresponding to the historical minimum value of the population at the tth iteration is taken as the best individual x * (t) Calculation of system deviation: Among them, e k represents the overall deviation of the kth iteration, e k-1 represents the overall deviation of the k-1th iteration; The system deviation is adjusted in the simulated PID algorithm, and the population is updated: wherein the adjustment formula is as follows: Δu(t)=K p ·r1·[e k (t)-e k-1 (t)]+K i ·r2·e k (t)+K d ·r3·[e k (t)-2e k-1 (t)+e k-2 (t)] Among them, K p ,K i ,K d are the adjustment coefficients of the proportional factor, integral factor and differential factor respectively, r1, r2, r3 are random number vectors with n rows and 1 column values ​​between 0 and 1; The PID algorithm introduces a zero-input condition factor, wherein the zero-input condition factor is shown in the following formula: o(t)=(cos(1-t / T)+λr4·L)·e k (t) λ=[ln(T-t+2) / ln(T)] 2 Where o(t) is the conditional factor for zero input, r4 is a random number vector with n rows and 1 column values ​​between 0 and 1, λ is the adjustment coefficient, T is the sampling period, t is the discrete independent variable, and L is the Levy flight function.

2. The battery state of charge estimation method based on local weighted regression according to claim 1, characterized in that: The smoothing process of the original current and voltage using the local weighted regression algorithm includes the following steps: Dividing the original current and voltage into a plurality of intervals, determining a proportion parameter covered by the fitting of each interval, wherein the proportion parameter is used to determine the proportion of current and voltage data points contained in a local neighborhood around each current and voltage data point; For each current and voltage data point, calculate the weights of each current and voltage data point in its domain; A weighted least squares method is used to fit and generate a quadratic term model, and a weighted error process is performed on the quadratic term model using the weights of each current and voltage data point in the field to obtain a weighted least squares equation; The weighted least squares equation is used to solve the smoothing parameter to obtain the smoothed value of the current and voltage data points.

3. The battery state of charge estimation method based on local weighted regression according to claim 1, characterized in that: The enhanced convolution hybrid neural network sequentially performs convolution and group convolution operations on the extended data, including: Performing ordinary convolution on the extended data to generate a first feature map; The first feature map is divided into g groups of sub-feature maps, where the size S of the sub-feature maps is: Among them, W is the width of the input feature map, H is the height of the input feature map, and C is the number of channels of the input feature map; The convolution kernels of the grouped convolution are divided into g groups, where the kernel size of each group of convolution kernels is S k for: Among them, k is the convolution kernel size; The sub-feature map is input into the convolution kernel of the corresponding group convolution for group convolution, and the sub-feature maps obtained by each group convolution are combined to obtain a second feature map, wherein the feature map size S of the second feature map is f for: S f =W'×H'×g Wherein, W' is the width of the second feature map, and H' is the height of the second feature map.

4. The battery state of charge estimation method based on local weighted regression according to claim 1, characterized in that: Processing the feature map based on the multi-layer self-attention mechanism includes the following steps: Flattening the feature graph into sequence data, and performing linear transformation on the sequence data to generate a query matrix, a key matrix, and a value matrix; calculating an attention score between the query matrix, the key matrix, and the value matrix; Calculating the attention scores using a softmax function to obtain an attention weight matrix, and multiplying the attention weight matrix by the value matrix to obtain a weighted matrix; Constructing a multi-layer self-attention layer based on a multi-layer attention mechanism, wherein the self-attention mechanism of each self-attention layer is constructed using the weighting matrix; The sequence data is input into the multi-layer self-attention layer, the output data of each layer is spliced, and the spliced ​​output data is linearly transformed to obtain the final output data.

5. The battery state of charge estimation method based on local weighted regression according to claim 4, characterized in that: A mask operation is used to set the attention weights of the filled positions in the query matrix, the key matrix and the value matrix to zero before calculating the attention scores between the query matrix, the key matrix and the value matrix.

6. A battery state of charge estimation system based on local weighted regression, characterized in that: include: A smoothing module is used to obtain the original current and voltage of the battery, and smooth the original current and voltage using a local weighted regression algorithm to obtain a smoothed current and voltage; A prediction module is configured to combine the raw current and voltage with the smoothed current and voltage into extended data and input the data into an enhanced convolutional hybrid neural network for regression prediction to obtain a predicted SOC value; wherein the prediction module includes: A convolution unit, wherein the enhanced convolution hybrid neural network sequentially performs ordinary convolution and grouped convolution operations on the extended data to generate a feature map; A self-attention unit, which is used to process the feature map based on a multi-layer self-attention mechanism, link the processed feature map to a fully connected layer for nonlinear combination, and obtain an SOC prediction value; The enhanced convolutional hybrid neural network is subjected to hyperparameter adjustment by a search algorithm based on the PID algorithm. The hyperparameter adjustment process includes the following steps: Initialize the population: x ij =(u j -l j )·round1,i=1,2,...,n;j=1,2,...,d Among them, x ij represents the jth hyperparameter of the i-th population individual, u j is the upper limit of the jth hyperparameter, l j is the lower limit of the jth hyperparameter, and round1 is a random number between 0 and 1; The individual corresponding to the historical minimum value of the population at the tth iteration is taken as the best individual x * (t) Calculation of system deviation: Among them, e k represents the overall deviation of the kth iteration, e k-1 represents the overall deviation of the k-1th iteration; The system deviation is adjusted in the simulated PID algorithm, and the population is updated: wherein the adjustment formula is as follows: Δu(t)=K p ·r1·[e k (t)-e k-1 (t)]+K i ·r2·e k (t)+K d ·r3·[e k (t)-2e k-1 (t)+e k-2 (t)] Among them, K p ,K i ,K d are the adjustment coefficients of the proportional factor, integral factor and differential factor respectively, r1, r2, r3 are random number vectors with n rows and 1 column values ​​between 0 and 1; The PID algorithm introduces a zero-input condition factor, wherein the zero-input condition factor is shown in the following formula: o(t)=(cos(1-t / T)+λr4·L)·e k (t) λ=[ln(T-t+2) / ln(T)] 2 Where o(t) is the conditional factor for zero input, r4 is a random number vector with n rows and 1 column values ​​between 0 and 1, λ is the adjustment coefficient, T is the sampling period, t is the discrete independent variable, and L is the Levy flight function.

7. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for estimating the state of charge of a battery based on local weighted regression as claimed in any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the battery state of charge estimation method based on local weighted regression as claimed in any one of claims 1 to 5 is implemented.