Battery management system agent autonomous decision-making method and system based on large language model
By using a battery management system agent based on a large language model, the BMS system achieves autonomous decision-making, dynamically selects the optimal SOC estimation algorithm, adaptively adjusts parameters, and fuses results from multiple algorithms, thereby improving the accuracy of SOC estimation and adaptability to operating conditions, and lowering the barrier to entry for use.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 王哲
- Filing Date
- 2026-04-27
- Publication Date
- 2026-07-24
AI Technical Summary
In existing BMS systems, the SOC estimation algorithm remains fixed and cannot be dynamically selected based on actual working conditions. Parameters cannot be adaptively adjusted, results from multiple algorithms are not integrated and optimized, and the user experience is poor.
A battery management system agent based on a large language model is adopted. Through data acquisition in the perception layer, operating condition identification and algorithm scheduling in the cognition layer, decision-making in the decision layer, and natural language interaction in the interaction layer, the system achieves weighted fusion of multiple algorithms and adaptive parameter adjustment.
Significantly improves SOC estimation accuracy, enhances adaptability to operating conditions, lowers the barrier to entry, and improves system robustness.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention belongs to the field of battery management technology, specifically relating to an autonomous decision-making method and system for a battery management system (BMS) agent based on a large language model. Background Technology
[0002] The Battery Management System (BMS) is a core component of new energy vehicles and energy storage systems, responsible for battery state monitoring, safety protection, and performance optimization. State of Charge (SOC) estimation is one of the core functions of the BMS, and its accuracy directly affects battery safety and lifespan.
[0003] Currently, mainstream SOC estimation methods include the ampere-hour integration method, the extended Kalman filter (EKF) method, and the LSTM neural network method. The ampere-hour integration method is simple in principle but suffers from accumulated errors; the EKF method has low computational cost and good real-time performance, but is sensitive to parameters; the LSTM method has high accuracy and strong adaptability, but requires significant computational resources. The performance of each algorithm varies significantly under different operating conditions: for example, in urban environments with frequent current fluctuations, LSTM can better learn complex patterns; in high-speed environments with relatively stable current, the real-time advantage of EKF is more prominent.
[0004] However, existing BMS systems have the following technical shortcomings: First, the algorithm is fixed. Traditional BMS uses a fixed SOC estimation algorithm, which cannot dynamically select the optimal algorithm according to the actual working conditions, resulting in unsatisfactory estimation accuracy under certain working conditions.
[0005] Second, the parameters cannot be adaptive. Taking the EKF algorithm as an example, its process noise parameter Q and measurement noise parameter R have a significant impact on the estimation accuracy. The optimal parameters are different under different operating conditions and battery aging levels, but the existing system uses fixed parameters and cannot be adjusted online.
[0006] Third, there is a lack of intelligent interaction. Users can only view digital battery status information through the dashboard and cannot use natural language to inquire about the battery status or issue management commands, resulting in a poor interactive experience and a high barrier to entry.
[0007] Fourth, the algorithm results were not integrated. Multiple SOC estimation algorithms ran independently, and the results were not integrated and optimized, failing to fully utilize the complementary advantages of multiple algorithms to improve the overall estimation accuracy. Summary of the Invention
[0008] The present invention aims to solve the problems existing in the prior art and provide a method and system for autonomous decision-making of a battery management system agent based on a large language model.
[0009] The technical problems to be solved by this invention include: (1) how to enable BMS to automatically identify operating conditions and dynamically select the optimal SOC estimation algorithm; (2) how to achieve online adaptive adjustment of SOC estimation algorithm parameters; (3) how to integrate the results of multiple SOC estimation algorithms to improve overall accuracy; and (4) how to achieve natural language intelligent interaction between BMS and users.
[0010] To address the aforementioned technical problems, this invention provides an autonomous decision-making method for a battery management system agent based on a large language model, comprising the following steps: Step 1, real-time acquisition of battery voltage, current, and temperature data through a perception layer, and calculation of SOC values using multiple SOC estimation algorithms; Step 2, extraction of current features based on a sliding window through a cognitive layer to identify the current operating condition type; Step 3, automatic scheduling of the optimal SOC estimation algorithm according to the operating condition type, while simultaneously executing at least one backup SOC estimation algorithm; Step 4, weighted fusion of the outputs of the optimal and backup SOC estimation algorithms to obtain a fused SOC value; Step 5, adaptive adjustment of the parameters of the SOC estimation algorithm based on the EKF news sequence; Step 6, conversion of battery state data into natural language descriptions through an interaction layer, and natural language interaction with the user.
[0011] The beneficial effects of the present invention include: (1) significantly improved SOC estimation accuracy. Through the multi-algorithm weighted fusion mechanism, the SOC estimation error is reduced by 15% to 30% compared with a single algorithm. The weighted fusion dynamically adjusts the weights according to the historical errors of each algorithm, and abnormal algorithms are automatically downweighted to ensure the reliability of the fusion result.
[0012] (2) Significantly enhanced adaptability to operating conditions. Through sliding window feature extraction and rule + KNN classifier, the system can automatically identify four operating condition types: urban operating condition, high-speed operating condition, charging operating condition, and stationary operating condition, and automatically switch to the optimal SOC estimation algorithm under the corresponding operating condition. The 30-second anti-shake mechanism avoids frequent switching caused by misjudgment of operating conditions.
[0013] (3) Parameter adaptive capability. Based on the Sage-Husa adaptive EKF method, the Q and R parameters are adjusted online. Combined with the loading of preset parameters based on operating conditions and parameter boundary constraints, it can adapt to battery aging without manual calibration and maintain long-term estimation accuracy.
[0014] (4) Human-computer interaction innovation. For the first time, a large language model is integrated into the BMS system to realize natural language query and control. Users can use everyday language to inquire about battery status and issue management commands. The system has the ability to recognize intent, perform security checks and context management, which greatly reduces the threshold for using BMS.
[0015] (5) The system is highly robust. The mechanism of parallel operation of multiple algorithms, automatic anomaly detection, and automatic switching to backup algorithms ensures that the system can still work normally when a single algorithm fails. Attached Figure Description Figure 1 This is a diagram of the overall system architecture of the present invention; Figure 2 This is a diagram of the layered architecture of the system of the present invention; Figure 3 This is a flowchart of the working condition identification process of the present invention; Figure 4 This is a flowchart of the algorithm scheduling and fusion process of the present invention; Figure 5 Flowchart of the adaptive parameter conditions of this invention; Figure 6 Figure 7 is a flowchart of the interaction process of the large language model of the present invention; Figure 8 is a schematic diagram of the system operation interface of the embodiment of the present invention.
[0016] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0017] like Figure 1 and Figure 2 As shown, this invention provides an autonomous decision-making system for a battery management system based on a large language model, which adopts a four-layer architecture: perception layer, cognition layer, decision-making layer and interaction layer.
[0018] The sensing layer is responsible for collecting battery data in real time, including voltage (V), current (I), and temperature (T), at a frequency of 1 Hz. The sensing layer calculates the SOC and SOH values using underlying algorithms (ampere-hour integration method, EKF, LSTM).
[0019] The cognitive layer is the core innovative layer of this invention, comprising four functional modules: Operating condition identification module: such as... Figure 3 As shown, a 60-second sliding window is used to collect the current data sequence I(t), and five feature vectors are extracted: mean mu=mean(I), standard deviation sigma=std(I), zero-crossing rate zcr=count(I(t)*I(t-1)<0) / N, maximum value I_max=max(I), and minimum value I_min=min(I). Then, rule-based pre-classification is used to determine candidate operating conditions, which are then confirmed by a KNN classifier, outputting the operating condition type and confidence score. A 30-second anti-jitter mechanism is set, requiring the same operating condition to be maintained for more than 30 seconds before confirming a switch, avoiding frequent erroneous switches.
[0020] Algorithm scheduling module: Maintains an algorithm registry, with each algorithm registering name, description, and suitable_conditions attributes. Automatically matches the optimal algorithm based on the operating condition identification results: LSTM algorithm is selected for urban conditions (excels at handling complex current patterns), EKF algorithm for high-speed conditions (low computational cost, good real-time performance), ampere-hour integration method + OCV correction for charging conditions, and OCV lookup table method for stationary conditions. Manual overriding by the user is supported. Tracks the estimation error of each algorithm and automatically switches to a backup algorithm when the error of the current algorithm suddenly increases.
[0021] Algorithm fusion module: such as Figure 4 As shown, the outputs of multiple SOC estimation algorithms are fused. A weighted average fusion method is used, with weights calculated based on the reciprocal of the historical estimation errors of each algorithm: w_i = 1 / E_i, where E_i is the mean absolute error of the i-th algorithm. The fusion formula is SOC_fused = sum(w_i * SOC_i) / sum(w_i). An anomaly detection mechanism is implemented, automatically reducing the weight of an algorithm when its output deviates from that of other algorithms by more than 5%. Adaptive fusion is also supported: weighted average is used when the operating conditions are stable, and Kalman filter fusion is used when the operating conditions change (using the outputs of each algorithm as observations of the Kalman filter) to improve robustness during operating condition transitions.
[0022] Adaptive parameter adjustment module: such as Figure 5 As shown, online parameter adjustment is based on the Sage-Husa adaptive EKF method. The innovation sequence e(k) = V_measured(k) - V_predicted(k) and its variance Var(e) are calculated. When Var(e) is greater than a high threshold, R is increased (reducing confidence in the measurement); when Var(e) is less than a low threshold, R is decreased (increasing confidence in the measurement). Similarly, Q is adjusted. The parameter boundary constraints are Q_min = 1e-10, Q_max = 1e-4, R_min = 1e-6, and R_max = 1e-2. Simultaneously, preset parameters are loaded according to the operating condition type: Q is larger for urban conditions (adapting to rapid changes), Q is smaller for high-speed conditions (for stable operating conditions), and R is smaller for charging conditions (for more accurate voltage measurement).
[0023] The decision-making layer generates battery management decisions based on the output of the cognitive layer, including algorithm switching decisions, parameter adjustment decisions, and anomaly alarm decisions.
[0024] The interaction layer integrates the large language model interface, such as Figure 6As shown. It supports preset question template matching (battery status query, SOC query, range estimation, health assessment, working condition query, algorithm query), natural language command parsing (supports fuzzy expressions such as "switch to EKF" and "increase precision"), intent recognition (keyword matching + LLM assistance), security checks (dangerous operations require confirmation, and disallowed operations are directly rejected) and context management (maintains the history of the last 10 rounds of dialogue and supports follow-up questions).
[0025] Example 1: Intelligent algorithm scheduling under urban conditions.
[0026] Scenario: An electric car is driving on a city road, experiencing frequent starts and stops.
[0027] System operation process: The perception layer collects current data at a frequency of 1Hz. The operating condition identification module of the cognition layer extracts current features using a 60-second sliding window, calculating the mean mu = -8.3A, standard deviation sigma = 15.7A, and zero-crossing rate zcr = 0.12. Rule-based pre-classification identifies it as a candidate for urban operating condition (sigma > 10A), and the KNN classifier confirms the output as urban operating condition with a confidence level of 95%. Since the urban operating condition has persisted for more than 30 seconds, the operating condition switch is confirmed.
[0028] The algorithm scheduling module switches the SOC estimation algorithm from EKF to LSTM. Meanwhile, EKF continues to run as a backup algorithm. The outputs of the two algorithms are combined through a weighted fusion module: LSTM with a weight of 0.65 (due to its smaller historical error), and EKF with a weight of 0.35. The combined SOC value is 72.3%, with a fusion error of approximately 1.2%.
[0029] The adaptive parameter adjustment module detects the change in operating conditions and increases the Q parameter of EKF from 1e-6 to 5e-5 (the preset value for urban operating conditions) to adapt to the rapidly changing current mode.
[0030] The user asks "What algorithm are you using now?" through the interaction layer. The system generates a response through the LLM interface: "Currently operating under urban conditions, we are using the LSTM neural network algorithm because urban conditions have large current fluctuations, and LSTM can better learn complex patterns. Meanwhile, the EKF is running as a backup. After fusing the results of both, the SOC error is approximately 1.2%."
[0031] Example 2: Natural Language Control and Security Check.
[0032] Scenario: Users interact with the BMS system via voice or text.
[0033] Dialogue Process: User inputs: "How is the battery status?" The system identifies the intent as a query, matches it against the preset template for "battery status," calls the get_battery_status() interface to retrieve data, and the LLM translates it into natural language to reply: Current battery level 68%, health 92%, temperature 32 degrees Celsius, operating under urban conditions. Estimated remaining range is approximately 170 kilometers.
[0034] The user input "Switch to EKF" was identified as a control intent and the parsed instruction was `switch_algorithm("EKF")`. The security check module confirmed this operation was in the allowed list, executed the algorithm switch, and replied: Switched to EKF algorithm. Reason for switch: Manually specified by the user.
[0035] The user inputs "Turn off battery protection". The system intent is identified as a control operation. The safety check module determines that the operation is dangerous and triggers a secondary confirmation mechanism. The response is: Turning off battery protection may cause safety hazards. Please confirm whether to continue.
[0036] The user inputs: "Why did you use LSTM just now?" The system retrieves the dialogue history through the context management module, identifies the reason for using LSTM, and replies: The system previously identified urban operating conditions, and LSTM has higher accuracy under complex current modes. EKF is more advantageous under high-speed operating conditions because of its lower computational cost and better real-time performance.
[0037] Example 3: Multi-algorithm fusion and anomaly detection.
[0038] Scenario: The battery is driving at high speed, and three SOC estimation algorithms are running simultaneously.
[0039] The EKF output SOC is 75.1%, the LSTM output SOC is 74.8%, and the ampere-hour integral output SOC is 75.3%. The output deviation of the three algorithms is less than 1%, and the SOC after weighted fusion is 75.0%, with the weight allocation as follows: EKF: 0.40, LSTM: 0.35, and ampere-hour integral: 0.25.
[0040] At a certain point, the LSTM model outputs a SOC of 82.5% due to data anomalies, deviating from the EKF and ampere-hour integral by more than 5%. The anomaly detection mechanism automatically reduces the LSTM weights to 0.05, resulting in a fused SOC of 75.2% (primarily determined by the EKF and ampere-hour integral). The system records the LSTM anomaly event and checks whether the LSTM has recovered in the next evaluation cycle (after 100 steps).
[0041] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method and system for autonomous decision-making of a battery management system agent based on a large language model, characterized in that, Includes the following steps: Step 3: Automatically schedule the optimal SOC estimation algorithm according to the operating condition type, and simultaneously execute at least one backup SOC estimation algorithm; Step 4: Weight and fuse the outputs of the optimal SOC estimation algorithm and the backup SOC estimation algorithm to obtain the fused SOC value; Step 5: Adaptively adjust the parameters of the SOC estimation algorithm based on the EKF news sequence; Step 6: Convert the battery status data into natural language description through the interaction layer and interact with the user in natural language.
2. The method according to claim 1, characterized in that, Step 2, which involves extracting current features based on a sliding window, includes: collecting a current data sequence from the most recent 60 seconds; extracting the mean, standard deviation, zero-crossing rate, maximum value, and minimum value of the current data sequence as feature vectors; determining candidate operating conditions through rule-based pre-classification, where: when the absolute value of the mean is less than 0.5A and the standard deviation is less than 0.3A, it is determined as a candidate for a stationary operating condition; when the mean is less than -1A, it is determined as a candidate for a charging operating condition; when the standard deviation is greater than 10A, it is determined as a candidate for a city operating condition; when the standard deviation is less than 5A and the absolute value of the mean is greater than 5A, it is determined as a candidate for a high-speed operating condition; confirming the candidate operating condition type using a KNN classifier and outputting the operating condition type and confidence level; and setting an anti-shake mechanism, requiring the same operating condition type to remain for more than 30 seconds before confirming a switch.
3. The method according to claim 1, characterized in that, In step 3, the automatic scheduling of the optimal SOC estimation algorithm according to the operating condition includes: selecting the LSTM neural network algorithm under urban operating conditions; selecting the extended Kalman filter (EKF) algorithm under high-speed operating conditions; selecting the ampere-hour integration method combined with OCV correction under charging operating conditions; selecting the OCV lookup table method under stationary operating conditions; supporting manual selection of the algorithm by the user; tracking the estimation error of each SOC estimation algorithm, and automatically switching to the backup algorithm when the estimation error of the current algorithm suddenly increases.
4. The method according to claim 1, characterized in that, In step 4, the weighted fusion includes: calculating the reciprocal of the historical estimation error of each SOC estimation algorithm as the weight; calculating the fused SOC value using a weighted average method: SOC_fused = sum(w_i * SOC_i) / sum(w_i), where w_i is the weight of the i-th algorithm and SOC_i is the output of the i-th algorithm; setting an anomaly detection mechanism, automatically reducing the weight of an algorithm when the output of a certain algorithm deviates from the output of other algorithms by more than 5%; and triggering an anomaly alarm when the output deviation of all algorithms exceeds the threshold.
5. The method according to claim 1, characterized in that, In step 4, an adaptive fusion method is also supported: when the operating conditions are stable, a weighted average fusion method is used; when the operating conditions change, a Kalman filter fusion method is used, and the output of each SOC estimation algorithm is used as the observation value of the Kalman filter.
6. The method according to claim 1, characterized in that, In step 5, the adaptive adjustment of parameters based on the EKF innovation sequence includes: calculating the EKF innovation sequence e(k) = V_measured(k) - V_predicted(k); calculating the variance Var(e) of the innovation sequence; using the Sage-Husa adaptive method: when Var(e) is greater than a preset high threshold, increasing the measurement noise parameter R; when Var(e) is less than a preset low threshold, decreasing the measurement noise parameter R; similarly adjusting the process noise parameter Q; applying boundary constraints to parameters Q and R: Q_min=1e-10, Q_max=1e-4, R_min=1e-6, R_max=1e-2; and loading the corresponding preset parameter values according to the current operating condition type.
7. The method according to claim 1, characterized in that, In step 6, the natural language interaction includes: receiving the user's natural language input; performing intent recognition on the input, categorizing it into query, control, and dialogue types; for query input, matching a preset question template, calling the corresponding data interface to obtain battery status data, and converting the numerical data into a natural language description; for control input, parsing the natural language instructions and mapping them to corresponding system operations; for dialogue input, maintaining the dialogue context and calling a large language model to generate a response; performing security checks on control instructions, requiring secondary confirmation for dangerous operations, and directly rejecting disallowed operations; maintaining the history of the last 10 rounds of dialogue and supporting contextual follow-up questions.
8. The method according to claim 7, characterized in that, The preset question templates include: Battery Status Query: Calls the battery status interface and returns SOC, SOH, temperature, and operating condition information; Driving Range Estimation: Estimates the remaining driving range based on the current SOC and historical energy consumption data; Health Assessment: Returns the SOH value and battery health status assessment; Operating Condition Query: Returns the current operating condition identification result and confidence level; Algorithm Query: Returns the name of the currently used SOC estimation algorithm and the reason for its selection.
9. The method according to claim 1, characterized in that, It also includes a periodic algorithm performance evaluation step: evaluate the performance of each SOC estimation algorithm every 100 time steps; compare the estimation errors of each algorithm in the most recent 100 steps; automatically switch to the backup algorithm when the estimation error of the backup algorithm is consistently lower than that of the current algorithm; and record the reason and time of each algorithm switch.
10. An autonomous decision-making system for a battery management system based on a large language model, characterized in that, include: The system comprises the following layers: a perception layer for real-time acquisition of battery voltage, current, and temperature data; a cognition layer including: a condition identification module for extracting current features and identifying condition types based on a sliding window; an algorithm scheduling module for automatically selecting the optimal SOC estimation algorithm based on the condition type; an algorithm fusion module for weighted fusion of the outputs of multiple SOC estimation algorithms; an adaptive parameter adjustment module for online adjustment of algorithm parameters based on the EKF news sequence; a decision layer for generating battery management decisions based on the output of the cognition layer; and an interaction layer including a large language model interface for converting battery status into natural language and interacting with the user.
11. The system according to claim 10, characterized in that, The cognitive layer also includes a performance monitoring module, which tracks the estimation error of each SOC estimation algorithm and triggers algorithm switching when the error of the current algorithm suddenly increases.
12. The system according to claim 10, characterized in that, The interaction layer also includes: an intent recognition module for classifying user input; a security check module for verifying the security of control commands; and a context management module for maintaining dialogue history.