Detection method for battery capacity
By using the structured pruning, quantified perception training and adaptive learning rate algorithm of the multi-task neural network model in battery capacity detection, the accuracy and resource efficiency problems of battery capacity detection under different environmental conditions are solved, achieving efficient and Stable battery state prediction and battery management.
Patent Information
- Application Number
- CN202410760900.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-27
AI Technical Summary
Existing battery capacity detection methods are difficult to adapt to different load and temperature conditions, resulting in a decrease in the accuracy and stability of SOC prediction, and high-precision neural network models have high computational complexity in resource-constrained embedded systems, affecting user experience.
A multi-task neural network model is used to optimize the model structure and parameters through structured pruning, quantification-aware training and adaptive learning rate algorithms to achieve instant update of the model and efficient use of resources under different environmental conditions.
It significantly optimizes the use of computing resources of the neural network model, improves the accuracy and stability of battery power state prediction, extends the battery life of the device, and improves the user experience and the actual performance of the device.
Smart Images

Figure CN118700894A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of battery capacity detection, and in particular to a method for detecting battery capacity. Background Art
[0002] With the widespread use of electric vehicles and other portable electronic devices, the importance of battery capacity detection technology has become increasingly prominent. Existing battery capacity detection methods mainly rely on neural network models. [1],[2] , by inputting data such as battery voltage, current, temperature, etc., the battery SOC is predicted. However, these methods still have the following technical problems in practical applications.
[0003] (1) Batteries exhibit different discharge characteristics under different load and temperature conditions, but the existing neural network model [1],[2] The model is difficult to adjust in time to adapt to new data distribution and usage conditions, which will affect the accuracy and stability of SOC prediction;
[0004] (2) Neural Network Model [1],[2] The high-precision neural network model is adopted, but the computational complexity of the high-precision neural network model is high. When deployed in resource-constrained embedded systems, it will face limitations in computing resources and power consumption, affecting the user experience.
[0005] References
[0006] [1] Zhao Qinghe. A residual capacity detection system for lithium batteries used in electric vehicles[J]. Information Technology, 2012, 36(06): 205-207. DOI: 10.13274 / j.cnki.hdzj.2012.06.013
[0007] [2] Pan Guicai. Design of battery pack capacity detection system based on neural network[D]. Dalian University of Technology, 2015. Summary of the invention
[0008] The purpose of the present invention is to provide a method for detecting battery capacity, which is used to solve the technical problem that the existing solution cannot actively control image recognition and obstacle avoidance solutions from multiple dimensions to cooperate with detection sensor recognition and obstacle avoidance solutions.
[0009] The purpose of the present invention can be achieved through the following technical solutions:
[0010] A method for detecting battery capacity, comprising:
[0011] Obtain data on the battery under different environmental conditions, extract historical changes in voltage, current, temperature, and characteristics of load conditions from the data, and finally integrate the collected features into a data set;
[0012] The obtained data set is used to construct and train a multi-task neural network model for processing time series data and the trained neural network model is cross-validated and tested to obtain a trained and validated multi-task neural network model;
[0013] Perform structured pruning on the trained and verified multi-task neural network model to remove neurons and connections that have little impact on battery state of charge (SOC) prediction; retrain the pruned neural network model and convert the neural network model parameters from floating point numbers to low-precision integers for quantization-aware training;
[0014] By using an adaptive learning rate algorithm, the neural network model can be updated instantly when new sensor data is acquired and an incremental update mechanism is established. The changing trend of sensor data is monitored. When a significant change in data distribution is detected, the neural network model is incrementally updated and fine-tuned with some new data to maintain the prediction accuracy of the neural network model.
[0015] The optimized neural network model is deployed in an embedded system to detect the battery state of charge (SOC). During the battery state of charge (SOC) detection process, the neural network model's prediction accuracy, response time, and resource consumption for the battery state of charge (SOC) are evaluated in real time, and the battery state of charge (SOC) prediction accuracy, response time, and resource consumption are adaptively adjusted based on real-time monitoring data.
[0016] Real-time monitoring and prediction results are displayed on the vehicle's display screen, allowing users to understand the vehicle's battery status and capacity.
[0017] Optionally, the steps for acquiring data under different environmental conditions of the battery include:
[0018] Use sensors to collect battery voltage, current, temperature and load conditions under different environmental conditions; set the data collection frequency and time interval according to the specific application scenario, and use statistical methods to detect outliers and remove outliers in the data;
[0019] Extract the historical change characteristics of battery voltage, current, and temperature. The historical change characteristics include statistical characteristics and trend characteristics of time series;
[0020] Extract load condition features, which include the frequency and amplitude of load changes.
[0021] 3. A method for detecting battery capacity according to claim 2, characterized in that:
[0022] The steps to build a neural network model with input layer, RNN / LSTM layer, fully connected layer, and multi-task output layer are:
[0023] The collected data set is divided into training set, validation set and test set. The training set is used for neural network model training, the validation set is used for hyperparameter tuning, and the test set is used for the final evaluation of the neural network model. Finally, the formula is used Normalize all features in the training set, validation set, and test set to make them in the same dimension. The normalized data will be used as the input of the neural network model, where x is the original feature value, μ is the mean of the feature, and σ is the standard deviation of the feature;
[0024] Obtain the battery state of charge (SOC) prediction loss and load condition prediction loss in the training set, validation set, and test set after normalization, and convert the obtained battery state of charge (SOC) prediction loss L SOC and load condition predicted loss L oad The weighted sum is used as the total loss function L Ltotal , by adjusting the weight parameters, the training of the two tasks is balanced, and its expression is: L total =αL SOC +βL Load , where α and β are weight parameters used to balance the training of the two tasks;
[0025] Input the training data into the neural network model, perform forward propagation to calculate the output value, use the defined total loss function to calculate the error between the output value of the neural network model and the true value, calculate the gradient of the loss function relative to the neural network model parameters through the back propagation algorithm, and update the neural network model parameters according to the calculated gradient to minimize the loss function. The above process is iterated multiple times on the training set to continuously optimize the neural network model parameters and finally obtain the optimal neural network model.
[0026] Use the validation set to evaluate the performance of the neural network model, record the errors of battery state of charge (SOC) prediction and load prediction, adjust the hyperparameters of the neural network model based on the evaluation results on the validation set, and monitor the validation set loss during training. If the validation set loss does not decrease within a few epochs, stop training early.
[0027] The trained neural network model is finally evaluated using the test set and deployed into the embedded system to predict the battery SOC and current load conditions.
[0028] Optionally, the steps for optimizing the multi-task neural network model are:
[0029] Calculate the fuzzy entropy of each neuron and connection, set the pruning threshold based on the fuzzy entropy value, initialize the predator population P, define the pruning strategy of each predator, continuously optimize the pruning strategy through iterative optimization and fitness calculation, finally select the pruning strategy with the best fitness, apply it to the neural network model, update the neural network model structure after removing neurons and connections, and retrain the pruned neural network model for the first time after the neural network model structure is updated using the same data set and optimization method as the initial training;
[0030] After the first retraining, the floating point number W′ of the neural network model parameters needs to be converted to a low-precision integer W through quantization-aware training. q , whose expression is: in, is the quantization step size, b is the number of quantization bits, and the quantization error is added to the forward propagation and back propagation calculations after converting the floating point number to a low-precision integer; after completing the initial quantization, the model is retrained for the second time using the quantized parameters and the same data set and optimization method as the initial training, and the neural network model parameters are updated through small batches of data to gradually adapt to the quantized representation;
[0031] The optimized neural network model θ′ is tested on the validation set and the test set. q Perform a final evaluation to ensure the generalization ability and performance stability of the neural network model. The expression is: Among them, N val is the number of samples in the validation set, N test is the number of samples in the test set, x i is the input of the i-th validation sample, y i is the true value of the i-th validation sample, f(x i θ′ q ) is the model parameter θ′ q The predicted value for the i-th test sample.
[0032] Optionally, when using the predator population to obtain the optimal pruning strategy, a simulated annealing mechanism is also provided to search for the global optimal solution.
[0033] Optionally, the steps to maintain the prediction accuracy of the neural network model using an adaptive learning rate algorithm are:
[0034] The model parameters are updated according to the calculated gradient. The adaptive learning rate algorithm dynamically adjusts the learning rate according to the change of the gradient. Its expression is: Among them, θ t Model parameters at time step t, g t is the gradient of time step t, which is the loss function L Ltotal For the model parameters θ tThe partial derivative of L(θ t ) is the loss function, which is used to measure the error between the model prediction value and the true value, m t The first-order moment estimate of time step t, β1 is the decay rate of the first-order moment, which determines the update speed of the momentum term, β2 is the decay rate of the second-order moment, which determines the update speed of the gradient square term, and the values of β2 and β1 are less than 1 and greater than 0.9, v t is the second-order moment estimate of time step t, η is the learning rate, which controls the step size of each parameter update, and ∈ is a small value;
[0035] Set indicators for monitoring changes in data distribution, calculate these statistics using sliding window technology, and use change detection algorithms to monitor changes in data distribution in real time. Once a significant change in data distribution is detected, record the time point and magnitude of the change;
[0036] Set a threshold for change detection. When the monitoring indicator exceeds the set threshold, the incremental update mechanism is triggered to record the change point and related data for use in the incremental update.
[0037] New data near the change point is selected for incremental update of the model, and forward propagation, loss calculation and back propagation are performed. The model parameters are updated according to the adaptive learning rate algorithm to ensure that the model adapts to the new data distribution, and the validation set data is used to evaluate the model performance after incremental update.
[0038] Optionally, the steps for testing the battery using the model are:
[0039] Acquire real-time data from sensors for preprocessing and input the preprocessed real-time data into the neural network model for forward propagation calculation;
[0040] Through the input layer, the data is passed to the RNN / LSTM layer to process the time series data. The RNN / LSTM layer extracts the time series features of the data and passes it to the fully connected layer. After the fully connected layer processes the data, it passes the data to the multi-task output layer to generate the SOC prediction value and the load condition prediction value.
[0041] Set key monitoring indicators, collect and record data of various monitoring indicators in real time, and record the data collected by the real-time monitoring system into the database;
[0042] Obtain the output of the neural network model, namely the battery state of charge (SOC) prediction value and the current load condition prediction value, and finally parse the model output results into a user-readable format and display them on the user interface;
[0043] By integrating fault detection algorithms, the operating status of the battery is monitored in real time, potential problems are discovered and handled in a timely manner, and when an abnormality is detected, the alarm mechanism is immediately triggered, and detailed fault data is recorded for subsequent analysis and maintenance. The alarm mechanism when an abnormality is detected includes real-time notification of the system administrator or user, triggering the alarm mechanism, and sending alarm information via SMS or email.
[0044] Optionally, the following steps are further included before using the fault detection algorithm:
[0045] Train the model locally on multiple devices and create the initial model parameters θ0 on the central server, and distribute the initial model parameters θ0 to all participating devices. Each device prepares its own local dataset D i , but do not share the dataset content, use the local dataset D i Perform model training and update local model parameters θ i , that is, get the locally updated model parameters And update the model parameters locally Upload to the central server and use the formula Aggregate the model parameters uploaded by all devices to obtain the global model parameters θ (t+1) , N is the number of devices participating in the training, and finally the updated global model parameter θ (t+1) Sent to all participating devices.
[0046] Compared with the existing solutions, the present invention achieves the following beneficial effects:
[0047] The present invention uses structured pruning technology, quantization-aware training and adaptive learning rate algorithm to significantly optimize the use of computing resources of neural network models, and solve the computing resource and power consumption limitation problems faced by high-precision models in resource-constrained embedded systems and mobile devices in the prior art. In addition, structured pruning technology calculates the fuzzy entropy of each neuron and connection, removes redundant parts, and reduces computational complexity; quantization-aware training converts model parameters from floating-point numbers to low-precision integers, further reducing computing requirements while maintaining high prediction accuracy; and adaptive learning rate algorithm dynamically adjusts the learning rate according to gradient changes to ensure efficient convergence of the model in resource-constrained environments. The optimized neural network model can run efficiently in embedded systems, realize real-time battery state of charge (SOC) detection, and provide prediction results with high accuracy and stability by dynamically adapting to different loads and environmental conditions, thereby extending the battery life of the device, improving user experience and the actual use efficiency of the device.
[0048] The present invention can effectively avoid falling into the local optimal solution by combining the simulated annealing mechanism in the process of obtaining the optimal pruning strategy by using the predator population. By setting the initial temperature and iteratively updating the temperature and calculating the annealing acceptance probability, the simulated annealing mechanism can accept some strategies that seem unfavorable in the short term, thereby jumping out of the trap of the local optimal solution and exploring the global optimal solution. This method improves the globality of the pruning strategy search, ensures that the pruning strategy finally obtained has better performance, and improves the overall prediction accuracy and robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The present invention will be further described below in conjunction with the accompanying drawings.
[0050] Figure 1 The present invention is a flowchart of a method for detecting battery capacity. DETAILED DESCRIPTION
[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary operation and maintenance personnel in this field without creative work are within the scope of protection of the present invention.
[0052] Example 1: Figure 1 As shown, the present invention is a method for detecting battery capacity, comprising the following steps:
[0053] Obtain data on the battery under different environmental conditions, extract historical changes in voltage, current, temperature, and features of load conditions from the data, and finally integrate the collected features into a data set;
[0054] For example: Install sensors on electric vehicles to monitor voltage, current, temperature and load conditions. Select different driving environments for data collection, including city driving, highway driving, high temperature, low temperature and high humidity. And collect data continuously for 100 hours under each environmental condition. All sensor data are recorded in the database in real time to ensure the integrity and accuracy of the data. The battery voltage is 3.0V-4.2V, the battery current is 0A-100A, the outdoor temperature is -10℃-40℃, and the battery load condition is 0%-100%.
[0055] The obtained data set is used to construct and train a multi-task neural network model for processing time series data, and the trained neural network model is cross-validated and tested to obtain a trained and verified multi-task neural network model; during the training process, the data set needs to be divided into a training set (70%), a validation set (20%) and a test set (10%). After 48 hours of training using the training set, the SOC prediction accuracy after training is 92%, and the load prediction accuracy is 89%.
[0056] The trained and verified multi-task neural network model was subjected to structured pruning, with the pruning ratio set to 20%, to remove neurons and connections that had little impact on the battery state of charge (SOC) prediction; the pruned neural network model was retrained, and the neural network model parameters were converted from floating point numbers to low-precision integers for quantization-aware training; after the above pruning process, the SOC prediction accuracy was 91%, and the load prediction accuracy was 88%
[0057] By using an adaptive learning rate algorithm, the neural network model can be updated instantly when new sensor data is acquired and an incremental update mechanism is established. The changing trend of sensor data is monitored. When a significant change in data distribution is detected, the neural network model is incrementally updated and fine-tuned with some new data to maintain the prediction accuracy of the neural network model. The updated SOC prediction accuracy is 93%, and the load prediction accuracy is 90%.
[0058] For example: suppose that the battery of an electric car is used in very different environments in summer and winter. In summer, the voltage and temperature of the battery change greatly in high temperature environment, while in winter, the performance of the battery will drop significantly in low temperature environment. If the SOC is detected only by static data comparison, it may not accurately reflect the changes in different seasons. By fine-tuning the neural network model, the model parameters can be adjusted in summer and winter respectively to adapt to the changes in battery performance under different temperature conditions, provide more accurate SOC prediction, and ensure that electric vehicles can operate stably in different seasons.
[0059] The optimized neural network model is deployed in an embedded system to detect the battery state of charge (SOC). During the battery state of charge (SOC) detection process, the neural network model is evaluated in real time for the battery state of charge (SOC) prediction accuracy, response time, and resource consumption. The results of the battery state of charge (SOC) prediction accuracy, response time, and resource consumption are adaptively adjusted according to the real-time monitoring data. The real-time monitoring and prediction results are displayed on the vehicle's display screen, so that users can understand the vehicle's battery status and capacity. During the detection process, the average SOC prediction accuracy of this application is 92.5%, the average response time is 50ms, and the average CPU usage is 40%.
[0060] It should be noted that by collecting and analyzing data under different environmental conditions, the model is ensured to accurately predict SOC in various real-world scenarios. Secondly, by using a multi-task neural network model to process time series data, multiple influencing factors can be considered at the same time to improve the reliability of the prediction. Structured pruning and parameter quantization techniques further optimize the computational efficiency of the model, reduce the consumption of computing resources, and maintain a high level of prediction accuracy. In addition, the incremental update mechanism and adaptive learning rate algorithm ensure that the model can continuously adapt to new data changes during operation and maintain prediction performance. Finally, the optimized model is deployed in an embedded system to achieve real-time SOC detection, and through real-time monitoring and adaptive adjustment, the system's response speed and resource utilization efficiency are improved.
[0061] Incremental updates allow the model to continue learning, which can significantly improve its adaptability and generalization capabilities, allowing it to maintain high-precision predictions under different driving conditions and environments.
[0062] For example, during a specific driving process of an electric vehicle, the system monitors the battery status in real time and makes adjustments as needed. The sensor collects the battery voltage (such as 3.7V), current (such as 50A), temperature (such as 25℃) and load condition (such as 75%) in real time.
[0063] If the model’s prediction error is found to exceed 5%, the system will make adaptive adjustments, using the latest collected data to fine-tune the model to suit the current driving conditions and environment.
[0064] For example, when the vehicle is going uphill or accelerating, the battery load exceeds 90% and lasts for 10 minutes. Under such high-load conditions, the discharge characteristics of the battery change significantly, which may lead to an increase in the SOC prediction error. The system finds that the SOC prediction error has increased from the original 3% to 7%. When the system detects an increase in the SOC prediction error, it triggers the incremental update mechanism, retrains some model parameters, and adjusts the learning rate to better adapt to high-load conditions. After incremental updates and parameter adjustments, the model's SOC prediction error is restored to within 3%. The vehicle's display screen updates the SOC prediction value in real time, and prompts the driver that high-load operation may affect battery life, and it is recommended to slow down or reduce the load appropriately.
[0065] The steps of acquiring data under different battery environmental conditions in this embodiment include:
[0066] Use sensors to collect battery voltage, current, temperature and load conditions under high temperature, low temperature, high humidity, city driving and high-speed driving; set the data collection frequency and time interval according to the specific application scenario, and use statistical methods to detect outliers and eliminate outliers in the data;
[0067] For example: In summer, when collecting battery data under high temperature conditions, the voltage range is 3.0V-4.2V, the current range is 0A-100A, and the temperature range is 30℃-40℃. In winter, when collecting battery data under low temperature conditions, the voltage range is 3.2V-4.1V, the current range is 0A-80A, and the temperature range is -10℃-0℃.
[0068] Specific instructions: Set the data collection frequency and time interval according to the specific application scenario. When driving on the highway, collect voltage, current, temperature and load data once a second. When driving in the city, collect data every 5 seconds. Through high-frequency data collection, capture the instantaneous state and change rules of the battery, and improve the accuracy of SOC prediction.
[0069] Extract the historical change characteristics of battery voltage, current, and temperature, including the statistical characteristics and trend characteristics of the time series; extract the load condition characteristics, including the frequency and amplitude of load changes. Feature extraction can help the model better understand the dynamic changes of batteries and loads and improve the performance of SOC prediction.
[0070] The steps of constructing a neural network model with an input layer, an RNN / LSTM layer, a fully connected layer, and a multi-task output layer in this embodiment are as follows:
[0071] The collected data set is divided into training set, validation set and test set. The training set is used for neural network model training, the validation set is used for hyperparameter tuning, and the test set is used for the final evaluation of the neural network model. Finally, the formula is used All features in the training set, validation set, and test set are normalized to be in the same dimension. The normalized data will be used as the input of the neural network model, where x is the original feature value, μ is the mean of the feature, and σ is the standard deviation of the feature. The data set is divided into training set, validation set, and test set. The training set is used for model training, the validation set is used for hyperparameter tuning, and the test set is used for final evaluation. Through this division, the performance of the model on unseen data can be effectively evaluated to ensure the reliability of the model in practical applications.
[0072] Obtain the battery state of charge (SOC) prediction loss and load condition prediction loss in the training set, validation set, and test set after normalization, and convert the obtained battery state of charge (SOC) prediction loss L SOC and load condition predicted loss L oad The weighted sum is used as the total loss function L Ltotal , by adjusting the weight parameters, the training of the two tasks is balanced, and its expression is: L total =αL SOC +βL Load, where α and β are weight parameters used to balance the training of the two tasks; the output value is calculated using forward propagation, the error is calculated using the defined total loss function, the gradient is calculated through the back propagation algorithm, and the model parameters are updated according to the gradient to minimize the loss function. This process is repeated multiple times on the training set to continuously optimize the model parameters.
[0073] Input the training data into the neural network model, perform forward propagation to calculate the output value, use the defined total loss function to calculate the error between the output value of the neural network model and the true value, calculate the gradient of the loss function relative to the neural network model parameters through the back propagation algorithm, and update the neural network model parameters according to the calculated gradient to minimize the loss function. The above process is iterated multiple times on the training set to continuously optimize the neural network model parameters and finally obtain the optimal neural network model.
[0074] Use the validation set to evaluate the performance of the neural network model, record the errors of battery state of charge (SOC) prediction and load prediction, adjust the hyperparameters of the neural network model based on the evaluation results on the validation set, and monitor the validation set loss during training. If the validation set loss does not decrease within a few epochs, stop training early.
[0075] The trained neural network model is finally evaluated using the test set and deployed into the embedded system to predict the battery SOC and current load conditions.
[0076] The steps for optimizing the multi-task neural network model in this embodiment are:
[0077] Calculate the fuzzy entropy of each neuron and connection, set the pruning threshold based on the fuzzy entropy value, initialize the predator population P, define the pruning strategy of each predator, continuously optimize the pruning strategy through iterative optimization and fitness calculation, finally select the pruning strategy with the best fitness, apply it to the neural network model, update the neural network model structure after removing neurons and connections, and retrain the pruned neural network model for the first time after the neural network model structure is updated using the same data set and optimization method as the initial training;
[0078] It should be noted that by calculating the fuzzy entropy of each neuron and connection, the complexity and importance of each part of the neural network can be quantified, so as to set an accurate pruning threshold to ensure that only the part with the least impact on model performance is removed. The predator algorithm is introduced to optimize the pruning strategy. Through continuous iteration and fitness calculation, the optimal pruning strategy is selected to improve the efficiency and accuracy of the model.
[0079] More specifically: Fuzzy entropy reflects the distribution and discreteness of the activation values of neurons or connections. Neurons with high complexity usually have higher fuzzy entropy values, which means that they have more variability and uncertainty in the process of information transmission.
[0080] For example: This application has a neural network with 200 neurons and 500 connections, and 10 predator populations, and each predator represents a different pruning strategy. When updating the neural network model, the fuzzy entropy value of each neuron and connection is first calculated, and the fuzzy entropy pruning threshold is set. It is found that 50 neurons and 150 connections have low fuzzy entropy values, so these parts are removed. After removal, 50 iterations are performed, and the fitness is calculated each time to optimize the pruning strategy. Finally, the strategy with the highest fitness is selected, which retains 150 neurons and 350 connections after pruning.
[0081] After the first retraining, the floating point number W′ of the neural network model parameters needs to be converted to a low-precision integer W through quantization-aware training. q , whose expression is: in, is the quantization step size, b is the number of quantization bits, and quantization errors are added to the forward propagation and back propagation calculations after converting floating-point numbers to low-precision integers; after completing the initial quantization, the model is retrained for the second time using the quantized parameters and the same data set and optimization method as the initial training, and the neural network model parameters are updated through small batches of data to gradually adapt to the quantized representation; through the retraining after the first pruning and the retraining after the second quantization, it is ensured that the model can gradually adapt to the new structure and parameter representation, maintain efficient operation and high prediction accuracy. Through the calculation of fuzzy entropy and quantization-aware training, the complexity of the model can be finely controlled to achieve the optimal performance-complexity balance.
[0082] The optimized neural network model θ′ is tested on the validation set and the test set. q Perform a final evaluation to ensure the generalization ability and performance stability of the neural network model. The expression is: Among them, N val is the number of samples in the validation set, N test is the number of samples in the test set, x i is the input of the i-th validation sample, y i is the true value of the i-th validation sample, f(x i θ′ q ) is the model parameter θ′ q The predicted value of the i-th test sample is obtained by the following formula: Among them, H fIt is fuzzy entropy, which is used to quantify the complexity of neurons or connections in a neural network and measure the degree of disorder of the system. The larger the value, the more complex or disordered the system is. i=1 represents the index variable, which means that the i-th neuron or connection is currently being calculated. N represents the total number of neurons or connections in the neural network, that is, the upper limit of the summation. p i is the normalized value of the fuzzy set of the i-th neuron or connection, μ(x i ) is the fuzzy set of the ith neuron or connection, is the sum of the fuzzy set membership values of all neurons or connections, used for normalization, The logarithmic function is used to calculate the amount of information in information entropy, which measures the amount of self-information of the fuzzy set member values, x i is the activation value of the ith neuron or connection, c is the mean of the activation value, σ is the standard deviation, which measures the discreteness of the activation value, and m is the fuzzy index, which is used to control the shape of the fuzzy set. By using structured pruning technology, neurons and connections that have little impact on the prediction of the battery state of charge (SOC) are removed, which can significantly optimize the structure of the model, reduce the consumption of computing resources, and improve operating efficiency. Next, the model parameters are converted from floating point numbers to low-precision integers through quantization-aware training, which not only further reduces the computational complexity, but also maintains a high prediction accuracy, ensuring the efficiency and stability of the model in different operating environments.
[0083] The present invention uses an adaptive learning rate algorithm to enable the neural network model to be updated instantly when new sensor data is acquired, and establishes an incremental update mechanism to ensure that the model is always in the optimal state. This mechanism monitors the changing trend of sensor data in real time. When a significant change in data distribution is detected, it triggers an incremental update of the neural network model and uses some new data for fine-tuning to maintain the prediction accuracy of the model. This dynamic adjustment method not only improves the adaptability and real-time performance of the model, but also ensures the accuracy and stability of SOC prediction.
[0084] By training models in parallel on multiple devices, the present invention can fully utilize the computing power of each device, thereby significantly improving the overall training speed. Compared with centralized training methods, this distributed training method can significantly reduce the computing burden of the central server and avoid the centralized consumption of computing resources. In addition, since local training does not require large-scale data transmission, the occupancy of network bandwidth is also significantly reduced, further improving the operating efficiency of the system. Each device performs model training locally, which not only fully utilizes the computing resources of the device, but also reduces the computing pressure of the central server and the consumption of network bandwidth.
[0085] Calculate the fitness of the pruning strategy (S i ) is calculated as:
[0086] Fitness(S i )=α·Accuracy(S i )-β·Complexity(S i ), where α is the accuracy weight, β is the complexity weight, Accuracy(S i ) is the pruning strategy S i The prediction accuracy, Complexity(S i ) is the pruning strategy S i The computational complexity of .
[0087] In the process of using the predator population to obtain the optimal pruning strategy, this embodiment also has a simulated annealing mechanism to find the global optimal solution. When finding the global optimal solution, the initial temperature T0 is first set, and the temperature is iteratively updated to obtain the temperature T of the next generation. t+1 , where the expression is: T t+1 =T t α, T t is the current temperature, α is the temperature attenuation coefficient, and the value of α is between 0 and 1;
[0088] Calculate the annealing acceptance probability P(ΔE), which is expressed as: ΔE is the energy difference between the current strategy and the new strategy, and ΔE = Fitness (S new )-Fitness(S current ), k is a constant whose value is 1, and T is the current temperature.
[0089] According to the obtained annealing acceptance probability P(ΔE), the new pruning strategy is accepted, and its calculation formula is:
[0090] S current Represents the currently selected pruning strategy, which is used for evaluation and optimization in the predator algorithm and simulated annealing process. If ΔE is greater than 0, the new strategy S new S new The fitness is higher than the current strategy S current ; If ΔE is less than or equal to 0, the fitness of the new strategy is not as good as the current strategy.
[0091] More specifically, when ΔE>0, accept the new strategy S new .
[0092] When ΔE≤0, accept the new strategy S with probability P(ΔE) new .
[0093] If none of the above conditions are met, keep the current strategy S current constant.
[0094] Generate new strategy S through crossover and mutation new , and choose to keep and eliminate the new strategy Snew, which is expressed as: P t+1 =Select(P t ∪{S new}), Select is the selection function, P t Represents the population in the tth generation. This population contains all current pruning strategies. In the process of using the predator population to obtain the optimal pruning strategy, combined with the simulated annealing mechanism, it is possible to effectively avoid falling into the local optimal solution. By setting the initial temperature and iteratively updating the temperature, and calculating the annealing acceptance probability, the simulated annealing mechanism can accept some strategies that seem unfavorable in the short term, thereby jumping out of the trap of the local optimal solution and exploring the global optimal solution. This method improves the globality of the pruning strategy search, ensures that the final pruning strategy has better performance, and improves the overall prediction accuracy and robustness of the model.
[0095] Specific description: The simulated annealing mechanism dynamically adjusts the selection of pruning strategies by calculating the annealing acceptance probability. When the fitness of the new strategy is high, it is directly accepted; when the fitness of the new strategy is low, there is also a certain probability of acceptance, thereby maintaining diversity and exploration. Combined with the crossover and mutation operations of the predator algorithm, new pruning strategies can be generated, and the population can be gradually optimized by selecting the retention and elimination strategies of the function.
[0096] By setting the initial temperature and iteratively updating the temperature, and calculating the annealing acceptance probability, the problem of local optimal solutions can be effectively avoided and global search capabilities can be ensured. In addition, the dynamic adaptation and optimization method selects strategies through annealing acceptance probability, maintains the diversity and exploratory nature of strategies, and generates new strategies through crossover and mutation, gradually optimizes the population, and finally obtains the optimal pruning strategy. These advantages significantly improve the efficiency and performance of the model, ensuring the efficient operation and high-precision prediction of the pruning strategy in different environments.
[0097] The steps of using the adaptive learning rate algorithm to maintain the prediction accuracy of the neural network model in this embodiment are:
[0098] The model parameters are updated according to the calculated gradient. The adaptive learning rate algorithm dynamically adjusts the learning rate according to the change of the gradient. Its expression is: Among them, θ t Model parameters at time step t, g t is the gradient of time step t, which is the loss function L Ltotal For the model parameters θ t The partial derivative of L(θ t ) is the loss function, which is used to measure the error between the model prediction value and the true value, m tThe first-order moment estimate of time step t, β1 is the decay rate of the first-order moment, which determines the update speed of the momentum term, β2 is the decay rate of the second-order moment, which determines the update speed of the gradient square term, and the values of β2 and β1 are less than 1 and greater than 0.9, v t is the second-order moment estimate of time step t, η is the learning rate, which controls the step size of each parameter update, and ∈ is a small value; the model parameters are dynamically adjusted according to the calculated gradient. Adam combines the advantages of the momentum method and RMSProp. Through the estimation of the first-order moment and the second-order moment, the learning rate can be adaptively adjusted during the training process, thereby improving the convergence speed and stability of the model training.
[0099] Set indicators for monitoring changes in data distribution, such as mean, variance, skewness, and kurtosis, and use sliding window technology to calculate these statistics. Use change detection algorithms to monitor changes in data distribution in real time. Once a significant change in data distribution is detected, record the time point and magnitude of the change; the incremental update mechanism enables the model to dynamically adapt to the new data distribution, maintain prediction accuracy and stability, and avoid the decline in prediction performance caused by changes in data distribution. When the monitoring indicator exceeds the set threshold, the incremental update mechanism is triggered. Record the change point and related data for use in incremental updates. The model can dynamically adapt to the new data distribution and maintain prediction accuracy and stability.
[0100] Set a threshold for change detection. When the monitoring indicator exceeds the set threshold, trigger the incremental update mechanism to record the change points and related data for use in incremental updates. Use new data to update the model to ensure that the model parameters are consistent with the latest data distribution, improve the model's adaptability to new data, and enhance the model's prediction accuracy.
[0101] New data near the change point is selected for incremental update of the model, and forward propagation, loss calculation and back propagation are performed. The model parameters are updated according to the adaptive learning rate algorithm to ensure that the model adapts to the new data distribution. The performance of the model after incremental update is evaluated using the validation set data to ensure the accuracy and stability of SOC prediction. By using the adaptive learning rate algorithm Adam to dynamically adjust the model parameters, combined with dynamic monitoring of data distribution changes and incremental update mechanism, the training efficiency and prediction performance of the model can be significantly improved. The model is updated with new data to ensure that the model always adapts to the latest data distribution and maintains high prediction accuracy and stability. The performance of the model after incremental update is evaluated through the validation set to ensure the reliability and accuracy of the model in practical applications. This method has shown significant advantages in the development of electric vehicle battery management systems and can provide efficient and accurate battery state prediction and management.
[0102] The steps of using the model to detect the battery in this embodiment are as follows:
[0103] Acquire real-time data from sensors for preprocessing and input the preprocessed real-time data into the neural network model for forward propagation calculation;
[0104] Through the input layer, the data is passed to the RNN / LSTM layer to process the time series data. The RNN / LSTM layer extracts the time series features of the data and passes it to the fully connected layer. After the fully connected layer processes it, the data is passed to the multi-task output layer to generate the SOC prediction value and the load condition prediction value. The RNN / LSTM layer can capture the time dependency and dynamic changes in the battery data, and improve the prediction accuracy of the SOC and load conditions. Multi-task learning can optimize multiple related tasks at the same time, improve the prediction performance of each task, and enhance the overall performance of the model.
[0105] Set key monitoring indicators, collect and record data of various monitoring indicators in real time, and record the data collected by the real-time monitoring system into the database for subsequent analysis. Through real-time monitoring, data anomalies can be discovered in time, which is convenient for subsequent analysis and processing, and improves the reliability and maintenance efficiency of the system. Real-time fault detection and alarm mechanism ensures the safety and reliability of the battery system, notifies users or administrators in time, and reduces potential risks and losses.
[0106] Obtain the output of the neural network model, namely the battery state of charge (SOC) prediction value and the current load condition prediction value, and finally parse the model output results into a user-readable format and display them on the user interface;
[0107] By integrating fault detection algorithms, the operating status of the battery is monitored in real time, potential problems are discovered and handled in a timely manner, and when an abnormality is detected, the alarm mechanism is immediately triggered, and detailed fault data is recorded for subsequent analysis and maintenance. The alarm mechanism when an abnormality is detected includes real-time notification of the system administrator or user, triggering the alarm mechanism, and sending alarm information via SMS or email.
[0108] Through the above steps, the battery management system can achieve real-time data collection, accurate prediction, multi-task learning, key indicator monitoring, user-friendly display and fault detection alarm. These functions combined not only improve the accuracy of battery status prediction and system operation efficiency, but also enhance the system reliability and user experience, ensuring that electric vehicles can maintain efficient and safe working conditions under various operating conditions.
[0109] This embodiment also includes the following steps before using the fault detection algorithm:
[0110] Train the model locally on multiple devices and create the initial model parameters θ0 on the central server, and distribute the initial model parameters θ0 to all participating devices. Each device prepares its own local dataset D i, but do not share the dataset content, use the local dataset D i Perform model training and update local model parameters θ i , that is, get the locally updated model parameters And update the model parameters locally Upload to the central server and use the formula Aggregate the model parameters uploaded by all devices to obtain the global model parameters θ (t+1) , N is the number of devices participating in the training, and finally the updated global model parameter θ (t+1) Send to all participating devices. By aggregating the training results of multiple devices, the global model parameters are optimized, the generalization ability and prediction performance of the model are improved, and the consistency and reliability of the model on various devices are ensured. By training the model locally on multiple devices and aggregating and distributing the model parameters on the central server, data privacy can be effectively protected, distributed computing resources can be fully utilized, and the training efficiency and generalization ability of the model can be improved. This method reduces bandwidth usage, dynamically adapts to local data characteristics, and improves the scalability and applicability of the model.
[0111] For example, in the patent document with publication number CN112557907A, although a SOC estimation method for electric vehicle lithium-ion batteries based on GRU_RNN is disclosed, the GRU-RNN model is mainly used to estimate the SOC of electric vehicle lithium-ion batteries. Compared with the prior art, this application uses structured pruning technology to calculate the fuzzy entropy of each neuron and connection, scientifically set the pruning threshold, and remove neurons and connections that have little impact on SOC prediction, thereby reducing the computational complexity. Further through quantized perception training, the model parameters are converted from floating point numbers to low-precision integers, further reducing the computing requirements. The computational complexity and power consumption of the model are greatly reduced, so that the optimized model can run efficiently in embedded systems, realize real-time SOC detection, extend the battery life of the device, and improve the user experience. Moreover, this application enhances the global search capability through the use of annealing mechanism and predator algorithm, which can effectively avoid local optimal solutions and improve the efficiency of finding global optimal solutions.
[0112] In addition, the formulas involved in the above are all dimensionless and numerical calculations. They are a formula that is closest to the actual situation obtained by collecting a large amount of data and simulating it with simulation software.
[0113] In the several embodiments provided by the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the above-described embodiments of the invention are only illustrative, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation.
[0114] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, and may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0115] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0116] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the basic features of the present invention.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, ordinary operation and maintenance personnel in the field should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for detecting battery capacity, characterized in that: The following steps are involved: Obtain data on the battery under different environmental conditions, extract historical changes in voltage, current, temperature, and features of load conditions from the data, and finally integrate the collected features into a data set; The obtained data set is used to construct and train a multi-task neural network model for processing time series data and the trained neural network model is cross-validated and tested to obtain a trained and validated multi-task neural network model; Perform structured pruning on the trained and verified multi-task neural network model, remove neurons and connections that have little impact on battery state of charge (SOC) prediction, retrain the pruned neural network model, and convert the neural network model parameters from floating point numbers to low-precision integers for quantization-aware training; By using an adaptive learning rate algorithm, the neural network model can be updated instantly when new sensor data is acquired and an incremental update mechanism is established. The changing trend of sensor data is monitored. When a significant change in data distribution is detected, the neural network model is incrementally updated and fine-tuned using some of the new data. The optimized neural network model is deployed in an embedded system to detect the battery state of charge (SOC). The performance of the neural network model is evaluated in real time during the battery state of charge (SOC) detection process, and the model is adaptively adjusted according to the evaluated performance. Real-time monitoring and prediction results are displayed on the vehicle's display screen, allowing users to understand the vehicle's battery status and capacity.
2. A method for detecting battery capacity according to claim 1, characterized in that: The steps for obtaining data under different environmental conditions of the battery include: Use sensors to collect battery voltage, current, temperature and load conditions under different environmental conditions, and use statistical methods to detect outliers and remove outliers from the data; Extract the historical change characteristics of battery voltage, current, and temperature. The historical change characteristics include statistical characteristics and trend characteristics of time series; Extract load condition features, which include the frequency and amplitude of load changes.
3. A method for detecting battery capacity according to claim 2, characterized in that: The steps to build a neural network model with input layer, RNN / LSTM layer, fully connected layer, and multi-task output layer are: The collected data set is divided into training set, validation set and test set. The training set is used for neural network model training, the validation set is used for hyperparameter tuning, and the test set is used for the final evaluation of the neural network model. Finally, the formula is used Normalize all features in the training set, validation set, and test set to make them in the same dimension. The normalized data will be used as the input of the neural network model, where x is the original feature value, μ is the mean of the feature, and σ is the standard deviation of the feature; Obtain the battery state of charge (SOC) prediction loss and load condition prediction loss in the training set, validation set, and test set after normalization, and convert the obtained battery state of charge (SOC) prediction loss L SOC and load condition predicted loss L oad The weighted sum is used as the total loss function L Ltotal , by adjusting the weight parameters, the training of the two tasks is balanced, and its expression is: L total =αL SOC +β LLoad , where α and β are weight parameters used to balance the training of the two tasks; Input the training data into the neural network model, perform forward propagation to calculate the output value, use the defined total loss function to calculate the error between the output value of the neural network model and the true value, calculate the gradient of the loss function relative to the neural network model parameters through the back propagation algorithm, and update the neural network model parameters according to the calculated gradient to minimize the loss function. The above process is iterated multiple times on the training set to continuously optimize the neural network model parameters and finally obtain the optimal neural network model. Use the validation set to evaluate the performance of the neural network model, record the errors of battery state of charge (SOC) prediction and load prediction, adjust the hyperparameters of the neural network model based on the evaluation results on the validation set, and monitor the validation set loss during training. If the validation set loss does not decrease within a few epochs, stop training early. The trained neural network model is finally evaluated using the test set and deployed into the embedded system to predict the battery SOC and current load conditions.
4. A method for detecting battery capacity according to claim 3, characterized in that: The steps for optimizing the multi-task neural network model are: Calculate the fuzzy entropy of each neuron and connection, set the pruning threshold based on the fuzzy entropy value, initialize the predator population P, define the pruning strategy of each predator, continuously optimize the pruning strategy through iterative optimization and fitness calculation, finally select the pruning strategy with the best fitness, apply it to the neural network model, update the neural network model structure after removing neurons and connections, and retrain the pruned neural network model for the first time after the neural network model structure is updated using the same data set and optimization method as the initial training; After the first retraining, the floating point number W′ of the neural network model parameters needs to be converted to a low-precision integer W through quantization-aware training. q , whose expression is: in, is the quantization step size, b is the number of quantization bits, and the quantization error is added to the forward propagation and back propagation calculations after converting the floating point number to a low-precision integer; after completing the initial quantization, the model is retrained for the second time using the quantized parameters and the same data set and optimization method as the initial training, and the neural network model parameters are updated through small batches of data to gradually adapt to the quantized representation; The optimized neural network model θ′ is tested on the validation set and the test set. q Perform a final evaluation to ensure the generalization ability and performance stability of the neural network model. The expression is: Among them, N val is the number of samples in the validation set, N test is the number of samples in the test set, x i is the input of the i-th validation sample, y i is the true value of the i-th validation sample, f(x i θ′ q ) is the model parameter θ′ q The predicted value for the i-th test sample.
5. A method for detecting battery capacity according to claim 4, characterized in that: When using the predator population to obtain the optimal pruning strategy, it also has a simulated annealing mechanism to find the global optimal solution.
6. A method for detecting battery capacity according to claim 5, characterized in that: The steps to maintain the prediction accuracy of the neural network model using the adaptive learning rate algorithm are: The model parameters are updated according to the calculated gradient. The adaptive learning rate algorithm dynamically adjusts the learning rate according to the change of the gradient. Its expression is: Among them, θ t Model parameters at time step t, g t is the gradient of time step t, which is the loss function L Ltotal For the model parameters θ t The partial derivative of L(θ t ) is the loss function, which is used to measure the error between the model prediction value and the true value, m t The first-order moment estimate of time step t, β1 is the decay rate of the first-order moment, which determines the update speed of the momentum term, β2 is the decay rate of the second-order moment, which determines the update speed of the gradient square term, and the values of β2 and β1 are less than 1 and greater than 0.9, v t is the second-order moment estimate of time step t, η is the learning rate, which controls the step size of each parameter update, and ∈ is a small value; Set indicators for monitoring changes in data distribution, calculate these statistics using sliding window technology, and use change detection algorithms to monitor changes in data distribution in real time. Once a significant change in data distribution is detected, record the time point and magnitude of the change; Set a threshold for change detection. When the monitoring indicator exceeds the set threshold, the incremental update mechanism is triggered to record the change point and related data for use in the incremental update. New data near the change point is selected for incremental update of the model, and forward propagation, loss calculation and back propagation are performed. The model parameters are updated according to the adaptive learning rate algorithm to ensure that the model adapts to the new data distribution, and the validation set data is used to evaluate the model performance after incremental update.
7. A method for detecting battery capacity according to claim 6, characterized in that: The steps to use the model to test the battery are: Acquire real-time data from sensors for preprocessing and input the preprocessed real-time data into the neural network model for forward propagation calculation; Through the input layer, the data is passed to the RNN / LSTM layer to process the time series data. The RNN / LSTM layer extracts the time series features of the data and passes it to the fully connected layer. After the fully connected layer processes the data, it passes the data to the multi-task output layer to generate the SOC prediction value and the load condition prediction value. Set key monitoring indicators, collect and record data of various monitoring indicators in real time, and record the data collected by the real-time monitoring system into the database; Obtain the output of the neural network model, namely the battery state of charge (SOC) prediction value and the current load condition prediction value, and finally parse the model output results into a user-readable format and display them on the user interface; By integrating fault detection algorithms, the operating status of the battery is monitored in real time, potential problems are discovered and handled in a timely manner, and when an abnormality is detected, the alarm mechanism is immediately triggered, and detailed fault data is recorded for subsequent analysis and maintenance. The alarm mechanism when an abnormality is detected includes real-time notification of the system administrator or user, triggering the alarm mechanism, and sending alarm information via SMS or email.
8. A method for detecting battery capacity according to claim 7, characterized in that: The following steps are also included before using the fault detection algorithm: Train the model locally on multiple devices and create the initial model parameters θ0 on the central server, and distribute the initial model parameters θ0 to all participating devices. Each device prepares its own local dataset D i , but do not share the dataset content, use the local dataset D i Perform model training and update local model parameters θ i , that is, get the locally updated model parameters And update the model parameters locally Upload to the central server and use the formula Aggregate the model parameters uploaded by all devices to obtain the global model parameters θ (t+1) , N is the number of devices participating in the training, and finally the updated global model parameter θ (t+1) Sent to all participating devices.
Citation Information
Cited By
Battery capacity off-line detection method, system and device for electric energy circulation
CN119199567A
Light storage and charging control system and method based on short-distance logistics vehicle
CN119693181A
A short-distance logistics vehicle-based light storage and charging control system and method
CN119693181B
Electric quantity management method and system of intelligent door lock, terminal and storage medium
CN119694027A
Battery thermal runaway early warning prevention and control system based on multi-sensor fusion type neural network
CN119975090A
