Method for generating battery state of charge, computer device and medium

CN122922740APending Publication Date: 2026-10-16SHENZHEN SYD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611127467.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0004]本发明提供一种电池荷电状态的生成方法、计算机设备及介质,以解决目前在低温或高倍率的工况下SOC估算误差大的技术问题

Benefits of technology

[0008] In the aforementioned method for generating the state of charge (SOC) of a battery, the computer equipment, and the storage medium, the current temperature and the original sampled current of the battery can be obtained. Based on a preset temperature threshold and a preset piecewise linear function, temperature compensation is performed on the current temperature to obtain a temperature compensation coefficient. Based on a preset current threshold and the piecewise linear function, current compensation is performed on the original sampled current to obtain a current compensation coefficient. Based on the temperature compensation coefficient and the current compensation coefficient, the original sampled current is corrected to obtain a target current. Based on the target current, the change in battery charge is calculated, and based on the change in charge, the current SOC value of the battery is calculated. In this application, by acquiring real-time operating data and using a preset piecewise linear function to independently compensate for temperature and current, the complex nonlinear electrochemical characteristics are decoupled into a multi-segment linear model. The original current used for integration is directly corrected to the target current. Thus, without relying on high-performance floating-point operations or large lookup tables, the cumulative integration error at low temperatures and high rates is eliminated, achieving high-precision SOC generation with low resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122922740A_ABST
    Figure CN122922740A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of battery management, and discloses a battery state-of-charge generation method, computer equipment and a computer readable storage medium. The method is characterized in that real-time working condition data are acquired, preset segmented linear functions are used to independently compensate temperature and current respectively, complex nonlinear electrochemical characteristics are decoupled into multiple linear models, and original current for integration is directly corrected as target current, so that, without depending on high-power floating point operation or a large lookup table, integral cumulative errors at low temperature and high rate are eliminated, and high-precision SOC generation under low resource consumption is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of battery management technology, and in particular to a method for generating the state of charge of a battery, a computer device, and a computer-readable storage medium. Background Technology

[0002] State of Charge (SOC) is a core parameter of the Battery Management System (BMS), and its estimation accuracy directly affects the operating strategies and user experience of electric vehicles, energy storage systems, and portable devices. Excessive SOC error can lead to a series of problems, such as sudden changes in driving range, increased risks of overcharging and over-discharging, and shortened battery cycle life.

[0003] Current SOC estimation methods are based on coulomb counting, combined with open circuit voltage (OCV) correction. This method can estimate SOC under normal temperature (25℃) and low-rate (≤0.2C) conditions. However, in practical applications, batteries often face extreme conditions such as low temperatures and high-rate discharge. Under these conditions, the SOC estimation error of the traditional coulomb counting method will be drastically amplified. Summary of the Invention

[0004] This invention provides a method, computer equipment, and medium for generating the state of charge (SOC) of a battery, in order to solve the technical problem of large errors in SOC estimation under current operating conditions at low temperatures or high rates.

[0005] Firstly, a method for generating the state of charge of a battery is provided, comprising: Obtain the battery's current temperature and raw sampling current; Based on a preset temperature threshold and a preset piecewise linear function, the current temperature is compensated in a piecewise manner to obtain a temperature compensation coefficient. Based on the preset current threshold and the piecewise linear function, the original sampled current is subjected to current piecewise compensation to obtain the current compensation coefficient. Based on the temperature compensation coefficient and the current compensation coefficient, the original sampled current is corrected to obtain the target current; Based on the target current, the change in the battery's charge is calculated, and based on the change in charge, the current state of charge of the battery is calculated.

[0006] In a second aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.

[0007] Thirdly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described method.

[0008] In the aforementioned method for generating the state of charge (SOC) of a battery, the computer equipment, and the storage medium, the current temperature and the original sampled current of the battery can be obtained. Based on a preset temperature threshold and a preset piecewise linear function, temperature compensation is performed on the current temperature to obtain a temperature compensation coefficient. Based on a preset current threshold and the piecewise linear function, current compensation is performed on the original sampled current to obtain a current compensation coefficient. Based on the temperature compensation coefficient and the current compensation coefficient, the original sampled current is corrected to obtain a target current. Based on the target current, the change in battery charge is calculated, and based on the change in charge, the current SOC value of the battery is calculated. In this application, by acquiring real-time operating data and using a preset piecewise linear function to independently compensate for temperature and current, the complex nonlinear electrochemical characteristics are decoupled into a multi-segment linear model. The original current used for integration is directly corrected to the target current. Thus, without relying on high-performance floating-point operations or large lookup tables, the cumulative integration error at low temperatures and high rates is eliminated, achieving high-precision SOC generation with low resource consumption. Attached Figure Description

[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a flowchart illustrating a method for generating the state of charge of a battery according to an embodiment of the present invention. Figure 2 This is a schematic diagram of a battery state of charge generation system in one embodiment of the present invention; Figure 3 This is another flowchart illustrating the method for generating the state of charge of a battery in one embodiment of the present invention; Figure 4 This is another flowchart illustrating the method for generating the state of charge of a battery in one embodiment of the present invention. Figure 5 This is another flowchart illustrating the method for generating the state of charge of a battery in one embodiment of the present invention. Figure 6 This is another flowchart illustrating the method for generating the state of charge of a battery according to an embodiment of the present invention. Figure 7This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0011] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0012] The battery state of charge (SOC) generation method provided in this embodiment of the invention corrects the original sampled data in real time through a piecewise linear compensation mechanism, so as to achieve high-precision SOC estimation on a low-computing-power platform.

[0013] Please see Figure 1 As shown, the battery state-of-charge generation system 100 executing this method mainly includes a temperature sensor 10, a current sensor 20, an adaptive compensation module 30, a coulomb counting and capacity learning module 40, a storage module 50, and a SOC output interface 60. The adaptive compensation module 30 further includes a temperature compensation unit, a current compensation unit, and a coupling compensation unit; the coulomb counting and capacity learning module 40 includes an integration unit and a capacity learning unit.

[0014] Understandably, although Figure 1 The diagrams show the independent block diagrams of each module. However, in actual engineering implementation, these modules can be integrated into the same microcontroller unit (MCU) and their functions can be achieved through software algorithms or hardware accelerators, as long as the data flow and processing logic are met.

[0015] Please see Figure 2 As shown, Figure 2 A schematic flowchart of a method for generating the state of charge of a battery according to an embodiment of the present invention is shown. The method includes the following steps: Step S100: Obtain the current temperature and raw sampling current of the battery; In this embodiment, the temperature sensor 10 collects the temperature signal of the battery cell surface or interior in real time as the current temperature, and the current sensor 20 (such as a Hall sensor or shunt) synchronously collects the instantaneous current value flowing through the battery terminals as the raw sampling current. It should be noted that the raw sampling current here only represents the rate of physical charge flow in the external circuit. It includes ineffective current components caused by heating due to battery internal resistance, consumption by side reactions, and polarization effects, and cannot be directly equated to the net current participating in the effective electrochemical reaction. Therefore, if coulomb integration is performed directly based on the raw sampling current, significant cumulative errors will inevitably occur under low-temperature or high-rate operating conditions.

[0016] Step S200: Based on a preset temperature threshold and a preset piecewise linear function, perform piecewise temperature compensation on the current temperature to obtain a temperature compensation coefficient. In this embodiment, the temperature compensation unit receives the current temperature and divides the entire temperature range into intervals according to a preset temperature threshold. Within each interval, a piecewise linear function is used. Calculate the temperature compensation coefficient, where This represents the temperature difference between the current temperature and the reference temperature for this range. This is the compensation slope for that temperature range. This is the baseline offset.

[0017] Unlike traditional methods that rely on large two-dimensional look-up tables and interpolation, this embodiment uses piecewise linear functions that require storing only a small number of slope and intercept parameters (e.g., only 4 bytes per group), significantly saving storage space and allowing the algorithm to run on resource-constrained 8-bit or 16-bit MCUs. Furthermore, the function calculation ensures the continuity of the compensation coefficients at the threshold boundaries, avoiding the SOC jump problem caused by excessively large discrete point intervals in the look-up table method. The temperature compensation coefficient is physically defined as a quantified correction factor for the decrease in lithium-ion diffusion coefficient and electrolyte conductivity at low temperatures.

[0018] Specifically, the temperature compensation unit receives the current temperature collected in step S100 and calculates the temperature compensation coefficient according to the following process. First, the current temperature is compared with a preset temperature threshold to determine the temperature range in which the current temperature falls. In this embodiment, the preset temperature threshold is a critical temperature value pre-calibrated and stored in the storage module 50 based on the electrochemical characteristics of the battery material. Its physical meaning is the turning point where the lithium-ion diffusion mechanism inside the battery undergoes a significant change. For example, the preset temperature threshold may include two thresholds: 0°C and 25°C, thereby dividing the entire temperature range into at least a low-temperature range below 0°C, a normal-temperature range from 0°C to 25°C, and a high-temperature range above 25°C. Then, based on the range in which the current temperature falls, the compensation slope and reference offset corresponding to that range are retrieved from the storage module 50 to construct a preset piecewise linear function. The temperature difference between the current temperature and the corresponding reference temperature is calculated, and then this temperature difference is substituted into the piecewise linear function to obtain the temperature compensation coefficient at the current temperature. For example, if the current temperature is -10℃, the system determines that it is in the low-temperature range. Using 0℃ as the reference temperature, the temperature difference is calculated to be 10℃. This difference is then multiplied by the larger compensation slope corresponding to the low-temperature range to obtain the temperature compensation coefficient. The physical meaning of the temperature compensation coefficient is a quantitative correction factor for the decrease in lithium-ion diffusion coefficient and electrolyte conductivity under low-temperature conditions. The larger the value, the further the current temperature deviates from the ideal operating temperature, and the greater the correction required to the original sampling current.

[0019] After obtaining the temperature compensation coefficient, it needs to be limited. Specifically, the calculated temperature compensation coefficient is compared with a preset upper limit value for temperature compensation. If the temperature compensation coefficient exceeds the upper limit value, it is truncated to the upper limit value; if the temperature compensation coefficient is lower than zero, it is truncated to zero. In this embodiment, the upper limit value for temperature compensation can be set to 50%, that is, the effective range of the temperature compensation coefficient is 0 to 50%.

[0020] Understandably, at extremely low temperatures, the calculated results of the piecewise linear function may exceed a reasonable physical correction range. An excessively large compensation coefficient can lead to over-correction of the target current, introducing new estimation biases. By using amplitude limiting constraints, the compensation strength in the low-temperature range is ensured while preventing compensation runaway caused by sensor noise or extreme temperature readings, thus ensuring the robustness of the algorithm.

[0021] Step S300: Based on the preset current threshold and the piecewise linear function, perform current segment compensation on the original sampled current to obtain the current compensation coefficient. In this embodiment, the current compensation unit receives the original sampled current collected in step S100 and calculates the current compensation coefficient according to the following process. First, the absolute value of the original sampled current is compared with a preset current threshold to determine the current rate range. In this embodiment, the preset current threshold is a critical current value pre-calibrated based on the polarization characteristics of the battery at different discharge rates. Its physical meaning is the turning point where the internal polarization effect of the battery changes from linear growth to nonlinear surge. For example, the preset current threshold may include two thresholds: 0.6C and 1.2C, thereby dividing the discharge current range into at least a low rate range below 0.6C, a medium-high rate range from 0.6C to 1.2C, and an ultra-high rate range above 1.2C. When the original sampled current is in the low rate range, the internal polarization effect of the battery is weak, the system does not perform current compensation, and the current compensation coefficient is zero or the default value. Then, according to the range where the original sampled current is located, the compensation slope corresponding to that range is retrieved from the storage module 50 and calculated using the same piecewise linear function architecture as temperature compensation.

[0022] Specifically, the current difference between the original sampling current and the corresponding reference current is calculated, and then multiplied by the corresponding compensation slope to obtain the current compensation coefficient. During high-rate discharge, the ohmic polarization and concentration polarization inside the battery increase non-linearly, causing some charge to be converted into heat instead of being effectively released. The current compensation coefficient characterizes the proportion of usable capacity loss caused by the large current; a larger value indicates a higher discharge rate and more severe polarization loss. For example, if the original sampling current is 1.5C, it is determined to be in the ultra-high rate range. Using 1.2C as the reference current, the current difference is calculated to be 0.3C, which is then multiplied by the larger compensation slope corresponding to the ultra-high rate range to obtain the current compensation coefficient. Similarly, this step also uses function calculation instead of discrete table lookup to ensure a smooth transition of the compensation coefficient during different rate switching processes, preventing SOC estimation jitter caused by sudden coefficient changes.

[0023] After obtaining the temperature compensation coefficient, it needs to be limited. Specifically, the calculated temperature compensation coefficient is compared with a preset upper limit value for temperature compensation. If the temperature compensation coefficient exceeds the upper limit value, it is truncated to the upper limit value; if the temperature compensation coefficient is lower than zero, it is truncated to zero. In this embodiment, the upper limit value for temperature compensation can be set to 50%, that is, the effective range of the temperature compensation coefficient is 0 to 50%.

[0024] Understandably, at extremely low temperatures, the calculated results of the piecewise linear function may exceed a reasonable physical correction range. An excessively large compensation coefficient can lead to over-correction of the target current, introducing new estimation biases. By using amplitude limiting constraints, the compensation strength in the low-temperature range is ensured while preventing compensation runaway caused by sensor noise or extreme temperature readings, thus ensuring the robustness of the algorithm.

[0025] Step S400: Based on the temperature compensation coefficient and the current compensation coefficient, the original sampled current is corrected to obtain the target current; In this embodiment, the adaptive compensation module 30 performs comprehensive calculations on the original sampled current, temperature compensation coefficient, and current compensation coefficient to generate a target current. By replacing the original sampled current with the target current, the ineffective loss components caused by ambient temperature and load rate in the original sampled current are eliminated, thus accurately reflecting the net current value that can be converted into battery chemical energy under the current operating conditions. The specific correction method can be multiplicative correction (i.e., target current = original sampled current × temperature compensation coefficient × current compensation coefficient), additive correction, or other weighted combination forms. By decoupling the complex nonlinear electrochemical characteristics into linear compensation in two dimensions, temperature and current, and then synthesizing the target current, this embodiment achieves accurate modeling of the battery's dynamic characteristics without adding additional sensors.

[0026] Specifically, the adaptive compensation module 30 corrects the original sampled current according to the following process. First, the adaptive compensation module 30 obtains the temperature compensation coefficient calculated in step S200 from the temperature compensation unit and the current compensation coefficient calculated in step S300 from the current compensation unit. Then, the adaptive compensation module 30 performs a weighted operation on these two compensation coefficients and the original sampled current collected in step S100 to generate the target current. In this embodiment, the weighted operation is specifically performed using a multiplication correction, that is, the target current is equal to the original sampled current multiplied by the temperature compensation coefficient and then multiplied by the current compensation coefficient.

[0027] It is understood that in other embodiments, the weighting operation may also adopt an additive correction form, such as converting the temperature compensation coefficient and the current compensation coefficient into corresponding current correction amounts and then adding them to the original sampled current, or adopting other weighting combination forms, which are not limited in this application.

[0028] Before applying the temperature compensation coefficient and current compensation coefficient together to the original sampling current, the total sum of the two is limited. Specifically, the sum of the temperature compensation coefficient and current compensation coefficient is calculated and compared with a preset upper limit for summation compensation. If the summation value exceeds the upper limit, the summation value is truncated to the upper limit and then proportionally allocated back to the temperature compensation coefficient and current compensation coefficient. In this embodiment, the upper limit for summation compensation can be set to 60%.

[0029] Understandably, although the temperature compensation coefficient and current compensation coefficient have been independently limited (50% and 10% respectively), under extreme conditions of simultaneous low temperature and high load rate, their combined value may still reach the 60% boundary value. Without constraint on the total superposition, overcorrection may occur under extreme boundary conditions, causing the target current to deviate from the true electrochemical equivalent value. By employing a strategy of superposition followed by limiting, the overall correction magnitude is constrained while preserving the accuracy of independent compensation in each dimension. The target current is essentially an electrochemical equivalent current used to eliminate the ineffective loss components in the original sampled current caused by ambient temperature and load rate, truly reflecting the net current value that can be converted into battery chemical energy under the current operating conditions. By decoupling the complex nonlinear electrochemical characteristics into linear compensation in two dimensions—temperature and current—and then synthesizing the target current, this embodiment achieves accurate modeling of the battery's dynamic characteristics without adding additional sensors.

[0030] Step S500: Based on the target current, calculate the change in battery charge, and based on the change in battery charge, calculate the current state of charge of the battery.

[0031] In this embodiment, the integrator unit integrates the target current over time to obtain the change in charge, Delta Q. Since the integration object is the double-corrected target current rather than the original sampled current, the calculated change in charge already includes the effects of temperature and rate, eliminating the need for cumbersome capacity correction in subsequent stages. Subsequently, based on the change in charge and the current full charge capacity (FCC), the current state of charge (SOC) is calculated through normalization. This SOC value is sent to the vehicle controller or energy storage management system via the SOC output interface 60 and is simultaneously written to the storage module 50 for power-down protection.

[0032] Specifically, the integrator calculates the current state of charge of the battery according to the following process. First, the integrator integrates the target current output in step S400 over time to obtain the change in charge. The specific integral formula is as follows: ,in For the target current, The sampling period is defined as follows. Since the integration object is the target current after double correction rather than the original sampled current, the calculated change in charge automatically includes the effects of temperature and rate of charge, eliminating the need for cumbersome capacity correction in subsequent stages. The system then accumulates the changes in charge calculated for each sampling period to obtain the cumulative change in charge within the current charge / discharge cycle. During discharge, the cumulative change in charge is subtracted from the remaining charge; during charging, the cumulative change in charge is added to the remaining charge. Subsequently, based on the cumulative change in charge and the current full charge capacity, the current state of charge (SOC) value is calculated through normalization. The specific normalization formula is as follows: ,in This represents the current remaining battery power. The current charge capacity is considered full. The remaining charge can be obtained by adding or subtracting the current cumulative charge change from the charge corresponding to the previously known state of charge value. This current state of charge value is sent to the vehicle controller or energy storage management system via the SOC output interface 60, and is simultaneously written to the storage module 50 for power-off protection. Through the above process, this embodiment establishes a higher-level technical framework of piecewise linear compensation plus target current correction, eliminating the integral divergence problem of the traditional coulomb counting method under extreme conditions from the source, and providing a basic computing platform for more refined compensation strategies in subsequent embodiments.

[0033] Before outputting the current state of charge (SOC) value, boundary limiting processing is performed. Specifically, the calculated current SOC value is compared with preset upper and lower limits. If the current SOC value exceeds the upper limit (e.g., 100%), it is truncated to the upper limit; if the current SOC value is below the lower limit (e.g., 0%), it is truncated to the lower limit.

[0034] Understandably, due to the cumulative nature of integral operations, the calculated State of Charge (SOC) value may slightly exceed the physically reasonable range of 0% to 100% after prolonged operation due to minor integral errors. Boundary limiting ensures that the SOC value output to the external control system remains within the valid range, preventing control strategy anomalies caused by numerical overflow. The current state of charge value after boundary limiting is sent to the vehicle controller or energy storage management system via the SOC output interface 60, and is simultaneously written to the storage module 50 for power-down protection.

[0035] In this embodiment, by acquiring real-time operating data and using preset piecewise linear functions to independently compensate for temperature and current, the complex nonlinear electrochemical characteristics are decoupled into a multi-segment linear model. The original current used for integration is directly corrected to the target current. Thus, without relying on high-performance floating-point operations or large lookup tables, the cumulative error of integration at low temperature and high rate is eliminated, and high-precision SOC generation with low resource consumption is achieved.

[0036] In one implementation, step S200 includes: When the current temperature is less than or equal to a first temperature threshold, a first temperature compensation slope is determined, and a first temperature difference between the current temperature and the first temperature threshold is calculated. Based on the first temperature compensation slope and the first temperature difference, the first temperature compensation amount of the current temperature is calculated and used as the temperature compensation coefficient. When the current temperature is greater than the first preset temperature threshold and less than the second preset temperature threshold, a second temperature compensation slope is determined, and a second temperature difference between the current temperature and the second temperature threshold is calculated. Based on the difference between the second temperature compensation slope and the first temperature, the second temperature compensation amount of the current temperature is calculated and used as the temperature compensation coefficient. Wherein, the first preset temperature threshold is less than the second preset temperature threshold, and the first temperature compensation slope is greater than the second temperature compensation slope.

[0037] In this embodiment, combined with Figure 3The temperature compensation logic flowchart shown above generates the segmented compensation strategy based on the electrochemical reaction kinetics characteristics inside the battery. The first temperature threshold is set to 0℃, and the second temperature threshold is set to 25℃. When the current temperature is between 0℃ and 25℃, the lithium-ion diffusion rate and electrolyte conductivity inside the battery show a slow, approximately linear decreasing trend with temperature change. At this time, a smaller second temperature compensation slope can accurately characterize the capacity loss. However, when the current temperature drops to 0℃ or below, the lithium-ion diffusion coefficient inside the negative electrode SEI film and solid particles decays exponentially according to the Arrhenius equation, causing a nonlinear and sharp drop in the battery's usable capacity and discharge plateau voltage. If the linear compensation slope in the room temperature region is still used, the compensation in the deep low temperature region will be severely insufficient, and the estimated SOC value will be significantly higher than the actual value.

[0038] like Figure 3 As shown, the system first reads the current temperature T collected by the temperature sensor and the basic compensation slope parameter K_base stored in the storage module 50, preparing to enter the temperature range judgment logic. Then, the system determines whether the current temperature T is less than 0℃ (i.e., the first temperature threshold). If the judgment result is yes, the process enters the negative temperature range double compensation branch: calculating the temperature difference between the current temperature and 0℃ |ΔT = 0 - T| (taking the absolute value, representing the degree below zero), and then superimposing a compensation line segment with a halved slope on the original basic compensation slope K_base, i.e., the total compensation slope becomes 1.5 times or 2 times the original, calculated using the following formula: Preliminary compensation values ​​for the negative temperature range were obtained. If the judgment result is negative, the process enters the linear compensation branch at room temperature: the system determines that the current temperature is within the range of 0℃ to 25℃ (i.e., the second temperature threshold), and calculates the effective temperature difference Δ. Then multiply by the base compensation slope K_base, the calculation formula is: Preliminary compensation values ​​for the normal temperature range were obtained. When T equals 25℃, the compensation is zero; when T equals 0℃, the compensation reaches its maximum value and connects with the negative temperature range. Regardless of which branch is taken, the two compensation results converge and enter the limiting processing stage, constraining the compensation value within a preset effective range. Finally, the temperature compensation coefficient after limiting is output and returned to the main process.

[0039] Therefore, in this embodiment, the first temperature compensation slope is greater than the second temperature compensation slope. For example, the first temperature compensation slope can be 1.5 to 2 times the second temperature compensation slope, thereby providing a more aggressive compensation force in the negative temperature range and accurately matching the electrochemical performance degradation curve at low temperatures. In specific calculations, if the current temperature is -10℃, the first temperature difference is 10℃, and the system uses a larger first temperature compensation slope multiplied by this difference to obtain the first temperature compensation amount; if the current temperature is 15℃, the second temperature difference is 10℃ (i.e., 25℃ minus 15℃), and a smaller second temperature compensation slope multiplied by this difference to obtain the second temperature compensation amount. This piecewise linear fitting method with varying slopes achieves effective approximation of the battery's wide-temperature-range nonlinear characteristics with extremely low computational cost.

[0040] By setting different temperature ranges and corresponding compensation slopes, especially making the compensation slope in the low temperature range greater than that in the normal temperature range, this embodiment can accurately match the physical characteristic of the battery's polarization internal resistance increasing exponentially in sub-zero environments. This avoids the problem of insufficient compensation in the deep low temperature range or overcompensation in the normal temperature range by a single slope, and improves the temperature compensation fitting degree in a wide temperature range.

[0041] In another implementation, step S300 includes: When the original sampling current is greater than or equal to the first current threshold, a first current compensation slope is determined, and a first current difference between the original sampling current and the first current threshold is calculated. Based on the first current compensation slope and the first current difference, the first current compensation amount of the original sampled current is calculated as the current compensation coefficient. When the original sampling current is less than the first current threshold and greater than the second current threshold, a second current compensation slope is determined, and a second current difference between the original sampling current and the second current threshold is calculated. Based on the second current compensation slope and the second current difference, the second current compensation amount of the original sampled current is calculated as the current compensation coefficient. Wherein, the first current threshold is greater than the second current threshold, and the first current compensation slope is greater than the second current compensation slope.

[0042] In this embodiment, combined with Figure 4The flowchart shown illustrates the calculation process for the high-rate current compensation coefficient. The current compensation unit performs segmented current compensation according to the following procedure: First, it reads the real-time discharge current I collected by the current sensor, as well as the basic compensation slope parameter K_curr_base and the enhanced slope parameter K_curr_high stored in the storage module, preparing to enter the current range judgment logic. Then, it determines whether the discharge current I exceeds 1.2C (i.e., the first current threshold). If the judgment result is negative, and the discharge current I is greater than 0.6C (i.e., the second current threshold), the process enters the medium-to-high rate linear compensation branch: calculating the excess current. Then multiply by the basic compensation slope K_curr_base, the calculation formula is: The preliminary compensation value of the basic section is obtained. If the judgment result is yes, that is, the discharge current I exceeds 1.2C, the process enters the ultra-high rate enhancement compensation branch: First, calculate the excess current Delta I_{high} = I -1.2C, then use the enhancement slope parameter K_curr_high, which is larger than the base slope, for calculation, while simultaneously adding the full compensation amount of the base segment. The calculation formula is as follows: ,in The full compensation value for the range of 0.6C to 1.2C is used to obtain the preliminary compensation value for the high-ratio segment. If the discharge current I is less than or equal to 0.6C, the compensation process is not initiated, and the current compensation coefficient is zero. Regardless of which branch is taken, the two compensation results are then converged into the aging correction stage, where the aging component SOH_factor calculated based on the battery health state SOH is superimposed (the more severe the aging, the greater the polarization, requiring additional compensation). The merged data then flows through the limiting processing stage, constraining the current compensation coefficient within an effective range of 0 to 10% (such as the upper limit of 10% described in Example 1), and finally outputs the limited current compensation coefficient and returns to the main process. This segmented current compensation mechanism aims to address the differences in polarization effects within different rate ranges.

[0043] This segmented current compensation mechanism addresses the differences in polarization effects across different rate ranges. The second current threshold is set at 0.6C, and the first current threshold is set at 1.2C. When the initial sampling current is in the mid-to-high rate range (0.6C to 1.2C), the polarization within the battery is primarily dominated by electrochemical polarization, exhibiting a relatively gentle logarithmic or linear relationship between overpotential and current density. Therefore, a relatively small second current compensation slope is sufficient for basic correction. However, when the initial sampling current exceeds 1.2C and enters the ultra-high rate range, ohmic polarization becomes the dominant factor, and concentration polarization exhibits a non-linear surge due to limited mass transfer, causing the voltage drop to far exceed the linear proportion of current increase. Extrapolating solely based on the slope of the mid-rate range will fail to cover the additional ineffective energy loss under high current conditions, resulting in a falsely low SOC display and premature device shutdown. Therefore, in this embodiment, the first current compensation slope is set to be greater than the second current compensation slope. For example, in the range exceeding 1.2C, the compensation increment corresponding to each 0.1C increase in current is more than twice that of the 0.6C-1.2C range. For example, when the original sampling current is 1.5C, the 0.3C difference exceeding 1.2C is first calculated as the first current difference, and the enhanced compensation amount for this segment is calculated using the larger first current compensation slope. At the same time, the basic compensation amount of the 0.6C-1.2C range is superimposed, thereby constructing a convex compensation curve that conforms to the polarization characteristics of high-rate discharge.

[0044] It is understandable that the temperature compensation and current compensation mentioned above are independent parallel branches in terms of algorithm logic. After calculating the temperature compensation coefficient and current compensation coefficient separately, they are then applied together to the original sampled current to generate the target current. This decoupling design not only avoids the storage pressure caused by building a complex three-dimensional lookup table, but also allows for parameter calibration according to different aging evolution laws of temperature and current, providing a flexible interface for dynamic adjustment based on SOH in subsequent embodiments. Although this embodiment provides specific threshold examples such as 0℃, 25℃, 0.6C, and 1.2C, in practical applications, these thresholds can be adaptively adjusted according to the characteristics of the battery material system (such as lithium iron phosphate or ternary lithium) and the application scenario (such as power battery or energy storage battery), as long as the monotonic relationship of the slope in the low temperature region being greater than that in the normal temperature region and the slope in the ultra-high rate region being greater than that in the medium-high rate region is maintained.

[0045] In this embodiment, in response to the nonlinear enhancement of polarization effect in high-rate discharge, a dual-threshold segmentation strategy is adopted. A larger compensation slope is used in the high-current range, which effectively solves the problem of artificially low SOC caused by excessive ohmic voltage drop at ultra-high rates. At the same time, the compensation smoothness in the medium and low rate range is guaranteed, and the SOC curve jump is prevented.

[0046] Please see Figure 5 As shown, Figure 5Another schematic flowchart of the method for generating the state of charge of a battery provided in an embodiment of the present invention is shown, wherein the method further includes the following steps: Step S610: Among the various changes in the battery's charge, determine the change in discharge when the battery is in a discharging state, and calculate the cumulative discharge amount based on the various changes in discharge within a preset discharge cycle. Step S620: When the battery meets the capacity learning trigger condition, update the full charge capacity to the cumulative discharge amount to calibrate the full charge capacity. Step S630: Based on the nominal capacity of the battery and the updated full-charge capacity, calculate the capacity decay ratio, and based on the capacity decay ratio, calibrate the temperature compensation slope used to calculate the temperature compensation coefficient, the current compensation slope used to calculate the current compensation coefficient, the temperature compensation coefficient, and the current compensation coefficient.

[0047] In this embodiment, an adaptive parameter calibration mechanism based on battery aging is further constructed to address the issue of accuracy degradation of the fixed compensation coefficient throughout its lifespan. Combined with... Figure 6 The flowchart shown illustrates the coulomb integration and capacity learning process. The integration unit performs coulomb integration and triggers capacity learning within each control cycle according to the following procedure: After the process starts, it first determines whether the battery is currently charging. If yes, the target current is multiplied by the charging efficiency factor and accumulated in the charging counter. When the charging counter reaches the 1mAh threshold, it checks if the remaining capacity has not yet reached the 99.3% upper limit. If yes, the remaining capacity register is incremented by 1, and the process returns to the main flow. If no, meaning the battery is discharging, the target current is inverted and accumulated in the discharging counter. Similarly, for every 1mAh full, the remaining capacity is decremented by 1, and the current learning discharge amount is simultaneously accumulated. After the charging and discharging paths converge, it checks if the battery is completely discharged, i.e., whether the battery terminal voltage is less than or equal to the empty discharge threshold or whether the software empty discharge flag is set. If the battery is completely discharged, it directly returns to the main flow. If the battery is not completely discharged, it further checks whether the current learning discharge amount is greater than 90% of the full charge capacity. If the discharge level is greater than 90%, the discharge is considered a valid deep discharge. The full charge capacity is immediately updated with the cumulative discharge amount, the cycle count is incremented by 1, and the result is written to storage module 50 (non-volatile memory) for aging tracking, providing a data basis for subsequent compensation parameter calibration. If the discharge level is less than 90%, it is further determined whether the remaining charge is below 2.7%. If it is below 2.7%, only the charge level is decremented by 1, without triggering a capacity refresh. All branches eventually converge and return to the main process, ensuring that the integration, learning, and write operations are completed efficiently within a 1ms cycle.

[0048] The above mechanism is executed by the capacity learning unit in the coulomb counting and capacity learning module 40. During battery operation, the change in charge during discharge is continuously recorded and accumulated to obtain the cumulative discharge amount. When the battery is detected to meet specific capacity learning trigger conditions, the discharge process is deemed complete and valid, and the current cumulative discharge amount is assigned to the full charge capacity (FCC), completing an online capacity refresh. Subsequently, the capacity decay ratio (i.e., the complement of SOH or a related characterization quantity) is calculated using the ratio of the updated full charge capacity to the factory nominal capacity. Since battery aging is not only manifested as a reduction in capacity, but also accompanied by an increase in internal resistance and a decline in dynamic performance, the original temperature and current compensation slopes are often insufficient to cover the polarization increment after aging. Therefore, this embodiment establishes a linkage relationship between the capacity decay ratio and the compensation parameters. For example, when the capacity decay ratio increases by 1% (meaning a decrease in battery health), the system adjusts the temperature compensation slope and the current compensation slope by a preset correction step size (e.g., 0.5% to 1%). This reverse adjustment strategy allows the compensation strength to automatically increase as the battery ages, ensuring that even at the end of the battery's life, the target current calculation can still accurately reflect the current electrochemical characteristics, avoiding the divergence of SOC estimation error caused by parameter solidification as the number of cycles increases.

[0049] Through the above methods, this embodiment establishes a dynamic correlation mechanism between compensation parameters and battery state of health (SOH), refreshes the full charge capacity online using actual discharge data, and automatically adjusts the compensation benchmarks for temperature and current according to the degree of capacity decay. This solves the problem of accuracy drift caused by fixed compensation coefficients being unable to adapt to battery aging, and ensures the accuracy of estimation throughout the entire life cycle.

[0050] To ensure the accuracy of capacity learning and prevent mislearning due to fluctuations in operating conditions, this application also strictly limits the triggering conditions. As one implementation, before step S620, the following steps are also included: Obtain the current terminal voltage of the battery and determine whether the current terminal voltage is less than or equal to a preset no-discharge threshold. If the current terminal voltage is less than or equal to a preset no-discharge threshold, the battery is determined to meet the discharge termination condition, and it is determined whether the cumulative discharge amount is greater than a preset capacity threshold, where the preset capacity threshold is a preset percentage of the full charge capacity. If the cumulative discharge exceeds a preset capacity threshold, the battery is determined to meet the capacity learning trigger condition.

[0051] In this embodiment, this dual verification mechanism is executed according to the following process, serving as a key defense to ensure the robustness of online learning. First, the system acquires the current terminal voltage of the battery through a voltage sensor and compares it with a preset discharge threshold. In this embodiment, the preset discharge threshold refers to the critical terminal voltage value corresponding to the battery's discharge cutoff. Its specific value depends on the cell material system; for example, it can be set to 2.5V for lithium iron phosphate cells and 2.8V for ternary lithium cells. If the current terminal voltage is less than or equal to the preset discharge threshold, it indicates that the battery terminal voltage has dropped to the discharge cutoff level. The system determines that the battery meets the discharge termination condition, that is, it confirms from an electrical perspective that the battery has truly entered a discharged state, eliminating the possibility of false judgments due to voltage dips caused by sudden load unloading. Then, after confirming that the discharge termination condition is met, the system further compares the cumulative discharge amount with a preset capacity threshold. The preset capacity threshold is a preset percentage of the full charge capacity. In this embodiment, this preset percentage can be set to 90%, meaning the preset capacity threshold equals the current full charge capacity multiplied by 90%. The physical meaning of the preset capacity threshold in this embodiment is a threshold value for determining whether the current discharge has undergone a sufficiently deep energy release. If the cumulative discharge amount exceeds the preset capacity threshold, it indicates that the discharge process has released nearly the full charge capacity. The system determines that the battery meets the capacity learning trigger conditions and then executes a full charge capacity update. If only voltage is relied upon for judgment, a sudden large current may pull down the voltage at the end of a shallow cycle, falsely triggering learning and causing the full charge capacity to be incorrectly updated to a value far smaller than the true value, resulting in a precipitous drop in the SOC display. Conversely, if only the amount of charge is relied upon for judgment, it may trigger prematurely before the battery is truly discharged, also causing an underestimation of capacity. Only when both the voltage bottoming out and the depth of discharge meet the threshold are met simultaneously does the system confirm that this is a valid and complete discharge cycle and then execute a full charge capacity update. This design effectively eliminates the interference of numerous shallow charge and discharge segments present in daily use on the capacity learning algorithm, ensuring the stability and reliability of the full charge capacity update.

[0052] Through the above method, this embodiment eliminates invalid learning samples generated by shallow charging and discharging or incomplete cycles by dual verification of voltage cutoff and deep discharge ratio. Capacity updates are only triggered after the battery has undergone full discharge, avoiding abnormal fluctuations in full-charge capacity caused by mislearning and improving the robustness of the online learning algorithm.

[0053] In addition to the learning calibration on the discharge side, this embodiment also introduces a missing detection and compensation enhancement mechanism on the charging side to address nonlinear losses during the charging process. As another implementation, the method further includes: When the battery is in the final stage of charging, among the various changes in charge of the battery in the final stage of charging, the change in charge when the battery is in the charging state is determined, wherein the current state of charge value of the battery in the final stage of charging reaches a preset charging threshold. Based on the charging changes in the final charging period, the cumulative charging amount is calculated as the effective charging amount, and the expected charging amount is calculated based on the initial state of charge value and the updated full charge capacity. The initial state of charge value is the state of charge value of the battery before it enters the charging end interval; When the battery has a lack of charging capacity, a capacity loss ratio is calculated based on the expected charging amount and the effective charging amount. Based on the capacity loss ratio, the temperature compensation slope used to calculate the temperature compensation coefficient, the current compensation slope used to calculate the current compensation coefficient, the temperature compensation coefficient, and the current compensation coefficient are enhanced. When the effective charge amount is less than the expected charge amount, it is determined that the battery has a lack of charging capacity.

[0054] In this embodiment, the aforementioned charging-side missing detection and compensation enhancement mechanism is executed according to the following process. First, the system monitors the current state of charge (SOC) value in real time to determine whether the battery has entered the final charging phase. In this embodiment, the final charging phase refers to the charging stage after the current SOC value reaches a preset charging threshold, which can be set to 95%. When the battery enters the final charging phase, the system records the SOC value before entering this phase as the initial SOC value. Then, within the final charging phase, the system filters out the portion of the battery in the charging state from various changes in charge volume, determines it as the charging change, and accumulates each charging change to obtain the cumulative charging amount, which is then taken as the effective charging amount. The effective charging amount in this embodiment refers to the amount of charge actually received and stored by the battery within the final charging phase. Simultaneously, the system calculates the expected charging amount based on the initial SOC value and the updated full-charge capacity. The specific calculation formula is as follows: ,in For the desired charging amount, For the updated full charge capacity, This represents the initial state of charge (SOC). The expected charge amount, in this embodiment, represents the theoretical amount of electricity required to fully charge the battery from its initial state at the end of the charging phase. Next, the system compares the effective charge amount with the expected charge amount. If the effective charge amount is less than the expected charge amount, the system determines that the battery has a capacity deficiency, meaning that some electricity has been consumed in side reactions such as lithium plating or has not been effectively stored due to premature charger shutdown caused by increased polarization voltage. At this time, the system calculates the ratio of the difference between the expected charge amount and the effective charge amount to the expected charge amount, obtaining the capacity deficiency ratio. The specific calculation formula is as follows: ,in This represents the missing volume ratio. The effective charge amount is determined by the capacity loss ratio, which directly reflects the degree of decline in charging efficiency or the severity of side reactions. Finally, the system enhances the compensation parameters based on the capacity loss ratio. For example, if the capacity loss ratio is 5%, the temperature compensation slope and current compensation slope are increased accordingly, while the currently calculated temperature compensation coefficient and current compensation coefficient are simultaneously enhanced. This enhancement essentially expands the correction weight of the integration step size in the next charge-discharge cycle, enabling the algorithm to provide a more conservative SOC value that is closer to the actual usable energy in subsequent estimates, eliminating the long-term accumulated hidden dangers of virtual charge. Through capacity benchmark refresh on the discharge side and efficiency loss compensation on the charging side, this embodiment constructs a two-way closed-loop adaptive calibration system, achieving dynamic maintenance of SOC estimation accuracy throughout the battery's entire lifespan.

[0055] In this embodiment, a charging loss feedback mechanism is introduced to address the capacity loss caused by incomplete charging or lithium plating side reactions at the charging end. When the actual charging capacity is detected to be lower than the theoretical expectation, the subsequent compensation is automatically enhanced to correct the SOC estimation deviation caused by the decrease in charging efficiency or loss of active materials, thus further improving the adaptive closed loop under all operating conditions.

[0056] To address the issue of SOC estimation accuracy under extreme operating conditions, a nonlinear coupling correction mechanism is further introduced. In a specific embodiment, the method further includes: Based on a preset low temperature threshold, a preset high rate threshold, the current temperature of the battery, and the original sampled current, it is determined whether the battery currently meets the preset compensation conditions. When the battery currently meets the compensation conditions, calculate the coupling temperature difference between the low temperature threshold and the current temperature, and calculate the coupling current difference between the high rate threshold and the original sampling current; Based on the preset coupling compensation slope, the coupling temperature difference, and the coupling current difference, a coupling compensation coefficient is calculated, and the target current is corrected a second time based on the coupling compensation coefficient, so as to estimate the state of charge of the battery based on the target current after the second correction.

[0057] In this embodiment, the aforementioned preset compensation condition is a logic gate that triggers secondary correction. It is defined as the simultaneous occurrence of a current temperature lower than a preset low-temperature threshold and an original sampling current greater than a preset high-rate threshold. For example, the preset low-temperature threshold can be set to 0°C or -10°C, and the preset high-rate threshold can be set to 1.0C or 1.2C. The technical consideration for setting this dual trigger condition is that, under normal operating conditions, the independent temperature compensation and current compensation in embodiments 1 to 3 are sufficient to cover the polarization characteristics of the battery. However, when low temperature and high current occur simultaneously, the electrochemical polarization and concentration polarization inside the battery will undergo a nonlinear coupling effect, resulting in an actual usable capacity loss far exceeding the linear superposition value of the two independent compensation values. If only a linear superposition model is relied upon, in extreme scenarios such as discharging at a rate of 1.5C in an environment of -20°C, the SOC estimation error may be as high as 15% or more, which can easily lead to unexpected equipment shutdown or battery over-discharge risk. Therefore, this embodiment uses a coupling compensation unit to specifically perform a fallback correction for this model blind spot.

[0058] After determining that the preset compensation conditions are met, the system first calculates the coupling temperature difference and coupling current difference. The coupling temperature difference is the absolute value of the current temperature minus the preset low-temperature threshold, representing the degree to which the current temperature deviates from the low-temperature reference. The coupling current difference is the difference between the original sampled current and the preset high-rate threshold, representing the extent to which the current load exceeds the high-rate reference. These two differences essentially quantify the depth to which the operating condition has entered the extreme region. Subsequently, the system calculates the coupling compensation coefficient based on the preset coupling compensation slope and the above two differences. As a preferred implementation, the coupling compensation coefficient can be calculated using a product form, i.e. ,in To preset the coupling compensation slope, This is the coupling temperature difference value. The product form represents the difference in coupling current. The physical mechanism behind this approach is that the exponential decay of the lithium-ion diffusion coefficient at low temperatures and the limited mass transfer under high currents create a positive feedback loop, resulting in additional polarization losses that are approximately proportional to the degree of deviation between the two, rather than a simple additive relationship. Of course, in other implementations, weighted summation or higher-order polynomial fitting can also be used, as long as this nonlinear enhancement trend can be characterized.

[0059] After calculating the coupling compensation coefficient, the system applies it to the target current generated in Example 1 for secondary correction. The specific correction formula can be... ,in This is the corrected target current after independent compensation for temperature and current. This is the target current for the final second-order correction used for the Coulomb integral. This step is a recalibration of the aforementioned linear compensation result, equivalent to adding an incremental term deeply related to extreme operating conditions to the original compensation. Through this hierarchical correction strategy of first linear decoupling and then nonlinear coupling, this application ensures both the simplicity of calculation under normal operating conditions and the accuracy of estimation at the extreme boundary. According to measured data, under the extreme operating conditions of -20℃ and 1C discharge, after introducing the coupling second-order correction of this embodiment, the SOC estimation error throughout the entire process is significantly reduced from 18% without correction to 2.7%, effectively eliminating the phenomenon of falsely low SOC caused by abnormal drop in polarization voltage.

[0060] It is understood that although this embodiment uses a discharge scenario as an example, this coupling correction mechanism is also applicable to low-temperature high-rate charging scenarios. During charging, the coupling of low temperature and high current can also lead to serious lithium plating risks and artificially high terminal voltage. In this case, the calculation logic of the coupling compensation coefficient is the same, but its correction direction for the target current may be opposite (e.g., reducing the charging integral step size to prevent overcharging). The specific correction polarity can be dynamically switched according to the charge / discharge status flag. In addition, the preset low-temperature threshold and preset high-rate threshold are not fixed. In practical applications, they can be adaptively adjusted according to the battery material system (e.g., lithium iron phosphate or ternary lithium) and the degree of aging (SOH). For example, as the internal resistance of the battery increases with aging, the trigger threshold can be appropriately increased to avoid frequent intervention. These variations are all within the scope of protection of this application.

[0061] In this embodiment, in response to the extreme and harsh conditions of low temperature and high rate of charge, a coupling correction term is added on the basis of independent compensation. This quantifies the nonlinear surge effect of polarization resistance when low temperature and high current work together, makes up for the fitting defects of the linear superposition model at the extreme boundary, and prevents the divergence of SOC estimation in the extreme cold fast charging and discharging scenario.

[0062] To address the SOC estimation deviation caused by prolonged battery inactivity, a self-discharge correction mechanism is further introduced. In further embodiments, the method also includes: When the battery is in a static state, the static duration during which the absolute value of the original sampled current is less than a preset static current threshold is calculated, wherein the static state is defined as the absolute value of the original sampled current being less than the preset static current threshold and the static duration exceeding a preset static time threshold. Based on the full charge capacity and the current temperature, the battery's current self-discharge rate is queried from a preset self-discharge rate mapping table, and the battery's capacity loss is calculated based on the resting duration and the self-discharge rate, wherein the capacity loss is caused by the battery's self-discharge. The current state of charge value is corrected based on the capacity loss.

[0063] In this embodiment, the determination of the aforementioned idle state employs a dual verification logic of current amplitude and duration, which is the first line of defense to ensure the accuracy of the correction. In practical applications, the battery management system may experience brief current fluctuations such as relay activation, instantaneous load switching, or sensor zero-point drift. If only current amplitude is relied upon for judgment, these transient processes are easily misidentified as an idle state, leading to incorrect self-discharge deduction. Therefore, this embodiment sets that the battery is officially confirmed to have entered an idle state and the accumulation of idle duration only begins when the absolute value of the original sampled current is continuously lower than a preset idle current threshold (e.g., 10mA or 0.005C) and the duration of this state exceeds a preset idle time threshold (e.g., 30 minutes or 1 hour). This hysteresis comparison strategy effectively filters out noise interference during the operating condition switching process, ensuring that self-discharge correction is triggered only in true idle scenarios.

[0064] After confirming the static state, the system needs to determine the current self-discharge rate. Since the battery's self-discharge behavior is influenced by a combination of factors and is not a fixed constant, this embodiment constructs a multi-dimensional preset self-discharge rate mapping table. This mapping table includes at least two query dimensions: temperature and full charge capacity, and preferably also includes the current state of charge (SOH) value. From an electrochemical perspective, increased temperature significantly accelerates side reactions such as electrolyte decomposition and SEI film thickening, leading to an exponential increase in the self-discharge rate. Full charge capacity, as a direct indicator of battery state of health (SOH), often declines with increased internal micro-short circuit risk or separator performance degradation, resulting in a higher self-discharge rate for aged batteries compared to new batteries. By pre-calibrating self-discharge rate data at different temperature points and aging levels and storing it in non-volatile memory, the system can quickly obtain accurate real-time self-discharge rates during runtime through table lookup or linear interpolation. Compared to complex electrochemical model calculations, the table lookup method greatly reduces the computational requirements in sleep or low-power modes, enabling the BMS to perform self-discharge tracking while maintaining extremely low static power consumption.

[0065] After obtaining the self-discharge rate, the system can calculate the capacity loss during the resting period. The specific calculation formula can be expressed as follows: ,in This is the amount of capacity loss. For the current full charge capacity, The self-discharge rate obtained from the query (the unit is usually % / h or Ah / h). This represents the cumulative resting time. This formula transforms the abstract self-discharge effect into a specific energy loss value, providing a quantitative basis for subsequent SOC correction. It should be understood that although a linear integral form is given here, in some high-precision application scenarios, piecewise integration or nonlinear integration considering the change of self-discharge rate with SOC can also be used, as long as the correspondence between resting time and capacity loss can be characterized.

[0066] In this embodiment, based on the self-discharge characteristics of the battery during long-term idle periods, the capacity lost due to self-discharge is dynamically deducted according to the resting time and temperature. This eliminates the "artificially high" phenomenon where the SOC display value is inconsistent with the actual remaining capacity due to long-term idle periods, ensuring the real-time accuracy of the SOC display when the vehicle or equipment is restarted.

[0067] Regarding the timing of the correction, this application supports two optional strategies to adapt to different system architectures. The first is to perform a one-time correction when the battery exits the dormant state (i.e., at the wake-up moment). When the absolute value of the original sampled current is detected to exceed the preset dormant current threshold again, the system immediately calculates the total capacity loss using the accumulated dormant duration, and subtracts the corresponding percentage from the current state of charge value before wake-up to obtain the corrected initial state of charge value, and then resets the dormant duration to zero. The advantage of this method is that it does not require frequent MCU wake-ups during sleep, thus maximizing standby power savings. The second is to perform the correction periodically in the background during the dormant process, for example, waking up once every 24 hours for intermediate settlement, which is suitable for battery systems with extremely high SOC real-time requirements or high self-discharge rates. Regardless of the strategy adopted, this correction path is independent of the charge-discharge integration path in Examples 1 to 4, and is specifically designed to eliminate the phenomenon of artificially high SOC caused by chemical self-discharge.

[0068] Through the above embodiments, the battery state of charge (SOC) generation method provided in this application, by employing a preset piecewise linear function to independently and coupledly compensate for temperature and current, and by using simple integer operations to replace complex floating-point division, two-dimensional lookup table, or iterative filtering algorithms, significantly reduces the computing power requirements and storage footprint of the BMS main control chip, making it possible to achieve millisecond-level real-time high-precision estimation on a low-cost MCU. At the same time, by deeply coupling the compensation coefficient with the online capacity learning module, an adaptive mechanism for dynamically adjusting the compensation parameters according to the battery aging degree is established, overcoming the inherent defect of the traditional fixed parameter algorithm that gradually decreases in accuracy throughout the entire life cycle, ensuring the consistency and reliability of SOC estimation across the entire operating range of the battery, from new to old, from room temperature to extreme cold, and from low rate to ultra-high rate.

[0069] In one embodiment, a computer device is provided, the internal structure of which can be shown as follows: Figure 7As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When executed by the processor, the computer program implements client-side functions or steps of a method for generating the state of charge of a battery.

[0070] In one embodiment, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that, when executed by a processor, performs the following steps: Obtain the battery's current temperature and raw sampling current; Based on a preset temperature threshold and a preset piecewise linear function, the current temperature is compensated in a piecewise manner to obtain a temperature compensation coefficient. Based on the preset current threshold and the piecewise linear function, the original sampled current is subjected to current piecewise compensation to obtain the current compensation coefficient. Based on the temperature compensation coefficient and the current compensation coefficient, the original sampled current is corrected to obtain the target current; Based on the target current, the change in the battery's charge is calculated, and based on the change in charge, the current state of charge of the battery is calculated.

[0071] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0072] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0073] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0074] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.

[0075] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for generating the state of charge of a battery, characterized in that, The method includes: Obtain the battery's current temperature and raw sampling current; Based on a preset temperature threshold and a preset piecewise linear function, the current temperature is compensated in a piecewise manner to obtain a temperature compensation coefficient. Based on the preset current threshold and the piecewise linear function, the original sampled current is subjected to current piecewise compensation to obtain the current compensation coefficient. Based on the temperature compensation coefficient and the current compensation coefficient, the original sampled current is corrected to obtain the target current; Based on the target current, the change in the battery's charge is calculated, and based on the change in charge, the current state of charge of the battery is calculated.

2. The method as described in claim 1, characterized in that, The step of performing piecewise temperature compensation on the current temperature based on a preset temperature threshold and a preset piecewise linear function to obtain temperature compensation coefficients includes: When the current temperature is less than or equal to a first temperature threshold, a first temperature compensation slope is determined, and a first temperature difference between the current temperature and the first temperature threshold is calculated. Based on the first temperature compensation slope and the first temperature difference, the first temperature compensation amount of the current temperature is calculated and used as the temperature compensation coefficient. When the current temperature is greater than the first preset temperature threshold and less than the second preset temperature threshold, a second temperature compensation slope is determined, and a second temperature difference between the current temperature and the second temperature threshold is calculated. Based on the difference between the second temperature compensation slope and the first temperature, the second temperature compensation amount of the current temperature is calculated and used as the temperature compensation coefficient. Wherein, the first preset temperature threshold is less than the second preset temperature threshold, and the first temperature compensation slope is greater than the second temperature compensation slope.

3. The method as described in claim 1, characterized in that, The process of performing piecewise current compensation on the original sampled current based on a preset current threshold and the piecewise linear function to obtain current compensation coefficients includes: When the original sampling current is greater than or equal to the first current threshold, a first current compensation slope is determined, and a first current difference between the original sampling current and the first current threshold is calculated. Based on the first current compensation slope and the first current difference, the first current compensation amount of the original sampled current is calculated as the current compensation coefficient. When the original sampling current is less than the first current threshold and greater than the second current threshold, a second current compensation slope is determined, and a second current difference between the original sampling current and the second current threshold is calculated. Based on the second current compensation slope and the second current difference, the second current compensation amount of the original sampled current is calculated as the current compensation coefficient. Wherein, the first current threshold is greater than the second current threshold, and the first current compensation slope is greater than the second current compensation slope.

4. The method as described in claim 1, characterized in that, The method further includes: Among the various changes in the battery's charge, the change in discharge when the battery is in a discharging state is determined, and the cumulative discharge amount is calculated based on each of the discharge changes within a preset discharge cycle. When the battery meets the capacity learning trigger condition, the full charge capacity is updated to the cumulative discharge amount in order to calibrate the full charge capacity; Based on the nominal capacity of the battery and the updated full-charge capacity, the capacity decay ratio is calculated, and based on the capacity decay ratio, the temperature compensation slope used to calculate the temperature compensation coefficient, the current compensation slope used to calculate the current compensation coefficient, the temperature compensation coefficient, and the current compensation coefficient are calibrated.

5. The method as described in claim 4, characterized in that, Before updating the full charge capacity to the cumulative discharge amount to calibrate the battery's full charge capacity when the battery meets the capacity learning trigger condition, the method further includes: Obtain the current terminal voltage of the battery and determine whether the current terminal voltage is less than or equal to a preset no-discharge threshold. If the current terminal voltage is less than or equal to a preset no-discharge threshold, the battery is determined to meet the discharge termination condition, and it is determined whether the cumulative discharge amount is greater than a preset capacity threshold, where the preset capacity threshold is a preset percentage of the full charge capacity. If the cumulative discharge exceeds a preset capacity threshold, the battery is determined to meet the capacity learning trigger condition.

6. The method as described in claim 4, characterized in that, The method further includes: When the battery is in the final stage of charging, among the various changes in charge of the battery in the final stage of charging, the change in charge when the battery is in the charging state is determined, wherein the current state of charge value of the battery in the final stage of charging reaches a preset charging threshold. Based on the charging changes in the final charging period, the cumulative charging amount is calculated as the effective charging amount, and the expected charging amount is calculated based on the initial state of charge value and the updated full charge capacity. The initial state of charge value is the state of charge value of the battery before it enters the charging end interval; When the battery has a lack of charging capacity, a capacity loss ratio is calculated based on the expected charging amount and the effective charging amount. Based on the capacity loss ratio, the temperature compensation slope used to calculate the temperature compensation coefficient, the current compensation slope used to calculate the current compensation coefficient, the temperature compensation coefficient, and the current compensation coefficient are enhanced. When the effective charge amount is less than the expected charge amount, it is determined that the battery has a lack of charging capacity.

7. The method as described in claim 1, characterized in that, The method further includes: Based on a preset low temperature threshold, a preset high rate threshold, the current temperature of the battery, and the original sampled current, it is determined whether the battery currently meets the preset compensation conditions. When the battery currently meets the compensation conditions, calculate the coupling temperature difference between the low temperature threshold and the current temperature, and calculate the coupling current difference between the high rate threshold and the original sampling current; Based on the preset coupling compensation slope, the coupling temperature difference, and the coupling current difference, a coupling compensation coefficient is calculated, and the target current is corrected a second time based on the coupling compensation coefficient, so as to estimate the state of charge of the battery based on the target current after the second correction.

8. The method as described in claim 1, characterized in that, The method further includes: When the battery is in a static state, the static duration during which the absolute value of the original sampled current is less than a preset static current threshold is calculated, wherein the static state is defined as the absolute value of the original sampled current being less than the preset static current threshold and the static duration exceeding a preset static time threshold. Based on the full charge capacity and the current temperature, the battery's current self-discharge rate is queried from a preset self-discharge rate mapping table, and the battery's capacity loss is calculated based on the resting duration and the self-discharge rate, wherein the capacity loss is caused by the battery's self-discharge. The current state of charge value is corrected based on the capacity loss.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 8.