A power battery fault detection method based on MSFD
By using multi-scale comparison learning and Transformer's MSFD network model in power battery fault detection, combined with comparison learning and data enhancement, the shortcomings of fault detection under noise interference in the existing technology are solved, and a more accurate and generalized fault detection effect is achieved.
Patent Information
- Application Number
- CN202410599208.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-05-15
AI Technical Summary
Existing power battery fault detection methods are difficult to accurately detect faults under noise interference, especially in time series data, and the model generalization ability is insufficient, which can easily lead to overfitting.
The MSFD network model based on multi-scale contrast learning and Transformer is adopted. By combining contrast learning with data enhancement methods, noise interference is overcome, model generalization ability is improved, and the powerful feature extraction ability of Transformer is used to obtain the time pattern correlation in the time series and the correlation between different feature dimensions.
It realizes more accurate fault detection in power battery fault detection, overcomes the shortcomings of traditional models in feature extraction and noise processing, and improves the generalization ability and detection accuracy of the model.
Smart Images

Figure CN118625164B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power battery management, and in particular to a power battery fault detection method based on MSFD. Background Art
[0002] With the rapid development of the new energy industry, power batteries as energy storage devices are one of the key components of electric vehicles and energy storage power stations. The stability of power batteries is directly related to the safety and reliability of the entire vehicle and energy storage power station. However, the working conditions of power batteries are complex. The battery system will generate a lot of heat during operation, which may cause various internal and external faults, leading to performance problems and potential serious consequences, such as thermal runaway, fire or explosion, causing irreversible harm. Therefore, it is very important to perform fault detection on power batteries.
[0003] Existing power battery fault detection can be divided into two categories: model-based methods and data-driven methods. Model-based methods use the electrochemical process inside the battery to establish a mathematical model to identify possible faults. However, due to the complexity of the internal reaction of the battery, the actual working conditions of the model may change with time and environment. Therefore, it is difficult to build a high-precision model and it is difficult to process nonlinear and non-uniform data. As a black box model, the data-driven method does not need to establish an electrochemical mathematical model inside the battery. It builds a fault representation model through historical operation data. Among them, deep neural network models are widely used because of their superior feature representation ability and good generalization. Deep neural network models perform fault detection by learning the normal feature patterns of historical data. However, there is often noise interference in time series data, because there are always some potential abnormal points hidden between a large number of normal points, so the model cannot learn the normal time pattern characteristics well, weakening the generalization ability and easily leading to the problem of overfitting of the model. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and propose a power battery fault detection method based on MSFD, a new fault detection network (Multi-Scale Transformer With Contrastive Learning For Fault Detection, MSFD) model based on contrastive learning and Transformer for fault detection. By combining contrastive learning with data enhancement methods, the noise interference in historical data is overcome and the generalization ability of the model is improved. The powerful feature extraction ability of transformer is used to obtain the correlation between time pattern associations and different feature dimensions in the time series, such as voltage, current, and temperature. Ultimately, accurate power battery fault detection is achieved.
[0005] In order to solve the above technical problems, the technical solution of the present invention is:
[0006] A power battery fault detection method based on MSFD comprises the following steps:
[0007] S1. Collect power battery data and preprocess it, and make the preprocessed data into training data set, verification data set and test data set. The collected data includes voltage, current and temperature of the power battery system.
[0008] S2. Construct an MSFD network model by a multi-scale contrastive learning transformer feature extraction network and a feature fusion network. The multi-scale contrastive learning transformer feature extraction network is composed of a data enhancement layer and two parallel multi-scale contrastive learning feature extraction modules in serial order, respectively extracting intra-patch features and inter-patch features, and each multi-scale contrastive learning feature extraction module is composed of a multi-scale patch segmentation layer and a transformer encoder. The feature fusion network is composed of a feature fusion layer and a fully connected layer in serial order.
[0009] S3. Through multi-scale contrast learning transformer feature extraction network, feature extraction is performed on the preprocessed data samples to obtain accurate feature representation.
[0010] S4. Through the feature fusion network, the extracted feature representation is decoded and the reconstruction result is output.
[0011] S5. Use data containing only normal working conditions as training data sets, train the MSFD network model through comparison loss and reconstruction loss, input data sets that may contain abnormal data into the trained MSFD network model for fault detection, divide the fault threshold according to the reconstruction error, and the reconstruction error exceeding the fault threshold is considered a fault.
[0012] Preferably, in step S1, the battery data is collected by placing a sensor at the power battery system end to obtain the power battery system voltage, current and temperature data of a discharge cycle under different working conditions of the power battery.
[0013] Preferably, the method for preprocessing the battery data collected in step S1 is:
[0014] The collected battery data samples After normalization, T and M represent the length of the sample and the number of features, respectively.
[0015] Use the windowing operation to divide the normalized samples into samples of the same length in the time dimension. The sliding window size is L.
[0016] Preferably, in step S1, the preprocessed data is made into a data set, and the data set is divided into three subsets: a training set, a validation set and a test set, wherein the training set is used for model training, the validation set is used for model parameter adjustment and fault threshold selection, and the test set is used to verify the final fault detection performance.
[0017] Preferably, the specific process of step S3 is:
[0018] S3-1. For the preprocessed sample X input Through the data enhancement layer, the data enhancement operation is obtained
[0019]
[0020] Where L represents the time window length, M represents the number of features, and RandomMask(·) represents the random mask module. input A time dimension or feature dimension of is randomly masked.
[0021] S3-2. For sample X input and Perform patch block operation to obtain P = {P 1 ,P 1 ,…,P N}and in S represents the length of the patch block, and N=L / S represents the number of patch blocks.
[0022] S3-3. Data after patch segmentation through transformer encoder and Feature extraction is performed between patches and within patches respectively.
[0023] Preferably, the step S3-3 includes the following sub-steps:
[0024] S3-3-1. First, and Preprocessing is performed before feature extraction. For inter-patch features, we perform dimensionality reduction and feature embedding operations on the input to obtain input features and For the features within the patch, we perform dimensionality reduction and feature embedding operations on the input to obtain the input features and Where dmodel represents the feature dimension.
[0025] S3-3-2. Use the transformer’s self-attention mechanism to focus on the input feature P intra , P inter , and Perform feature extraction to obtain the output feature X of the attention mechanism within the patch intra , And the inter-patch attention mechanism output feature X inter ,
[0026] S3-3-3. Perform residual connection and normalization on the input features and the output features of the attention mechanism to obtain features and P intra With X intra For example, the expression is as follows:
[0027]
[0028] Where Norm(·) represents the normalization operation, and Add(·) represents the residual connection operation.
[0029] S3-3-4. Output features for different patch sizes Perform weighted summation to obtain the final multi-scale fusion output features and by For example, the expression is as follows:
[0030]
[0031] in represents the inter-patch feature output under different patch sizes, represents the learnable feature weights.
[0032] S3-3-5. Output characteristics and Perform contrastive learning and obtain contrastive learning loss
[0033] Preferably, the step S4 includes the following sub-steps:
[0034] S4-1. Features within the patch and inter-patch features Linear transformation and upsampling are performed respectively to keep the dimensions of the two features consistent, and U intra , The expression is as follows:
[0035]
[0036]
[0037] in represents the learnable weight matrix, represents the learnable bias vector, S′=S×M, N′=N×M, Transpose(·,0,1) represents the dimension exchange operation, which exchanges the first dimension of the variable with the second dimension, and Upsampling(·) represents the upsampling operation, which increases the dimension of the variable.
[0038] S4-2. After feature fusion, reconstruction and dimensionality reduction are performed through the fully connected layer and the activation layer to obtain the reconstructed output The expression is as follows:
[0039]
[0040] Among them, MLP (·) represents the fully connected layer, Sigmoid (·) represents the activation layer, and the final reconstructed output is obtained by mapping and reconstructing the features.
[0041] Preferably, the hyperparameters of the MSFD neural network model constructed in step S2 are determined by a cross-validation method, specifically including sliding window size, patch block size, embedding dimension dmodel size and batch size.
[0042] The present invention has the following characteristics and beneficial effects:
[0043] By adopting the above technical solution, the present invention uses a multi-scale contrastive learning transformer to extract time patterns and features from the time series data in the power battery system, and uses a feature fusion network to perform multi-scale fusion and decoding on the extracted feature representation. Through the method based on the new MSFD network, the disadvantage of the traditional model that it cannot construct an accurate feature model when extracting feature information in the battery system is overcome. Through the multi-scale contrastive learning method, the noise interference in the data is effectively overcome, and an accurate feature representation is constructed. The patch-based input structure allows the transformer to comprehensively extract the global and local time series features of the battery system. It helps to detect faults in the power battery in a timely and accurate manner, and provides protection for the safe use of the power battery on the vehicle side and in the energy storage power station. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0045] Figure 1 A framework diagram of a power battery fault detection method based on MSFD according to an embodiment of the present invention;
[0046] Figure 2 Schematic diagram of the MSFD network structure in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The present invention provides a power battery fault detection method based on MSFD, such as Figure 1 As shown, the following steps are included:
[0048] Step (1): Power battery system data collection and preprocessing.
[0049] The collected original samples of power battery system Through normalization processing, the original samples of the battery system include historical time series data such as voltage, current, and temperature. The normalized expression is:
[0050]
[0051] in, represents the normalized sample, X min and X max Represent the minimum and maximum values in the feature dimension, X ori represents the original sample, T and M represent the length and number of features of the sample respectively.
[0052] In order to ensure the robustness and generalization ability of the model in the fault detection process, the normalized samples are divided into samples of the same length in the time dimension using the window operation. The sliding window size is L.
[0053] Step (2) extracts features based on multi-scale contrastive learning transformer, such as Figure 2 As shown in the figure, the multi-scale contrastive learning transformer feature extraction network consists of a data enhancement layer and two parallel multi-scale contrastive learning feature extraction modules in serial order, which extract intra-patch features and inter-patch features respectively. Each multi-scale contrastive learning feature extraction module consists of a multi-scale patch segmentation layer and a transformer encoder. Specifically:
[0054] First, the sample X after normalization and windowing operation input Perform data enhancement operations to obtain
[0055]
[0056] Where L represents the time window length, M represents the number of features, and RandomMask(·) represents the random mask module. input The model randomly masks a certain time dimension or feature dimension and sets the data of that dimension to zero. Through contrastive learning, the model is prompted to extract the normal time pattern features of the essence of the time series during the learning process.
[0057] For sample X input and Perform patch block operation to obtain P = {P 1 ,P 1 ,…,P N}and in S represents the patch block length, and N=L / S represents the number of patches. By learning the features of various patch block lengths and performing multi-scale modeling, the model can fully acquire the time pattern and perform more accurate fault detection.
[0058] The data after patch block is processed by transformer encoder and Perform feature extraction between patches and within patches.
[0059] First, and Preprocessing is performed before feature extraction. For inter-patch features, we perform dimensionality reduction and feature embedding operations on the input to obtain input features and For the features within the patch, we perform dimensionality reduction and feature embedding operations on the input to obtain the input features and Where dmodel represents the feature dimension.
[0060] Use the transformer’s self-attention mechanism to input feature P intra , P inter , and Perform feature extraction to obtain the output feature X of the attention mechanism within the patch intra , And the inter-patch attention mechanism output feature X inter , Pintra Take the feature extraction of as an example, the expression is as follows:
[0061] Q=W Q P intra ,K=W K P intra ,V=W V P intra
[0062]
[0063] in, They represent the three learnable parameters in the attention mechanism, Query (Q), Key (K) and Value (V), respectively. They represent the learnable parameter matrices of Q, K, and V respectively, dmodel represents the feature dimension, and softmax(·) represents the normalized weight function.
[0064] Perform residual connection and normalization on the input features and the output features of the attention mechanism to obtain features and P intra With X intra For example, the expression is as follows:
[0065]
[0066] Where Norm(·) represents the normalization operation, and Add(·) represents the residual connection operation.
[0067] Output features for different patch sizes Perform weighted summation to obtain the final multi-scale fusion output features and by For example, the expression is as follows:
[0068]
[0069] in represents the inter-patch feature output under different patch sizes, Represents learnable feature weights. Through multi-scale fusion, the model can learn temporal patterns at different feature scales, obtain richer feature representations, and improve the model's generalization ability.
[0070] For output features and Perform contrastive learning and obtain contrastive learning loss By optimizing the model parameters through contrastive learning loss, the model learning process is guided to pay more attention to normal time patterns, reduce the interference of abnormal noise in the data, and improve the generalization performance of the model. The contrastive learning loss expression is as follows:
[0071]
[0072]
[0073] Loss contra =Loss inter +Loss intra
[0074] The initial input sample X input and After two multi-scale contrastive learning feature extraction modules, we obtain a
[0075] Step (3): Construct a feature fusion network based on the linear decoding layer, decode the extracted time series pattern feature representation, and output the reconstruction result. The feature fusion network consists of a feature fusion layer and a fully connected layer. Specifically:
[0076] First, the features in the patch and inter-patch features Linear transformation and upsampling are performed respectively to keep the dimensions of the two features consistent, and U intra , The expression is as follows:
[0077]
[0078]
[0079] in represents the learnable weight matrix, represents the learnable bias vector, S′=S×M, N′=N×M, Transpose(·,0,1) represents the dimension exchange operation, which exchanges the first dimension of the variable with the second dimension, and Upsampling(·) represents the upsampling operation, which increases the dimension of the variable.
[0080] After the features are fused, the reconstruction and dimensionality reduction operations are performed through the fully connected layer and the activation layer to obtain the reconstructed output The expression is as follows:
[0081]
[0082] Among them, MLP (·) represents the fully connected layer, Sigmoid (·) represents the activation layer, and the final reconstructed output of the battery system time series data is obtained by mapping and reconstructing the features. By fusing inter-patch and intra-patch feature representations, global time-dependent features can be combined with local details to accurately reconstruct time series and achieve accurate fault detection;
[0083] Step (4) Power battery fault detection method based on MSFD.
[0084] First, determine the hyperparameters of the MSFD network model. The cross-validation method is used to determine the network hyperparameters, including the sliding window size, patch block size, embedding dimension dmodel size, and batch size.
[0085] The data is divided into three dataset subsets: training set, validation set and test set. The training set is used for model training, the validation set is used for model parameter adjustment and fault threshold selection, and the test set is used to verify the final fault detection performance.
[0086] For fault detection, the voltage, current, and temperature time series data in the data set are selected as input, and the feature mapping output is reconstructed through the neural network, and the reconstruction error is calculated:
[0087]
[0088] Among them, X, Represent the original input and reconstructed output of the model respectively, Represents reconstruction error. For fault detection, data containing only normal working conditions is used as the training data set. The MSFD network model is trained by comparing the loss and reconstruction loss. The validation set is used to adjust the model hyperparameters and select the fault threshold. Finally, the data set containing abnormal data is input into the trained model for fault detection. According to the comparison between the reconstruction error and the fault threshold, the data exceeding the fault threshold is considered a fault.
[0089] Step (5) The present invention conducts a control experiment on the multi-dimensional time series fault detection effect on the public data set SWaT data set. The comparison method uses the traditional machine learning method OC-SVM, and the test results are shown in Table 1 below:
[0090] Table 1
[0091] Detection Model Precision(%) Recall(%) F-score(%) OC-SVM 45.39 49.22 47.23 The present invention 93.02 98.39 95.63
[0092] Among them, Precision, Recall, and F-score are fault detection accuracy, recall rate, and F1 score, respectively, reflecting the accuracy and performance of the model for fault detection. As can be seen from Table 1, the power battery fault detection method based on MSFD proposed in the present invention can have good accuracy and detection performance in the power battery fault detection task.
[0093] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments including components are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.
Claims
1. A power battery fault detection method based on MSFD, characterized in that: The steps include: S1. Collect power battery data and perform preprocessing, and divide the preprocessed data into data sets; the battery data collection process is: arrange sensors at the power battery system end to obtain the voltage, current, and temperature data of the power battery system under a discharge cycle under different working conditions of the power battery; The preprocessing is: collecting the battery data samples Through normalization processing, T and M represent the length and number of features of the sample respectively. The normalized sample is divided into samples of the same length in the time dimension using the window operation. The sliding window size is L; S2, construct the MSFD network model by using a multi-scale contrastive learning transformer feature extraction network and a feature fusion network; The multi-scale contrastive learning transformer feature extraction network is composed of a data enhancement layer and two parallel multi-scale contrastive learning feature extraction modules in serial order, respectively extracting intra-patch features and inter-patch features, and each multi-scale contrastive learning feature extraction module is composed of a multi-scale patch segmentation layer and a transformer encoder; The feature fusion network is composed of a feature fusion layer and a fully connected layer in serial order; S3, extract features from the preprocessed data samples through multi-scale contrast learning transformer feature extraction network to obtain feature representation; The specific process is: S3-1. For the preprocessed sample X input Through the data enhancement layer, the data enhancement operation is performed, and the Where M represents the number of features, RandomMask(·) represents the random mask module, and input Randomly mask a certain time dimension or feature dimension; S3-2. For sample X input and Perform patch block operation to obtain P = {P 1 ,P 1 ,…,P N }and in S represents the length of the patch block, and N=L / S represents the number of patch blocks; S3-3. Data after patch segmentation through transformer encoder and Perform feature extraction between patches and within patches respectively; the specific process is as follows: S3-3-1. and Preprocessing is performed. For inter-patch features, the input is dimensionally reduced and feature embedded to obtain input features. and For the features within the patch, the input is reduced in dimension and feature embedded to obtain the input features and Where dmodel represents the feature dimension; S3-3-2. Use the transformer self-attention mechanism to focus on the input feature P intra , P inter , and Perform feature extraction to obtain the output features of the attention mechanism within the patch And the output features of the inter-patch attention mechanism S3-3-3. Perform residual connection and normalization on the input features and the output features of the attention mechanism to obtain features and S3-3-4. Output features for different patch sizes Perform weighted summation to obtain the final multi-scale fusion output features and S3-3-5. Output characteristics and Perform contrastive learning and obtain contrastive learning loss S4, decode the extracted feature representation through the feature fusion network and output the reconstruction result; S5. Use data containing only normal working conditions as the training data set, train the MSFD network model through comparison loss and reconstruction loss, input the data set containing abnormal data into the trained MSFD network model, divide the fault threshold according to the reconstruction error, and the reconstruction error exceeding the fault threshold is considered a fault.
2. The power battery fault detection method based on MSFD according to claim 1 is characterized in that: The specific process of step S4 is as follows: S4-1. Features within the patch and inter-patch features Linear transformation and upsampling are performed respectively to keep the dimensions of the two features consistent, and we get The expression is as follows: in represents the learnable weight matrix, represents the learnable bias vector, S′=S×M, N′=N×M, Transpose(·,0,1) represents a dimension swap operation, swapping the first dimension of a variable with the second dimension. Upsampling(·) represents the upsampling operation, which increases the dimension of the variable; S4-2. After feature fusion, reconstruction and dimensionality reduction are performed through the fully connected layer and the activation layer to obtain the reconstructed output The expression is as follows: Among them, MLP (·) represents the fully connected layer, Sigmoid (·) represents the activation layer, and the final reconstructed output is obtained by mapping and reconstructing the features.
Citation Information
Patent Citations
Gas turbine fault diagnosis method based on improved Transform
CN116127720A