Battery SOH prediction method based on attention mechanism MOE model

By adopting an attention mechanism-based MOE model in battery SOH prediction, combining multiple expert sub-models and gated networks, and using the attention mechanism computing layer, the problems of insufficient generalization ability and overfitting of traditional models are solved, and the problem of realization of the implementation of the Higher prediction accuracy and robustness.

CN118914906AInactive Publication Date: 2024-11-08NANTONG LE CHUANGXIN ENERGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411412352.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-11-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional machine learning models have limited generalization capabilities in battery SOH prediction, which is prone to overfitting, and is not efficient when processing large-scale data, making it difficult to effectively improve prediction accuracy.

Method used

The MOE model based on attention mechanism is adopted, and the combination of multiple expert sub-models and gated network models is combined with the attention mechanism calculation layer to improve the expression ability and robustness of the model and reduce the risk of overfitting.

Benefits of technology

It improves the accuracy of battery SOH prediction, the robustness and generalization ability of the model, reduces the risk of overfitting, enhances the ability to capture important parts of the features, and significantly improves the prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118914906A_ABST
    Figure CN118914906A_ABST
Patent Text Reader

Abstract

The invention discloses a battery SOH prediction method based on an attention mechanism MOE model, and the method comprises the steps: testing and collecting the current, voltage, temperature and capacity data of a battery, constructing an attention mechanism-based MOE model, and enabling the attention mechanism-based MOE model to comprise a plurality of expert sub-models, a gating network model and an attention mechanism calculation layer. And training and verifying the MOE model based on the attention mechanism, predicting the SOH of the battery, deploying the trained model on the premise of good model effect after the MOE model based on the attention mechanism is trained, and predicting the SOH of the battery by using the deployed model. According to the method, the MOE model based on the attention mechanism is adopted, the expression ability and prediction precision of the model can be improved when the SOH of the battery is predicted, the robustness and generalization ability of the whole model are improved, and the over-fitting risk is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a battery SOH prediction method, in particular to a battery SOH prediction method based on an attention mechanism MOE model, and belongs to the technical field of battery detection. Background Art

[0002] The battery's State of Health (SOH) reveals the battery's overall health and its estimated remaining service life. As a key parameter for measuring battery performance, the importance of SOH is mainly reflected in the following aspects: it shows the degree of battery aging, guides the best time to replace the battery, evaluates the remaining capacity of the battery, optimizes battery management, diagnoses potential battery failures, evaluates battery safety, and predicts the remaining life of the battery.

[0003] Predicting the SOH of a battery has extremely important practical application value. The current, voltage, and temperature data of the battery during operation are closely related to the SOH, and using these data to predict the SOH has become a focus of research. Usually, researchers use current, voltage, and temperature data to train machine learning models, such as neural networks and support vector machines, to understand the changing patterns of the battery SOH and make effective predictions.

[0004] Traditional machine learning models often use a single model to fit all data, which is inadequate when faced with complex and highly heterogeneous data sets. Such models have limited generalization capabilities, are prone to overfitting, and are inefficient when processing large-scale data. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a battery SOH prediction method based on the attention mechanism MOE model to improve the accuracy of battery SOH prediction.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: A battery SOH prediction method based on the attention mechanism MOE model includes the following steps: S1. Test and collect battery current, voltage, temperature and capacity data; S2. Construct an MOE model based on the attention mechanism. The MOE model based on the attention mechanism includes multiple expert sub-models, a gating network model and an attention mechanism calculation layer; S3, training and verifying the MOE model based on the attention mechanism; S4. Predicting battery SOH. After the MOE model based on the attention mechanism is trained, the trained model is deployed on the premise that the model effect is good, and the deployed model is used to predict the battery SOH.

[0007] Furthermore, the step S1 is specifically as follows: Current collection: BMS detects the total current at the battery pack connection end using a Hall sensor or a high-precision sampling resistor; Voltage collection: BMS detects the voltage of each battery cell through the battery isolation circuit, thereby obtaining the voltage information of the entire battery pack; Temperature collection: BMS sets temperature sensors at the battery pack connection end and / or battery cell to detect the operating temperature of the battery; Capacity collection: BMS counts the ampere-hours of battery charging and discharging, and calculates the battery's charge and discharge capacity based on the battery voltage change curve.

[0008] Furthermore, in step S2, the number of expert sub-models is 3, each expert sub-model is an MLP model, and each expert sub-model includes an expert sub-model input layer, a first expert sub-model middle layer, a second expert sub-model middle layer and an expert sub-model output layer. The expert sub-model input layer receives input battery current, voltage, temperature and capacity data, the dimension of the first expert sub-model middle layer is 64, the dimension of the second expert sub-model middle layer is 32, and the expert sub-model output layer outputs a 16-dimensional vector.

[0009] Furthermore, in step S2, the gated network model adopts a multi-layer perceptron model, and the gated network model includes a gated network model input layer, a gated network model middle layer and a gated network model output layer. The gated network model input layer receives input battery current, voltage, temperature and capacity data, the dimension of the gated network model middle layer is 32, the activation function is the relu function, the gated network model output layer outputs a 3D vector, the activation function is softmax, and the 3D vectors output by the gated network model output layer correspond to the weights of the three expert sub-models, and the sum of the weights of the three expert sub-models is 1.

[0010] Furthermore, the outputs of the three expert sub-models are output1, output2, and output3, respectively. Output1, output2, and output3 are all high-dimensional vectors, representing the feature representation of each sub-expert model for the input data. The feature representation output by the three expert sub-models is weighted summed with the weights of the three expert sub-models output by the gating network to obtain the comprehensive features; Afterwards, the comprehensive features are connected to an attention mechanism calculation layer.

[0011] Furthermore, the query vector, key vector and value vector in the attention mechanism calculation layer are all 16-dimensional vectors, and the output of the attention mechanism calculation layer is a 16-dimensional vector.

[0012] Furthermore, the calculation process of the attention mechanism calculation layer is: Step 1: Calculate the attention score; First, calculate the similarity between each query vector and all key vectors: attention_score i =query·key i Among them, attention_score i is the i-th attention score, query is the query vector, key i is the i-th key vector; Step 2: Calculate attention weight; The obtained attention score is converted into a probability form through the softmax function, which is called the attention weight: attention_weights=softmax(attention_scores)=

[0013] Among them, attention_weights is the attention weight, attention_scores is the attention score, softmax() is the softmax function, the softmax function ensures that all weights add up to 1, and attention_score i is the i-th attention score, attention_score j is the jth attention score; Step 3: Calculate the weighted value Multiply each value by its corresponding attention weight and add the results to get the final attention output:

[0014] Among them, attention_output is the attention output, attention_weight i is the i-th attention weight, value i is the i-th value vector; The comprehensive features are used as the input data of the attention mechanism calculation layer to obtain the attention output.

[0015] Furthermore, the step S3 is specifically as follows: implementing the MOE model code based on the attention mechanism on the Keras platform and training it, with the number of training epochs=100, the number of batch samples batch_size=32, the optimizer for model training being the adam algorithm, and the loss function being the mean square error; the training data being divided into a training set and a test set in a ratio of 8:2, the model being trained on the training set, and the model being verified on the test set.

[0016] Compared with the prior art, the present invention has the following advantages and technical effects: 1. The present invention adopts the MOE model based on the attention mechanism, which can improve the expression ability and prediction accuracy of the model when predicting the battery SOH, improve the robustness and generalization ability of the overall model, and reduce the risk of overfitting; 2. The MOE model of the present invention combines multiple expert sub-models, each of which focuses on different aspects of the data, thereby improving the expressiveness and prediction accuracy of the overall model; 3. The present invention adopts the attention mechanism to enable the MOE model to better capture the important parts of the features, which is very effective in improving the prediction accuracy of the model; 4. The present invention reduces the overfitting risk of a single model and improves the robustness and generalization ability of the overall model through the combination of multiple expert sub-models, the gated network model, and the dynamic adjustment of the attention mechanism. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flow chart of a battery SOH prediction method based on the attention mechanism MOE of the present invention.

[0018] Figure 2 This is a structural diagram of a battery SOH prediction model based on the attention mechanism MOE of the present invention.

[0019] Figure 3 It is a structural diagram of the expert sub-model of the present invention.

[0020] Figure 4 It is a structural diagram of the expert sub-model of the present invention.

[0021] Figure 5 It is an example of the collected battery current, voltage, temperature and capacity data of the embodiment of the present invention.

[0022] Figure 6 This is a data sample of the battery SOH prediction result of an embodiment of the present invention.

[0023] Figure 7 It is a bar chart of the battery SOH prediction results of the embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to elaborate on the technical scheme adopted by the present invention to achieve the predetermined technical purpose, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments, and the technical means or technical features in the embodiments of the present invention can be replaced without paying creative work. The present invention will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0025] like Figure 1 As shown, a battery SOH prediction method based on the attention mechanism MOE model of the present invention comprises the following steps: S1. Test and collect battery current, voltage, temperature and capacity data.

[0026] Current collection: BMS detects the total current at the battery pack connection end using a Hall sensor or a high-precision sampling resistor.

[0027] Voltage collection: BMS detects the voltage of each battery cell through the battery isolation circuit, thereby obtaining the voltage information of the entire battery pack.

[0028] Temperature collection: BMS sets temperature sensors at the battery pack connection end and / or battery cell to detect the operating temperature of the battery.

[0029] Capacity collection: BMS counts the ampere-hours of battery charging and discharging, and calculates the battery's charge and discharge capacity based on the battery voltage change curve.

[0030] S2. Construct a MOE model based on the attention mechanism, such as Figure 2 As shown in the figure, the attention-based MOE model includes multiple expert sub-models, a gating network model and an attention mechanism calculation layer.

[0031] The number of expert sub-models is 3, such as Figure 3 As shown, each expert sub-model is an MLP model, and each expert sub-model includes an expert sub-model input layer, a first expert sub-model middle layer, a second expert sub-model middle layer and an expert sub-model output layer. The expert sub-model input layer receives input battery current, voltage, temperature and capacity data, the dimension of the first expert sub-model middle layer is 64, the dimension of the second expert sub-model middle layer is 32, and the expert sub-model output layer outputs a 16-dimensional vector.

[0032] like Figure 4As shown in the figure, the gated network model adopts a multi-layer perceptron model. The gated network model includes a gated network model input layer, a gated network model middle layer and a gated network model output layer. The gated network model input layer receives the input battery current, voltage, temperature and capacity data. The dimension of the gated network model middle layer is 32, and the activation function is the relu function. The gated network model output layer outputs a 3D vector, and the activation function is softmax. The 3D vectors output by the gated network model output layer correspond to the weights of the three expert sub-models, and the sum of the weights of the three expert sub-models is 1.

[0033] The outputs of the three expert sub-models are output1, output2 and output3 respectively. Output1, output2 and output3 are all high-dimensional vectors, which respectively represent the feature representation of the input data of each sub-expert model.

[0034] The feature representations output by the three expert sub-models are weighted summed with the weights of the three expert sub-models output by the gating network to obtain the comprehensive features.

[0035] Afterwards, the comprehensive features are connected to an attention mechanism calculation layer.

[0036] The query vector, key vector, and value vector in the attention mechanism calculation layer are all 16-dimensional vectors, and the output of the attention mechanism calculation layer is a 16-dimensional vector. The query vector represents the information that needs to be processed at present, usually a hidden state; the key vector represents the information used to compare with the query; the value vector represents the information used to generate the output representation once the attention weight is determined.

[0037] The calculation process of the attention mechanism calculation layer is: Step 1: Calculate the attention score; First, calculate the similarity between each query vector and all key vectors: attention_score i =query·key i Among them, attention_score i is the i-th attention score, query is the query vector, key i is the i-th key vector; Step 2: Calculate attention weight; The obtained attention score is converted into a probability form through the softmax function, which is called the attention weight: attention_weights=softmax(attention_scores)=

[0038] Among them, attention_weights is the attention weight, attention_scores is the attention score, softmax() is the softmax function, the softmax function ensures that all weights add up to 1, and attention_score i is the i-th attention score, attention_score j is the jth attention score; Step 3: Calculate the weighted value Multiply each value by its corresponding attention weight and add the results to get the final attention output:

[0039] Among them, attention_output is the attention output, attention_weight i is the i-th attention weight, value i is the i-th value vector; The comprehensive features are used as the input data of the attention mechanism calculation layer to obtain the attention output.

[0040] After the attention mechanism is calculated, the attention output is connected to the prediction target, i.e., battery SOH, through a linear regression layer.

[0041] S3. Train and verify the MOE model based on the attention mechanism.

[0042] The MOE model code based on the attention mechanism is implemented and trained on the Keras platform. The number of training epochs=100, the number of batch samples batch_size=32, the optimizer for model training is the adam algorithm, and the loss function is the mean square error; the training data is divided into a training set and a test set in a ratio of 8:2. The model is trained on the training set and verified on the test set.

[0043] S4. Predicting battery SOH. After the MOE model based on the attention mechanism is trained, the trained model is deployed on the premise that the model effect is good, and the deployed model is used to predict the battery SOH.

[0044] After the attention output is a linear regression layer, the activation function is a linear function, and the output value is the battery SOH. The loss function of the model is the mean square error (MSE); the optimizer is adam; the evaluation metric is the mean absolute error (MAE), which is the sum of the absolute values ​​of the difference between the target value and the predicted value.

[0045] The present invention tests the effect on the discharge phase data of the B0018 battery in the NASA battery data set, and uses the battery current, voltage and temperature data therein to predict the battery SOH. The data set is divided into a training set and a test set in a ratio of 8:2, the MOE model is trained on the training set, and the effect is tested on the test set.

[0046] like Figure 5 As shown, the test data has a total of 5 features (measured voltage, measured current, measured temperature, current measured under load, and voltage measured under load) and 1 prediction target (battery capacity discharged to 2.7V).

[0047] like Figure 6 As shown, the mean of the test set of battery capacity is 1.5841, the standard deviation is 0.1571, and the mean of the prediction set is 1.5963, the standard deviation is 0.1314, which shows that the data distribution of the prediction results is basically consistent with the data distribution of the real data.

[0048] The root mean square error between the prediction set and the test set of battery SOH is only 0.08332, indicating that the prediction effect of the model is good.

[0049] like Figure 7 As shown in the figure, the solid line represents the true value, the dotted line represents the predicted value, and the solid square represents the error value. The numbers represent the true values. It can be seen from the figure that the prediction effect is good.

[0050] The present invention adopts an MOE model based on an attention mechanism, which can improve the expression ability and prediction accuracy of the model when predicting battery SOH, improve the robustness and generalization ability of the overall model, and reduce the risk of overfitting; the MOE model of the present invention is combined by multiple expert sub-models, each expert sub-model focuses on different aspects of the data, thereby improving the expression ability and prediction accuracy of the overall model; the present invention adopts an attention mechanism to enable the MOE model to better capture the important parts of the features, which is very effective in improving the prediction accuracy of the model; the present invention reduces the overfitting risk of a single model through the combination of multiple expert sub-models and a gated network model as well as dynamic adjustment of the attention mechanism, thereby improving the robustness and generalization ability of the overall model.

[0051] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent replacement and improvement made to the above embodiments without departing from the content of the technical solution of the present invention, based on the technical essence of the present invention, within the spirit and principles of the present invention, still fall within the protection scope of the technical solution of the present invention.

Claims

1. A battery SOH prediction method based on the attention mechanism MOE model, characterized in that The following steps are involved: S1. Test and collect battery current, voltage, temperature and capacity data; S2. Construct an MOE model based on the attention mechanism. The MOE model based on the attention mechanism includes multiple expert sub-models, a gating network model and an attention mechanism calculation layer; S3, training and verifying the MOE model based on the attention mechanism; S4. Predicting battery SOH. After the MOE model based on the attention mechanism is trained, the trained model is deployed on the premise that the model effect is good, and the deployed model is used to predict the battery SOH.

2. According to claim 1, a battery SOH prediction method based on the attention mechanism MOE model is characterized in that: The step S1 is specifically as follows: Current collection: BMS detects the total current at the battery pack connection end using a Hall sensor or a high-precision sampling resistor; Voltage collection: BMS detects the voltage of each battery cell through the battery isolation circuit, thereby obtaining the voltage information of the entire battery pack; Temperature collection: BMS sets temperature sensors at the battery pack connection end and / or battery cell to detect the operating temperature of the battery; Capacity collection: BMS counts the ampere-hours of battery charging and discharging, and calculates the battery's charge and discharge capacity based on the battery voltage change curve.

3. According to claim 1, a battery SOH prediction method based on the attention mechanism MOE model is characterized in that: In step S2, the number of expert sub-models is 3, each of which is an MLP model. Each expert sub-model includes an expert sub-model input layer, a first expert sub-model middle layer, a second expert sub-model middle layer and an expert sub-model output layer. The expert sub-model input layer receives input battery current, voltage, temperature and capacity data, the dimension of the first expert sub-model middle layer is 64, the dimension of the second expert sub-model middle layer is 32, and the expert sub-model output layer outputs a 16-dimensional vector.

4. According to claim 3, a battery SOH prediction method based on the attention mechanism MOE model is characterized in that: In the step S2, the gated network model adopts a multi-layer perceptron model, and the gated network model includes a gated network model input layer, a gated network model middle layer and a gated network model output layer. The gated network model input layer receives input battery current, voltage, temperature and capacity data, the dimension of the gated network model middle layer is 32, the activation function is the relu function, the gated network model output layer outputs a 3D vector, the activation function is softmax, and the 3D vectors output by the gated network model output layer correspond to the weights of the three expert sub-models respectively, and the sum of the weights of the three expert sub-models is 1.

5. According to claim 4, a battery SOH prediction method based on the attention mechanism MOE model is characterized in that: The outputs of the three expert sub-models are output1, output2, and output3, respectively. Output1, output2, and output3 are all high-dimensional vectors, representing the feature representation of each sub-expert model for the input data. The feature representation output by the three expert sub-models is weighted summed with the weights of the three expert sub-models output by the gating network to obtain the comprehensive features; Afterwards, the comprehensive features are connected to an attention mechanism calculation layer.

6. According to claim 5, a battery SOH prediction method based on the attention mechanism MOE model is characterized in that: The query vector, key vector and value vector in the attention mechanism calculation layer are all 16-dimensional vectors, and the output of the attention mechanism calculation layer is a 16-dimensional vector.

7. The battery SOH prediction method based on the attention mechanism MOE model according to claim 6 is characterized in that: The calculation process of the attention mechanism calculation layer is: Step 1: Calculate the attention score; First, calculate the similarity between each query vector and all key vectors: attention_score i =query·key i Among them, attention_score i is the i-th attention score, query is the query vector, key i is the i-th key vector; Step 2: Calculate attention weight; The obtained attention score is converted into a probability form through the softmax function, which is called the attention weight: attention_weights=softmax(attention_scores)= ; Among them, attention_weights is the attention weight, attention_scores is the attention score, softmax() is the softmax function, the softmax function ensures that all weights add up to 1, and attention_score i is the i-th attention score, attention_score j is the jth attention score; Step 3: Calculate the weighted value Multiply each value by its corresponding attention weight and add the results to get the final attention output: ; Among them, attention_output is the attention output, attention_weight i is the i-th attention weight, value i is the i-th value vector; The comprehensive features are used as the input data of the attention mechanism calculation layer to obtain the attention output.

8. The battery SOH prediction method based on the attention mechanism MOE model according to claim 1 is characterized in that: The step S3 is specifically as follows: implementing the MOE model code based on the attention mechanism on the Keras platform and training it, with the number of training epochs=100, the number of batch samples batch_size=32, the optimizer for model training using the adam algorithm, and the loss function being the mean square error; the training data is divided into a training set and a test set in a ratio of 8:2, the model is trained on the training set, and the model is verified on the test set.

Citation Information

Patent Citations

  • Lithium battery SOH estimation method of hybrid deep network fusing attention mechanism

    CN115684973A

  • Battery RUL prediction method based on Transform combination model

    CN117347866A

  • Lithium ion battery degradation track and residual life prediction method, medium and equipment

    CN118294840A

  • SOH prediction method based on MOE model and current, voltage and temperature of battery

    CN118584357A

  • Method for predicting RUL based on MOE model and current resistance impedance of battery

    CN118625152A