Lithium battery charge state estimation method based on Bi-GRU and attention mechanism and application
The lithium battery state of charge estimation method based on Bi-GRU and attention mechanism, combined with whale optimization algorithm to optimize hyperparameters and piecewise estimation, solves the problem of insufficient accuracy of lithium battery state of charge estimation under aging and complex working conditions, and improves the accuracy and robustness of SOC estimation, especially the dynamic characteristics in the low temperature range, particularly the dynamic characteristics in the low temperature and low SOC estimation range.
Patent Information
- Application Number
- CN202511319632.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-16
- Publication Date
- 2026-01-06
AI Technical Summary
Existing methods for estimating the state of charge (SOC) of lithium batteries are not accurate enough under battery aging and complex operating conditions. In particular, they are prone to introducing errors during the low to medium SOC period, which can lead to a shortened lifespan of lithium batteries and safety hazards.
A lithium battery state of charge estimation method based on Bi-GRU and attention mechanism is adopted. By constructing a BiGRU-Attention model and combining it with the whale optimization algorithm to optimize hyperparameters, the feature weights are dynamically adjusted by utilizing bidirectional learning capability and attention mechanism to optimize the SOC definition method, and segmented estimation is performed in the low temperature range.
This improves the accuracy and robustness of lithium battery state of charge (SOC) estimation, particularly in dynamic characteristics at low and low SOC levels. It enhances the accuracy and reliability of SOC estimation, especially in dynamic characteristics at low temperatures, particularly the dynamic characteristics of lithium batteries in low-temperature and low-SOC estimation performance. It addresses the dynamic characteristics of lithium batteries in the low-temperature and low-SOC estimation range, thereby improving the accuracy and reliability of SOC estimation.
Smart Images

Figure CN121276338A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of lithium battery SOC estimation, and in particular to a lithium battery state of charge estimation method and application based on Bi-GRU and attention mechanism. Background Technology
[0002] Lithium-ion batteries, with their advantages of high energy density, long cycle life, low self-discharge rate, and wide operating temperature range, have become the preferred energy storage solution for electric vehicles. However, the full realization of the advantages of lithium-ion battery technology is highly dependent on the real-time monitoring and precise management of the battery management system (BMS). Improper use can not only significantly shorten the lifespan of lithium-ion batteries, but in extreme cases, it may even lead to fires or explosions. Among the core functions of the BMS, accurately estimating the battery's state of charge (SOC) is crucial. It not only provides a scientific basis for battery charge and discharge control, equalization charging, and thermal management, but also helps drivers better plan their trips, ensuring the driving range and safety of electric vehicles. However, as a complex nonlinear system, the state of charge of lithium-ion batteries cannot be directly measured and can only be estimated indirectly through data collected by sensors. In addition, the performance of lithium-ion batteries is highly susceptible to multiple factors such as the operating environment, charge and discharge conditions, and battery aging, making accurate estimation of the battery's SOC an extremely challenging task.
[0003] Currently, lithium-ion battery state-of-charge (SOC) estimation methods can be categorized into open-circuit voltage methods, ampere-hour integration methods, model-based methods, and data-driven methods. Among these, data-driven methods do not require knowledge of the complex electrochemical reaction mechanisms within the battery or the construction of intricate models. By simply transforming measurable battery variables and using them as input, their powerful nonlinear fitting capabilities enable SOC prediction. Data-driven methods are gradually becoming the mainstream trend in battery SOC estimation.
[0004] Currently, State of Charge (SOC) is generally defined using rated capacity or actual discharge capacity (current maximum usable capacity). However, since most experimental data comes from the early stages of battery use, the difference between rated capacity and actual discharge capacity is not significant at this time, so the distinction between the two definitions is not obvious. As the battery ages, its capacity gradually decreases and is affected by complex factors such as discharge temperature and current, resulting in the actual discharge capacity being much lower than the rated capacity. If rated capacity is still used to define SOC, the range of SOC variation will be inappropriately compressed, failing to truly reflect the actual remaining capacity of the battery. On the other hand, accurately obtaining the current maximum usable capacity is difficult. In practice, the discharge capacity under the current operating conditions is usually regarded as the current maximum usable capacity. This method simplifies the data processing flow to some extent, but it also brings new problems: under complex operating conditions, especially under large current fluctuations, lithium batteries may prematurely end the discharge process, resulting in incomplete discharge. At this point, if the capacity obtained by integrating the discharge current is simply regarded as the maximum capacity of the lithium battery, and the state of charge (SOC) is estimated based on this, it is likely to introduce a large input error, especially when the SOC is at a low to medium level. The input interference caused by the limitations of the SOC definition is more obvious, thus affecting the improvement of SOC estimation performance. This is also a problem that urgently needs to be solved in the field of data-driven SOC estimation. Summary of the Invention
[0005] In view of the above problems, this application provides a lithium battery state of charge estimation method and system based on Bi-GRU and attention mechanism, which aims to optimize the definition of SOC and improve the SOC estimation accuracy by constructing a BiGRU-Attention network model, so as to overcome the above problems or at least partially solve the above problems.
[0006] In a first aspect, embodiments of this application provide a method for estimating the state of charge of a lithium battery based on Bi-GRU and attention mechanisms, the method comprising:
[0007] Obtain the voltage, current, and battery temperature of the lithium battery under test at multiple time periods;
[0008] Based on the Bi-GRU network and attention mechanism, a BiGRU-Attention model is constructed;
[0009] The BiGRU-Attention model was trained, and its hyperparameters were determined based on the whale optimization algorithm.
[0010] The trained BiGRU-Attention model was validated using root mean square error and maximum absolute error, resulting in a state of charge estimation model.
[0011] By inputting voltage, current, and battery temperature into the state of charge estimation model, the estimated state of charge of the lithium battery at the current moment is obtained.
[0012] Optionally, the BiGRU-Attention model is obtained by connecting an attention mechanism after the output layer of the Bi-GRU network.
[0013] Optionally, training the BiGRU-Attention model and determining its hyperparameters based on the whale optimization algorithm includes:
[0014] Set up the hyperparameter space;
[0015] Initialize the parameters of the whale optimization algorithm and the whale population;
[0016] Determine the experimental value of the state of charge corresponding to the sample battery;
[0017] The sample voltage, sample current, and sample battery temperature are input into the BiGRU-Attention model, which outputs the estimated state of charge at the current moment.
[0018] Based on the experimental values of the state of charge and the estimated values of the state of charge output by the BiGRU-Attention model, the fitness of each individual whale is calculated, and the individual whale with the highest fitness is taken as the current optimal solution.
[0019] The optimal solution at the time of reaching the required number of iterations or meeting the preset conditions is taken as the final optimal solution, and the hyperparameters of the BiGRU-Attention model are determined based on the final optimal solution.
[0020] Optionally, the formula for calculating the experimental value of the state of charge corresponding to the sample battery is:
[0021]
[0022] Among them, SOC t Let represent the battery's state of charge at time t, SOC0 represent the initial value of the battery's state of charge, i(τ) represent the instantaneous load current, and T represent the temperature. This indicates the maximum discharge capacity.
[0023] Optionally, the method further includes: if the current battery temperature of the battery under test is within a low temperature range, determining the estimated value of the state of charge at the current moment using piecewise estimation; wherein, the low temperature range is [0℃, 10℃].
[0024] Optionally, determining the estimated state of charge at the current moment using piecewise estimation includes:
[0025] The overall discharge process of a lithium battery is divided into a first sub-interval and a second sub-interval. The first sub-interval corresponds to the lithium battery going from full charge to half charge remaining, and the second sub-interval corresponds to the lithium battery going from half charge remaining to the end of discharge.
[0026] Train the BiGRU-Attention model on the first sub-interval and the second sub-interval respectively to obtain the prediction model for the first sub-interval and the prediction model for the second sub-interval respectively;
[0027] The voltage, current, and battery temperature collected at the current time and in the previous time period are input into the first sub-interval prediction model. If the output state of charge estimate at the current time is less than 0.5, the state of charge estimate at the current time is re-predicted using the second sub-interval prediction model; otherwise, the state of charge estimate at the current time is output.
[0028] Secondly, embodiments of this application provide a lithium battery state-of-charge estimation system based on Bi-GRU and attention mechanisms, the system comprising:
[0029] The data acquisition module is used to acquire the voltage, current, and battery temperature of the lithium battery under test over multiple time periods.
[0030] The model building module is used to construct a BiGRU-Attention model based on the Bi-GRU network and attention mechanism.
[0031] The model training module is used to train the BiGRU-Attention model and determine the model's hyperparameters based on the whale optimization algorithm.
[0032] The validation module is used to validate the trained BiGRU-Attention model using root mean square error and maximum absolute error to obtain the state of charge estimation model.
[0033] The output module is used to input voltage, current, and battery temperature into the state of charge estimation model to obtain the estimated state of charge of the lithium battery at the current moment.
[0034] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the lithium battery state-of-charge estimation method based on Bi-GRU and attention mechanism as described in any of the above claims.
[0035] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions, which, when executed by a processor, implement the lithium battery state-of-charge estimation method based on Bi-GRU and attention mechanism as described above.
[0036] Compared with the prior art, the specific beneficial effects of the present invention are as follows:
[0037] First, the present invention optimizes the SOC definition method, thereby solving the problem that when SOC is defined by rated capacity, the range of SOC variation is inappropriately compressed and cannot truly reflect the actual remaining capacity of the battery, and when SOC is defined by actual discharge capacity, the maximum dischargeable capacity before full discharge cannot be obtained during the discharge process.
[0038] Second, this invention proposes a BiGRU-Attention network model. This model utilizes the bidirectional learning capability of BiGRU to capture the long-term dependencies of time series from both positive and negative directions. At the same time, it dynamically adjusts feature weights with the help of the attention mechanism, focusing on information segments that are more critical to SOC prediction, thereby improving the estimation accuracy and generalization performance of SOC estimation.
[0039] Third, this invention proposes a segmented SOC estimation method. By eliminating the interference between SOC inputs at different stages, it effectively captures the dynamic characteristics of the battery at different SOC levels, especially the dynamic characteristics of lithium batteries in the low-temperature and low-SOC estimation range, thereby improving the accuracy and reliability of SOC estimation performance at low temperatures.
[0040] Fourth, the prediction accuracy of the BiGRU-Attention model is improved by automatically optimizing the hyperparameters of the BiGRU-Attention model through the introduction of the WOA algorithm.
[0041] In summary, the BiGRU-Attention model (i.e., the hybrid model for SOC estimation) proposed in this invention achieves accurate estimation, providing a new approach and method for accurate estimation of lithium battery SOC, and can be applied in fields such as electric vehicles and energy storage systems in the future. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a schematic diagram of the GRU structure.
[0044] Figure 2 This is a schematic diagram of the BiGRU structure.
[0045] Figure 3 This is a schematic diagram of the attention mechanism.
[0046] Figure 4 This is a flowchart of the BiGRU-Attention model optimized based on WOA.
[0047] Figure 5 (a)-(d) represent the prediction results and prediction errors at 0°C on the LA92, HWFET, UDDS and US06 test sets, respectively.
[0048] Figure 6 (a)-(d) represent the prediction results and prediction errors at 10℃ on the LA92, HWFET, UDDS and US06 test sets, respectively.
[0049] Figure 7 (a)-(d) represent the prediction results and prediction errors at 25°C on the LA92, HWFET, UDDS and US06 test sets, respectively.
[0050] Figure 8 (a)-(d) represent the prediction results and prediction errors at 40°C on the LA92, HWFET, UDDS and US06 test sets, respectively. Detailed Implementation
[0051] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0052] The lithium battery state-of-charge estimation method based on Bi-GRU and attention mechanism provided in this application embodiment may include the following steps:
[0053] Step 1: Obtain the voltage, current, and battery temperature of the battery under test during the first time period.
[0054] Step 2: Construct the BiGRU-Attention model based on the Bi-GRU network and attention mechanism.
[0055] First, GRU, as a variant of RNN, aims to solve the problems of RNN's inability to retain information for long periods and the gradient explosion or vanishing during backpropagation. Compared to RNN, it introduces two gating mechanisms: an update gate and a reset gate. The specific structure of GRU is as follows: Figure 1 As shown.
[0056] Among them, update gate z tThis is used to control the extent to which hidden state information from the previous moment is incorporated into the current hidden state, thus determining how much past information needs to be passed to the future. t The closer it is to 1, the more information at the current moment is remembered;
[0057] Reset door r t r is used to control the extent to which hidden state information from the previous time step is written into the current candidate hidden state. t The closer it is to 1, the more information from the previous hidden state is written into the current candidate hidden state.
[0058] GRU effectively reduces computational cost by introducing a gating mechanism that preserves long-term dependency information. The internal computation process of GRU can be represented as follows:
[0059]
[0060] Where, x t For the input information at the current time t, h t-1 This is the hidden state at the previous time step t-1. Let h be the candidate hidden state at time t. t Let σ be the hidden state at time t, σ be the sigmoid function, and the operator * be the Hadamard product. Let b be the weight matrix. z To update the gate's bias term, b r To reset the door's bias term, b h The bias term for the candidate hidden state;
[0061] Secondly, while a unidirectional GRU can predict the current state based on past data, it cannot utilize future state information to enhance the prediction accuracy of the current output. To address this issue, a bidirectional gated recurrent unit (Bi-GRU) was proposed, with the following structure: Figure 2 As shown, it consists of two independent GRU units stacked together. One processes the input sequence in the forward direction, and the other processes the input sequence in the reverse direction. The output of the bidirectional gated cyclic unit is determined by both GRUs. The output of the bidirectional gated cyclic unit is as follows:
[0062]
[0063] in, This represents the hidden state at the current time t, obtained through forward acquisition. This represents the hidden state of the previous time step t-1, obtained through forward acquisition. This is the hidden state at the current time t obtained in reverse. The hidden state at the next time step t+1 is obtained by reverse acquisition;
[0064] Therefore, this invention selects a bidirectional gated cyclic unit (Bi-GRU) as the basic model framework. Next, considering that historical information has a significant impact on prediction accuracy in the SOC prediction of lithium batteries, an attention mechanism is introduced on this basic model framework.
[0065] Furthermore, an attention mechanism is connected after the output layer of the Bi-GRU model; therefore, the input to this attention mechanism is the output h of the Bi-GRU model. t Attention mechanisms are a key component of deep learning, representing an intelligent processing strategy that mimics human visual attention. They dynamically weight information from different positions within an input sequence, adaptively capturing global dependencies and focusing on critical information. Their structure is as follows: Figure 3 As shown.
[0066] The computational process of the introduced attention mechanism is as follows:
[0067] s(h i ) = tanh(Wh i +b i (8)
[0068]
[0069]
[0070] Among them, s(h i Let be the scoring function of the attention mechanism, given the input h at time i. i Scoring, W and b i These represent the weights and biases of the scoring function, α and β, respectively. i for h i Attention weights, y t It is a weighted sum of the input information and its corresponding attention weights;
[0071] Since Bi-GRU has a large number of output parameters, it is difficult to achieve a good fit by directly using fully connected layers. Therefore, this invention reduces the fitting difficulty by introducing an attention mechanism to assign different weight coefficients to information at different positions in the input sequence.
[0072] Thus, a BiGRU-Attention model based on a BiGRU network and an attention mechanism was constructed. This model leverages the bidirectional learning capability of BiGRU, enabling it to capture more comprehensive current and historical information from lithium battery measurement data. Simultaneously, by dynamically adjusting feature weights using the attention mechanism, the model can intelligently focus on the data segments most critical for SOC prediction, thereby improving prediction accuracy and robustness.
[0073] Step 3: Train the BiGRU-Attention model and determine the model's hyperparameters based on the whale optimization algorithm.
[0074] The BiGRU-Attention model requires pre-setting hyperparameters; only by setting appropriate hyperparameters can the model's prediction accuracy be improved. However, these hyperparameters vary widely and are difficult to calculate. Therefore, this invention introduces the Whale Optimization (WOA) algorithm to determine these hyperparameters, such as the learning rate, the number of hidden nodes, and the number of nodes in the fully connected layer.
[0075] First, in this embodiment, the model is trained on the McMaster University lithium-ion battery dataset. The McMaster University lithium-ion battery dataset uses LG18650 lithium-ion batteries with a rated capacity of 3Ah. This dataset mainly records the changes in current, voltage, temperature, and capacity of lithium batteries under different temperatures (-20℃ to 40℃) and different mixed driving cycle conditions. Due to the instability of lithium batteries discharging below 0℃ and the resulting safety hazards, the operating temperature of lithium batteries in electric vehicles is usually above 0℃. Therefore, this embodiment selects lithium battery test data at 0℃, 10℃, 25℃, and 40℃ for simulation. The mixed driving cycle conditions of the dataset consist of five sub-datasets: LA92, HWFET, US06, UDDS, and Mix1-8. Mix1-8 is used as the training set and validation set, with a ratio of 7:3. The mixed driving cycles LA92, HWFET, US06, and UDDS are used as the test set to evaluate the effectiveness of the proposed method. The input to the BiGRU-Attention model includes voltage, current, and battery temperature over multiple time periods, and the output is the current state of charge (SOC).
[0076] Due to the influence of battery temperature and discharge current under mixed driving cycle conditions, the capacity that lithium batteries can release varies, as shown in Table 1. The voltage and current capacities in Table 1 represent the voltage, current, and integral discharge capacity when discharge stops, respectively.
[0077] Table 1. Statistics on the discharge capacity of lithium batteries at the end of discharge.
[0078]
[0079] State of charge (SOC) is an important indicator for measuring battery capacity. Currently, the rated capacity or actual discharge capacity (current maximum usable capacity) is commonly used to define the SOC of a battery, and its definition is generally as follows:
[0080]
[0081] Among them, SOC tLet represent the state of charge of the battery at time t, SOC0 represent the initial value of the battery's state of charge, i(τ) represent the instantaneous load current, and Q represent the instantaneous load current. n C indicates the rated capacity of a lithium battery. actual τ represents the actual discharge capacity of the lithium battery under the current operating conditions, and τ represents time. By integrating the current, the capacity discharged by the lithium battery is obtained, and then the actual discharge capacity of the lithium battery at the current moment can be calculated.
[0082] If Equation (11) is used to calculate SOC, the influence of the incomplete discharge of the lithium battery can be ignored, but the range of SOC variation obtained is much smaller than 1. When Equation (12) is used to calculate SOC, the SOC variation is close to 1, but it will be affected by the incomplete discharge of the lithium battery, resulting in a decrease in the accuracy of SOC estimation.
[0083] Therefore, this invention modifies and optimizes the original SOC definition formula, as shown in formula (13), which uses the maximum discharge capacity at each temperature. Replace C actual This ensures that the SOC variation range is as close to 1 as possible while maintaining the estimation accuracy of the SOC estimation model.
[0084]
[0085] In the laboratory, by collecting the initial value of the current state of charge, the instantaneous load current, and the maximum discharge capacity at temperature T, the accurate value of the current state of charge of the lithium battery, i.e. the experimental value of the state of charge, can be calculated according to Equation (13). By comparing the predicted value of the current state of charge output by the model with the experimental value of the state of charge, if the difference between the two is less than the preset error threshold, the effect of the BiGRU-Attention model proposed in this invention can be verified.
[0086] Secondly, the whale optimization algorithm is a swarm intelligence optimization algorithm specifically designed to solve nonlinear problems. It iteratively searches for the global optimum within a complex search space by simulating the hunting, attacking, and searching strategies of whales. Combined with... Figure 4 The whale optimization algorithm generally includes the following steps:
[0087] A1: Encircle the prey;
[0088] Humpback whales adjust their position to surround their prey based on the prey's location. Since the prey's location is usually unknown, the position of the humpback whale closest to the prey is considered the optimal position for the individual humpback whale, and other individuals humpback whales move toward it, as shown below.
[0089] D=|C·Z′(t)-Z(t)| (14)
[0090] Z(t+1)=Z′(t)-A·D (15)
[0091] Where t is the current iteration number, Z is the humpback whale position vector, Z′ is the currently obtained best humpback whale individual position vector, D is the distance between the current individual and the optimal solution, and A and C are both parameter vectors:
[0092] A = 2a·ra (16)
[0093] C = 2·r (17)
[0094] Where r is a random variable on the interval [0,1], and a gradually decreases from 2 to 0 during the iteration process;
[0095] A2: Bubble Web Attack;
[0096] To simulate a humpback whale bubble web attack, WOA designed a spiral advance mechanism in addition to the shrinking encirclement mechanism. However, the shrinking encirclement mechanism and the spiral advance mechanism cannot be implemented simultaneously; it is generally assumed that they are implemented probabilistically, as shown in the following equation:
[0097]
[0098] Where b is a constant of helicity, l∈(-1,1), p∈[0,1], used to ensure that the two behaviors occur with equal probability; D′ is the distance vector from the humpback whale to the optimal humpback whale individual position:
[0099] D′=|Z′(t)-Z(t)| (19);
[0100] A3: Searching for prey
[0101] The humpback whale's search mechanism consists of a local search strategy and a global search strategy. When |A| < 1, the humpback whale updates its own position based on the best humpback whale individual position, executing the local search strategy. When |A| ≥ 1, the humpback whale updates its own position based on a randomly selected humpback whale position, executing the global search strategy. The formula for the global search strategy is shown below:
[0102] D″=|C·Z″(t)-Z(t)| (20)
[0103] Z(t+1)=Z″(t)-A·D″ (21)
[0104] Where Z″ is a randomly selected humpback whale position vector.
[0105] Finally, the specific process of determining the hyperparameters of the BiGRU-Attention model, such as the number of BiGRU hidden layer nodes, the number of fully connected layer nodes, and the learning rate, using the WOA algorithm is as follows: Figure 4As shown in the sub-diagram on the left, it includes the following sub-steps:
[0106] Step 301: Set the hyperparameter space;
[0107] Step 302: Initialize the parameters of the whale optimization algorithm and the whale population, wherein the parameters include the population size, the maximum number of iterations, and the initial position of individual whales;
[0108] Step 303: Determine the experimental value of the state of charge of the sample battery using equation (13);
[0109] Step 304: Input the sample voltage, sample current, and sample battery temperature into the current BiGRU-Attention model and output the estimated state of charge at the current time.
[0110] Step 305: Based on the experimental value and estimated value of state of charge, calculate the fitness of each individual whale using equation (22), and take the individual whale with the highest fitness as the current optimal solution;
[0111] Step 306: Determine whether the number of iterations has been reached or the preset conditions have been met. If yes, the optimal solution is obtained; otherwise, update vectors A and C, recalculate the fitness of individual whales, until the number of iterations has been reached or the preset conditions have been met, and the optimal solution is obtained.
[0112] Step 307: Determine the hyperparameters of the BiGRU-Attention model based on the optimal solution.
[0113] In the embodiments of this application, the number of hidden layer nodes and the number of fully connected layer nodes of BiGRU are integers [8, 128], the learning rate is [0.0001, 0.001], and the final predicted hyperparameter results are shown in Table 2.
[0114] Table 2. WOA Algorithm Optimization of BiGRU-Attention Model Hyperparameters
[0115]
[0116] Step 4: Validate the trained BiGRU-Attention model using root mean square error and maximum absolute error to obtain the state of charge estimation model.
[0117] To quantitatively describe the performance of the lithium battery SOC prediction model, the root mean square error and maximum absolute error were selected as evaluation functions. The parameter-optimized BiGRU-Attention model was evaluated on the validation set, and the final model that passed the evaluation was used as the state of charge estimation model.
[0118] The evaluation functions are as follows:
[0119]
[0120] MAX = max|Y i -Y i * | (23)
[0121] Among them, Y i Y represents the true value of the lithium battery's SOC (i.e., the experimental value of its state of charge); i * N represents the predicted value of the SOC (i.e., the estimated state of charge) of the lithium battery, where N is the total number of samples.
[0122] Step 5: Input the voltage, current, and battery temperature into the state of charge estimation model to obtain the estimated range of the lithium battery's state of charge within the first time period.
[0123] Step 6: If the current battery temperature is within the low temperature range, the entire lithium battery discharge process is divided into two sub-intervals. The BiGRU-Attention model is used in the two sub-intervals to predict the state of charge (SOC) and output the estimated state of charge value.
[0124] The low temperature range is [0℃, 10℃].
[0125] Specifically, the overall discharge process of the lithium battery refers to the process from SOC (State of Charge) from 100% (fully charged) to 0% (fully discharged). During this process, intermediate charging is not considered, and the SOC changes in a gradually decreasing trend. The overall discharge process of the lithium battery is divided into 100% (fully charged) to 50% (half the charge) and 50% (half the charge) to 0% (fully discharged), and two sub-intervals [1, 0.5] and [0.5, 0].
[0126] The BiGRU-Attention model is trained in the intervals [1, 0.5] and [0.5, 0] respectively. Then, the voltage, current and battery temperature collected at the current time and a period of time (e.g., 1 minute) before the current time are input into the BiGRU-Attention model trained in the interval [1, 0.5], and the estimated state of charge at the current time is output. If the estimated state of charge is less than 0.5, the voltage, current and battery temperature collected at the current time and a period of time before the current time are input into the BiGRU-Attention model trained in the interval [0.5, 0], and the estimated state of charge at the current time is output.
[0127] Simulation Case
[0128] To verify the effectiveness of the proposed method, it was validated on the McMaster University lithium battery dataset. For lithium batteries, the accuracy of the state of charge estimation model is affected by the SOC data processing. Therefore, it is very important to select a reasonable SOC data processing method. For this purpose, mixed driving conditions mix1-8 at four temperatures (0℃, 10℃, 25℃, 40℃) were used as the training set, and mixed driving conditions LA92, HWFET, US06, and UDDS were used as the test set to evaluate the impact of different SOC data processing methods on SOC estimation performance. The method of calculating SOC using formula (11) corresponds to test condition Case 1, the method of calculating SOC using formula (12) corresponds to test condition Case 2, and the method proposed in this invention corresponds to test condition Case 3. The results are shown in Table 3. Figure 5-8 The prediction results and prediction errors are shown under different SOC definition methods.
[0129] Table 3. Statistical results of estimation errors under different definitions
[0130]
[0131]
[0132] from Figures 5-8 As can be seen, the prediction results of Case 2 and Case 3 are very close to the true values, demonstrating good estimation accuracy. In contrast, Case 1 shows continuous large deviations under the 10℃ and 40℃ test environments. This indicates that the definition method in Case 1 is not conducive to accurate SOC estimation. This is mainly because the voltage is inconsistent at the end of lithium battery discharge, resulting in cluttered data in the training dataset, and the model cannot extract useful key information, thus causing a large estimation error. In addition, when the discharge is nearing its end, the SOC value in Case 2 is around 20%, much greater than 0. Although this can accurately reflect the discharged battery capacity, relying solely on SOC at this time cannot accurately assess the remaining usable capacity of the battery. During the SOC change process, the estimation error of SOC in the early stage is generally better than that in the later stage, and this phenomenon is more obvious in Case 1. This further confirms that the cluttered SOC data caused by incomplete discharge affects the SOC estimation performance, and also shows that Case 2 and Case 3 can effectively mitigate the impact of incomplete lithium battery discharge on the SOC estimation performance. It is worth noting that although Case 2... Figure 5-8 The fluctuation range of SOC error in the middle is better than that in Case 3. However, since the two use different SOC processing methods, their estimation performance cannot be judged solely by the fluctuation range of error.
[0133] The prediction results show that Case 1 exhibits the worst SOC estimation performance, with the largest root mean square error (RMSE) and maximum absolute error (MAO) at 3.25% and 8.09%, respectively. In contrast, Case 3 demonstrates superior estimation performance, with its RMSE and MAO controlled within 0.90% and 5.50%, respectively. This fully demonstrates that the proposed SOC processing method can significantly improve the accuracy of the SOC estimation model. It is also worth noting that Case 3's SOC estimation performance at 25℃ and 40℃ is significantly better than at 0℃ and 10℃. This is mainly because the electrochemical reactions of lithium batteries are more complex at low temperatures, and the incomplete discharge of lithium batteries causes data distortion and interference, leading to a larger deviation between the estimated value and the true SOC in the later stages of SOC estimation, thus increasing the RMSE of SOC estimation at 0℃ and 10℃.
[0134] Next, the method incorporating segmented estimation is compared with the method without segmented estimation on the same training and test sets. The prediction results show that the maximum root mean square error (MRM) and maximum absolute error (MAE) of the segmented estimation model are 0.79% and 4.27%, respectively. Compared with the original model, the MRM and MAE are reduced by 9.20% and 21.79%, respectively. This indicates that the segmented estimation method proposed in this invention improves the overall estimation accuracy of the model. However, it should be noted that the improvement in model estimation accuracy by segmented estimation is mainly concentrated in the low-temperature range [0℃, 10℃]. SOC segmentation reduces the fluctuation and estimation error in the later stages of SOC estimation. This is mainly because segmenting the data reduces the interference of data from different SOC estimation ranges, effectively capturing the dynamic characteristics of the battery at different SOC levels, especially the dynamic characteristics of lithium batteries in the low-temperature and low-SOC estimation ranges, thereby improving the prediction accuracy within each range. At 25℃ and 40℃, the model's estimation accuracy is high, and there is no significant difference in SOC estimation performance between the early and late stages. Therefore, the segmented estimation model has little effect on estimation performance at room temperature and high temperature; in fact, the high estimation accuracy may even lead to a decrease in estimation accuracy. In summary, the segmented SOC estimation model proposed in this invention can achieve more accurate lithium battery SOC estimation under various temperatures and operating conditions.
[0135] Finally, to demonstrate the superiority of the proposed method in SOC estimation, its performance was compared with that of other models, including LSTM, GRU, GRU_Attention, and BiGRU. All compared models shared the same parameters as the proposed model in the same structural aspects, and were trained using the same dataset.
[0136] The prediction results show that the LSTM and GRU models perform similarly in SOC estimation. Except for larger root mean square error (RMSE) and maximum absolute error (MAO) under the 40℃ US06 operating condition, the LSTM and GRU models can control the RMSE and MAO to below 0.50% and 2.5% respectively at 25℃ and 40℃, indicating high estimation accuracy. The larger error under the US06 condition is due to the larger estimation error in the 0.25–0.5 estimation range. However, as the temperature decreases, the model estimation accuracy declines. When the temperature is 0℃, the maximum RMSE is 1.22 and 1.19, and the MAO reaches 6.36% and 6.51% respectively. This indicates that a single deep learning model is greatly affected by temperature and operating conditions, making it difficult to meet the requirements of estimation accuracy and robustness in practical applications. Compared with LSTM and GRU, the GRU_Attention model and BiGRU model can improve the SOC estimation accuracy, especially at 0℃. This demonstrates the superiority of fusion models and the bidirectional learning capabilities of the models. Judging from the maximum and average values of the various indicators in the model, the method proposed in this invention demonstrates high estimation accuracy and robustness.
[0137] This application also provides a lithium battery state-of-charge estimation system based on Bi-GRU and attention mechanism, the system may include:
[0138] The data acquisition module is used to acquire the voltage, current, and battery temperature of the lithium battery under test over multiple time periods.
[0139] The model building module is used to construct a BiGRU-Attention model based on the Bi-GRU network and attention mechanism.
[0140] The model training module is used to train the BiGRU-Attention model and determine the model's hyperparameters based on the whale optimization algorithm.
[0141] The validation module is used to validate the trained BiGRU-Attention model using root mean square error and maximum absolute error to obtain the state of charge estimation model.
[0142] The output module is used to input voltage, current, and battery temperature into the state of charge estimation model to obtain the estimated state of charge of the lithium battery at the current moment.
[0143] The lithium battery state-of-charge estimation system based on Bi-GRU and attention mechanism in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a GPU BOX, mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the scope of the system.
[0144] The lithium battery state-of-charge estimation system based on Bi-GRU and attention mechanism in this application embodiment can be a device with an operating system. This operating system can be Android, Linux, Windows, or other possible operating systems; this application embodiment does not specifically limit it.
[0145] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0146] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0147] The above provides a detailed description of the lithium battery state-of-charge estimation method and system based on Bi-GRU and attention mechanism provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and its core ideas. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A lithium battery state of charge estimation method based on Bi-GRU and attention mechanism, characterized in that, The method comprises: acquiring voltages, currents and battery temperatures of a lithium battery to be measured in multiple time periods; constructing a BiGRU-Attention model based on a Bi-GRU network and an attention mechanism; training the BiGRU-Attention model and determining hyperparameters of the model based on a whale optimization algorithm; verifying the trained BiGRU-Attention model by using root mean square error and maximum absolute error to obtain a state of charge estimation model; inputting the voltages, currents and battery temperatures into the state of charge estimation model to obtain an estimated value of the state of charge of the lithium battery at the current time.
2. The method of claim 1, wherein, The BiGRU-Attention model is obtained by connecting an attention mechanism after an output layer of a Bi-GRU network.
3. The method of claim 1, wherein, The training of the BiGRU-Attention model and the determination of the hyperparameters of the model based on the whale optimization algorithm comprise: setting a hyperparameter space; initializing parameters of the whale optimization algorithm and a whale population; determining an experimental value of the state of charge of a sample battery; inputting sample voltages, sample currents and sample battery temperatures into the BiGRU-Attention model to output an estimated value of the state of charge at the current time; calculating fitness of each whale individual according to the experimental value of the state of charge and the estimated value of the state of charge output by the BiGRU-Attention model, and taking the whale individual with the highest fitness as a current optimal solution; taking an optimal solution when an iteration number is reached or a preset condition is met as a final optimal solution, and determining the hyperparameters of the BiGRU-Attention model according to the final optimal solution.
4. The method of claim 3, wherein, The calculation formula of the experimental value of the state of charge corresponding to the sample battery is: where SOC t represents the state of charge of the battery at time t, SOC0represents the initial value of the state of charge of the battery, i(t) represents the instantaneous load current, T represents the temperature, represents the maximum discharge capacity.
5. The method of claim 1, wherein, The method further comprises: if a battery temperature of a current battery to be measured is in a low-temperature interval, determining an estimated value of the state of charge at the current time by using segmented estimation; wherein the low-temperature interval is [0℃, 10℃].
6. The method of claim 5, wherein, The determination of the estimated value of the state of charge at the current time by using segmented estimation comprises: dividing a whole discharging process of the lithium battery into a first subinterval and a second subinterval, wherein the first subinterval corresponds to the lithium battery from full charge to half remaining charge, and the second subinterval corresponds to the lithium battery from half remaining charge to the end of discharging; training the BiGRU-Attention model on the first subinterval and the second subinterval respectively to obtain a first subinterval prediction model and a second subinterval prediction model respectively; inputting the current time and voltages, currents and battery temperatures collected in a previous time period into the first subinterval prediction model, and if an estimated value of the state of charge at the current time output by the first subinterval prediction model is less than 0.5, re-predicting the estimated value of the state of charge at the current time by using the second subinterval prediction model; otherwise, outputting the estimated value of the state of charge at the current time.
7. A lithium battery state of charge estimation system based on Bi-GRU and attention mechanism, characterized in that, The system is realized based on the method according to any one of claims 1-6, and the system comprises: a data acquisition module configured to acquire voltages, currents and battery temperatures of a lithium battery to be measured in multiple time periods; a model establishment module configured to construct a BiGRU-Attention model based on a Bi-GRU network and an attention mechanism; The model training module is configured to train the BiGRU-Attention model, and determine hyperparameters of the model based on a whale optimization algorithm; The verification module is configured to verify the trained BiGRU-Attention model by using a root mean square error and a maximum absolute error, and obtain a state of charge estimation model. The output module is configured to input the voltage, the current and the battery temperature into the state of charge estimation model, and obtain an estimated value of the state of charge of the lithium battery at the current time.
8. An electronic device, comprising: A computer program product comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to implement the method of any one of claims 1-6.
9. A readable storage medium, characterized by, A readable storage medium stores a program or instructions, and the program or instructions are executed by a processor to implement the method of any one of claims 1-6.