A method for abnormal detection of the state of health of power batteries based on machine learning
Through the MtsNet abnormality detection model, the diversification and nonlinear strong coupling of the health status data of power batteries in the existing technology are solved, and efficient detection of early degradation and sudden abnormalities of the battery is achieved, which improves the accuracy and generalization ability of the detection.
Patent Information
- Application Number
- CN202510605883.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-05-12
AI Technical Summary
When facing diversified, nonlinear and strongly coupled battery health status data, the existing power battery abnormality detection methods have poor generalization capabilities and are difficult to adapt to complex and changeable working conditions, and cannot effectively capture the weak characteristics and sudden or concealed abnormalities of early battery degradation.
The MtsNet abnormality detection model is adopted, including the slurred response time modeling module, the variable relationship learning module and the abnormality detection module. The dynamic mode is processed through the slurred response time modeling, the variable relationship learning is used to deal with dynamic coupling problems, and the abnormality score is integrated through the abnormality detection module to obtain the abnormality score of the power battery health status.
It improves the accuracy and generalization ability of the abnormal detection of health status of power batteries, can respond keenly to nonlinear and sudden state transfer behaviors, and enhances the ability to detect weak characteristics and hidden abnormalities.
Smart Images

Figure CN120142955B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of anomaly detection, and specifically relates to a method for detecting anomalies in the health status of a power battery based on machine learning. Background Art
[0002] With the development of new energy vehicles, power batteries, as core components, have a significant impact on the safety, reliability, and user experience of the entire vehicle. However, in actual operation, battery systems are subject to a variety of complex factors, such as temperature fluctuations and charge and discharge frequency, which can lead to gradual performance degradation and even safety accidents. Research on real-time battery health status monitoring and anomaly detection is of great practical significance. On the one hand, it can identify potential failure risks in advance, enabling early warning and optimizing operations and maintenance; on the other hand, it also provides technical support for extending battery life and improving energy efficiency. Traditional physics-based modeling methods have gradually exposed their shortcomings due to their difficulty adapting to the diverse, nonlinear, and strongly coupled characteristics of batteries.
[0003] Currently, common battery anomaly detection methods mainly include model-driven methods and signal processing methods. Model-driven methods estimate the health status by establishing an electrochemical or equivalent circuit model of the battery and combining it with actual operating data; signal processing methods focus on extracting characteristic indicators from sensor data such as voltage and determining anomalies. Such methods generally have problems such as poor generalization ability, sensitivity to environmental changes, and the need for a large amount of domain knowledge to participate in modeling, making them difficult to adapt to complex and changing operating conditions. In addition, traditional methods usually rely on manually set thresholds or rules, which cannot effectively capture the subtle characteristics of early battery degradation and have limited detection capabilities for sudden or hidden anomalies.
[0004] Machine learning technology, with its powerful data modeling and feature learning capabilities, has garnered widespread attention in recent years for power battery status monitoring and anomaly identification. By mining historical operating data, machine learning algorithms can automatically extract underlying patterns, enabling anomaly detection without the need for manually set rules. For example, support vector machines and random forests can perform classification and prediction based on labeled fault data. In scenarios where anomaly labels are lacking, semi-supervised or unsupervised methods such as autoencoders, isolation forests, and clustering algorithms can also effectively capture anomalous behavior. Furthermore, incorporating deep learning frameworks enhances the modeling capabilities of time series data. Currently, machine learning-based battery anomaly detection methods demonstrate advantages in accuracy and generalization. Summary of the Invention
[0005] The present invention provides a method for detecting abnormalities in the health status of power batteries based on machine learning. Aiming at diversified, nonlinear and strongly coupled battery health status data, an MtsNet anomaly detection model is proposed. The model consists of a perturbation response time modeling module, a variable relationship learning module and an anomaly detection module.
[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose specifically includes the following steps:
[0007] S1. Collect power battery health status data and pre-process the collected data;
[0008] S2, normalize the preprocessed data and divide the data set;
[0009] S3. Build a perturbation response time modeling module to process dynamic patterns in the data. The specific steps are as follows:
[0010] S31. Input the normalized power battery health status data sequence , construct the disturbance window;
[0011] S32. Perform linear response modeling and design dynamic dissipative drive weighting strategy , calculate the linear response term ;
[0012] S33, conduct second-order nonlinear perturbation modeling and propose a multi-order trajectory nonlinear weight strategy , calculate the second-order nonlinear disturbance term , fusion and Get response estimates and calculate nonlinear interaction residual scores ;
[0013] S4. Construct a variable relationship learning module to handle the dynamic coupling problem of data. The specific steps are as follows:
[0014] S41. Input a subsequence of the normalized power battery health status data sequence Perform 1D dilated convolution operation, calculate non-uniform frequency projection transformation, and propose a set of non-integer modulation frequencies , complex frequency representation is obtained through self-attention ;
[0015] S42, splitting the complex frequency representation into real and imaginary parts, and calculating the final interactively enhanced time domain features through residual connection and normalization methods;
[0016] S43. Construct a sine prototype matrix, calculate the minimum distance between its final interactively enhanced time domain feature and the sine prototype vector, and obtain the relationship deviation score ;
[0017] S5. Build an anomaly detection module to integrate the two deviation scores to obtain the final anomaly score .
[0018] Preferably, in S1, power battery health status data is collected, including cell-level monitoring parameters, system-level operating parameters, and environmental parameters. Cell-level monitoring parameters include voltage data, current data, and internal resistance change data. System-level operating parameters include cycle data, energy efficiency data, and fault code data. Environmental parameters include ambient temperature data and ambient humidity data. The mean of the power battery health status data is calculated to fill in missing values. The specific formula is:
[0019] ;
[0020] Where, is the mean of the fill, is the number of missing values, is a non-missing value.
[0021] Preferably, in S2, the pre-processed power battery health status data is normalized using a single vector, and the training set and the test set are divided proportionally. The specific formula is:
[0022] ;
[0023] Where, is the pre-processed power battery health status data, is the number of pre-processed power battery health status data, The first data, It is the normalized power battery health status data.
[0024] Preferably, the normalized power battery health status data sequence is input in S3 and S31. ,in is the power battery health status data at the current time point, For the number of variables of the power battery health status data, construct the disturbance window corresponding to the current time point, and define the length of the past time window as , each current time point The corresponding historical disturbance window is .
[0025] Preferably, the concept of "disturbance window" is introduced to construct a historical observation window centered on the current time point, and the normalized data is used to form a high-dimensional time series matrix to provide clear time series semantics for subsequent dynamic modeling, ensure the integrity and consistency of the modeling's dependence on history, and accurately focus on key historical fragments through the time window mechanism to improve the model's ability to characterize non-stationary signal disturbances.
[0026] Preferably, linear response modeling is performed in S3 and S32 to define the time point to The state difference is , represents the historical disturbance intensity, where is the power battery health status data at the current time point, Design a dynamic dissipative drive weight strategy for the number of variables in the power battery health status data , the specific formula is:
[0027] ;
[0028] Where, To traverse the variable dimensions of all power battery health status data, there are indivual, For the On each variable, the square of the disturbance intensity from the historical point to the current point of the power battery health status data represents the potential energy. The state difference is The components of the variable dimension of the power battery health status data, is the frequency of the sinusoidal oscillation, is the phase shift, and then the enhanced dissipated potential energy differential linear response weight is driven according to the historical points of the power battery health status data and the corresponding cycle , construct the weighted sum, the specific formula is:
[0029] ;
[0030] Where, is the length of the past time window, For historical moments Power battery health status data, For each current time point The corresponding historical disturbance window, is a linear response term.
[0031] Preferably, a cycle-driven enhanced dissipated potential energy differential linear response strategy is designed, and the historical disturbance intensity is embedded in the sinusoidal frequency modulation mechanism to simulate the physical dissipation process. The concept of "potential energy" is introduced into the battery state sequence modeling to enhance the recognition and weighting capabilities of periodic change patterns, so that the linear response term not only reflects the numerical change, but also includes the "phase-amplitude" dynamic weight modulation, thereby improving the physical rationality of the modeling and the prediction accuracy.
[0032] Preferably, the second-order nonlinear perturbation modeling is performed in S3 and S33, and a multi-order trajectory nonlinear weight strategy is proposed to measure the historical point pairs of any power battery health status data. The health status data of the power battery at the current time point The coupling strength is:
[0033] ;
[0034] Where, is the length of the past time window, 、 、 For historical moments 、 、 Power battery health status data, is the order, is an exponential function, is the square of the two norm, is a norm, To prevent division by zero, all 、 The specific formula is:
[0035] ;
[0036] Where, is the normalized nonlinear interaction weight of multi-order trajectories, is the dot product operation, For each current time point The corresponding historical disturbance window, is a second-order nonlinear disturbance term, performs time response estimation, and integrates linear response terms and the second-order nonlinear disturbance term , obtain the estimated value of the power battery health status data and calculate the nonlinear interaction residual score. The specific formula is:
[0037] ;
[0038] ;
[0039] Where, is the response estimate, Scoring nonlinear interaction bias.
[0040] Preferably, a multi-order trajectory nonlinear weight strategy is proposed, a coupling strength matrix is constructed through dot product operations, a two-norm and one-norm nested structure is introduced to construct nonlinear interaction terms, and linear and nonlinear responses are integrated for residual modeling to effectively capture nonlinear and sudden state transition behaviors, such as degradation mutations or complex fault co-evolution, so that the model not only relies on average behavior, but also can sensitively respond to "outliers" or "hidden risks".
[0041] Preferably, in said S4 and S41, a subsequence of the normalized power battery health status data sequence is input ,in, is the batch size, is the time step length, is the number of variables of the power battery health status data. A 1D dilated convolution operation is performed on the channel of each variable dimension. The specific formula is:
[0042] ;
[0043] Where, is the dilated convolution operation, is the void rate, and then a non-uniform frequency projection transformation is performed to propose a set of non-integer modulation frequencies , the specific formula for defining the non-uniform frequency projection transform is:
[0044] ;
[0045] ;
[0046] Where, 、 are the scaling factors for controlling the logarithmic frequency component and the scaling factors for controlling the square root frequency component, 、 is an integer index, indicating the The position of the frequency components, is the total number of frequency components used, is the result of the dilated convolution, is a non-resonant rotation basis function used to project the signal to a non-integer modulation frequency , is an imaginary unit, and self-attention is performed on the variable dimension on the non-uniform frequency projection transformation. The specific formula is:
[0047] ;
[0048] Where, is the activation function, is the transpose of the non-uniform frequency projection transform, is the complex frequency representation.
[0049] Preferably, the 1D dilated convolution and the frequency domain projection strategy of non-integer modulation frequency are combined to propose a non-resonant rotation basis function to map the time series signal to a non-uniform spectral space, and construct a complex frequency representation, giving the model the ability to represent frequencies across variable dimensions, so that it can still identify fine-grained modulation features in a high-dimensional state, improve the ability to model asynchronous coupling between variables, and lay the foundation for subsequent frequency domain interaction enhancement.
[0050] Preferably, in S4 and S42, the complex frequency representation is split into a real part and an imaginary part, and the specific formula is:
[0051] ;
[0052] Where, for The real part of for The imaginary part of is the imaginary unit, and then construct the real vector, is the complex frequency representation, and the specific formula is:
[0053] ;
[0054] Where, For the Samples, is the frequency spectrum vector of the power battery health status data variable, For the Samples, The power battery health status data variable represents the real part response of the channel at all complex frequencies. For the Samples, The imaginary part response of the power battery health status data variable on all complex frequency channels is mapped to the time domain representation through a shared linear mapping. The specific formula is:
[0055] ;
[0056] Where, is the shared linear mapping matrix, The power battery health state sequence is reconstructed from the complex frequency representation, and the reconstruction result is restored to the dimension to obtain the power battery health state sequence of the merged dimension ,in, is the batch size, is the time step length, and finally the residual connection and normalization method are used to obtain the final interactively enhanced time domain features. The specific formula is:
[0057] ;
[0058] Where, is the layer normalization operation, is a subsequence of the normalized power battery health status data sequence, It is the time domain feature after the final interaction enhancement.
[0059] Preferably, the complex frequency signal is split into real and imaginary parts, and a shared linear mapping matrix is introduced to realize the restoration from the frequency domain to the time domain. The residual connection and layer normalization are combined to perform interactive feature enhancement, thereby improving the availability and representation ability of frequency features, and achieving low-dimensional time domain alignment while maintaining the spectral information structure, effectively solving the "irreversible and uncontrollable" problems of traditional frequency domain mapping, and improving the model's adaptability to small frequency changes.
[0060] Preferably, the sinusoidal prototype matrix is constructed in S4 and S43, and the specific formula is:
[0061] ;
[0062] Where, is the first Rank The sine basis vectors of the column, is the time step length, is the number of variables in the power battery health status data. For each time step, the minimum distance between the final interactively enhanced time domain feature and the sinusoidal prototype vector is calculated. The specific formula is:
[0063] ;
[0064] Where, For the The sine basis vectors of the column, is the time step The corresponding final interactively enhanced time domain features, To return the minimum distance operation, Score the relationship deviance, is the two-norm.
[0065] Preferably, a sinusoidal prototype matrix is constructed as a template for the ideal variable response. The degree to which the actual features deviate from the prototype is evaluated through minimum distance calculation to form a "relationship deviation score" to measure the relative abnormality between variable behaviors. With the help of prototype vectors, pattern comparison of abnormal features is achieved, which not only captures absolute changes but also analyzes whether the behavioral trajectory is "derailed", thereby enhancing the detection and judgment capabilities of weak systematic anomalies.
[0066] Preferably, an anomaly detection module is constructed in S5 to integrate the two deviation scores and calculate the final power battery health status anomaly score of each time step by a weighted fusion method. The specific formula is:
[0067] ;
[0068] Where, Score the relationship deviance, Score the nonlinear interaction deviation, is the activation function, is the final abnormal score of the power battery health status.
[0069] Preferably, a deviation score fusion strategy is designed, combining the nonlinear interaction score in S3 and the relationship deviation score in S4, and regulating the weighting mechanism through the activation function to form an adaptive nonlinear fusion anomaly score, realizing the integrated decision of multi-source anomaly score, taking into account the stability of frequency domain modeling and the sensitivity of time domain response. This mechanism improves the model's coverage and response capabilities to different types of anomalies.
[0070] In summary, due to the adoption of the present technical solution, the beneficial effects of the present invention are as follows: the present invention proposes an MtsNet anomaly detection model, which is applied to the power battery health status anomaly detection scenario, including a perturbation response time modeling module, a variable relationship learning module and an anomaly detection module. The perturbation response time modeling module is used to process dynamic patterns in the data, the variable relationship learning module is used to process the dynamic coupling problem of the data, and the anomaly detection module is used to integrate the two deviation scores to obtain the final power battery health status anomaly score. The modules cooperate with each other to realize the anomaly detection of the power battery health status. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 This is a step-by-step diagram of a method for detecting abnormal health status of power batteries based on machine learning.
[0072] Figure 2 Block diagram for modeling perturbation response time.
[0073] Figure 3 Learning module graph for variable relationships.
[0074] Figure 4 This is the structure diagram of the MtsNet anomaly detection model.
[0075] Figure 5 This is the effect diagram of abnormal detection of power battery health status. DETAILED DESCRIPTION
[0076] The technical solutions 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 part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0077] See also Figure 1-Figure 5The present invention provides a technical solution: a method for detecting abnormal health status of a power battery based on machine learning, which constructs a perturbation response time modeling module for processing dynamic patterns in data, a variable relationship learning module for processing dynamic coupling problems of data, and an anomaly detection module for integrating two deviation scores to obtain the final abnormal health status score of the power battery. The specific steps are as follows: Figure 1 shown.
[0078] Construct the MtsNet anomaly detection model, its structure diagram is as follows Figure 4 As shown, the specific steps are:
[0079] S1. Collect power battery health status data and pre-process the collected data.
[0080] Furthermore, power battery health status data is collected, including cell-level monitoring parameters, system-level operating parameters, and environmental parameters. Cell-level monitoring parameters include voltage data, current data, and internal resistance change data; system-level operating parameters include cycle data, energy efficiency data, and fault code data; and environmental parameters include ambient temperature data and ambient humidity data. The mean of the power battery health status data is calculated to fill in missing values. The specific formula is:
[0081] ;
[0082] Where, is the mean of the fill, is the number of missing values, is a non-missing value.
[0083] S2. Normalize the preprocessed data and divide the data set.
[0084] Furthermore, the pre-processed power battery health status data is normalized using a single vector, and the training set and test set are divided into a ratio of 7:3. The specific formula is:
[0085] ;
[0086] Where, is the pre-processed power battery health status data, is the number of pre-processed power battery health status data, The first data, It is the normalized power battery health status data.
[0087] S31. Input the normalized power battery health status data sequence , construct the disturbance window.
[0088] Furthermore, a perturbation response time modeling module is constructed, such as Figure 2 As shown, the input normalized power battery health status data sequence ,in is the power battery health status data at the current time point, is the number of variables of the power battery health status data, which is initially set to 8. Construct the disturbance window corresponding to the current time point and define the length of the past time window as , initially set to 16, each current time point The corresponding historical disturbance window is , the implementation code of step S31 is:
[0089] #Build the disturbance window
[0090] def construct_perturbation_windows(data, window_length=10):
[0091] if isinstance(data, np.ndarray):
[0092] data = torch.tensor(data, dtype=torch.float32)
[0093] T, C = data.shape
[0094] L = window_length
[0095] # Initialize the perturbation window tensor
[0096] perturb_windows = torch.zeros((T, L, C), dtype=torch.float32)
[0097] for t in range(T):
[0098] if t <L:
[0099] # Boundary processing: use the first t+1 data for reflection filling
[0100] pad = data[0].repeat(L - t - 1, 1)
[0101] window = torch.cat([pad, data[0:t+1]], dim=0)
[0102] else:
[0103] window = data[t-L+1:t+1]
[0104] perturb_windows[t] = window
[0105] return perturb_windows.
[0106] S32. Perform linear response modeling and design dynamic dissipative drive weighting strategy , calculate the linear response term .
[0107] Furthermore, linear response modeling is performed to define the time points to The state difference is , represents the historical disturbance intensity, where is the power battery health status data at the current time point, The number of variables for the power battery health status data is initially set to 8, and a dynamic dissipation drive weight strategy is designed. , the specific formula is:
[0108] ;
[0109] Where, To traverse the variable dimensions of all power battery health status data, there are The initial setting is 8. For the On each variable, the square of the disturbance intensity from the historical point to the current point of the power battery health status data represents the potential energy. The state difference is The components of the variable dimension of the power battery health status data, is the frequency of the sinusoidal oscillation, is the phase shift, and then the enhanced dissipated potential energy differential linear response weight is driven according to the historical points of the power battery health status data and the corresponding cycle , construct the weighted sum, the specific formula is:
[0110] ;
[0111] Where, is the length of the past time window, initially set to 16. For historical moments Power battery health status data, For each current time point The corresponding historical disturbance window, For a linear response term, the implementation code for step S32 is:
[0112] # Initialize the linear response model
[0113] class LinearResponseModel(torch.nn.Module):
[0114] def __init__(self, input_dim, window_length):
[0115] super(LinearResponseModel, self).__init__()
[0116] self.C = input_dim
[0117] self.L = window_length
[0118] # Learnable sine frequency and phase parameters
[0119] self.omega = torch.nn.Parameter(torch.rand(self.C)) # shape:[C]
[0120] self.theta = torch.nn.Parameter(torch.rand(self.C)) # shape:[C]
[0121] def forward(self, x, perturb_windows):
[0122] T, L, C = perturb_windows.shape
[0123] assert C == self.C
[0124] # Expand the current state to broadcast [T, 1, C]
[0125] x_current = x.unsqueeze(1).expand(-1, L, -1)
[0126] # State difference Δx_{t,l,c}
[0127] delta_x = x_current - perturb_windows
[0128] phi = delta_x ** 2
[0129] # Construct sin(ω_c * l + θ_c)
[0130] l_indices = torch.arange(1, L + 1, dtype=torch.float32).unsqueeze(1)
[0131] omega_theta = self.omega * l_indices.T + self.theta
[0132] sin_component = torch.sin(omega_theta)
[0133] # Expand the shape to multiply with phi
[0134] sin_component = sin_component.unsqueeze(0)
[0135] weights = phi * sin_component
[0136] # Weighted sum: multiply each weight by x_{tl,c}
[0137] response = weights * perturb_windows
[0138] response_sum = response.sum(dim=[1, 2])
[0139] return response_sum.
[0140] S33, conduct second-order nonlinear perturbation modeling and propose a multi-order trajectory nonlinear weight strategy , calculate the second-order nonlinear disturbance term , fusion and Get response estimates and calculate nonlinear interaction residual scores .
[0141] Furthermore, a second-order nonlinear disturbance model is conducted and a multi-order trajectory nonlinear weight strategy is proposed to measure the historical point pairs of any power battery health status data. The health status data of the power battery at the current time point The coupling strength is:
[0142] ;
[0143] Where, is the length of the past time window, initially set to 16. 、 、 For historical moments 、 、 Power battery health status data, is the order, initially set to 3, is an exponential function, is the square of the two norm, is a norm, To prevent division by zero, the constant is initially set to 0.1 and then remains constant for all subsequent 、 The specific formula is:
[0144] ;
[0145] Where, is the normalized nonlinear interaction weight of multi-order trajectories, is the dot product operation, For each current time point The corresponding historical disturbance window, is a second-order nonlinear disturbance term, performs time response estimation, and integrates linear response terms and the second-order nonlinear disturbance term , obtain the estimated value of the power battery health status data and calculate the nonlinear interaction residual score. The specific formula is:
[0146] ;
[0147] ;
[0148] Where, is the response estimate, For nonlinear interaction deviation scoring, the implementation code of step S33 is:
[0149] # Initialize the nonlinear perturbation modeling module
[0150] class NonlinearResponseModel(nn.Module):
[0151] def __init__(self, input_dim, window_length, max_order=3, epsilon=1e-6):
[0152] super(NonlinearResponseModel, self).__init__()
[0153] self.C = input_dim
[0154] self.L = window_length
[0155] self.K = max_order
[0156] self.epsilon = epsilon
[0157] # Learnable nonlinear exponential control parameter alpha
[0158] self.alpha = nn.Parameter(torch.tensor(0.1)) # Adjustable intensity control
[0159] def forward(self, x, perturb_windows, R_linear):
[0160] T, L, C = perturb_windows.shape
[0161] x_t = x.unsqueeze(1).expand(-1, L, -1)
[0162] # Nonlinear trajectory strength Ψ_{t,l}^{(k)} cumulative multiplication
[0163] product_weights = torch.ones((T, L), dtype=torch.float32)
[0164] for k in range(1, self.K + 1):
[0165] # 2-norm square term + 1-norm term
[0166] l2 = torch.norm(x_t - perturb_windows, dim=2, p=2) ** 2
[0167] l1 = torch.norm(x_t - perturb_windows, dim=2, p=1)
[0168] numerator = l2 + l1
[0169] denominator = torch.exp(-self.alpha * k) + self.epsilon
[0170] psi_k = numerator / denominator
[0171] product_weights *= psi_k # Multi-order trajectory weight multiplication
[0172] #Multi-order weights multiplied by the disturbance window generate nonlinear disturbance terms
[0173] W_expand = product_weights.unsqueeze(-1)
[0174] N_t = torch.sum(W_expand * perturb_windows, dim=1)
[0175] # Fusion linear response terms
[0176] R_linear_expand = R_linear.unsqueeze(-1)
[0177] response_estimate = N_t + R_linear_expand
[0178] # Non-linear interaction residual score
[0179] s_t = torch.norm(response_estimate - x, dim=1, p=2)
[0180] return s_t, response_estimate.
[0181] S41. Input a subsequence of the normalized power battery health status data sequence Perform 1D dilated convolution operation, calculate non-uniform frequency projection transformation, and propose a set of non-integer modulation frequencies , complex frequency representation is obtained through self-attention .
[0182] Furthermore, a variable relationship learning module is constructed, such as Figure 3 As shown, the subsequence of the normalized power battery health status data sequence is input ,in, is the batch size, initially set to 64, is the time step length, initially set to 24, The number of variables of the power battery health status data is initially set to 8. A 1D dilated convolution operation is performed on the channel of each variable dimension. The specific formula is:
[0183] ;
[0184] Where, is the dilated convolution operation, The hole rate is initially set to 3, and then a non-uniform frequency projection transformation is performed to propose a set of non-integer modulation frequencies , the specific formula for defining the non-uniform frequency projection transform is:
[0185] ;
[0186] ;
[0187] Where, 、 They are the scaling factors for controlling the logarithmic frequency component and the scaling factors for controlling the square root frequency component, and are initially set to 0.7 and 0.3. 、 is an integer index, indicating the The position of the frequency components, is the total number of frequency components used, is the result of the dilated convolution, is a non-resonant rotation basis function used to project the signal to a non-integer modulation frequency , It is an imaginary unit, initially set to 5, and self-attention is performed on the variable dimension on the non-uniform frequency projection transformation. The specific formula is:
[0188] ;
[0189] Where, is the activation function, is the transpose of the non-uniform frequency projection transform, For complex frequency representation, the implementation code of step S41 is:
[0190] #Non-uniform frequency dilated convolution + self-attention calculation of complex frequency representation
[0191] class NonUniformFrequencyAttention(nn.Module):
[0192] def __init__(self, input_dim, seq_len, freq_channels, dilation=2):
[0193] super(NonUniformFrequencyAttention, self).__init__()
[0194] self.C = input_dim
[0195] self.T = seq_len
[0196] self.F = freq_channels
[0197] self.dilation = dilation
[0198] self.embedding_dim = 64
[0199] # Dilated convolutional layer
[0200] self.conv = nn.Conv1d(in_channels=input_dim,
[0201] out_channels=input_dim,
[0202] kernel_size=3,
[0203] dilation=dilation,
[0204] padding=dilation)
[0205] # Learnable non-uniform frequency control parameters λ and η
[0206] self.lambda_param = nn.Parameter(torch.tensor(0.7))
[0207] self.eta_param = nn.Parameter(torch.tensor(0.3))
[0208] # QKV linear layer (complex real and imaginary parts shared linear mapping)
[0209] self.q_linear = nn.Linear(self.T, self.embedding_dim)
[0210] self.k_linear = nn.Linear(self.T, self.embedding_dim)
[0211] self.v_linear = nn.Linear(self.T, self.embedding_dim)
[0212] def build_complex_basis(self, t, f_idx):
[0213] log_term = self.lambda_param * torch.log1p(f_idx)
[0214] sqrt_term = self.eta_param * torch.sqrt(f_idx + 1e-5)
[0215] omega = log_term + sqrt_term
[0216] # Build e^{-jω t}
[0217] t = t.unsqueeze(0)
[0218] omega = omega.unsqueeze(1)
[0219] phase = omega * t
[0220] real = torch.cos(phase)
[0221] imag = -torch.sin(phase)
[0222] return torch.complex(real, imag)
[0223] def forward(self, x):
[0224] B, T, C = x.shape
[0225] assert C == self.C and T == self.T
[0226] # 1D dilated convolution: first reshape to [B, C, T]
[0227] x_conv = self.conv(x.permute(0, 2, 1))
[0228] x_conv = x_conv.permute(0, 2, 1)
[0229] # Projection to frequency domain: construct φ_f(t)
[0230] t = torch.arange(0, T).float().to(x.device)
[0231] f_idx = torch.arange(0, self.F).float().to(x.device)
[0232] basis = self.build_complex_basis(t, f_idx)
[0233] # Map the input to the complex frequency domain
[0234] x_freq_real = torch.einsum('btc,ft->bfc', x_conv.real,basis.real) - \
[0235] torch.einsum('btc,ft->bfc', x_conv.imag,basis.imag)
[0236] x_freq_imag = torch.einsum('btc,ft->bfc', x_conv.real,basis.imag) + \
[0237] torch.einsum('btc,ft->bfc', x_conv.imag,basis.real)
[0238] x_complex = torch.complex(x_freq_real, x_freq_imag)
[0239] # Flatten the complex number x_complex to do QKV attention
[0240] real_part = x_complex.real
[0241] q = self.q_linear(real_part)
[0242] k = self.k_linear(real_part)
[0243] v = self.v_linear(real_part)
[0244] # Attention score and output
[0245] attention_scores = torch.matmul(q, k.transpose(-1, -2)) / math.sqrt(self.embedding_dim)
[0246] attention_weights = F.softmax(attention_scores, dim=-1)
[0247] output = torch.matmul(attention_weights, v)
[0248] return output, x_complex # Attention enhanced output + original complex frequency domain representation.
[0249] S42. Split the complex frequency representation into real and imaginary parts, and calculate the final interactively enhanced time domain features through residual connection and normalization methods.
[0250] Furthermore, the complex frequency representation is split into real and imaginary parts. The specific formula is:
[0251] ;
[0252] Where, for The real part of for The imaginary part of is the imaginary unit, and then construct the real vector, It is a complex frequency representation, and the specific formula is:
[0253] ;
[0254] Where, For the Samples, is the frequency spectrum vector of the power battery health status data variable, For the Samples, The power battery health status data variable represents the real part response of the channel at all complex frequencies. For the Samples, The imaginary part response of the power battery health status data variable on all complex frequency channels is mapped to the time domain representation through a shared linear mapping. The specific formula is:
[0255] ;
[0256] Where, is the shared linear mapping matrix, The power battery health state sequence is reconstructed from the complex frequency representation, and the reconstruction result is restored to the dimension to obtain the power battery health state sequence of the merged dimension ,in, is the batch size, initially set to 64, is the time step length, which is initially set to 24. Finally, the residual connection and normalization method are used to obtain the final interactively enhanced time domain features. The specific formula is:
[0257] ;
[0258] Where, is the layer normalization operation, is a subsequence of the normalized power battery health status data sequence, The final interactively enhanced time domain feature, the implementation code of step S42 is:
[0259] #Frequency domain to time domain representation + residual normalization
[0260] class FrequencyToTimeDecoder(nn.Module):
[0261] def __init__(self, freq_channels, input_dim, time_steps):
[0262] super(FrequencyToTimeDecoder, self).__init__()
[0263] self.F = freq_channels
[0264] self.C = input_dim
[0265] self.T = time_steps
[0266] self.hidden_dim = 2 * self.C
[0267] # Spectrum vector mapping is a shared linear mapping matrix W_r in the time domain
[0268] self.projection = nn.Linear(self.hidden_dim, self.T)
[0269] # Residual and normalization module
[0270] self.layernorm = nn.LayerNorm(self.T)
[0271] def forward(self, x_complex, x_input):
[0272] B, F, C = x_complex.shape
[0273] T = self.T
[0274] assert C == self.C
[0275] # Split the real and imaginary parts
[0276] real = x_complex.real
[0277] imag = x_complex.imag
[0278] # Concatenate spectrum vectors: real || imag → [B, F, 2C]
[0279] freq_vector = torch.cat([real, imag], dim=-1)
[0280] # Shared mapping back to the time domain [B, F, T]
[0281] time_reconstruction = self.projection(freq_vector)
[0282] # Aggregate frequency channel information
[0283] time_merged = torch.mean(time_reconstruction, dim=1)
[0284] # Restore time dimension and channel structure
[0285] x_input_flat = torch.mean(x_input, dim=2)
[0286] fused = x_input_flat + time_merged # residual connection
[0287] normalized = self.layernorm(fused)
[0288] # Reconstruct to [B, T, C] for subsequent processing
[0289] enhanced = normalized.unsqueeze(-1).expand(-1, -1, C)
[0290] return enhanced.
[0291] S43. Construct a sine prototype matrix, calculate the minimum distance between its final interactively enhanced time domain feature and the sine prototype vector, and obtain the relationship deviation score .
[0292] Furthermore, a sinusoidal prototype matrix is constructed, and the specific formula is:
[0293] ;
[0294] Where, is the first Rank The sine basis vectors of the column, is the time step length, initially set to 24, is the number of variables of the power battery health status data, which is initially set to 8. For each time step, the minimum distance between the final interactively enhanced time domain feature and the sinusoidal prototype vector is calculated. The specific formula is:
[0295] ;
[0296] Where, For the The sine basis vectors of the column, is the time step The corresponding final interactively enhanced time domain features, To return the minimum distance operation, Score the relationship deviance, is the two-norm, and the implementation code of step S43 is:
[0297] #Build a sine prototype and calculate the relationship deviation score
[0298] class SinusoidPrototypeDistance(nn.Module):
[0299] def __init__(self, time_steps, input_dim, num_basis=None):
[0300] super(SinusoidPrototypeDistance, self).__init__()
[0301] self.T = time_steps
[0302] self.C = input_dim
[0303] self.P = num_basis if num_basis is not None else input_dim
[0304] # Learnable sine frequency and phase parameters
[0305] self.omega = nn.Parameter(torch.linspace(0.1, 1.0, self.P))
[0306] self.phi = nn.Parameter(torch.zeros(self.P))
[0307] # Optional linear transformation for feature matching
[0308] self.feature_mapper = nn.Linear(self.C, self.P)
[0309] def forward(self, enhanced_time_features):
[0310] B, T, C = enhanced_time_features.shape
[0311] assert C == self.C and T == self.T
[0312] # Step 1: Construct the sine prototype matrix [T, P]
[0313] t_idx = torch.arange(0, T, dtype=torch.float32).unsqueeze(1).to(enhanced_time_features.device)
[0314] omega = self.omega.unsqueeze(0)
[0315] phi = self.phi.unsqueeze(0)
[0316] S = torch.sin(omega * t_idx + phi)
[0317] # Step 2: Map the input to the same dimensions as the prototype [B, T, P]
[0318] projected = self.feature_mapper(enhanced_time_features)
[0319] # Step 3: Calculate the distance between each sample time step and all P prototypes [B, T, P]
[0320] S_expanded = S.unsqueeze(0).expand(B, -1, -1)
[0321] diff = projected - S_expanded
[0322] distance = torch.norm(diff, p=2, dim=2)
[0323] # Step 4: Take the minimum distance of all prototypes at each time step as the relationship deviation score
[0324] min_distance = torch.min(distance, dim=1).values
[0325] # Restore to a score tensor of [B, T]
[0326] return min_distance, distance, projected, S.
[0327] S5. Build an anomaly detection module to integrate the two deviation scores to obtain the final anomaly score .
[0328] Furthermore, an anomaly detection module is constructed to integrate the two deviation scores and calculate the final power battery health status anomaly score at each time step through a weighted fusion method. The specific formula is:
[0329] ;
[0330] Where, Score the relationship deviance, Score the nonlinear interaction deviation, is the activation function, The final power battery health status abnormality score, the implementation code of step S5 is:
[0331] #Anomaly score fusion module
[0332] class AnomalyScoringFusion(nn.Module):
[0333] def __init__(self, normalize=True, multi_scale=False):
[0334] super(AnomalyScoringFusion, self).__init__()
[0335] self.normalize = normalize
[0336] self.multi_scale = multi_scale
[0337] # Learnable fusion weights α, β and bias b
[0338] self.alpha = nn.Parameter(torch.tensor(1.0))
[0339] self.beta = nn.Parameter(torch.tensor(1.0))
[0340] self.bias = nn.Parameter(torch.tensor(0.0))
[0341] # Fusion Mapping Layer
[0342] self.fusion_mlp = nn.Sequential(
[0343] nn.Linear(1, 16),
[0344] nn.ReLU(),
[0345] nn.Linear(16, 1) )
[0347] def forward(self, nonlinear_score, relation_score):
[0348] B, T = nonlinear_score.shape
[0349] # Optional normalization
[0350] if self.normalize:
[0351] nonlinear_score = (nonlinear_score - nonlinear_score.mean(dim = 1, keepdim = True)) / \
[0352] (nonlinear_score.std(dim = 1, keepdim = True) + 1e - 6)
[0353] relation_score = (relation_score - relation_score.mean(dim = 1, keepdim = True)) / \
[0354] (relation_score.std(dim = 1, keepdim = True)+ 1e - 6)
[0355] # Weighted fusion
[0356] fused = self.alpha * nonlinear_score + self.beta * relation_score + self.bias
[0357] # Sigmoid activation + MLP non - linear mapping enhancement
[0358] fused_activated = torch.sigmoid(fused).unsqueeze(-1)
[0359] anomaly_score = self.fusion_mlp(fused_activated).squeeze(-1)
[0360] if self.multi_scale:
[0361] global_score = torch.mean(anomaly_score, dim=1)
[0362] return anomaly_score, global_score
[0363] else:
[0364] return anomaly_score.
[0365] Furthermore, the MtsNet anomaly detection model is written in Python. The experiment runs on the Windows operating system. Pytorch is selected as the framework in the CUDA11.27 environment. Training is performed on the GeForce RTX 3090. The optimizer is selected, the initial learning rate is set to 0.001, the training batch is set to 64, the training cycle is set to 100, and the dataset is 60 days of power battery health status related data, which is input into the MtsNet anomaly detection model after preprocessing.
[0366] Furthermore, the MtsNet anomaly detection model realizes the abnormal detection effect of power battery health status as shown in the figure Figure 5As shown in the figure, the performance of the MtsNet anomaly detection model in three key indicator dimensions, namely voltage, current and temperature. Each sub-graph uses time (h) as the horizontal axis to show the historical change trend of the dimension and mark the abnormal points determined by the model. The first figure is the power battery voltage change diagram. The curve is generally stable between 3.6V and 3.8V, but at about the 20th hour, there is a sharp abnormal point with a significant drop to below 2.5V. The model successfully marked this point as an abnormality, indicating that it can effectively identify transient mutation behaviors under the linear response and nonlinear interactive scoring mechanism, especially sudden drops caused by circuit breakers or short circuits; the second figure is the long-term current diagram of the power battery. Around the 50th hour, the current suddenly increased from the normal state of about 1.5A to 3.5A, forming a peak Abnormal points. This type of anomaly is often accompanied by problems such as load mutation, short-term overcharging or control strategy imbalance. The detection model accurately marks this point, indicating that it has good detection capabilities for local mutations in slow evolution, verifying the effectiveness of the multi-order trajectory nonlinear perturbation model; the third figure is a diagram of the temperature change of the power battery. The overall temperature remains in the range of 25-30°C, but there is a sudden temperature spike to about 45°C in the 80th hour. Such anomalies may be related to drastic changes in the external environment, overheating inside the battery cell, failure of the thermal management system, etc. This point is also judged as an abnormality by the model, indicating that the model can identify high-amplitude sparse sudden events from the frequency-time domain mapping enhancement features. Experimental results show that the MtsNet anomaly detection model performs well in detecting abnormalities in the health status of power batteries.
Claims
1. A method for detecting abnormal health status of power batteries based on machine learning, characterized in that: The following steps are involved: S1. Collect power battery health status data and pre-process the collected data; S2, normalize the preprocessed data and divide the data set; S3. Build a perturbation response time modeling module to process dynamic patterns in the data. The specific steps are as follows: S31. Input the normalized power battery health status data sequence , construct the disturbance window; S32. Perform linear response modeling and design dynamic dissipative drive weighting strategy , calculate the linear response term ,in For each current time point The corresponding historical disturbance window; S33, conduct second-order nonlinear perturbation modeling and propose a multi-order trajectory nonlinear weight strategy , calculate the second-order nonlinear disturbance term , fusion and Get response estimates and calculate nonlinear interaction residual scores ,in The power battery health status data at the current time point; S4. Construct a variable relationship learning module to handle the dynamic coupling problem of data. The specific steps are as follows: S41. Input a subsequence of the normalized power battery health status data sequence Perform 1D dilated convolution operation, calculate non-uniform frequency projection transformation, and propose a set of non-integer modulation frequencies , complex frequency representation is obtained through self-attention ; S42, splitting the complex frequency representation into real and imaginary parts, and calculating the final interactively enhanced time domain features through residual connection and normalization methods; S43. Construct a sine prototype matrix, calculate the minimum distance between its final interactively enhanced time domain feature and the sine prototype vector, and obtain the relationship deviation score ,in is the time step The corresponding final interactively enhanced time domain features have the following specific steps: Construct a sine prototype matrix. The specific formula is: ; Where, is the first Rank The sine basis vectors of the column, is the time step length, is the number of variables in the power battery health status data. For each time step, the minimum distance between the final interactively enhanced time domain feature and the sinusoidal prototype vector is calculated. The specific formula is: ; Where, For the The sine basis vectors of the column, is the time step The corresponding final interactively enhanced time domain features, To return the minimum distance operation, Score the relationship deviance, is the two-norm; S5. Build an anomaly detection module to integrate the two deviation scores to obtain the final anomaly score .
2. The method for detecting abnormal health status of a power battery based on machine learning according to claim 1, characterized in that: In the S1, power battery health status data is collected, including cell-level monitoring parameters, system-level operating parameters and environmental parameters. The cell-level monitoring parameters include voltage data, current data and internal resistance change data; the system-level operating parameters include cycle data, energy efficiency data and fault code data; the environmental parameters include ambient temperature data and ambient humidity data; the mean of the power battery health status data is calculated to fill in missing values and construct a power battery health status data set.
3. The method for detecting abnormal health status of a power battery based on machine learning according to claim 2, characterized in that: The normalized power battery health status data sequence is input in S3 and S31. ,in is the power battery health status data at the current time point, For the number of variables of the power battery health status data, construct the disturbance window corresponding to the current time point, and define the length of the past time window as , each current time point The corresponding historical disturbance window is .
4. The method for detecting abnormal health status of a power battery based on machine learning according to claim 3, characterized in that: Linear response modeling is performed in S3 and S32 to define the time points to The state difference is , represents the historical disturbance intensity, where is the power battery health status data at the current time point, Design a dynamic dissipative drive weight strategy for the number of variables in the power battery health status data , the specific formula is: ; Where, To traverse the variable dimensions of all power battery health status data, there are indivual, For the On each variable, the square of the disturbance intensity from the historical point to the current point of the power battery health status data represents the potential energy. The state difference is The components of the variable dimension of the power battery health status data, is the frequency of the sinusoidal oscillation, is the phase shift, and then the enhanced dissipated potential energy differential linear response weight is driven according to the historical points of the power battery health status data and the corresponding cycle , construct the weighted sum, the specific formula is: ; Where, is the length of the past time window, For historical moments Power battery health status data, For each current time point The corresponding historical disturbance window, is a linear response term.
5. The method for detecting abnormal health status of a power battery based on machine learning according to claim 4, characterized in that: In S3 and S33, second-order nonlinear perturbation modeling is performed, and a multi-order trajectory nonlinear weight strategy is proposed to measure the historical point pairs of any power battery health status data. The health status data of the power battery at the current time point The coupling strength is: ; Where, is the length of the past time window, 、 、 For historical moments 、 、 Power battery health status data, is the order, is an exponential function, is the square of the two norm, is a norm, To prevent division by zero, all 、 The specific formula is: ; Where, is the normalized nonlinear interaction weight of multi-order trajectories, is the dot product operation, For each current time point The corresponding historical disturbance window, is a second-order nonlinear disturbance term, performs time response estimation, and integrates linear response terms and the second-order nonlinear disturbance term , obtain the estimated value of the power battery health status data and calculate the nonlinear interaction residual score. The specific formula is: ; ; Where, is the response estimate, Scoring nonlinear interaction bias.
6. The method for detecting abnormal health status of a power battery based on machine learning according to claim 5, characterized in that: The subsequence of the normalized power battery health status data sequence input in S4 and S41 ,in, is the batch size, is the time step length, is the number of variables of the power battery health status data. A 1D dilated convolution operation is performed on the channel of each variable dimension. The specific formula is: ; Where, is the dilated convolution operation, is the void rate, and then a non-uniform frequency projection transformation is performed to propose a set of non-integer modulation frequencies , the specific formula for defining the non-uniform frequency projection transform is: ; ; Where, 、 are the scaling factors for controlling the logarithmic frequency component and the scaling factors for controlling the square root frequency component, 、 is an integer index, indicating the The position of the frequency components, is the total number of frequency components used, is the result of the dilated convolution, is a non-resonant rotation basis function used to project the signal to a non-integer modulation frequency , is an imaginary unit, and self-attention is performed on the variable dimension on the non-uniform frequency projection transformation. The specific formula is: ; Where, is the activation function, is the transpose of the non-uniform frequency projection transform, is the complex frequency representation.
7. The method for detecting abnormal health status of a power battery based on machine learning according to claim 6, characterized in that: In S4 and S42, the complex frequency representation is split into real and imaginary parts. The specific formula is: ; Where, for The real part of for The imaginary part of is the imaginary unit, and then construct the real vector, is the complex frequency representation, and the specific formula is: ; Where, For the Samples, is the frequency spectrum vector of the power battery health status data variable, For the Samples, The power battery health status data variable represents the real part response of the channel at all complex frequencies. For the Samples, The imaginary part response of the power battery health status data variable on all complex frequency channels is mapped to the time domain representation through a shared linear mapping. The specific formula is: ; Where, is the shared linear mapping matrix, The power battery health state sequence is reconstructed from the complex frequency representation, and the reconstruction result is restored to the dimension to obtain the power battery health state sequence of the merged dimension ,in, is the batch size, is the time step length, and finally the residual connection and normalization method are used to obtain the final interactively enhanced time domain features. The specific formula is: ; Where, is the layer normalization operation, is a subsequence of the normalized power battery health status data sequence, It is the time domain feature after the final interaction enhancement.
8. The method for detecting abnormal health status of a power battery based on machine learning according to claim 7, characterized in that: In S5, an anomaly detection module is constructed to integrate the two deviation scores and calculate the final anomaly score for each time step by weighted fusion. The specific formula is: ; Where, Score the relationship deviance, Score the nonlinear interaction deviation, is the activation function, is the final anomaly score.
Citation Information
Patent Citations
Multivariable time sequence anomaly detection method and system based on graph neural network
CN117786374A
Artificial intelligence driven battery energy storage health state and residual life prediction method
CN119716587A