Work condition lithium battery soh estimation method based on improved cordyceps sinensis modified-vision transformer

CN121232009BActive Publication Date: 2026-10-30HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511237666.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2026-10-30
Estimated Expiration
2045-09-01

AI Technical Summary

Technical Problem

[0007]本发明为解决现有锂电池容量估计中依赖实验数据,实验数据与工况数据存在巨大差异以及缺乏真实SOH标签,导致不能精确地获取工况下的真实电池电池容量的问题,进而提出基于改进冬虫夏草修正-视觉Transformer的工况锂电池SOH估计方法

Benefits of technology

1.本发明使用冬虫夏草修正电池容量模型,提高了锂电池SOC的估计准确度,并在原视觉Transformer模型的基础上创新性地提出了动态分块以及循环编码机制,使该模型在锂电池SOH估计上更适配,预测效果更好。该模型引入了动态分块机制,针对输入数据的自适应维度调整和特征提取进行了优化,从而能够有效处理充电过程中的变长时间序列。通过局部卷积分块捕获电压、电流、温度等数据的局部模式,并结合全局注意力机制与掩码机制(Mask)建模长期依赖关系。模型还结合了一次与老化特征,从而构建了更为丰富的特征表示。此外,本发明进一步引入循环编码(Cycle Encoding)信息,以增强模型对时序依赖性的建模能力。通过冬虫夏草修正的电池容量模型结合改进的视觉Transformer模型可以对工况下的锂电池健康状态起到更好的评估作用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121232009B_ABST
    Figure CN121232009B_ABST
Patent Text Reader

Abstract

The application provides a working condition lithium battery SOH estimation method based on an improved Cordyceps sinensis correction-visual Transformer, belongs to the technical field of battery health state estimation, and aims to solve the problems that in existing lithium battery capacity estimation, experimental data are relied on, there is a huge difference between the experimental data and working condition data, real SOH labels are lacked, and real battery capacity under working conditions cannot be accurately obtained, and the method comprises the following steps: acquiring lithium battery charging cycle and SOC change data and selecting data sampling points; calculating battery capacity estimation results, statistically analyzing the battery capacity estimation results, and obtaining the distribution and statistical characteristics of the capacity estimation values; correcting the battery capacity estimation results after statistical analysis; and establishing an SOH estimation model, taking the corrected lithium battery capacity estimation results and corresponding voltage, current and temperature data as inputs, and outputting the final lithium battery SOH estimation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for estimating the state of health (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-modified visual Transformer, belonging to the field of battery health state estimation technology. Background Technology

[0002] In the lifecycle of lithium batteries, degradation manifests as a gradual decrease in capacity and a gradual increase in internal resistance. These changes directly affect the battery's performance and remaining lifespan. The degradation mechanisms of lithium batteries mainly include cycle aging and time-related aging. Cycle aging is primarily caused by chemical reactions during the charging and discharging process. With each charge-discharge cycle, the active materials inside the battery are gradually consumed, leading to a decrease in battery capacity and an increase in internal resistance. Time-related aging, on the other hand, is the gradual performance degradation that occurs during battery storage due to factors such as ambient temperature and storage time. Even when the battery is not in use, it will age over time.

[0003] Battery State of Health (SOH) is a crucial indicator for assessing the degree of degradation of power batteries. SOH is expressed as the ratio of the battery's current capacity to its initial rated capacity, taking into account multiple parameters such as internal resistance changes and power output capability. Many factors influence the battery degradation process and SOH. Temperature, charge / discharge rate, and depth of discharge all significantly affect the battery's degradation rate. Furthermore, high-rate charge / discharge increases mechanical stress on battery materials, leading to structural damage and further accelerating battery degradation.

[0004] The State of Charge (SOH) curve typically exhibits a trend of initial flatness, accelerated growth in the middle stage, and a sharp decline in the later stage. In the initial stage, battery degradation is relatively slow, capacity remains at a high level, and SOH changes are not significant. However, with prolonged use and increased cycle count, the battery's chemical reactivity weakens, leading to gradual capacity decay and a faster rate of SOH decline. In the later stages of degradation, the battery capacity is significantly lower than its initial state, internal resistance increases sharply, and SOH rapidly approaches a critical value, indicating that the battery is nearing the end of its lifespan. Many combustion accidents have been found to be closely related to battery degradation. Accurately assessing the battery's State of Charge (SOC) and health status and promptly replacing batteries with low lifespans will reduce the likelihood of failures and is crucial for maintaining the overall performance of lithium batteries and ensuring personnel safety.

[0005] Due to the complex internal structure and strong dynamic characteristics of lithium-ion batteries, traditional equivalent circuit methods and other non-data-driven methods have limitations in modeling accuracy and online estimation capabilities, making it difficult to meet the needs of practical applications. With the rapid development of data mining and machine learning technologies, data-driven SOH estimation methods have gradually become a research hotspot. These methods do not require knowledge of the battery's physical mechanisms, relying solely on data features for analysis and prediction, exhibiting greater flexibility and applicability, and are particularly suitable for complex application scenarios.

[0006] While data-driven methods have demonstrated good estimation performance on laboratory data, their direct application to operating condition data still presents significant challenges. On one hand, there are substantial differences between laboratory data and actual operating condition data, and features extracted in the laboratory may become ineffective in operating condition data. On the other hand, operating condition data typically lacks true state of capacity (SOH) labels. Therefore, exploring how to more accurately obtain the actual battery capacity under operating conditions and developing SOH estimation models that can adapt to the characteristics of operating condition data are key research directions for improving the performance of battery management systems. Summary of the Invention

[0007] This invention addresses the problems in existing lithium battery capacity estimation methods, which rely on experimental data, suffer from significant discrepancies between experimental and operating condition data, and lack true State of Health (SOH) labels, thus failing to accurately obtain the actual battery capacity under operating conditions. Therefore, this invention proposes an operating condition lithium battery SOH estimation method based on an improved Cordyceps sinensis-corrected visual Transformer.

[0008] The technical solution adopted by the present invention to solve the above problems is as follows: The present invention includes the following steps: Step 1: Obtain lithium battery charging cycle and SOC change data, select the interval with a change of more than 30% as the candidate interval, and randomly select two data sampling points within the selected interval; Step 2: Construct a basic battery capacity model based on the improved ampere-hour integration method, calculate the battery capacity estimation results for the sampling time range of the extracted sampling points, perform statistical analysis on the battery capacity estimation results, fit the probability density function, and obtain the distribution and statistical characteristics of the capacity estimation values. Step 3: Establish a battery capacity correction model based on the improved Cordyceps sinensis correction algorithm to correct the battery capacity estimation results after statistical analysis; Step 4: Establish an SOH estimation model based on visual Transformer adaptive feature extraction and time-series dependency modeling. The corrected lithium battery capacity estimation result and the corresponding voltage, current and temperature data are used as input. A dynamic block mechanism and attention mask mechanism are introduced to preprocess the input data, perform adaptive block and loop number encoding in sequence to obtain fused features and loop embeddings. The fused features and loop embeddings are mapped to obtain the final lithium battery SOH estimation result.

[0009] The beneficial effects of this invention are: 1. This invention uses Cordyceps sinensis to modify the battery capacity model, improving the estimation accuracy of lithium battery SOC. Based on the original visual Transformer model, it innovatively proposes dynamic block division and cyclic encoding mechanisms, making the model more suitable for lithium battery SOH estimation and achieving better prediction results. The model introduces a dynamic block division mechanism, optimizing adaptive dimensionality adjustment and feature extraction for input data, thus effectively handling variable time series during charging. Local convolution blocks capture local patterns of data such as voltage, current, and temperature, and combine global attention and masking mechanisms to model long-term dependencies. The model also incorporates primary and aging features, constructing a richer feature representation. Furthermore, this invention introduces cyclic encoding information to enhance the model's ability to model temporal dependencies. The Cordyceps sinensis-modified battery capacity model combined with the improved visual Transformer model can better assess the health status of lithium batteries under operating conditions.

[0010] 2. This invention uses an improved Cordyceps sinensis-visual Transformer model to accurately estimate the SOH of lithium batteries. The estimated result has an error of 1.078% compared with the true value, and the obtained lithium battery SOH prediction result can track the change trend of battery SOH under operating conditions well. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating the SOH estimation method for lithium-ion batteries under operating conditions based on the improved Cordyceps sinensis correction-visual Transformer. Figure 2 This is a schematic diagram showing the true value calculation results of the capacity of lithium battery 1. Figure 2 In the diagram, (a) is a schematic diagram of the true value calculation results of the 1 ampere-hour integration method for the capacity of a lithium battery, and (b) is a schematic diagram of the true value calculation results of the 1 ampere-hour integration method for the capacity of a lithium battery using the Monte Carlo method. Figure 3 This is a schematic diagram showing the calculated true value of the capacity of lithium battery 2. Figure 3In the diagram, (c) is a schematic diagram of the true value calculation results of the capacity of lithium battery using the 2 ampere-hour integration method, and (d) is a schematic diagram of the true value calculation results of the capacity of lithium battery using the 2 Monte Carlo improved ampere-hour integration method. Figure 4 This is a schematic diagram of a battery capacity establishment and correction scheme based on operating condition data; Figure 5 This is a schematic diagram of the capacity label values ​​based on the improved Cordyceps sinensis correction and polynomial fitting. Figure 5 In the diagram, (a) is a schematic diagram of the capacity label value of lithium battery 1 after the improvement of Cordyceps sinensis correction and polynomial fitting, and (b) is a schematic diagram of the capacity label value of lithium battery 2 after the improvement of Cordyceps sinensis correction and polynomial fitting. Figure 6 Box plot of capacity values ​​for some lithium batteries. Figure 6 In the figure, (a) is a box plot of the capacity values ​​of some lithium batteries calculated based on the improved ampere-hour integration method, and (b) is a box plot of the capacity values ​​of some lithium batteries calculated after Cordyceps sinensis correction and polynomial fitting. Figure 7 A schematic diagram of the improved Cordyceps sinensis modified-visual Transformer model; Figure 8 A flowchart for processing input data; Figure 9 This is a schematic diagram of the dynamic block partitioning mechanism; Figure 10 This is a schematic diagram of the attention masking mechanism; Figure 11 A diagram illustrating the partitioning of the dataset; Figure 12 To train the loss convergence map; Figure 13 This is a diagram illustrating the experimental results of the algorithm. Figure 14 This is a schematic diagram of the experimental results for the Veh10 lithium battery pack. Figure 14 In the figure, (a) is a schematic diagram of the uncertainty test results of the Veh10 lithium battery pack, (b) is a histogram of the standard deviation distribution of the uncertainty test results of the Veh10 lithium battery pack, (c) is a schematic diagram of the uncertainty test results of the Veh27 lithium battery pack, and (d) is a histogram of the standard deviation distribution of the uncertainty test results of the Veh27 lithium battery pack. Detailed Implementation

[0012] Combination Figure 1-14 This implementation method is described as follows: Figure 1 As shown, the steps of the operating condition lithium battery SOH estimation method based on the improved Cordyceps sinensis correction-visual Transformer described in this embodiment include: S1: Acquire lithium battery charging cycle and SOC change data and select data sampling points; This embodiment selects the capacity method as the definition of battery SOH. The capacity method refers to the ratio of the capacity released by discharging the battery from a fully charged state to the cutoff voltage under standard discharge conditions to its corresponding nominal capacity. This is also the most widely used and common definition method. As shown in formula (1): (1); In formula (1), This refers to the capacity released by a lithium battery when it is discharged from a fully charged state at a certain rate to the cutoff voltage. This refers to the standard capacity of a lithium battery.

[0013] Analysis of the operating condition data revealed a lack of complete charging data, specifically, the absence of true State of Charge (SOH) values, in the data collected under typical operating conditions. However, true SOH values ​​are necessary to supervise model training when establishing an SOH estimation model. The operating condition dataset used in this implementation method has a long time span, covering approximately one year of charging data, demonstrating the battery aging trend. Therefore, this implementation method focuses on mining long-term capacity variation trends to establish a capacity model, providing support for subsequent SOH estimation.

[0014] SOC refers to the state of charge of a battery, usually expressed as the amount of charge stored in the battery. With battery capacity The ratio is expressed as: (2); In formula (2), and All units are ampere-hours (Ah).

[0015] When the battery cell is fully charged, SOC=1; when the battery cell is fully discharged, SOC=0. During the charging / discharging process, over time... and Between, the stored charge from It becomes: (3); In formula (3), A positive value during discharge indicates that the current flows out of the battery.

[0016] and Change to The method is the same, SOC also starts from Change to Through time and The capacity of the battery cell can be calculated using formulas (2) and (3). The specific derivation process is shown below: Differentiating SOC with respect to time t, we obtain formula (4): (4); In formula (4), the amount of charge The derivative with respect to time is the current. Formula (5) can be obtained: (5); Through time and Integrating, we get formula (6): (6); Since the actual measurement data is discretized, the above formula can be discretized to obtain formula (7): (7); S2: Calculate the battery capacity estimation results based on the data sampling points, and perform statistical analysis on the battery capacity estimation results to obtain the distribution and statistical characteristics of the capacity estimation values; To eliminate the impact of uncertainties such as measurement errors and current fluctuations on the calculation results of the ampere-hour integration method, this implementation method employs Monte Carlo simulation to improve the battery capacity value obtained by the ampere-hour integration method. Through multiple simulations and statistical analyses, a more reliable and robust capacity estimation result can be obtained, thereby effectively eliminating the negative impact of uncertainties on the calculation results of the ampere-hour integration method. In battery capacity estimation, Monte Carlo simulation is implemented through the following steps: (1) Determine the simulation objects and random sampling rules Using battery charging cycles and SOC changes as the simulation objects, the selected sampling rule is: select intervals where the SOC change exceeds 30% as candidate intervals, and randomly select two data sampling points within these intervals. The sampling rule ensures the diversity and representativeness of the simulation.

[0017] (2) Perform simulation calculations For each sampled time range, apply equation (4-7) to calculate the battery capacity. Repeat this step 1000 times to obtain a sufficient sample of capacity estimates.

[0018] (3) Results Analysis Statistical analysis is performed on the capacity estimates obtained from the simulation calculations to fit the probability density function, thereby obtaining the distribution and statistical characteristics of the capacity estimates.

[0019] The probability density function will be kernel density estimation (KDE), a non-parametric method for estimating the probability density function of a random variable. It constructs a smooth density estimate by placing a kernel function at each data point. Compared to other probability density estimation functions, it does not require assumptions about the data distribution. In contrast, parametric methods require prior assumptions about the data distribution, while KDE relies only on the data itself, making it more flexible and better suited to the characteristics of the work condition dataset used in this implementation. Furthermore, KDE can effectively capture the local structure of the data, revealing detailed features in the data distribution and better reconstructing the true shape of the data distribution.

[0020] Assumption From some unknown distribution The independent and identically distributed samples are drawn from the sample. The estimation expression for KDE is: (8); In formula (8), It is at point Density estimate at [location] It's the sample size. It is the bandwidth (smoothing parameter), used to control the width of the kernel function. This is the kernel function; in this implementation, the Gaussian kernel function is selected, and its expression is as follows: (9); Since the peak value usually represents the most likely capacity value and has a high degree of confidence, the capacity value corresponding to the peak value is selected as the true capacity value of the charging cycle based on the probability density function curve.

[0021] This implementation uses data from four batteries (B0005, B0006, B0007, and B0018) in the NASA publicly available battery dataset for validation. The evaluation metrics selected for this implementation are Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE). The MAE is the average of the absolute values ​​of the differences between all predicted and actual values. The RMSE is the square root of the average of the sum of squares of all predicted and actual values. The error comparison results of the capacity estimation results from the NASA battery dataset are shown in Table 1.

[0022] The formula for calculating the Mean Absolute Error (MAE) is shown in the following equation: (10); The formula for calculating the mean squared error (MSE) is shown in the following equation: (11); The formula for calculating the root mean square error (RMSE) is shown in the following equation: (12); In formula (10)-(12), Represents the actual capacity value. This represents the capacity value calculated using the ampere-hour integration method.

[0023] Table 1

[0024] The results show that the method used in this embodiment has a good fitting effect and a relatively balanced performance. The errors of the four batteries are similar, and the initial capacity value of the battery at the beginning of each charging cycle can be recovered from the SOC, current and time information of the battery dataset.

[0025] The above method was validated on a working condition dataset. The results obtained for the single ampere-hour integral method and the capacity calculation method proposed in this embodiment are as follows: Figure 2 and Figure 3 As shown, the battery capacity should gradually decrease with increasing number of charging cycles. Figure 2 and Figure 3 As can be seen from the comparison, the method proposed in this embodiment can well reflect this feature. Figure 2 (a) and Figure 3 (c) shows the battery capacity calculated using a single ampere-hour integration method. It can be observed that although the overall battery capacity gradually decreases, there are significant fluctuations in capacity values ​​within similar charging cycles. These fluctuations can introduce uncertainty and misleading information into the judgment of the capacity degradation pattern. In contrast, from... Figure 2 (b) and Figure 3 As can be clearly seen in (d), the capacity value gradually decreases with the increase of charging cycles, with smaller fluctuations and a smoother curve, which better reflects the capacity decay trend during actual battery use. This method more accurately reflects the aging trend of battery capacity, helps to more accurately predict battery life and performance changes, and better meet the needs under operating conditions.

[0026] S3: Establish a battery capacity correction model based on the improved Cordyceps sinensis correction algorithm to correct the battery capacity estimation results after statistical analysis; Using the battery capacity model based on the improved ampere-hour integration method derived from S2, battery capacity can be estimated from the operating condition dataset. However, due to the lack of labeled information in the operating condition data, the directly obtained capacity value is difficult to verify, thus requiring appropriate correction methods. Considering that the nominal capacity of the battery used in this embodiment is known, and that the battery's usage time at the time of manufacture is zero and its capacity is the nominal value, the relationship between usage time and capacity can be used to correct the model's estimation results, thereby improving calculation accuracy.

[0027] Therefore, this implementation proposes an improved polynomial fitting method based on the Cordyceps sinensis correction algorithm, which corrects the capacity value by utilizing the correlation between usage time and capacity data. This method can more accurately characterize the battery capacity decay trend, thus providing a more reliable reference for SOH calculation. The scheme for establishing and correcting a complete battery capacity model based on the operating condition dataset is as follows: Figure 4 As shown.

[0028] S301: The objective function selected for capacity value correction and factory nominal value calibration is: (13); In formula (13), It is the objective function. It is the sample size. This is the fitted value of the battery capacity. This is the actual battery capacity. It is a fitted value of the nominal battery capacity. It is the nominal capacity value.

[0029] S302: During the exploration phase, Cordyceps sinensis will be sorted in descending order based on their current fitness level. Subsequently, each Cordyceps sinensis will randomly select one of two exploration mechanisms, with both mechanisms having an equal probability of being selected.

[0030] 1) Wave Advancement Operator When the wave-like forward operator is selected, the search process for Cordyceps sinensis will exhibit a wave-like progression, as shown in formula (14): (14); In formula (14), Indicates the search phase i The location of each cordyceps; For the number of variables, This indicates the location of the Cordyceps with the lowest fitness value. and They represent the first i - 1 and i The location of each cordyceps; alpha The design is as shown in formula (15): (15); In formula (15), Dim represents the number of variables; Search coefficient alpha This represents the random search step size for each cordyceps towards a higher quality position. Furthermore, by introducing a random search step size, cordyceps can explore new regions within the search space and discover better solutions globally. Therefore, cordyceps can efficiently explore the search space using its detection capabilities, thereby increasing the probability of finding the optimal solution.

[0031] 2) Spiral Ascent Operator In the spiral ascent operator stage beta The search step size of Cordyceps in the spiral ascent operator stage can be further calculated using formula (17): (17); In formula (17), This represents a random number that is uniformly distributed between [0,1]. It is a random integer equal to 1 or 2. Parameter It is a random selection based on the population. This represents the search radius for cordyceps, used for local searches around it to explore better solutions. When When the value equals 2, cordyceps will be searched meticulously within a small area. Furthermore, when... Gradually approaching As time progresses, this parameter will gradually approach 1. This gradual adjustment ensures that if the search gets stuck in a local optimum, increasing the parameter will prevent the search from getting stuck in a local optimum. It can enhance the algorithm's ability to escape local optima in the later stages of iteration.

[0032] During the parasitic phase, Cordyceps sinensis exhibits a strategy choice between optimal parasitism and reparasitism. Mathematical modeling of this selective parasitism behavior enhances the convergence of the CFO towards higher parasitism success rates. This approach integrates the reparasitism behavior characteristics of global search with the optimal parasitism behavior of local search. This dual strategy significantly improves the search efficiency of the proposed CFO, enabling more comprehensive exploration and utilization within the search space.

[0033] S303: Reparasitic Stage: In reparasitism, Cordyceps continues to maintain a parasitic relationship with the same larva. However, the larva will be reparasitized by Cordyceps with a higher fitness value to improve the reliability of parasitism, which can be expressed as formula (18): (18); In formula (18), Indicates the first i The parasitic stage of Cordyceps sinensis; It is a random scalar obtained from the standard normal distribution. The parameter is a random number, with a high probability of being close to zero, and is uniquely generated and assigned to each cordyceps. Therefore, the parameter... In most cases, the displacement of cordyceps is small. Conversely, when Taking a larger value results in a larger displacement, thus pushing the cordyceps into new exploration areas in the search space. Furthermore, a larger parameter... This helps avoid getting trapped in local optima.

[0034] S304: Optimal parasitic stage; Unlike reparasitism, optimal parasitism usually occurs when Cordyceps sinensis encounters a parasitized larva. Therefore, during the optimal parasitism stage, Cordyceps sinensis tends to seek the most favorable growth conditions, as defined in formulas (19) and (20): (19); (20); In formulas (19) and (20), It is a random number uniformly distributed in the range [0,1]. This indicates that the search step size for Cordyceps at the beginning of the iteration is greater than the search step size at the end of the iteration. Furthermore, as the number of iterations approaches its maximum value, the parameter... The value gradually approaches zero. This gradual adjustment, controlled by the search step size parameter, allows the search to transition from large-scale exploration to small-scale utilization as the number of iterations increases. Through this adaptive strategy, the proposed CFO can continuously optimize its search trajectory and converge to the global optimum.

[0035] To address the low exploration efficiency of the Cordyceps sinensis algorithm, a Lévy flight strategy is introduced to enhance its exploration capabilities, thereby accelerating the exploration of unknown regions. By incorporating the randomness of the Lévy distribution into the algorithm, Cordyceps sinensis can make more frequent and significant jumps during the exploration phase, thus avoiding over-concentration in localized areas. This strategy provides the algorithm with a wider search range, helping it escape local optima and converge to the global optimum more quickly, thereby improving the algorithm's efficiency and exploration performance. (twenty one); (twenty two); (twenty three); In formulas (21)-(23), , and For random numbers that conform to a normal distribution, This represents the current iteration number. This represents the total number of iterations. It is an adjustable random disturbance factor. For Lévy's flight stride, This is the random walk strategy after introducing the Lévy flight strategy. This is the update strategy for the standard Cordyceps sinensis algorithm during the exploration phase; Meanwhile, the optimal parasitism strategy of the Cordyceps sinensis algorithm suffers from the drawback of completely random parameters during the parasitism process, leading to unstable convergence speed and making the population prone to slow convergence or even non-convergence. To address this issue, we consider optimizing the distribution of the parasitism strategy parameters.

[0036] By using the original formula (20) The original uniformly distributed random numbers are intentionally adjusted, that is, equation (20) is replaced with equation (24). The original parameter distribution is replaced with a beta distribution instead of a completely uniform random distribution, causing the optimization magnitude to decrease as the number of iterations increases. lamda Parameter settings and number of iterations i Establishing connections between them makes their convergence behavior controllable and improves the algorithm's global optimization capability: (twenty four); To evaluate the fit results, a coefficient of determination (R-squared) is added to the evaluation metrics. R 2 The calculation formula is shown in the following equation: (25); In formula (25), It is the average of the actual battery capacity.

[0037] like Figure 5 As shown, the battery capacity shows a gradual decreasing trend with the increase of charging cycles, which is consistent with the aging phenomenon of batteries in actual use. Figure 5 The table shows a comparison of all data points before and after fitting for two sets of batteries. Light-colored points represent capacity values ​​obtained from Monte Carlo simulations, while dark-colored points represent capacity correction values ​​obtained using the improved Cordyceps sinensis correction algorithm and polynomial fitting. It can be seen that the dark curve is smooth and captures the overall trend of the actual data well, indicating that the model fits all data points excellently. Overall, the corrected model demonstrates high accuracy and consistency in predicting battery capacity degradation trends and can effectively reflect the battery aging process. Furthermore, Table 2 shows that the RMSE, MAE, and MSE errors are all relatively small, and... R 2The values ​​are all close to 1, and the average relative error on the initial capacity value is 1.06%, indicating that the polynomial model obtained by parameter fitting through the improved Cordyceps sinensis correction algorithm can fit the battery capacity value well.

[0038] Table 2

[0039] At the same time, from Figure 6 As shown in the box plot, after correction, the overall distribution of lithium battery capacity data tends to be more concentrated, and outliers are significantly reduced, indicating improved data stability. Compared to the data before correction, the capacity range after correction is smaller, the median distribution of each group of lithium batteries is more uniform, and the dispersion is reduced. This demonstrates that the correction method effectively reduces data volatility, improves the consistency and reliability of measurement data, and makes the capacity estimation results more consistent with actual operating conditions, providing more accurate data support for subsequent battery state analysis.

[0040] S4: Establish an SOH estimation model based on visual Transformer adaptive feature extraction and time-series dependency modeling. Take the corrected lithium battery capacity estimation results and the corresponding voltage, current and temperature data as input, and output the final lithium battery SOH estimation results.

[0041] The SOH estimation model based on adaptive feature extraction and time-series dependency modeling using visual Transformer proposed in this embodiment is as follows: Figure 7 As shown, based on this, the model introduces a dynamic block-segmentation mechanism, optimizing adaptive dimensionality adjustment and feature extraction for the input data, thereby effectively handling variable time series during the charging process. Local convolution blocks capture local patterns in data such as voltage, current, and temperature, and a global attention mechanism combined with a masking mechanism is used to model long-term dependencies. The model also incorporates primary and aging features to construct a richer feature representation. Furthermore, this invention further introduces cycle encoding information to enhance the model's ability to model temporal dependencies.

[0042] S401: Input data processing; In real-world data, the length of data segments varies depending on the battery type and the cycling stage. Although the network designed in this invention is compatible with variable-length data segments, the data within the same batch still needs to maintain a consistent length during training. To address this issue, this invention pads the data from different batches to align it to the length of the longest data segment in that batch, and introduces a masking mechanism to distinguish between valid data and padding data, such as... Figure 8As shown. In subsequent attention network processing, this mask information will be used to adjust the attention distribution to ensure that the model can reasonably distinguish between real data and padding during computation, thereby improving training stability and the model's generalization ability.

[0043] The mechanism introduced by this invention for accurately estimating the state of harmonics (SOH) of lithium batteries is described below: S402: Dynamic block partitioning; Traditional ViT architectures are primarily used in 2D image scenarios. They divide fixed-size images into fixed-size patches and then linearly project them into a one-dimensional token sequence for Transformer processing. While this partitioning method performs well in image-related tasks, in this scenario, the input data is variable-length, and directly using a fixed-block strategy may not fully capture local temporal dependencies, thus affecting the modeling results.

[0044] To address this problem, this invention proposes an improved method based on a dynamic block-based mechanism, such as... Figure 4-7 As shown. This mechanism replaces the fixed partitioning operation in traditional ViT with one-dimensional convolution (Conv1D), enabling the model to adaptively perform feature segmentation and extraction based on the specific structure of the input sequence, thereby better handling variable-length data sequences. Specifically, let the original input data... ,in Indicates batch size, For sequence length, This represents the number of feature channels. To adapt to the input format of a one-dimensional convolution module, the data dimension must first be replaced with... ,Right now (26); Subsequently, one-dimensional convolution operations are applied for dynamic block segmentation and feature mapping, in the following form: (27); In formula (27), The dimension of the embedded feature space accepted by the Transformer model. Indicates the block size, and the convolution stride is set to... Implement non-overlapping sliding window extraction. This operation can effectively extract sliding windows of length [length missing]. The sequence is divided into Each local block is convolved and mapped to... The embedding space is then defined. Finally, the dimensions of the convolution result are replaced with... The input format is consistent with that required by the standard Transformer: (28); In summary, the dynamic block segmentation mechanism effectively solves the problem that fixed patch partitioning cannot adapt to variable time series, and can preserve key temporal features while compressing information.

[0045] (29); S403: Attention Masking Mechanism In the model structure proposed in this embodiment, the length of the input data may be variable or contain invalid padding. To ensure that the model only processes valid data, a masking mechanism is introduced to ignore invalid information during attention calculation, preventing interference with the model's learning.

[0046] In attention calculation, the scaled dot-product attention mechanism is also used, and the core calculation formula is as follows: (30); In formula (30), These are respectively: Query, Key, and Value. The number of heads for multi-head attention. For sequence length, The dimension size of a single head. It is the attention weight matrix. It is a scaling factor used to keep the gradient stable, and Softmax normalizes the weights to control the contribution at different time steps.

[0047] When processing sequences containing invalid padding, it is necessary to ensure that attention calculations are not affected by the padding data. Therefore, a binary mask matrix is ​​introduced. .in, This indicates that position j is valid data; This indicates that position j is padding data and should be ignored.

[0048] When calculating attention, a mask matrix is ​​used. Masking is performed to accommodate variable-length sequences and ensure that invalid data does not affect global feature extraction. The masking operation is as follows: (31); (32); After the above processing, the attention weights at the filling positions will be close to zero during Softmax calculation, thus ensuring that they will not affect subsequent calculations. Figure 10 As shown.

[0049] S404: Loop Count Encoding During actual long-term operation, the state changes of a battery are not only affected by its instantaneous operating conditions (such as temperature, current, and voltage), but also closely related to the number of charge-discharge cycles it has undergone. Therefore, it is necessary to introduce structured information on a time scale during modeling to help the model understand the battery's lifecycle evolution trend. To this end, the model further introduces a mechanism for processing time-series cyclic features, proposing a cycle count encoding mechanism. Specifically, the model includes a cycle encoding network, which first indexes the current cycle count... Mapping to a continuous embedding space using a learnable cycle embedding: It is then fused with the features output by the preceding module to enhance the model's ability to handle temporal dependencies.

[0050] This encoding mechanism is essentially similar to positional encoding in Transformers, but it expresses battery lifecycle information and has stronger structural semantics. By encoding the number of cycles, the model can explicitly model cyclic patterns and time-series features in the data, thereby more effectively capturing long-term dependencies and improving the ability to model time information.

[0051] After introducing the above mechanism, the complete workflow of the SOH estimation model based on visual Transformer adaptive feature extraction and time-series dependency modeling in this embodiment includes: Input data Include Each sample contains 10 samples. Each data point contains [number] data entries. Features. Input mask. Identify valid and invalid data in the original input data.

[0052] After dynamic block-based one-dimensional convolution, the input time series data is... Convert to To adapt to the Transformer structure, an additional CLS Token is introduced to extract global features, with the following shape: (33); Meanwhile, input data After the aging feature extraction process described above, the corresponding cyclic aging features can be obtained. This feature is achieved through a linear transformation layer. Perform a dimension mapping to transform it into the same dimension as the CLSToken. Ultimately, the mapped features... Add the CLS Token to form a joint feature representation: (34); In formula (34), These are the features after mapping.

[0053] This operation effectively fuses cyclic aging features with CLS token information, providing a richer and more comprehensive global feature representation, further supplementing and enhancing the CLS token representing global semantics. Subsequently, the fused CLS token is concatenated with the patch sequence: (35); (36); After dynamic segmentation, the mask also needs to be calculated using 1D pooling. This way, if a patch contains at least one valid piece of data, the entire patch is considered valid. (37); In formula (37), For 1D pooling computation; Additionally, since an extra CLS Token was also added, it is also necessary to... The extension indicates that the CLS Token is always valid.

[0054] (38); final, This masking mechanism ensures that the Transformer ignores invalid data when calculating attention.

[0055] Simultaneously, to provide sequence information, learnable positional encoding is used to preserve the spatial information of the sequence, and the positional encoding is dynamically adjusted according to the length of the input sequence, thereby better capturing positional information and offering greater flexibility compared to traditional sinusoidal encoding. Its definition is shown in the following equation: (39); (40); The core of the model is the Transformer module, composed of multi-layer self-attention mechanisms and feedforward neural networks, used to process input data in parallel and capture local and global dependencies. Each layer contains multi-head self-attention and feedforward networks.

[0056] In multi-head attention computation, the Query, Key, and Value are calculated first: (41); (42); In formulas (41)-(42), Q For query, K As key, V For value, The input data is after being learned positionally encoded. for Q The weight matrix of the values, for K The weight matrix of the values, for V The weight matrix of the values; Then calculate the attention score: (43); In formula (43), , representing the dimension of each attention head. For the mask matrix, This is a scaling factor used to maintain gradient stability. The dimension of a single head is denoted by Softmax(), which is the normalization function.

[0057] Then, through a linear transformation: (44); In formula (44), It is a linear transformation matrix; Then through the feedforward network: (45); In formula (45), and This is the weight matrix. and For bias, For activation functions; Finally, the output of each Transformer layer: (46); (47); In formulas (46) and (47), For layer normalization function; After processing by the Transformer module, we can obtain global features represented by CLS Tokens and local features represented by the average features of local patches, respectively.

[0058] (48); Unlike the standard ViT which only uses CLS tokens for classification, this model designs a global-local feature fusion mechanism. The model combines the global representation of the CLS token obtained through the self-attention mechanism with the local features from the input sequence by fusing global and local features. After passing through a fully connected layer, the fused features are obtained.

[0059] (49); In formula (49), The weight matrix of the fully connected layer, This is the bias vector.

[0060] Next, we need to construct a cyclic embedding of the input sample data, which is done using embedding layer encoding. (50); In formula (50), Indicates the number of iterations for the sample.

[0061] Combining fused features with recurrent embeddings allows the model to consider both data characteristics and recurrent characteristics when making predictions.

[0062] (51); Finally, it is mapped to SOH through a fully connected layer: (52); In formula (52), This is a nonlinear function expression for fitting the fully connected layer.

[0063] After completing the SOH estimation of the lithium battery described above, this embodiment trains the established model as follows: All algorithms were implemented on the server using a 12th Gen Intel® Core™ i7-12700F and an NVIDIA GeForce RTX 3050.

[0064] The dataset is divided into a training dataset and a test dataset, as detailed below. Figure 11 As shown in Table 3, the specific hyperparameter design is as follows: Table 3

[0065] During training over 50 episodes, the average convergence curve of the proposed method on 5 random seeds is as follows: Figure 12 As shown.

[0066] To more comprehensively evaluate the performance of the proposed SOH estimation method for lithium batteries under operating conditions, comparative experiments, uncertainty experiments, and robustness experiments were designed and conducted to fully analyze the overall performance of the algorithm.

[0067] (1) Comparative experiment To demonstrate the importance of dynamic block partitioning, attention masking, and loop count encoding, the standard ViT model was used for performance comparison. Furthermore, to prove the superiority of the proposed model on the working condition dataset, comparative experiments were conducted using SOH estimation algorithms based on improved antlion optimization and XGBoost (IALO-XGBoost), improved particle swarm optimization and BP neural network (IPSO-BP), and improved gray wolf optimization and long short-term memory neural network (IGWO-LSTM).

[0068] In the test dataset, the experiments will be conducted on a battery pack basis, and the results are shown in Table 4 and... Figure 13 As shown.

[0069] Table 4

[0070] The experimental results show that the model proposed in this invention outperforms other algorithms in terms of experimental accuracy for each battery group, with errors all below 1.078%. Regarding the fitting effect, from... R 2 and Figure 4-9 As can be seen, the battery SOH prediction results obtained by the model proposed in this invention can track the changing trend of battery SOH under operating conditions well, demonstrating the adaptability and accuracy of this model in the battery degradation process. R 2 All values ​​are above 0.8763. This indicates that the proposed model can effectively capture the variation pattern of battery SOH and has strong predictive ability. The model proposed in this embodiment shows significant advantages in capturing nonlinear time-series dependencies, and the experimental results fully verify its effectiveness. By introducing a global attention mechanism and a masking mechanism, the model can dynamically adjust the attention weights during training, thereby more reasonably focusing on key information. In terms of feature extraction, the model integrates primary features and aging features, enabling it to learn richer and more discriminative feature representations. In addition, the cycle number encoding mechanism introduced by the model helps to characterize the degradation characteristics of the battery over time, further enhancing the modeling ability of time-series dependencies. Compared with traditional time-series models, the model of this invention is more efficient and refined in identifying nonlinear changes in the battery degradation process, demonstrating stronger modeling ability and predictive performance.

[0071] Experimental results for the standard ViT algorithm show that its model error is significantly greater than that of the method proposed in this embodiment. Observing the trend, the standard ViT algorithm fails to effectively learn the decreasing SOH (Sort of OH) with increasing iteration count. This further validates the importance of dynamic block partitioning, attention masking, and iteration count encoding.

[0072] In contrast, while the IGWO-LSTM algorithm can capture the downward trend, this trend is not significant, and the overall error remains relatively large. Although this model employs a variable-length data processing method, it fails to effectively learn the key features in the data.

[0073] Experimental results of the IALO-XGBoost algorithm show that although it learns the trend of SOH changes well, the overall variance fluctuates significantly. This algorithm utilizes only aging feature information, which reduces the influence of a large number of primary features, but its accuracy is relatively poor.

[0074] The PSO-BP algorithm performs poorly in this task, primarily because it cannot effectively handle variable-length input data. Using global maximum length zero-padding dilutes the effective features of the input data, making it difficult for the model to learn the long-term battery degradation process, resulting in poor fitting. Furthermore, the model's low complexity prevents it from fully learning effective features when processing operating condition data.

[0075] (2) Uncertainty experiment To quantify the uncertainty of model estimation, the MC Dropout method is introduced. This method enables Dropout during inference, performs 50 forward propagations on the same data point to obtain multiple estimation results, and calculates the mean (as the final estimate) and standard deviation (as a measure of uncertainty).

[0076] Under the MC Dropout method, the model's estimate can be represented by a 99.7% confidence interval consisting of the mean ± 3σ (standard deviation). Figure 14 (a) and (c) show the estimation results of some experimental battery packs. It can be seen that the confidence interval is relatively narrow, indicating that the model has a high degree of confidence in the estimated values. At the same time, the confidence interval gradually widens as the number of cycles increases, which indicates that the uncertainty of the model increases during the battery aging process. This may be due to the increased volatility of the data in the later stage and the complexity of the aging mechanism, which makes the estimation more difficult.

[0077] To further analyze the uncertainty of the model, a histogram of the standard deviation was plotted, as shown below. Figure 14 As shown in (b) and (d), the uncertainty values ​​are mainly concentrated in the low range, indicating that the model's estimation results have good stability.

[0078] Furthermore, this invention calculated the proportion of true values ​​falling within the 99.7% confidence interval and the mean uncertainty, the results of which are shown in the table below: Table 5

[0079] Experimental results show that, across the eight test battery groups, the average uncertainty of most batteries remained at a low level, and, except for two groups, the proportion of their true values ​​falling within the 99.7% confidence interval was relatively high. This indicates that the model's estimation performance is quite satisfactory for most battery packs. In particular, for four test battery groups, the proportion of true values ​​falling within the confidence interval exceeded 90%, indicating that the model can make relatively accurate estimates of the lithium battery data characteristics under these operating conditions. However, the confidence interval coverage of the two battery groups was relatively low, at 75.54% and 62.03%, respectively. This low coverage may be related to the specific characteristics of these battery pack data, such as the presence of significant noise in the data, or a large difference in distribution between the data and the training data, thus increasing the model's uncertainty.

[0080] (3) Robustness test Although data quality assessment and data denoising have been introduced above, complex situations such as high noise levels, sensor malfunctions, or missing data may still occur in real-world scenarios and cannot be handled. Therefore, to verify the robustness of the model, this implementation method manually introduces different levels of noise and missing data, observes the model's performance under these conditions, and thus more comprehensively evaluates its robustness. The experimental results are shown in Table 6.

[0081] Table 6

[0082] Experimental results show that the model's estimation accuracy gradually decreases with increasing noise levels, but it still remains within a relatively ideal range. Even after adding 15% noise, its RMSE remains at 0.838%, indicating that the model still possesses strong robustness under a certain degree of noise interference. However, the model's estimation performance declines more significantly when the proportion of missing data increases. This suggests that, compared to the impact of noise, a large amount of missing data has a greater destructive effect on the model's learning ability and generalization performance, potentially leading to insufficient feature information and affecting the model's ability to recognize and reason about complex patterns.

[0083] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent substitutions, and improvements made to the above embodiments without departing from the scope of the present invention, based on the technical essence of the present invention and within the spirit and principles of the present invention, shall still fall within the protection scope of the present invention.

Claims

1. A method for estimating the state of harm (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-corrected visual Transformer, characterized in that: include: Step 1: Obtain lithium battery charging cycle and SOC change data, select the interval with a change of more than 30% as the candidate interval, and randomly select two data sampling points within the selected interval; Step 2: Construct a basic battery capacity model based on the improved ampere-hour integration method, calculate the battery capacity estimation results for the sampling time range of the extracted sampling points, perform statistical analysis on the battery capacity estimation results, fit the probability density function, and obtain the distribution and statistical characteristics of the capacity estimation values. Step 3: Establish a battery capacity correction model based on the improved Cordyceps sinensis correction algorithm to correct the battery capacity estimation results after statistical analysis; The improvements to the battery capacity correction model in the Cordyceps sinensis correction algorithm specifically include: A Lévy flight strategy is introduced to perform a global search of the objective function; For optimal parasitic behavior, the search step size of Cordyceps at the beginning of the iteration is greater than the search step size at the end of the iteration. To optimize, the original completely uniform random distribution is replaced with a beta distribution; Step 4: Establish an SOH estimation model based on visual Transformer adaptive feature extraction and time-series dependency modeling. The corrected lithium battery capacity estimation result and the corresponding voltage, current and temperature data are used as input. A dynamic block mechanism and attention mask mechanism are introduced to preprocess the input data, perform adaptive block and loop number encoding in sequence to obtain fused features and loop embeddings. The fused features and loop embeddings are mapped to obtain the final lithium battery SOH estimation result.

2. The method for estimating the state of harmonics (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-visual Transformer as described in claim 1, characterized in that, Step 2 involves calculating the battery capacity estimation result for the sampling time range of the extracted sampling points, specifically including: Set the sampling time for the two selected sampling points to be and Calculate the sampling time during charging / discharging. Sampling time Changes in stored charge within; Based on the amount of charge already stored in the battery With battery capacity Calculate the state of charge (SOC) of the lithium battery by differentiating the SOC with respect to time t, and at a sampling time of t. and Integrating the integral and discretizing the resulting formula yields the battery capacity estimation result. ; Sampling time Time The expression for the change in stored charge within is: (1); In formula (1), Sampling time Stored charge, Sampling time Stored charge; This represents the current, which is positive during discharge, indicating that the current flows out of the battery. For sampling and The difference in stored charge; The formula for calculating the State of Charge (SOC) of a lithium battery is as follows: (2); In formula (2), The amount of charge stored in the battery, measured in ampere-hours. Battery capacity, measured in ampere-hours; The expression for the differential of SOC with respect to time t is: (3); In formula (3), For current, ; At the sampling time and The expression for integration over is: (4); In formula (4), Sampling time The battery charge / discharge status, Sampling time The battery's charge and discharge status; To define the integral symbol; Battery capacity estimation results The calculation symbols are: (5); In formula (5), Sampling time With sampling time difference, It represents electric current.

3. The method for estimating the state of harmonics (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-corrected visual Transformer as described in claim 1, characterized in that, Step 2 involves statistical analysis of the battery capacity estimation results, specifically including: Let n be the number of battery capacity estimation results, and calculate the density estimate of the corresponding sampling points based on the bandwidth h. Based on the density estimates of all obtained sampling points A probability density function curve is established, and the capacity value corresponding to the peak value of the curve is taken as the true capacity value of the charging cycle. The mean absolute error, mean square error, and root mean square error are used as evaluation indicators to calculate the error between the true capacity value and the battery capacity estimation result. If any of the evaluation indicators, mean absolute error, mean square error, and root mean square error, does not meet the preset threshold, the battery capacity estimation result is calculated and statistical analysis is performed until the error of all evaluation indicators meets the preset threshold. Density estimate of sampling points The calculation formula is: (6); In formula (6), For sampling points Density estimate at [location] For sample size, Bandwidth, used to control the width of the kernel function; The kernel function has the following expression: (7)。 4. The method for estimating the state of harmonics (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-corrected visual Transformer as described in claim 1, characterized in that, Step 3 involves correcting the battery capacity estimation results after statistical analysis, specifically including: Step 3.1: Construct an objective function based on the fitted value of the lithium battery capacity, the actual capacity value, the fitted value of the nominal capacity value, and the nominal capacity value. ; Step 3.2: In the exploration phase, each screened battery capacity estimation result is taken as a single Cordyceps sinensis. The fitness of each Cordyceps sinensis is calculated and sorted in descending order according to fitness. The Cordyceps sinensis sorted in descending order are selected by either the wave forward operator or the spiral upward operator. The wave forward operator and the spiral upward operator have the same probability of being selected. Step 3.3: After the global search is completed, the parasitism stage begins. If a single Cordyceps sinensis plant maintains a parasitic relationship with the same larva, it will undergo reparasitism. If a single Cordyceps sinensis plant encounters a parasitized larva, it will undergo optimal parasitism. The objective function is evaluated based on the optimized reparasitism and optimal parasitism behaviors. Perform a local search and output the corrected lithium battery capacity estimation results; Step 3.4: Calculate the coefficient of determination based on the corrected lithium battery capacity estimation results and the actual lithium battery capacity value. R 2 If the coefficient of determination R 2 If the value exceeds the preset threshold, repeat steps 3.2-3.3 to perform the global and local searches again until the coefficient of determination is reached. R 2 Not greater than the preset threshold; objective function The expression is: (8); In formula (8), Let be the objective function. For the sample size, This is the fitted value for battery capacity. This represents the actual battery capacity. This is a fitted value of the nominal battery capacity. This is the nominal capacity value; The expression for reparasitic behavior is: (9); In formula (9), Indicates the first i The parasitic stage of Cordyceps sinensis; It is a random scalar obtained from the standard normal distribution. It is a random number; The expression for Lévy's flight strategy is: (10); (11); (12); In formula (10)-(12), , and For random numbers that conform to a normal distribution, This represents the current iteration number. This represents the total number of iterations. It is an adjustable random disturbance factor. For Lévy's flight stride, This is the random walk strategy after introducing the Lévy flight strategy. This is the update strategy for the standard Cordyceps sinensis algorithm during the exploration phase; The optimized reparasitic behavior is represented as follows: (13); (14); In formulas (13) and (14), A random number uniformly distributed in the range [0,1]. The search step size for Cordyceps at the beginning of the iteration is greater than the search step size at the end of the iteration. For the first i The reparasitic stage of Cordyceps. The search radius for Cordyceps sinensis; Coefficient of determination R 2 The calculation formula is: (15); In formula (15), This represents the average of the actual capacity of the lithium battery.

5. The method for estimating the state of harmonics (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-visual Transformer according to claim 4, characterized in that, When selecting the wave-advancing operator, the search process for Cordyceps sinensis progresses in a wave-like manner, through the fitness of Cordyceps sinensis and the introduction of search coefficients. alpha The first phase of computational search i The location of cordyceps And a random step size is introduced to enable Cordyceps to search for the optimal solution in the global scope; When selecting the spiral ascent operator, parameters are randomly chosen for the population. Based on parameters Search radius of cordyceps and parameters and Calculate the search step size of Cordyceps in the spiral ascent operator stage. beta Based on the search step size of Cordyceps in the spiral ascent operator stage beta The optimal solution for the location of Cordyceps is searched globally, where the parameter... When the value equals 2, the cordyceps will be searched meticulously within a small area. Gradually approaching In this case, increase the global search radius; Search Phase i The location of cordyceps The expression is: (16); In formula (16), Indicates the search phase i The location of each cordyceps; For the number of variables, This indicates the location of the Cordyceps with the lowest fitness value. and They represent the first i - 1 and i The location of each cordyceps; Search coefficient alpha The calculation formula is: (17); In formula (17), Dim represents the number of variables; Search step size of Cordyceps in the spiral ascending operator stage beta The calculation formula is: (18); In formula (18), This represents a random number that is uniformly distributed between [0,1]. It is a random integer equal to 1 or 2, parameter It is randomly selected from the population. This indicates the search radius for cordyceps, used for local searches around it to explore better solutions.

6. The method for estimating the state of harmonics (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-corrected visual Transformer as described in claim 1, characterized in that, Step 4 specifically includes: Step 4.1: Input the corrected lithium battery capacity estimation results and the corresponding voltage, current, and temperature data for different batches. Perform data population, where, B The number of samples. L The number of data entries contained in each sample. C Given the number of features contained in each data point, align the data in the same batch to the length of the longest data segment in that batch, and input a mask. Identify valid data and fill in the missing data to obtain preprocessed time series data. ; Step 4.2: Process the preprocessed time series data Perform dynamic block-based one-dimensional convolution on time series data. Convert to adapt to Transformer structure To obtain key temporal features The CLS Token is introduced to extract global features from time series data. The shape of the CLS Token is... Simultaneously, the preprocessed time series data The aging feature extraction process is performed to obtain the corresponding cyclic aging features. ; Step 4.3: Extracted Cyclic Aging Characteristics Through a linear transformation layer Perform a dimension mapping to convert it to the same dimensions as the CLS Token, and obtain the mapped features. The mapped features The joint feature is obtained by adding it to the global feature extracted from CLSToken. ; Step 4.4: Combine features With preservation of key temporal features By splicing them together, we get Then, 1D pooling is performed on the mask to obtain the result after 1D pooling. ,in, It must include at least one valid data point. To ensure the validity of the CLS Token, an extension is needed. Step 4.5: Process the spliced ​​features Learnable positional encoding is performed, and the encoded data is then input into a Transformer module consisting of a multi-layer self-attention mechanism and a feedforward neural network for parallel processing to obtain fused features. ; Step 4.6: Construct a cyclic embedding of the input data using embedding layer encoding. Embed the loop With fusion features By fusing the components, the final features are obtained. The SOH is then mapped to the fully connected layer to obtain the final SOH estimation result for the lithium battery. ; Joint features The calculation formula is: (19); In formula (19), Features after mapping; The expression for feature concatenation is: (20); 1D pooling calculation The calculation formula is: (21); In formula (21), For 1D pooling computation; The extended expression is: (22); Loop embedding of input data The calculation formula is: (23); In formula (23), Indicates the number of iterations for the sample; Final features The calculation formula is: (24); Final SOH estimation results for lithium batteries The expression is: (25); In formula (25), This is a nonlinear function expression for fitting the fully connected layer.

7. The method for estimating the state of harmonics (SOH) of lithium-ion batteries under operating conditions based on an improved Cordyceps sinensis-visual Transformer according to claim 6, characterized in that, Step 4.5 specifically includes: Step 4.5.1: Process the spliced ​​features Perform learnable positional encoding; Step 4.5.2: After encoding, the input is a Transformer module consisting of a multi-layer self-attention mechanism and a feedforward neural network. Multi-head attention calculation is performed through multi-head self-attention layers, and a weight matrix is ​​introduced. , as well as Calculate the Q value, K value, and V value, where, , To accommodate the number of heads in a multi-head attention mechanism, each layer in the Transformer module includes a multi-head self-attention layer, a fully connected layer, and a feedforward network layer. Step 4.5.3: Calculate the attention score based on the Q-value, K-value, and V-value. And on attention scores Perform a linear transformation to obtain the attention score after the linear transformation. ; Step 4.5.4: Calculate the attention score after linear transformation. Attention scores are obtained by inputting the feedforward network layer. Based on attention score Attention score Obtain the output X of each Transformer layer; Obtain global features represented by CLS Tokens based on the output X of each Transformer layer. Local features represented by local patch average features global features and local features The fused features are obtained through a fully connected layer. ; The expression for the learnable positional encoding is: (26); (27); The formulas for calculating Q, K, and V are as follows: (28); In formula (26), Q For query, K As key, V For value, The input data is after being learned positionally encoded. for Q The weight matrix of the values, for K The weight matrix of the values, for V The weight matrix of the values; Attention Score The calculation formula is: (29); In formula (29), , representing the dimension of each attention head. For the mask matrix, This is a scaling factor used to maintain gradient stability. The dimension of a single head is Softmax(), which is the normalization function. Attention score after linear transformation The calculation formula is: (30); In formula (30), It is a linear transformation matrix; Attention Score The calculation formula is: (31); In formula (31), and This is the weight matrix. and For bias, For activation functions; The formula for calculating the output X of each Transformer layer is: (32); In formula (32), For layer normalization function; Global features The calculation formula is: (33); and local features The calculation formula is: (34); Fusion features The calculation formula is: (35); In formula (35), This is the weight matrix of the fully connected layer. This is the bias vector.

Citation Information

Patent Citations

  • Battery health state prediction method, model training method and device

    CN119828028A

  • Systems and methods for cell-based modeling performance of a battery pack

    WO2025096588A1