Lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network

By integrating convolutional neural networks, long short-term memory networks, and multi-head attention mechanisms, and using the Bayesian optimization algorithm to optimize hyperparameters, the problems of insufficient accuracy and poor generalization in lithium battery SOC estimation are solved, high-precision and stable SOC estimation is achieved, and the intelligence level of the battery management system is improved.

CN120468677BActive Publication Date: 2025-09-16LUOYANG INST OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510948346.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-09-16
Estimated Expiration
2045-07-10

AI Technical Summary

Technical Problem

Existing lithium battery state of charge (SOC) estimation methods are easily affected by changes in environmental conditions, individual battery differences and aging effects, resulting in limited estimation accuracy. In addition, single machine learning models have poor generalization in complex application scenarios and low hyperparameter optimization efficiency.

Method used

A Bayes-TLCO-based deep neural network optimization method is adopted, which integrates convolutional neural networks, long short-term memory networks and multi-head attention mechanisms. The Bayesian optimization is used to assist the termite life cycle algorithm in optimizing the model hyperparameters, and a multi-objective optimization system is constructed to achieve high-precision estimation of the lithium battery state of charge.

Benefits of technology

The accuracy and stability of lithium battery state of charge estimation have been significantly improved, the adaptability of the model in complex environments has been enhanced, and it can more accurately estimate battery SOC, extend battery life, and improve safety and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120468677B_ABST
    Figure CN120468677B_ABST
Patent Text Reader

Abstract

The present invention discloses a lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network, which belongs to the field of battery state monitoring technology. The method first pre-processes the lithium battery charge and discharge data set; then constructs a deep neural network model including a convolutional neural network, a long short-term memory network and a multi-head attention mechanism, and uses Bayesian optimization to assist the termite life cycle optimization algorithm to dynamically optimize the hyperparameters of the model. During the iteration process of the TLCO algorithm, when the iteration stagnates, Bayesian optimization is introduced, and a search experience model is constructed by fitting historical data through a Gaussian process to generate high-value sampling points, and accelerate the convergence of the model hyperparameters to the global optimal solution; finally, the state of charge of the lithium battery is estimated. The present invention breaks through the limitations of a single algorithm, realizes high-precision estimation of the state of charge of the lithium battery under complex working conditions, and effectively improves the efficiency of model training. It is suitable for scenarios such as electric vehicles and energy storage systems, and provides key technical support for the intelligent upgrade of battery management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of battery status monitoring, and in particular to a lithium battery state of charge estimation method based on a Bayes-TLCO optimized deep neural network. Background Art

[0002] With the booming renewable energy and electric vehicle industries, batteries have become an indispensable component of modern technology, and their application scope continues to expand. In battery management systems, accurate state estimation, particularly SOC (State of Charge), forms the core cornerstone of effective management strategies. Accurate SOC estimation is not only a prerequisite for precise charge and discharge control, balancing management, and thermal management, but also significantly improves battery efficiency, extends battery life, and ensures system safety and reliability.

[0003] Currently, SOC estimation relies on methods such as open-circuit voltage, ampere-hour integration, and Kalman filtering. Although these methods have demonstrated some effectiveness in practice, they are susceptible to multiple factors such as environmental changes, individual battery differences, and aging effects, resulting in limited estimation accuracy and even failure in some cases.

[0004] In recent years, the rapid development of machine learning technology has provided a new technical path for battery SOC estimation. Based on a data-driven strategy, the system can mine the dynamic behavior characteristics of batteries from a wealth of historical data, significantly improving prediction accuracy. Among them, convolutional neural networks (CNN) and long short-term memory networks (LSTM) have been widely used in the field of battery SOC estimation due to their excellent feature extraction capabilities and time series modeling advantages. However, practice has shown that a single model has limitations when dealing with complex and changing practical application scenarios. When balancing the contradictions between battery management system accuracy, computational cost, and generalization performance, constructing a multi-objective optimization system to achieve uncertainty quantification and optimal solution solution is of great significance for reducing prediction errors and promoting the intelligent upgrade of battery management systems. Summary of the Invention

[0005] The purpose of the present invention is to provide a lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network. By integrating convolutional neural network, long short-term memory network and multi-head attention mechanism, and using Bayesian optimization to assist the termite life cycle algorithm to optimize model hyperparameters, a multi-objective optimization system is constructed to quantify uncertainty, thereby achieving high-precision and high-efficiency estimation of lithium battery state of charge, so that the model still maintains high applicability and accuracy in complex environments.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network includes the following steps:

[0008] S1. Preprocessing the lithium battery charge and discharge data set;

[0009] S2. Construct a deep neural network model including a convolutional neural network, a long short-term memory network, and a multi-head attention mechanism, wherein the deep neural network model includes a convolutional layer, a batch normalization layer, a pooling layer, an expansion layer, a smoothing layer, an LSTM layer, a multi-head attention mechanism, and a fully connected layer in sequence;

[0010] S3. Using Bayesian optimization to assist the termite life cycle optimization algorithm to dynamically optimize the hyperparameters of the deep neural network model. During the iteration process of the termite life cycle optimization algorithm, when the iteration stagnates, Bayesian optimization is introduced to construct a proxy model for simulating the optimization objective function by fitting historical data through a Gaussian process to generate high-value sampling points and accelerate the convergence of the model hyperparameters to the global optimal solution;

[0011] S4: Input the data preprocessed by S1 into the deep neural network model after hyperparameter optimization for training. By minimizing the loss function, the model learns the mapping relationship between the lithium battery state of charge and the input data, thereby realizing the estimation of the lithium battery state of charge.

[0012] Furthermore, the implementation of the multi-head attention mechanism in step S2 includes:

[0013] First, the input data is linearly mapped into query vector Q, key vector K and value vector V;

[0014] Then, for each attention head, perform parallel calculation of scaled dot product attention: calculate the dot product of Q and K and scale it, and then pass it through the Softmax function to obtain the attention weight;

[0015] Finally, the attention calculation results of each head are spliced ​​together and then linearly transformed to output the final result.

[0016] Furthermore, the dynamic optimization of the termite life cycle optimization algorithm assisted by Bayesian optimization in step S3 includes:

[0017] S31, initialization phase: Initialize basic parameters; randomly initialize the population, calculate the fitness value of the individual population through the neural network evaluation module; select the initial optimal solution Gbest from the initialized population as the benchmark for iterative optimization;

[0018] S32, Termite Update Phase: According to the termite life cycle optimization algorithm rules and based on the Lévy flight strategy, the termite individuals are controlled to update their positions in the search space, and the fitness value is calculated by the neural network evaluation module to obtain the candidate solution set under the current iteration;

[0019] S33, Bayesian optimization and reproduction phase: When the iteration stagnates, Bayesian optimization is triggered. Initial points are generated through Latin hypercube sampling. A Gaussian process surrogate model is constructed to fit historical data. High-value sampling points are generated based on the expected improvement function. The global optimal solution is evaluated and updated. If the Bayesian optimization effect is not good and the limit constraint is triggered, the termite reproduction process is executed to generate new positions and update the global optimal solution.

[0020] S34. Repeat steps S32 and S33 until the iteration termination condition is met, and output the optimal hyperparameter combination after dynamic optimization.

[0021] Furthermore, the termite renewal stage specifically includes: for each individual in the population, the population is divided into worker termites and soldier termites according to their proportions, and worker termite renewal and soldier termite renewal are performed respectively;

[0022] The worker termites update their positions based on the Lévy flight strategy and obtain a fitness value through a neural network evaluation module. The process determines whether the fitness is better. If so, the new position is retained. Otherwise, the number of attempts is marked and an over-limit constraint judgment is performed. When the iteration progress is greater than 1 / 3 of the total number of iterations and the constraint condition is triggered, the Bayesian optimization process is entered. If the condition is not met, the termite breeding process is executed if the over-limit constraint is triggered.

[0023] The soldier termite update calculates a new position based on the optimal solution and the Lévy flight strategy, and obtains a fitness value through a neural network evaluation module; determines whether the fitness is better, and if so, retains the new position; otherwise, executes an over-limit constraint judgment; when the iteration progress is greater than 1 / 2 of the total number of iterations and the constraint condition is triggered, enters the Bayesian optimization process; if it is not met, if the over-limit constraint is triggered, executes the termite breeding process.

[0024] Furthermore, the worker termites account for 70% of the population size and implement a global exploration strategy; the soldier termites account for 30% of the population size and implement a local development strategy around the current optimal solution area.

[0025] Furthermore, in step S32

[0026] The step length formula of the Lévy flight strategy is:

[0027]

[0028] Where, is the step length, is the Lévy distribution index, , 、 Normal distribution ;

[0029]

[0030] Where, is the current iteration number, is the maximum number of iterations, For the The step size factor for the i-th individual in the iteration.

[0031] Furthermore, in the process of using Bayesian optimization to assist TLCO in optimizing hyperparameters, the optimized hyperparameters include: learning rate, number of neurons, key value, regularization parameter, number of convolution kernels, vertical filter size, horizontal filter size, vertical pooling size, horizontal pooling size, pooling window step size and dropout rate.

[0032] Furthermore, the data preprocessing includes: extracting 10 groups of data from the battery life cycle data in layers, with the first 8 groups as training sets and the last 2 groups as test sets; normalizing the voltage, current, and temperature data, and reconstructing them into three-dimensional tensors.

[0033] Furthermore, the BN layer performs batch normalization after the convolutional layer to accelerate training convergence and prevent gradient explosion.

[0034] Furthermore, during the model training process, the root mean square error is used as the loss function to measure the error between the lithium battery state of charge predicted by the model and the actual value, and the model parameters are optimized by minimizing the loss function.

[0035] The beneficial effects of the above scheme are:

[0036] (1) This invention can significantly improve estimation accuracy and stability. By integrating the dynamic synergy mechanism of Bayesian optimization and the termite life cycle algorithm (Bayes-TLCO), intelligent switching is achieved during the hyperparameter optimization process: when the termite algorithm iteration stagnates, the Bayesian optimization module is automatically triggered, and the Gaussian process surrogate model is used to fit historical data. Based on the expected improvement function (EI), high-potential sampling points are generated in a targeted manner, replacing the traditional random search. This method reduces the mean absolute error (MAE) of the test set from 0.0528 to 0.0458, significantly improves the stability of the coefficient of determination (R²), and effectively solves the problem of accuracy degradation caused by environmental fluctuations and battery aging.

[0037] (2) The present invention can enhance the adaptability of the model to complex scenarios. In terms of model construction, the convolutional neural network (CNN), long short-term memory network (LSTM) and multi-head attention mechanism (Multhead-Attention) are integrated to give full play to the advantages of each model, and the feature extraction capability is comprehensively improved through multi-level coupling of space, time sequence and attention. The CNN layer uses a 3×3 convolution kernel to extract the spatial correlation features of voltage, current and temperature, providing a basis for SOC estimation based on the internal structure information of the battery. The LSTM layer captures the long-term temporal dependence of the battery charging and discharging process and accurately grasps the dynamic change of the battery status over time. The multi-head attention mechanism splits the input into multiple groups of parallel calculations, and after splicing, it comprehensively identifies the key state nodes from a global perspective, so that the model has a more comprehensive understanding of the complex operating state of the battery, thereby improving the adaptability of the model to complex battery working conditions and significantly improving the accuracy of SOC estimation.

[0038] (3) In terms of practical application effects, experimental verification shows that the model of the present invention can estimate the battery SOC more accurately than non-optimized models and other traditional estimation methods in complex environments, such as working conditions with multiple factors such as different temperatures, humidity, and charge and discharge rates. This helps the battery management system to formulate charge and discharge strategies more reasonably, avoid overcharging or over-discharging of the battery, extend the battery life, and improve the safety and reliability of battery use. At the same time, it also provides more stable and efficient operation guarantees for battery-dependent application scenarios such as electric vehicles and energy storage systems, promoting technological development and performance improvement in related fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is the overall flow chart of the present invention;

[0040] Figure 2 This is a diagram of the CNN-LSTM network structure in an embodiment of the present invention;

[0041] Figure 3 This is a diagram of the multi-head attention mechanism structure in an embodiment of the present invention;

[0042] Figure 4 This is a flow chart of the present invention's optimization of the deep neural network model based on Bayes-TLCO;

[0043] Figure 5 A comparison chart of the predicted values ​​and true values ​​of the test set in an embodiment of the present invention;

[0044] Figure 6 This is the error histogram of the test set in the embodiment of the present invention. DETAILED DESCRIPTION

[0045] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0046] It should be noted that unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0047] In order to solve the problem of insufficient accuracy of traditional methods in lithium battery state of charge (SOC) estimation caused by environmental fluctuations, individual differences of batteries and aging, and to overcome the technical defects of poor generalization of single machine learning models and low efficiency of hyperparameter optimization, this paper proposes a lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network, such as Figure 1 As shown, the method includes the following steps:

[0048] S1. Preprocessing the lithium battery charge and discharge data set;

[0049] S2. Construct a deep neural network model including a convolutional neural network, a long short-term memory network, and a multi-head attention mechanism, wherein the deep neural network model includes a convolutional layer, a batch normalization layer, a pooling layer, an expansion layer, a smoothing layer, an LSTM layer, a multi-head attention mechanism, and a fully connected layer in sequence;

[0050] S3. Using Bayesian optimization to assist the termite life cycle optimization algorithm to dynamically optimize the hyperparameters of the deep neural network model. During the iteration process of the termite life cycle optimization algorithm, when the iteration stagnates, Bayesian optimization is introduced to construct a proxy model for simulating the optimization objective function by fitting historical data through a Gaussian process to generate high-value sampling points and accelerate the convergence of the model hyperparameters to the global optimal solution;

[0051] S4: Input the data preprocessed by S1 into the deep neural network model after hyperparameter optimization for training. By minimizing the loss function, the model learns the mapping relationship between the lithium battery state of charge and the input data, thereby realizing the estimation of the lithium battery state of charge.

[0052] The implementation process of each step of the present invention is described in detail below.

[0053] S1. Data collection and preprocessing.

[0054] The preprocessing of lithium battery data sets is mainly divided into data acquisition, cleaning, normalization, data reconstruction and division into training sets and test sets.

[0055] First, data is acquired by collecting the terminal voltage, charge and discharge current, temperature, state of charge and other data of the lithium battery through high-precision battery testing equipment and BMS real-time sampling modules to form an original data set containing timestamps and various parameters.

[0056] Next, data cleaning is performed. First, multi-source data with inconsistent timestamps are uniformly resampled to the same frequency, and linear interpolation is used to fill in the intermediate values. Then, the 3σ principle is used to detect outliers in data such as voltage and current, and they are repaired through sliding median filtering. For temperature outliers that exceed the normal operating temperature range of lithium batteries, they are directly marked as invalid and then repaired using cubic spline interpolation. At the same time, linear interpolation, cubic spline interpolation, or forward filling is used for small-scale missing data according to different types. Large-scale missing data are marked, filled, or discarded.

[0057] Normalization is then performed. For numerical features such as voltage and current, Min-Max normalization is used to map the data to the range [-1, 1]. For data involved in CNN convolution operations, Z-Score normalization is used to eliminate dimensionality effects. Finally, data reconstruction and partitioning are performed. Sliding window segmentation is used to reshape the data into a format suitable for CNN and LSTM input. The dataset is then divided into training and test sets for subsequent model training and evaluation.

[0058] S2. Build a deep neural network model.

[0059] like Figure 2 、 Figure 3 As shown in the figure, a CNN-LSTM-Multihead-Attention network model is built for feature extraction and time series prediction. The CNN layer extracts spatial features, while the LSTM layer learns the temporal information of the data. Each head of the multi-head attention mechanism learns different features, capturing the rich dependencies in the sequence. Combining multiple heads gives the model a global perspective.

[0060] The deep neural network model includes convolutional layer, BN layer, pooling layer, expansion layer, smoothing layer, LSTM layer, multi-head attention mechanism and fully connected layer in sequence, specifically including:

[0061] Convolutional layer: This layer extracts input features through convolution operations, optimizing the number of filters and stride length. It uses a two-dimensional Same convolution with a 3×3 kernel size, stride length 1, ReLU activation function, and L2 regularization to constrain weights.

[0062] BN layer: Batch normalization is performed after the convolutional layer to accelerate training convergence and prevent gradient disappearance or gradient explosion.

[0063] Pooling layer: The pooling window is 2×2. The pooling operation reduces the size of the feature map, retains the main features, and optimizes the pooling window and step size.

[0064] Unfolding layer: Flattens multidimensional features into one-dimensional vectors.

[0065] Smoothing layer: Further processes the expanded vector, such as linear transformation and dimensionality adjustment, to make the features more suitable for the input format of the LSTM layer.

[0066] LSTM layer: The LSTM layer receives features extracted and processed by CNN, uses the LSTM gating mechanism to capture long-term and short-term dependencies in time series data, remembers the long-term trend of battery data (such as the attenuation law of SOC with charge and discharge cycles), controls information transmission and updates, and compensates for the CNN's inability to capture long-term dependencies.

[0067] Multi-head attention mechanism: The multi-head attention mechanism enhances the model's feature capture capability and expression flexibility through separate learning and fusion. The multi-head attention mechanism is followed by a dropout layer.

[0068] Fully connected layer: maps features to the output space and generates the final prediction value.

[0069] Figure 3 This is the structural diagram of the multi-head attention mechanism. First, the input data is linearly mapped into a query vector Q, a key vector K, and a value vector V. Then, for each attention head, a scaled dot product attention parallel calculation is performed: the dot product of Q and K is calculated and scaled, and then the attention weight is obtained by the Softmax function. Finally, the attention calculation results of each head are spliced ​​together and then linearly transformed to output the final result.

[0070] Specifically, first input the feature sequence Through the learnable weight matrix, they are mapped into query vector, key vector, and value vector respectively, with the number of attention heads being h. Then, for each attention head i, the scaled dot product attention is calculated in parallel:

[0071] ,in, , scaling factor Used to alleviate the vanishing gradient problem, The function normalizes the attention weights into a probability distribution. Then the attention outputs of h heads are concatenated into ,in, For splicing operation, , and finally projected back to the original dimension through the linear transformation matrix , and get the final output.

[0072] S3. Use Bayes-TLCO to optimize the deep neural network model.

[0073] like Figure 4 As shown in the figure, the dynamic optimization of the termite life cycle optimization algorithm assisted by Bayesian optimization includes:

[0074] S31. Initialization phase: Initialize basic parameters; set parameters such as population size (NP), number of iterations (cycle), optimization target, etc., define the problem dimension (the number of parameters to be optimized, such as the number of neural network layers and neurons) and boundary conditions (the range of parameter values); randomly initialize the population and calculate the individual fitness values ​​of the population through the neural network evaluation module to provide an initial solution for subsequent iterations, find the initial optimal solution Gbest, and clarify the global optimal benchmark for the first round of iterations.

[0075] The neural network evaluation module constructs and trains the neural network by inputting the parameters to be optimized (learning rate, number of layers, etc.), verifies the loss as the fitness value, quantifies the quality of the parameter combination, and completes the calculation of the fitness value.

[0076] S32, termite update stage: According to the termite life cycle optimization algorithm rules and based on the Lévy flight strategy, the termite individuals are controlled to update their positions in the search space, and the fitness value is calculated by the neural network evaluation module to obtain the candidate solution set under the current iteration.

[0077] The termite individual update path in the termite life cycle optimization algorithm is represented by a series of random steps, as shown in the following equation:

[0078] (1)

[0079] Where, The mathematical formula for converting step length into probability uses the Mantegna algorithm for asymmetric and stable Lévy distribution. When the random walk follows the Lévy distribution, the random walk will become a Lévy flight. According to the Mantegna algorithm, the step size is defined as the following equation:

[0080] (2)

[0081] Where, is the step length, is the Lévy distribution index, , 、 Normal distribution .

[0082] 、 It is derived from the normal distribution of the following equation:

[0083] (3)

[0084] in, 、 The standard deviation of is:

[0085] (4)

[0086] In formula (4), the Gamma function Γ is expressed as follows:

[0087] (5)

[0088] Each step length It can be either positive or negative. In particular, the step size can be implemented with a long or short distance, depending on the parameter .

[0089] (6)

[0090] Where, is the current iteration number, is the maximum number of iterations, For the The step size factor for the i-th individual in the iteration.

[0091] The breeding timing slope is σ, which is used to adjust the rate of change of the breeding trigger threshold λ. .

[0092] The calculation formulas for the reproduction trigger thresholds of soldier termites and worker termites are: , ,With the number of iterations, the reproduction probability of termites of different roles is controlled, and the search and reproduction strategies are dynamically adjusted to adapt to different stages of the optimization task.

[0093] Assuming high-quality search space symbolization The position of is known. In two-dimensional space, from the current position To new location The exercise strategy is as follows:

[0094] (7)

[0095] Where, is a vector or scalar that controls the expandable search space. These parameters will be flexibly selected to achieve new search space expansion and convergence speed.

[0096] Specifically, this embodiment dynamically optimizes the hyperparameters of the CNN-LSTM-Multhead-Attention model through a role-based iteration mechanism combined with probabilistic guidance from Bayesian optimization. Individual termites in the population are divided into worker termites and soldier termites based on their proportions, and worker termite updates and soldier termite updates are performed separately. The worker termites, representing 70% of the population, implement a global exploration strategy; the soldier termites, representing 30% of the population, implement a localized exploration strategy around the current optimal solution area.

[0097] The worker termites update their positions based on the Lévy flight strategy and obtain a fitness value through a neural network evaluation module. The new position is judged to be better. If so, the new position is retained. Otherwise, the number of attempts is marked and an over-limit constraint judgment is performed. When the iteration progress is greater than 1 / 3 of the total number of iterations and the constraint condition is triggered, the Bayesian optimization process is entered. If the condition is not met, the termite breeding process is executed if the over-limit constraint is triggered.

[0098] Set the initial population size of the ant colony to N, represents the position of the worker termite. The worker termite guarantees the ability to expand the search space. By converting in Eq. for , which is defined as the best solution at the kth iteration. arrive The speed of movement, , and The value of is chosen to be 1:

[0099] (8)

[0100] Where, represents the position of the i-th worker termite at the k+1th iteration; represents the position of the i-th worker termite at the k-th iteration; represents the global optimal position at the kth iteration; Represents the weight coefficient; the ability of worker termites to expand the search space is determined by the weight Decide.

[0101] The soldier termite update calculates a new position based on the optimal solution and the Lévy flight strategy, and obtains a fitness value through a neural network evaluation module; determines whether the fitness is better, and if so, retains the new position; otherwise, executes an over-limit constraint judgment; when the iteration progress is greater than 1 / 2 of the total number of iterations and the constraint condition is triggered, enters the Bayesian optimization process; if it is not met, if the over-limit constraint is triggered, executes the termite breeding process.

[0102] Soldier termites perform local development and update their positions based on the global optimal solution:

[0103] (9)

[0104] Where, represents the position of the i-th soldier termite at the k+1th iteration; represents the position of the i-th worker termite at the k-th iteration; represents the optimal solution at the kth iteration; S represents the strategy coefficient; and is a random number that follows a uniform distribution.

[0105] S33, Bayesian Optimization and Reproduction Phase: When iterations stagnate, meaning no better solution is found after the set number of iterations has been reached, Bayesian optimization is triggered. Specifically, when worker termite iterations progress more than one-third of the total number of iterations, and soldier termite iterations progress more than one-half of the total number of iterations, and no better solution is found, Bayesian optimization is triggered.

[0106] The Bayesian optimization process is as follows: generate initial points through Latin hypercube sampling, build a Gaussian process proxy model to fit historical hyperparameters and fitness data, generate high-value sampling points based on the expected improvement function, guide population search, evaluate and update the global optimal solution.

[0107] If the Bayesian optimization effect does not improve for a long time and the limit constraint is triggered, the termite reproduction process is executed: two reference individuals are randomly selected, Lévy flight is superimposed on the difference vector to perturb and generate a new position, the fitness of the new position is evaluated and the global optimal solution is updated. The formula for the termite reproduction stage is:

[0108] (10)

[0109] Where, are two randomly selected reference individual positions, is the random weight coefficient, and f is the objective function.

[0110] In this embodiment, Bayesian optimization uses Gaussian Process (GP) as a proxy model to approximate the objective function. Gaussian process establishes a distribution model of the objective function by learning from existing data. Assume that the objective function At the input point The value at is unknown, and the distribution of the objective function value is described by the Gaussian process. , the objective function value follows a normal distribution, where the mean and variance are determined by the prior distribution of the Gaussian process and the training data.

[0111] Specifically, suppose there is a set of input points and the corresponding function value , then in the Gaussian process, the joint distribution of the objective function value is: in, is the mean function, is the covariance matrix, which describes the correlation between input points.

[0112] Bayesian optimization uses an acquisition function to select the next evaluation point. The acquisition function reflects the expected improvement of the current model for each candidate point. This embodiment uses the expected improvement function (EI) to calculate the expected improvement between the current optimal solution and the objective function's prediction. .in, is the current optimal solution, is the predicted objective function value.

[0113] The probability of the objective function value being greater than the current optimal value is calculated through Probability of Improvement (PI). .in, is the cumulative distribution function of the standard normal distribution, is a Gaussian process at the point The standard deviation of .

[0114] During hyperparameter optimization, the point that can provide the maximum information gain is selected based on the knowledge gradient (KG) of the current model, accurately locating the hyperparameter combination with high adaptability.

[0115] After each evaluation, Bayesian optimization updates the Gaussian process proxy model with the actual objective function value. and the corresponding function value , we add the new data points to the training set and retrain the Gaussian process proxy model. The posterior distribution update formula of the Gaussian process is: .in, is the training set including new points, is the expanded covariance matrix.

[0116] In specific implementation, the Bayesian optimization process is:

[0117] 1. Initialization: Select a set of initial sample points , and evaluate the objective function value .

[0118] 2. Build a proxy model: Based on the initial sample points, build a Gaussian process proxy model.

[0119] 3. Optimize the acquisition function: Select the next evaluation point by optimizing the acquisition function .

[0120] 4. Evaluate the objective function: Evaluate the objective function at the selected point .

[0121] 5. Update the proxy model: Add the new evaluation results to the training set and update the Gaussian process model.

[0122] Repeat: Repeat steps 3 to 5 until the termination condition (such as the maximum number of iterations or accuracy requirement) is met.

[0123] S34. Repeat steps S32 and S33 until the iteration termination condition is met, and output the optimal hyperparameter combination after dynamic optimization. Figure 4 In the figure, ① represents the fitness evaluation process, ② represents the Bayesian optimization process, and ③ represents the termite reproduction process.

[0124] The termite lifecycle algorithm efficiently explores the parameter space, finding the optimal configuration and thus enhancing the model's overall performance. The Bayesian optimization algorithm, by incorporating prior knowledge and constructing a posterior distribution to guide hyperparameter search, effectively compresses the search space, avoids ineffective computations, and improves optimization efficiency. It also dynamically adjusts exploration and development efforts to prevent model training from becoming trapped in local optima. By combining Bayesian optimization-assisted TLCO optimization with a CNN-LSTM network and a multi-head attention mechanism, it will provide strong technical support for the intelligent upgrade of battery management systems and propel them to higher levels of development.

[0125] The hyperparameters optimized by Bayes-TLCO include: learning rate, number of neurons, key value, regularization parameter, number of convolution kernels, vertical filter size, horizontal filter size, vertical pooling size, horizontal pooling size, pooling window stride, and dropout rate. The hyperparameter optimization process is shown in Table 1.

[0126] Table 1. Deep neural network hyperparameter optimization process

[0127]

[0128] S4. Estimating the state of charge of the lithium battery.

[0129] The training set data is input into the deep neural network model after hyperparameter optimization for training. During the model training process, the root mean square error is used as the loss function to measure the error between the lithium battery state of charge predicted by the model and the true value. The model parameters are optimized by minimizing the loss function; the model learns the mapping relationship between the lithium battery state of charge and the input data, and realizes the estimation of the lithium battery state of charge.

[0130] Finally, the mean absolute error (MAE), root mean square error (RMSE), mean square error (MSE), mean absolute percentage error (MAPE) and coefficient of determination (R) of the prediction results of the training set and the test set were calculated. 2 ) to evaluate the effect of the optimized parameters on the dataset.

[0131] To fully demonstrate the effectiveness and superiority of the present invention, the battery SOC estimation is performed using the deep learning algorithm based on Bayes-TLCO optimized CNN-LSTM-Multhead-Attention based on the Severson dataset (Nature Energy, 2019, Vol. 4, pp. 383-391). The steps are as follows:

[0132] (1) Ten sets of data were stratified and sampled from a set of data sets, of which the first eight were used as training sets and the last two were used as test sets, ensuring that the training set and test set contained battery data at different aging stages.

[0133] (2) The data is normalized and flattened into 3D data before being passed to the deep neural network model CNN-LSTM-Multhead-Attention.

[0134] (3) Initialize the algorithm, give the number of individuals P = 20, the number of evolutions M = 20; set the optimization parameter threshold.

[0135] (4) After training based on the data set constructed after 1188 cycles of the battery, the prediction errors of the deep neural network model without Bayes-TLCO optimization and the deep neural network model obtained after Bayes-TLCO hyperparameter optimization are shown in Table 2 and Table 3, respectively.

[0136] Table 2 Prediction error of the deep neural network model without Bayes-TLCO optimization

[0137]

[0138] Table 3 Prediction error of the deep neural network model after Bayes-TLCO optimization of hyperparameters

[0139]

[0140] The minimum value of the coefficient of determination occurs in the 11th cycle. Excluding this cycle, the minimum value of the coefficient of determination is 0.9631. That is, the coefficient of determination of the model's predicted values ​​for all data, except for the data in the 11th cycle, is all in the range of 0.9631~0.9818, indicating that the model performs well and has excellent stability.

[0141] Figure 5 The comparison between the predicted values ​​and the true values ​​of the test set is shown. The overall shape of the blue predicted curve and the red true curve are highly consistent, indicating that the model can capture the temporal variation of the battery SOC and has good SOC estimation capabilities. Figure 6This is the test set error histogram. The orange vertical line represents the zero error line, indicating the ideal state of "prediction error of 0." The height of each bin in the blue histogram represents the number of samples within that error range, reflecting the distribution of model errors. In terms of error concentration trend, the histogram peak (the highest blue bar) is close to the zero error line, indicating that most prediction errors are small and the model's overall prediction accuracy is high. In terms of error dispersion, the error distribution covers multiple bins (ranging from -0.9598 to 0.9639), but the number of examples in the bins on either side is much lower than in the middle, indicating few extreme errors and strong model robustness. The data show little variation around the zero error line, indicating a relatively uniform error between the predicted and true values.

[0142] In summary, the present invention integrates a convolutional neural network with excellent feature extraction capabilities, a long short-term memory network with excellent time series information extraction capabilities, and a multi-head attention mechanism, taking into account environmental fluctuations, individual differences in batteries, and aging effects, so that the model remains highly applicable and accurate in complex environments. In addition, the hyperparameters of the deep neural network model are dynamically optimized using a Bayesian optimization-assisted termite life cycle optimization algorithm, significantly improving the model quality in complex environments. Experiments have shown that the present invention can utilize its specific architecture and training methods to better capture complex patterns and relationships in data, thereby improving the performance and generalization ability of the model.

[0143] Finally, it should be noted that the parts of the present invention that are not described in detail are all prior art. Those skilled in the art will understand that the above description is only a preferred embodiment of the invention and is not intended to limit the invention. Although the invention has been described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions described in the above examples or replace some of the technical features therein with equivalents. Any modifications, equivalent replacements, etc. made within the spirit and principles of the invention should be included in the scope of protection of the invention.

Claims

1. A lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network, characterized in that: The following steps are involved: S1. Preprocessing the lithium battery charge and discharge data set; S2. Construct a deep neural network model including a convolutional neural network, a long short-term memory network, and a multi-head attention mechanism, wherein the deep neural network model includes a convolutional layer, a batch normalization layer, a pooling layer, an expansion layer, a smoothing layer, an LSTM layer, a multi-head attention mechanism, and a fully connected layer in sequence; S3. Using Bayesian optimization to assist the termite life cycle optimization algorithm to dynamically optimize the hyperparameters of the deep neural network model. During the iteration process of the termite life cycle optimization algorithm, when the iteration stagnates, Bayesian optimization is introduced to construct a proxy model for simulating the optimization objective function by fitting historical data through a Gaussian process to generate high-value sampling points and accelerate the convergence of the model hyperparameters to the global optimal solution; The dynamic optimization of the termite life cycle optimization algorithm assisted by Bayesian optimization includes: S31, initialization phase: Initialize basic parameters; randomly initialize the population, calculate the fitness value of the individual population through the neural network evaluation module; select the initial optimal solution Gbest from the initialized population as the benchmark for iterative optimization; S32, Termite Update Phase: According to the termite life cycle optimization algorithm rules and based on the Lévy flight strategy, the termite individuals are controlled to update their positions in the search space, and the fitness value is calculated by the neural network evaluation module to obtain the candidate solution set under the current iteration; S33, Bayesian optimization and reproduction phase: When the iteration stagnates, Bayesian optimization is triggered. Initial points are generated through Latin hypercube sampling. A Gaussian process surrogate model is constructed to fit historical data. High-value sampling points are generated based on the expected improvement function. The global optimal solution is evaluated and updated. If the Bayesian optimization effect is not good and the limit constraint is triggered, the termite reproduction process is executed to generate new positions and update the global optimal solution. S34, repeat steps S32 and S33 until the iteration termination condition is met, and output the optimal hyperparameter combination after dynamic optimization; The termite renewal stage specifically includes: for the individuals in the population, they are divided into worker termites and soldier termites according to their proportions, and worker termite renewal and soldier termite renewal are performed respectively; The worker termites update their positions based on the Lévy flight strategy and obtain a fitness value through a neural network evaluation module. The process determines whether the fitness is better. If so, the new position is retained. Otherwise, the number of attempts is marked and an over-limit constraint judgment is performed. When the iteration progress is greater than 1 / 3 of the total number of iterations and the constraint condition is triggered, the Bayesian optimization process is entered. If the condition is not met, the termite breeding process is executed if the over-limit constraint is triggered. The soldier termite updates a new position based on the optimal solution and the Lévy flight strategy, and obtains a fitness value through a neural network evaluation module; determines whether the fitness is better, and if so, retains the new position; otherwise, executes the over-limit constraint judgment; when the iteration progress is greater than 1 / 2 of the total number of iterations and the constraint condition is triggered, enters the Bayesian optimization process; if not, if the over-limit constraint is triggered, executes the termite breeding process; S4: Input the data preprocessed by S1 into the deep neural network model after hyperparameter optimization for training. By minimizing the loss function, the model learns the mapping relationship between the lithium battery state of charge and the input data, thereby realizing the estimation of the lithium battery state of charge.

2. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 1, characterized in that: The implementation of the multi-head attention mechanism in step S2 includes: First, the input data is linearly mapped into query vector Q, key vector K and value vector V; Then, for each attention head, perform parallel calculation of scaled dot product attention: calculate the dot product of Q and K and scale it, and then pass it through the Softmax function to obtain the attention weight; Finally, the attention calculation results of each head are spliced ​​together and then linearly transformed to output the final result.

3. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 1, characterized in that: The worker termites account for 70% of the population size and implement a global exploration strategy; the soldier termites account for 30% of the population size and implement a local development strategy around the current optimal solution area.

4. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 1, characterized in that: In step S32, The step length formula of the Lévy flight strategy is: Where, is the step length, is the Lévy distribution index, , 、 Normal distribution ; Where, is the current iteration number, is the maximum number of iterations, For the The step size factor for the i-th individual in the iteration.

5. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 1, characterized in that: In the process of using Bayesian optimization to assist TLCO in optimizing hyperparameters, the optimized hyperparameters include: learning rate, number of neurons, key value, regularization parameter, number of convolution kernels, vertical filter size, horizontal filter size, vertical pooling size, horizontal pooling size, pooling window step size and dropout rate.

6. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 1, characterized in that: The data preprocessing includes: extracting 10 groups of data from the battery life cycle data in layers, with the first 8 groups as training sets and the last 2 groups as test sets; normalizing the voltage, current, and temperature data and reconstructing them into three-dimensional tensors.

7. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 6, characterized in that: The BN layer performs batch normalization after the convolutional layer to accelerate training convergence and prevent gradient explosion.

8. The lithium battery state of charge estimation method based on Bayes-TLCO optimized deep neural network according to claim 1, characterized in that: During the model training process, the root mean square error is used as the loss function to measure the error between the lithium battery state of charge predicted by the model and the actual value, and the model parameters are optimized by minimizing the loss function.

Citation Information

Patent Citations

  • Lithium battery SOH estimation method based on coupling of attention mechanism and Bayesian network

    CN117192378A

  • Methods and kits for determining the prognosis of pulmonary sarcoidosis

    US20120034214A1