A battery anomaly detection method for new energy vehicles
The BEACON anomaly detection model solves the problem of nonlinear anomaly identification in new energy vehicle battery data through adaptive parameter adjustment and multi-scale feature extraction, achieving efficient and accurate battery anomaly detection and fault root cause analysis.
Patent Information
- Application Number
- CN202511013383.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-07-23
AI Technical Summary
Existing battery management systems have difficulty accurately identifying nonlinear anomalies when faced with the multiple operating conditions, multiple monitoring signals, and inconsistently distributed battery data of new energy vehicles, resulting in abnormality detection hysteresis, high misjudgment rate, and lack of adaptive adjustment capabilities.
The BEACON anomaly detection model is adopted, including a feature extraction adaptation module, a dynamic fusion module and anomaly judgment module. It captures dynamic changes and abnormal characteristics in battery data through adaptive parameter adjustment, multi-scale feature extraction and dynamic weighted scoring.
The accuracy and adaptability of battery anomaly detection have been improved, and it can identify battery anomalies in real time under different vehicle models and environments, reduce the misjudgment rate, and enhance the ability to analyze the root cause of faults.
Smart Images

Figure CN120524209B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of anomaly detection, and in particular relates to a battery anomaly detection method for a new energy vehicle. Background Art
[0002] As a core component of the entire vehicle, the operating status of the power battery of new energy vehicles directly affects the performance, safety and service life of the entire vehicle. Since it is easily affected by factors such as ambient temperature, load fluctuations and cycle aging during the charging and discharging process, it leads to nonlinear changes in operating parameters such as voltage, current, and temperature. If potential abnormalities cannot be identified in time, it may cause serious consequences such as thermal runaway, capacity decay, and internal short circuit. Therefore, constructing an efficient, accurate and real-time battery abnormality detection method is of great significance to improving the safe operation of new energy vehicles.
[0003] Currently, mainstream battery management systems (BMS) mostly use static threshold monitoring or physical model-based anomaly detection methods. While these methods are low-cost and fast to implement, they often fail to accurately identify nonlinear anomaly evolution patterns in high-dimensional, dynamic, and multi-factor-interacting real-world operating conditions. This leads to problems such as hysteresis and high false positive rates in anomaly detection. Furthermore, some methods rely on fixed rules or empirical parameters, lacking adaptive adjustment capabilities and struggling to cope with the diverse battery performance under different vehicle models, climate conditions, and charging strategies.
[0004] Deep learning-based anomaly detection methods demonstrate strong potential. In particular, advanced approaches such as cross-domain learning, mixture of experts models, and meta-learning mechanisms can effectively address distribution drift in diverse scenarios and enhance the generalization of detection algorithms to unknown operating conditions. Furthermore, by designing interpretable mechanisms within the model, it is possible to not only determine the presence of anomalies but also clearly identify the root causes of faults, providing technical support for operational and maintenance decision-making. Summary of the Invention
[0005] The present invention provides a battery anomaly detection method for new energy vehicles. Aiming at battery data of new energy vehicles with multiple working conditions, multiple monitoring signals and inconsistent distribution, a BEACON anomaly detection model is proposed, which consists of a feature extraction and adaptation module, a dynamic fusion module and an anomaly judgment module.
[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose specifically includes the following steps:
[0007] S1. Collect battery-related data of new energy vehicles, build a data set, and divide the data set after preprocessing;
[0008] S2. Construct a feature extraction adaptation module for domain robust anomaly features. The specific steps are as follows:
[0009] S21. Calculate the loss of the subdomain in the training set and quickly update the initial parameters;
[0010] S22. Propose a trajectory point generation method based on variable scale amplitude and time lag term, construct a multi-scale vector offset sequence of variable embedded trajectory, and design the rotation angle evolution factor and dynamic disturbance offset term to guide the disturbance response direction;
[0011] S23. A topological perturbation bifurcation response factor is proposed. Combining the rotation angle evolution factor with the dynamic perturbation offset term, the topological perturbation bifurcation response factor is obtained, and the characteristic vector of the new energy vehicle battery is calculated.
[0012] S3. Build a dynamic fusion module to dynamically suppress interference features. The specific steps are as follows:
[0013] S31. Input the feature vector, introduce multi-scale resonance modeling, calculate the structural similarity and difference between modelers to obtain the resonance kernel, and construct the structural resonance expression to obtain the multi-scale interaction kernel;
[0014] S32. An extended adaptive gating mechanism is proposed, which introduces a time dynamic adjustment mechanism, calculates the gating factor, and further combines the time sliding coefficient and weight to obtain the gated weighted interaction feature vector;
[0015] S33, constructing a cross-time correlation matrix, fusing the gated weighted interaction feature vector, calculating the multi-scale interaction kernel, and fusing it with the resonance kernel to obtain the fusion feature;
[0016] S4. Build an anomaly judgment module, design a dynamic weighted anomaly scoring calculation method, and complete battery anomaly detection for new energy vehicles.
[0017] Preferably, the battery-related data of the new energy vehicle is collected in S1, including battery voltage data, current data, temperature data and SOC / SOH data, a multivariate original data set is constructed, the mean filling method is used for data preprocessing, and the training set, validation set and test set are divided into a ratio of 7:1:2 to fix the window length. Construct local sequences of new energy vehicle batteries using time windows.
[0018] The core idea of S21 is to provide fast and stable parameter updates for electric vehicle battery data, thereby improving the adaptability and accuracy of the model. By calculating the loss for each subdomain, it is possible to identify good and bad data segments, allowing the model to make more sensitive adjustments to such good and bad data segments. By quickly updating model parameters based on subdomain-specific losses, the model can more efficiently adapt to dynamic changes in data.
[0019] Preferably, in said S21, the local sequence of the new energy vehicle battery is input , divide the sequence into multiple data segments ,initialization Modeler , and divide subdomains, of which For each subdomain, the initialization parameter set is used to calculate the loss of the new energy vehicle battery data segment in the input training set in each subdomain, and the optimal subdomain is selected to quickly update the initial parameters to obtain the updated parameters. The specific mathematical model is:
[0020] ;
[0021] Where, is the kth subdomain parameter of the jth modeler, After the parameters of the kth sub-domain are updated, the updated parameters of the data sub-segment corresponding to the new energy vehicle battery data in the i-th time period are updated. is the training sub-segment corresponding to the new energy vehicle battery data in the i-th time period, is the loss corresponding to the subdomain of the j-th modeler, where , is the learning rate, is the partial derivative vector.
[0022] Optimally, the efficiency and accuracy of anomaly detection in electric vehicle battery data are improved by adaptively updating model parameters and subdomain-based loss functions. Rapid adjustments to subdomains ensure more efficient computation. Based on subdomain-specific loss functions, the model can sensitively respond to data changes in different domains, enhancing domain adaptability and enabling the model to cope with data fluctuations from different battery types or operating conditions. By rapidly updating model parameters, subtle changes in battery data can be more accurately captured, allowing potential anomalies to be identified at an early stage. This approach enhances the accuracy of anomaly detection and improves the reliability of battery failure prediction.
[0023] Preferably, the core idea of the S22 design is to construct a multidimensional trajectory point sequence by generating trajectory points based on variable scale amplitude and time lag terms, thereby providing more refined feature extraction for anomaly detection of electric vehicle batteries. Based on the dynamic changes of electric vehicle battery data, multidimensional trajectory points are generated by using time lag intervals and current and previous values of variables. Combined with multi-scale vector offset sequences, it can better simulate the complex nonlinear characteristics and multidimensional correlations of battery data, and enhance the model's ability to perceive anomalies.
[0024] Preferably, in said S22, a trajectory point based on the variable scale amplitude and the time lag term is proposed The generation method is to construct a multi-dimensional trajectory point sequence by sampling the current value of the variable and its previous value according to the preset lag interval within a fixed time window, forming a trajectory point and constructing a multi-scale vector offset sequence of the variable embedded in the trajectory. , design rotation angle evolution factor Quantify the local rotation curvature between continuous states. The specific mathematical model is:
[0025] ;
[0026] Where, is the length of the phase space trajectory after delayed embedding, is the inverse cosine function, is the inner product of two multi-scale vector offset sequences, is the norm, is the trajectory index, is a very small positive number, is a multi-scale vector offset sequence, where , Design a dynamic disturbance offset term for the lth trajectory point after delayed embedding of the new energy vehicle battery variable at time t and in the dth dimension To guide the disturbance response direction, the specific design is as follows: calculate the difference between the current new energy vehicle battery value and the historical mean value in the time window, and use the historical standard deviation to normalize the difference to obtain the dynamic disturbance offset term reflecting the new energy vehicle battery value. The specific mathematical model is:
[0027] ;
[0028] Where, is the value of the d-dimensional variable of the new energy vehicle battery at time t, is a fixed window length, is the standard deviation, is a very small positive number.
[0029] The optimal approach is to introduce a multidimensional trajectory point sequence and a multiscale vector offset sequence to extract more detailed and discriminative features from the battery data, enhancing the temporal and spatial sensitivity to data changes and improving the model's ability to capture both long-term and short-term dynamic changes. By designing a rotation angle evolution factor and a dynamic perturbation offset term, the model can quantify the local rotational curvature in the battery data, accurately reflecting subtle changes and perturbations in the battery under different operating conditions.
[0030] S23 battery data typically exhibits high nonlinearity and spatiotemporal variability, and traditional single feature extraction methods often fail to fully capture the various perturbation responses in the data. By introducing a topological perturbation bifurcation response factor, the model can integrate different types of perturbation information at multiple scales, providing a more refined and multi-dimensional feature representation for battery anomaly detection.
[0031] Preferably, in said S23, a topological perturbation bifurcation response factor is proposed, and the construction process is specifically as follows: using the dynamic perturbation offset term of the new energy vehicle battery value combined with standard deviation normalization and periodic phase modulation, integrating the rotation angle evolution factor, and proposing a composite triangular modulation function based on a dual phase term, while constructing a fusion polynomial scale control term and a sigmoid adjustment factor to obtain the topological perturbation bifurcation response factor , the specific mathematical model is:
[0032] ;
[0033] Where, is the dynamic disturbance offset term, is the rotation angle evolution factor, is a periodic modulation function based on the rotation angle, is a periodic modulation function based on the disturbance offset, is a constant weight factor, is a natural exponential function, and the topological perturbation bifurcation response factors of the j new energy vehicle battery variable dimensions are constructed into a diagonal modulation matrix , perform weighted adjustment on each dimension of the original new energy vehicle battery local sequence to generate the modulated new energy vehicle battery input , then each modeler uses the modulated new energy vehicle battery input and the updated parameters to perform feature extraction mapping to obtain the new energy vehicle battery feature vector , the specific mathematical model is:
[0034] ;
[0035] Where, After the parameters of the kth sub-domain are updated, the updated parameters of the data sub-segment corresponding to the new energy vehicle battery data in the i-th time period are updated. For the modulated new energy vehicle battery input, is the feature extraction function of the corresponding modeler.
[0036] Optimally, by combining multiple disturbance response factors, the model is able to capture subtle dynamic changes in battery data, especially its ability to respond to local disturbances and system bifurcations has been significantly improved. The design of the topological disturbance bifurcation response factor enables the model to effectively handle complex nonlinear disturbances. By integrating the rotation angle and disturbance offset terms, it quantifies the dynamic changes in battery data and the stability of the system, helping to improve the robustness of the model. In particular, it can effectively avoid overfitting when dealing with different battery types and different operating environments, and improve the universality and accuracy of anomaly detection.
[0037] S31 battery data may exhibit different dynamic characteristics at different time scales, and single-scale analysis methods cannot fully capture these complex temporal relationships. By introducing multi-scale resonance modeling, information from different scales can be effectively processed, ensuring that the model can deeply mine data features in multiple dimensions, improving the sensitivity and accuracy of battery anomalies.
[0038] Preferably, in said S31, the new energy vehicle battery characteristic vector is input The multi-scale resonance modeling is introduced to calculate the nonlinear mapping between the similarities between the features of different modelers at multiple new energy vehicle battery scales, and the structural similarity and difference between the modelers are calculated at different scale levels to obtain the resonance kernel. , the specific mathematical model is:
[0039] ;
[0040] Where, is the scale number of the multi-scale structural resonance kernel, is the weight coefficient of the s-th scale, is the nonlinear mapping function of the s-th scale, To represent the new energy vehicle battery feature vector of the j′th modeler at time t based on its k′th subdomain, the corresponding structural resonance expressions are constructed at different new energy vehicle battery scale levels. , forming multiple levels of expert interaction tensors, and integrating the expert interaction information of different scales through the weight coefficients of each scale, and performing multi-scale hierarchical fusion to obtain the multi-scale interaction kernel .
[0041] Optimally, by introducing a multi-scale structural resonance kernel, the model can weight the characteristics of battery data at multiple levels, identifying subtle changes at different time scales and capturing the complex changes in the battery's long- and short-term dynamics. By calculating the similarities and differences between modelers, the model can integrate the different perspectives from multiple modelers, effectively reducing bias and improving the accuracy of the overall prediction. This enhances the model's robustness and improves its comprehensive analysis of battery health status.
[0042] Preferably, in the process of abnormality detection of battery data in S32, the behavior and state changes of the battery usually have strong time dependence. By introducing an extended adaptive gating mechanism and combining it with a time dynamic adjustment mechanism, the gating factor is calculated and the interactive feature vector is further weighted to cope with the time-varying characteristics in the data.
[0043] Preferably, in said S32, the new energy vehicle battery characteristic vector is input , proposed an extended adaptive gating mechanism and introduced a time dynamic adjustment mechanism. The specific design is as follows: construct a set of gating functions, use nonlinear activation functions to map the numerical difference information of the feature vectors extracted from the new energy vehicle battery data input at the same time into the dynamic participation weight of each pair of modelers, and obtain the gating factor between modelers j and j′ at time t , the specific mathematical model is:
[0044] ;
[0045] Where, is the Sigmoid activation function, is the difference in modeler features, 、 is the weight vector and bias, combined with the time dynamic adjustment factor , a time sliding weighting coefficient is designed. For each moment t, the extended adaptive gating mechanism is dynamically adjusted according to the input feature vector and the difference of the modeler features at the current moment. The specific mathematical model is:
[0046] ;
[0047] Where, is the time sliding weight coefficient between modelers j and j′ at time t. The feature vector is element-wise multiplied by the time sliding weight coefficient to obtain the gated weighted interaction feature vector dominated by modeler j and modeler j′ at time t. .
[0048] Preferably, by extending the adaptive gating mechanism and the temporal dynamic adjustment mechanism, the model can adaptively adjust feature weights at each time step, effectively handling the time dependency and dynamic changes in battery data. The introduction of the gating factor enables each modeler to dynamically adjust its influence based on the data characteristics at the current moment. This mechanism helps the model maintain high flexibility and accuracy when faced with the non-stationary characteristics of battery data. In addition, the temporal dynamic adjustment mechanism enhances the model's responsiveness to time-varying data, ensuring that the model can quickly adapt and adjust its prediction strategy when the battery's operating state changes.
[0049] The core idea of the S33 design is to fuse gated weighted interaction feature vectors by constructing a cross-time correlation matrix and combining it with a multi-scale interaction kernel to calculate fused features. Battery data typically has long-term and short-term temporal dependencies, and the features of a single time step often cannot fully reflect the overall state of the battery. By introducing a cross-time correlation matrix, features at different time steps can be associated, thereby more comprehensively capturing the temporal changes of the battery.
[0050] Preferably, in said S33, a cross-time correlation matrix is constructed based on the dynamic evolution law of the time series. , the gated weighted interaction feature vector dominated by input modeler j and modeler j′ at time t , through the multi-scale interaction kernel The specific mathematical model is:
[0051] ;
[0052] Where, is the activation function, is the gated weighted interaction feature vector between modeler j′ and modeler j at time t, and then the cross-expert temporal correlation matrix and the resonance kernel are used Fusion, get the new energy vehicle battery fusion characteristics .
[0053] Preferably, by introducing a cross-time correlation matrix, the model can fully consider the inherent correlations between different time steps in the temporal dimension, enhancing its sensitivity to battery state evolution. Combined with a multi-scale interaction kernel, it can fuse features at different time scales, effectively modeling the spatiotemporal variations in battery data. This improves the model's comprehensive analysis of battery health status, enabling it to better capture the dynamic correlations between different time points, thereby improving the accuracy and timeliness of anomaly detection. When the battery state changes, the detection strategy can be adjusted promptly to adapt to dynamic patterns in the data, improving robustness and accuracy in practical applications.
[0054] Optimally, S4 implements anomaly detection in electric vehicle battery data by building an anomaly judgment module and combining it with a dynamically weighted anomaly scoring method. This design stems from the fact that in battery health monitoring, traditional anomaly detection methods often rely on static threshold judgments or single feature screening, making it difficult to cope with dynamic anomalies in complex battery data that change over time. By designing a dynamically weighted scoring method, it is possible to more accurately assess battery anomaly status and adapt to changes in battery data characteristics at different time steps.
[0055] Preferably, in said S4, an abnormality judgment module is constructed to input the local sequence of the new energy vehicle battery , calculate the abnormal response value of each modeler to the input, combined with the dynamic weight , through the cross-time correlation matrix and time sliding weighting coefficient Fusion, combined with the anomaly scoring function of sparsity measurement, designed a dynamic weighted anomaly scoring calculation method. The specific mathematical model is:
[0056] ;
[0057] Where, is the number of initialized modelers, is the anomaly scoring function of the sparsity measure, where is the gated weighted interaction feature vector between modeler j′ and modeler j at time t, The initialization parameter set for each subdomain is finally scored based on the anomaly Dynamically set thresholds Determine abnormal data of new energy vehicle batteries.
[0058] Preferably, through dynamic weighted anomaly scoring, the model can flexibly adjust weights based on feature changes at each time point, more accurately capturing dynamic anomalies in battery data. This method weights and integrates the abnormal responses of each modeler, allowing the model to adaptively enhance the influence of important features when faced with complex battery state changes, thereby improving the accuracy and robustness of anomaly detection. In addition, the use of this dynamically weighted scoring method can avoid misjudgments or missed judgments caused by static thresholds in traditional methods, improving flexibility and applicability in practical applications.
[0059] In summary, the present invention proposes a battery anomaly detection method for new energy vehicles. The method comprises a feature extraction and adaptation module, a dynamic fusion module, and an anomaly judgment module. First, the feature extraction and adaptation module divides the battery data into subdomains and initializes a modeler for each subdomain. It then calculates losses and performs rapid updates to adaptively adjust parameters. Dynamic changes in the battery data are captured through a time-lagged trajectory point generation method and a multi-scale vector offset sequence. A rotation angle evolution factor and a dynamic perturbation offset term are designed to quantify local perturbations. Next, the dynamic fusion module fuses the extracted features at multiple scales, calculates the structural similarity and difference between the modelers, and obtains a resonance kernel. It then weights the interaction features using an extended adaptive gating mechanism and a temporal dynamic adjustment mechanism to optimize the interaction between the modelers and generate a weighted feature vector. Finally, the anomaly judgment module uses a dynamic weighted anomaly scoring method, combining a cross-temporal correlation matrix and a gated weighted interaction feature vector, to calculate anomaly scores and dynamically adjust thresholds for anomaly detection. The combination of these three modules ensures efficient and accurate battery anomaly detection, adapting to dynamic changes in battery data in real time. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A step diagram of a method for detecting battery abnormality in a new energy vehicle.
[0061] Figure 2 This is the structure diagram of the BEACON anomaly detection model.
[0062] Figure 3 This is the structural diagram of the feature extraction adaptation module.
[0063] Figure 4 This is the structural diagram of the dynamic fusion module.
[0064] Figure 5 This is the effect diagram of the BEACON anomaly detection model. DETAILED DESCRIPTION
[0065] 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.
[0066] See also Figure 1-Figure 5The present invention provides a technical solution: a battery anomaly detection method for new energy vehicles, including a feature extraction adaptation module, a dynamic fusion module and an anomaly judgment module. First, the feature extraction adaptation module divides the battery data into subdomains, initializes the modeler for each subdomain, calculates the loss and performs rapid updates to adaptively adjust the parameters. By generating trajectory points based on time lag and multi-scale vector offset sequences, the dynamic changes in the battery data are captured, and the rotation angle evolution factor and dynamic disturbance offset term are designed to quantify local disturbances. Then, the dynamic fusion module performs multi-scale fusion on the extracted features, calculates the structural similarity and difference between the modelers, obtains the resonance kernel, and weights the interactive features by extending the adaptive gating mechanism and the time dynamic adjustment mechanism, optimizes the interaction between the modelers, and generates a weighted feature vector. Finally, the anomaly judgment module calculates the anomaly score and dynamically adjusts the threshold for anomaly detection by combining the cross-time correlation matrix and the gated weighted interactive feature vector through a dynamic weighted anomaly scoring method. The specific steps are as follows: Figure 1 shown.
[0067] Construct the BEACON anomaly detection model, whose structure is as follows Figure 2 As shown, the specific steps are:
[0068] S1. Collect battery-related data of new energy vehicles, build a data set, and divide the data set after preprocessing;
[0069] Furthermore, we collected battery-related data of new energy vehicles, including battery voltage data, current data, temperature data, and SOC / SOH data, and constructed a multivariate original data set. We used the mean filling method for data preprocessing. The specific mathematical model is:
[0070] ;
[0071] Where, Battery data for new energy vehicles, is the average value, The observations are divided into training set, validation set and test set in a ratio of 7:1:2 to fix the window length. Construct local sequences of new energy vehicle batteries using time windows.
[0072] S21, construct a feature extraction adaptation module, whose structure is as follows Figure 3 As shown, the loss of the subdomain in the training set is calculated and the initial parameters are quickly updated.
[0073] Furthermore, a feature extraction adaptation module is constructed, whose structure is as follows Figure 3 As shown, enter the local sequence of new energy vehicle battery , divide the sequence into multiple data segments , the initial division length of the data segment is set to 200, initialize Modeler , and divide subdomains, the initial division is set to 5 subdomains, among which For each subdomain, the initialization parameter set is used to calculate the loss of the new energy vehicle battery data segment in the input training set in each subdomain, and the optimal subdomain is selected to quickly update the initial parameters to obtain the updated parameters. The specific mathematical model is:
[0074] ;
[0075] Where, is the kth subdomain parameter of the jth modeler, After the parameters of the kth sub-domain are updated, the updated parameters of the data sub-segment corresponding to the new energy vehicle battery data in the i-th time period are updated. is the training sub-segment corresponding to the new energy vehicle battery data in the i-th time period, is the loss corresponding to the subdomain of the j-th modeler, where , is the learning rate, initially set to 0.001 is the partial derivative vector, and the specific implementation code is:
[0076] class FeatureExtraction:
[0077] def __init__(self, data, target, n_subdomains=5, segment_length=200,
[0078] n_models=5, alpha_meta=0.001, epochs=100):
[0079] """
[0080] :param data: ndarray(T, D), battery multivariate data
[0081] :param target: ndarray(T,) battery status label
[0082] :param n_subdomains: number of subdomains
[0083] :param segment_length: the length of each subdomain
[0084] :param n_models: number of modelers
[0085] :param alpha_meta: meta learning rate
[0086] :param epochs: The number of iterations for each model update
[0087] """
[0088] self.data = data
[0089] self.target = target
[0090] self.n_subdomains = n_subdomains
[0091] self.segment_length = segment_length
[0092] self.n_models = n_models
[0093] self.alpha_meta = alpha_meta
[0094] self.epochs = epochs
[0095] self.subdomain_params = [
[0096] {"weights": np.random.randn(data.shape[1]), # Initialize the θ parameters
[0097] "bias": np.random.randn()} for _ in range(n_subdomains) ]
[0099] def segment_data(self):
[0100] segments = []
[0101] target_segments = []
[0102] for i in range(self.n_subdomains):
[0103] start = i * self.segment_length
[0104] end = start + self.segment_length
[0105] if end>len(self.data):
[0106] break
[0107] segments.append(self.data[start:end])
[0108] target_segments.append(self.target[start:end])
[0109] return segments, target_segments
[0110] def compute_loss(self, X, y, weights, bias):
[0111] predictions = np.dot(X, weights) + bias
[0112] loss = mean_squared_error(y, predictions)
[0113] return loss, predictions
[0114] def compute_gradients(self, X, y, predictions):
[0115] error = predictions - y
[0116] grad_w = 2 * np.dot(X.T, error) / len(y)
[0117] grad_b = 2 * np.mean(error)
[0118] return grad_w, grad_b
[0119] def meta_update(self, theta_old, grad_w, grad_b):
[0120] updated_weights = theta_old["weights"] - self.alpha_meta * grad_w
[0121] updated_bias = theta_old["bias"] - self.alpha_meta * grad_b
[0122] return {"weights": updated_weights, "bias": updated_bias}
[0123] def train(self):
[0124] segments, target_segments = self.segment_data()
[0125] best_loss = float("inf")
[0126] best_model_idx = -1
[0127] # Calculate the loss for each sub - domain and find the best one
[0128] for i in range(self.n_subdomains):
[0129] weights = self.subdomain_params[i]["weights"]
[0130] bias = self.subdomain_params[i]["bias"]
[0131] loss, _ = self.compute_loss(segments[i], target_segments[i], weights, bias)
[0132] if loss < best_loss:
[0133] best_loss = loss
[0134] best_model_idx = i
[0135] # Perform a fast meta - update on the best model
[0136] best_theta = self.subdomain_params[best_model_idx]
[0137] X = segments[best_model_idx]
[0138] y = target_segments[best_model_idx]
[0139] for epoch in range(self.epochs):
[0140] loss, preds = self.compute_loss(X, y, best_theta["weights"],best_theta["bias"])
[0141] grad_w, grad_b = self.compute_gradients(X, y, preds)
[0142] best_theta = self.meta_update(best_theta, grad_w, grad_b)
[0143] if epoch % 10 == 0:
[0144] print(f"[Epoch {epoch}] Loss: {loss:.4f}, Weight Norm:{np.linalg.norm(best_theta['weights']):.4f}")
[0145] # Return the updated optimal model parameters
[0146] return best_model_idx, best_theta
[0147] S22. A method for generating trajectory points based on variable scale amplitude and time lag terms is proposed, a multi-scale vector offset sequence of variable embedded trajectories is constructed, and the rotation angle evolution factor and dynamic disturbance offset term are designed to guide the disturbance response direction.
[0148] Furthermore, a trajectory point based on variable scale amplitude and time lag term is proposed The generation method is to construct a multi-dimensional trajectory point sequence by sampling the current value of the variable and its previous value according to the preset lag interval within a fixed time window, forming a trajectory point and constructing a multi-scale vector offset sequence of the variable embedded in the trajectory. , design rotation angle evolution factor Quantify the local rotation curvature between continuous states. The specific mathematical model is:
[0149] ;
[0150] Where, is the length of the phase space trajectory after delayed embedding, is the arccosine function, is the inner product of two multi-scale vector offset sequences, is the norm, is the trajectory index, is a very small positive number, initially set to 0.1. is a multi-scale vector offset sequence, where , Design a dynamic disturbance offset term for the lth trajectory point after delayed embedding of the new energy vehicle battery variable at time t and in the dth dimension To guide the disturbance response direction, the specific design is as follows: calculate the difference between the current new energy vehicle battery value and the historical mean value in the time window, and use the historical standard deviation to normalize the difference to obtain the dynamic disturbance offset term reflecting the new energy vehicle battery value. The specific mathematical model is:
[0151] ;
[0152] Where, is the value of the d-dimensional variable of the new energy vehicle battery at time t, The initial setting is 50 for a fixed window length. is the standard deviation, It is a very small positive number, initially set to 0.1. The specific implementation code is:
[0153] class FeatureExtraction:
[0154] def __init__(self, data, segment_length=200, n_scales=3, learning_rate=0.01, epochs=100):
[0155] """
[0156] data: input battery data
[0157] segment_length: the length of each data segment
[0158] n_scales: The number of scales for multi-scale vector offset
[0159] learning_rate: learning rate for gradient descent
[0160] epochs: number of training iterations
[0161] """
[0162] self.data = data
[0163] self.segment_length = segment_length
[0164] self.n_scales = n_scales
[0165] self.learning_rate = learning_rate
[0166] self.epochs = epochs
[0167] def generate_trajectory_points(self, X, lag=1):
[0168] """
[0169] Generate a sequence of trajectory points based on time lag
[0170] """
[0171] trajectory = []
[0172] for i in range(len(X) - lag):
[0173] trajectory.append(np.concatenate([X[i], X[i + lag]]))
[0174] return np.array(trajectory)
[0175] def calculate_rotation_angle(self, trajectory):
[0176] """
[0177] Calculate the rotation angle of the trajectory point sequence
[0178] """
[0179] angles = []
[0180] for i in range(1, len(trajectory)):
[0181] cos_sim = cosine(trajectory[i - 1], trajectory[i])
[0182] angle = np.arccos(1 - cos_sim) # Calculate the bending angle
[0183] angles.append(angle)
[0184] return np.array(angles)
[0185] def calculate_dynamic_displacement(self, X, window_length=10):
[0186] """
[0187] Calculate the dynamic disturbance offset term
[0188] """
[0189] displacement = []
[0190] for i in range(window_length, len(X)):
[0191] window = X[i - window_length:i]
[0192] mean = np.mean(window, axis=0)
[0193] std_dev = np.std(window, axis=0)
[0194] displacement.append((X[i] - mean) / (std_dev + 1e-6)) # Prevent division by zero
[0195] return np.array(displacement)
[0196] def multi_scale_vector_offset(self, X):
[0197] """
[0198] Constructing multi-scale vector offset sequences
[0199] """
[0200] scale_offsets = []
[0201] for scale in range(1, self.n_scales + 1):
[0202] offset = []
[0203] for i in range(len(X) - scale):
[0204] offset.append(X[i + scale] - X[i]) # Calculate the offset of each scale
[0205] scale_offsets.append(np.array(offset))
[0206] return scale_offsets
[0207] def update_model_params(self, best_model, trajectory,displacement):
[0208] """
[0209] Use gradient descent to update the parameters of the optimal model
[0210] """
[0211] for epoch in range(self.epochs):
[0212] gradient = np.zeros_like(best_model)
[0213] # Update model parameters
[0214] gradient += np.sum(trajectory, axis=0)
[0215] gradient += np.sum(displacement, axis=0)
[0216] best_model -= self.learning_rate * gradient
[0217] if epoch % 10 == 0:
[0218] print(f"Epoch {epoch}, Params: {best_model}")
[0219] def extract_features(self):
[0220] """
[0221] Extract and update features
[0222] """
[0223] segments = [self.data[i:i + self.segment_length] for i in range(0, len(self.data), self.segment_length)]
[0224] # Process each segment feature
[0225] all_trajectories = []
[0226] all_displacements = []
[0227] all_scale_offsets = []
[0228] for segment in segments:
[0229] trajectory = self.generate_trajectory_points(segment)
[0230] rotation_angles = self.calculate_rotation_angle(trajectory)
[0231] displacement = self.calculate_dynamic_displacement(segment)
[0232] scale_offsets = self.multi_scale_vector_offset(segment)
[0233] # Save each sub-domain feature
[0234] all_trajectories.append(trajectory)
[0235] all_displacements.append(displacement)
[0236] all_scale_offsets.append(scale_offsets)
[0237] # Training process
[0238] best_model = np.zeros_like(all_trajectories[0]) # Model initialized to zero
[0239] # Select the best features to update
[0240] self.update_model_params(best_model, np.concatenate(all_trajectories), np.concatenate(all_displacements)).
[0241] S23. A topological perturbation bifurcation response factor is proposed. Combining the rotation angle evolution factor and the dynamic perturbation offset term, the topological perturbation bifurcation response factor is obtained, and the characteristic vector of the new energy vehicle battery is calculated.
[0242] Furthermore, a topological perturbation bifurcation response factor is proposed. The construction process is as follows: the dynamic perturbation offset term of the new energy vehicle battery value is combined with standard deviation normalization and periodic phase modulation, the rotation angle evolution factor is integrated, and a composite triangular modulation function based on a dual phase term is proposed. At the same time, a fusion polynomial scale control term and a sigmoid adjustment factor are constructed to obtain the topological perturbation bifurcation response factor. , the specific mathematical model is:
[0243] ;
[0244] Where, is the dynamic disturbance offset term, is the rotation angle evolution factor, is a periodic modulation function based on the rotation angle, is a periodic modulation function based on the disturbance offset, is a constant weight factor, initially set to 0.5, is a natural exponential function, and the topological perturbation bifurcation response factors of the j new energy vehicle battery variable dimensions are constructed into a diagonal modulation matrix , perform weighted adjustment on each dimension of the original new energy vehicle battery local sequence to generate the modulated new energy vehicle battery input , then each modeler uses the modulated new energy vehicle battery input and the updated parameters to perform feature extraction mapping to obtain the new energy vehicle battery feature vector , the specific mathematical model is:
[0245] ;
[0246] Where, After the parameters of the kth sub-domain are updated, the updated parameters of the data sub-segment corresponding to the new energy vehicle battery data in the i-th time period are updated. For the modulated new energy vehicle battery input, is the feature extraction function of the corresponding modeler, and the specific implementation code is:
[0247] class FeatureExtraction:
[0248] def __init__(self, data, n_scales=3, window_length=10, learning_rate=0.01, epochs=100):
[0249] # Rotation angle weighting
[0250] angle_weighted = rotation_angles / np.max(rotation_angles) # Standardization
[0251] displacement_weighted = displacement / np.max(displacement) # normalization
[0252] # Calculate the perturbation bifurcation response factor
[0253] topological_response = angle_weighted * displacement_weighted
[0254] return topological_response
[0255] def update_model_params(self, best_model, topological_response):
[0256] """
[0257] Update the parameters of the optimal model
[0258] """
[0259] for epoch in range(self.epochs):
[0260] gradient = np.zeros_like(best_model)
[0261] gradient += np.sum(topological_response, axis=0)
[0262] best_model -= self.learning_rate * gradient
[0263] if epoch % 10 == 0:
[0264] print(f"Epoch {epoch}, Params: {best_model}")
[0265] def extract_features(self):
[0266] """
[0267] Extract and update features
[0268] """
[0269] trajectory = self.generate_trajectory_points(self.data)
[0270] rotation_angles = self.calculate_rotation_angle(trajectory)
[0271] displacement = self.calculate_dynamic_displacement(self.data)
[0272] scale_offsets = self.multi_scale_vector_offset(self.data)
[0273] # Calculate the topological perturbation bifurcation response factor
[0274] topological_response = self.calculate_topological_disturbance(trajectory, displacement, rotation_angles)
[0275] # Training process
[0276] best_model = np.zeros_like(topological_response[0])
[0277] # Select the best features to update
[0278] self.update_model_params(best_model, topological_response).
[0279] S31. Input the feature vector, introduce multi-scale resonance modeling, calculate the structural similarity and difference between modelers to obtain the resonance kernel, and construct the structural resonance expression to obtain the multi-scale interaction kernel.
[0280] Furthermore, a dynamic fusion module is constructed, whose structure is as follows Figure 4 As shown, input the new energy vehicle battery feature vector The multi-scale resonance modeling is introduced to calculate the nonlinear mapping between the similarities between the features of different modelers at multiple new energy vehicle battery scales, and the structural similarity and difference between the modelers are calculated at different scale levels to obtain the resonance kernel. , the specific mathematical model is:
[0281] ;
[0282] Where, is the number of scales of the multi-scale structural resonance kernel, initially set to 4, is the weight coefficient of the s-th scale, which is a learnable parameter, is the nonlinear mapping function of the s-th scale, To represent the new energy vehicle battery feature vector of the j′th modeler at time t based on its k′th subdomain, the corresponding structural resonance expressions are constructed at different new energy vehicle battery scale levels. , forming multiple levels of expert interaction tensors, and integrating the expert interaction information of different scales through the weight coefficients of each scale, and performing multi-scale hierarchical fusion to obtain the multi-scale interaction kernel , the specific implementation code is:
[0283] class MultiScaleResonance:
[0284] def __init__(self, model_feature_dict, n_scales=3):
[0285] """
[0286] :param model_feature_dict: dictionary, key is modeler name, value is feature vector sequence (T, D)
[0287] :param n_scales: number of multi-scale levels
[0288] """
[0289] self.model_feature_dict = model_feature_dict
[0290] self.n_scales = n_scales
[0291] self.model_names = list(model_feature_dict.keys())
[0292] self.num_models = len(self.model_names)
[0293] self.time_steps, self.feature_dim = next(iter(model_feature_dict.values())).shape
[0294] self.scale_weights = self._initialize_scale_weights()
[0295] return R
[0296] def construct_interaction_tensor(self, R):
[0297] """
[0298] Construct the final multi-scale interaction kernel to fuse all scales
[0299] :param R: multi-scale structural resonance kernel, shape is (num_models, num_models, time_steps, n_scales)
[0300] :return: Multiscale interaction kernel (num_models, num_models, time_steps)
[0301] """
[0302] interaction_tensor = np.zeros((self.num_models, self.num_models,self.time_steps))
[0303] for s in range(self.n_scales):
[0304] interaction_tensor += self.scale_weights[s] * R[:, :, :, s]
[0305] return interaction_tensor
[0306] def run(self):
[0307] """
[0308] Execute the main process of resonance modeling
[0309] :return: Multi-scale interaction kernel tensor (num_models, num_models, time_steps)
[0310] """
[0311] R = self.compute_structure_similarity_tensor()
[0312] final_kernel = self.construct_interaction_tensor(R).
[0313] S32. An extended adaptive gating mechanism is proposed, which introduces a time dynamic adjustment mechanism, calculates the gating factor, and further combines the time sliding coefficient and weight to obtain the gated weighted interaction feature vector.
[0314] Furthermore, input the new energy vehicle battery feature vector , proposed an extended adaptive gating mechanism and introduced a time dynamic adjustment mechanism. The specific design is as follows: construct a set of gating functions, use nonlinear activation functions to map the numerical difference information of the feature vectors extracted from the new energy vehicle battery data input at the same time into the dynamic participation weight of each pair of modelers, and obtain the gating factor between modelers j and j′ at time t , the specific mathematical model is:
[0315] ;
[0316] Where, is the Sigmoid activation function, is the difference in modeler features, 、 is the weight vector and bias, combined with the time dynamic adjustment factor , a time sliding weighting coefficient is designed. For each moment t, the extended adaptive gating mechanism is dynamically adjusted according to the input feature vector and the difference of the modeler features at the current moment. The specific mathematical model is:
[0317] ;
[0318] Where, is the time sliding weight coefficient between modelers j and j′ at time t. The feature vector is element-wise multiplied by the time sliding weight coefficient to obtain the gated weighted interaction feature vector dominated by modeler j and modeler j′ at time t. , the specific implementation code is:
[0319] class GatedInteraction:
[0320] def __init__(self, model_features, time_vector=None, hidden_dim=128):
[0321] """
[0322] :param model_features: dict {model_name: ndarray(T, D)} modeler output features
[0323] :param time_vector: time encoding vector (T, ), optional, used for time weight adjustment
[0324] :param hidden_dim: model feature dimension
[0325] """
[0326] self.model_features = model_features
[0327] self.model_names = list(model_features.keys())
[0328] self.num_models = len(self.model_names)
[0329] self.time_steps, self.feature_dim = next(iter(model_features.values())).shape
[0330] self.hidden_dim = hidden_dim
[0331] self.time_vector = time_vector if time_vector is not None else np.arange(self.time_steps)
[0332] self.W_diff = np.random.randn(hidden_dim) * 0.01
[0333] self.b_diff = np.zeros(hidden_dim)
[0334] self.W_time = np.random.randn() * 0.01
[0335] self.b_time = 0.0
[0336] def _calculate_gate(self, feature_a, feature_b):
[0337] """
[0338] Calculate the gating factor for the feature difference between modelers
[0339] """
[0340] diff = feature_a - feature_b
[0341] proj = np.dot(diff, self.W_diff) + self.b_diff
[0342] return expit(proj)
[0343] def _calculate_time_weight(self, t):
[0344] """
[0345] Dynamically adjust gate output according to time code (sliding weights)
[0346] """
[0347] return expit(self.W_time * self.time_vector[t] + self.b_time)
[0348] def compute_interaction(self):
[0349] """
[0350] Compute the gated weighted interaction feature tensor
[0351] :return: dict {(j, j′): ndarray(T, D)}, gated interaction vector
[0352] """
[0353] interaction_result = {}
[0354] for i in range(self.num_models):
[0355] for j in range(self.num_models):
[0356] if i == j:
[0357] continue # No gated interaction itself
[0358] name_i = self.model_names[i]
[0359] name_j = self.model_names[j]
[0360] feature_i = self.model_features[name_i]
[0361] feature_j = self.model_features[name_j]
[0362] gated_vector = []
[0363] for t in range(self.time_steps):
[0364] gate_val = self._calculate_gate(feature_i[t], feature_j[t])# γ_j,j′^t
[0365] time_val = self._calculate_time_weight(t) # λ_t
[0366] product = gate_val * time_val * (feature_i[t] * feature_j[t]) # element-wise product
[0367] gated_vector.append(product)
[0368] interaction_result[(name_i, name_j)] = np.stack(gated_vector)
[0369] S33. Construct a cross-time correlation matrix, fuse the gated weighted interaction feature vector, calculate the multi-scale interaction kernel, and fuse it with the resonance kernel to obtain the fusion feature.
[0370] Furthermore, a cross-time correlation matrix is constructed based on the dynamic evolution law of time series. , the gated weighted interaction feature vector dominated by input modeler j and modeler j′ at time t , through the multi-scale interaction kernel The specific mathematical model is:
[0371] ;
[0372] Where, is the activation function, is the gated weighted interaction feature vector between modeler j′ and modeler j at time t, and then the cross-expert temporal correlation matrix and the resonance kernel are used Fusion, get the new energy vehicle battery fusion characteristics , the specific implementation code is:
[0373] class CrossTemporalFusion:
[0374] def __init__(self, gated_interactions: dict, resonance_kernel:np.ndarray):
[0375] """
[0376] :param gated_interactions: dict {(model_i, model_j): ndarray(T,D)}
[0377] Gated Weighted Interaction Features
[0378] :param resonance_kernel: ndarray(M, M, T)
[0379] Multiscale resonant kernel
[0380] """
[0381] self.gated_interactions = gated_interactions
[0382] self.resonance_kernel = resonance_kernel
[0383] self.model_pairs = list(gated_interactions.keys())
[0384] self.time_steps, self.feature_dim = next(iter(gated_interactions.values())).shape
[0385] self.num_models = resonance_kernel.shape[0]
[0386] def _build_time_correlation_matrix(self, X: np.ndarray):
[0387] """
[0388] Constructing a cross-time correlation matrix
[0389] :param X: ndarray(T, D)
[0390] :return: ndarray(T, T) symmetric matrix
[0391] """
[0392] normed = (X - X.mean(axis=0)) / (X.std(axis=0) + 1e-6)
[0393] correlation = np.matmul(normed, normed.T) / self.feature_dim
[0394] return correlation
[0395] def _temporal_attention_pooling(self, time_corr: np.ndarray, features: np.ndarray):
[0396] """
[0397] Perform weighted fusion based on the cross-temporal correlation matrix
[0398] :param time_corr: (T, T) matrix
[0399] :param features: (T, D) original interaction features
[0400] :return: (T, D) weighted fusion features
[0401] """
[0402] # Use tanh + softmax to get attention weights
[0403] raw_score = tanh(time_corr)
[0404] weights = np.exp(raw_score) / np.sum(np.exp(raw_score), axis=1,keepdims=True)
[0405] return np.matmul(weights, features)
[0406] def _fuse_with_resonance(self, fused_dict):
[0407] """
[0408] Fuse the weights in the resonance kernel to construct the final fusion feature
[0409] :param fused_dict: {(i, j): ndarray(T, D)}
[0410] :return: ndarray(M, T, D) Final fusion output of multiple models
[0411] """
[0412] fused_features = np.zeros((self.num_models, self.time_steps,self.feature_dim))
[0413] for i in range(self.num_models):
[0414] for j in range(self.num_models):
[0415] if i == j:
[0416] continue
[0417] key = (f'Model_{i}', f'Model_{j}')
[0418] if key not in fused_dict:
[0419] continue
[0420] weight = self.resonance_kernel[i, j, :].reshape(-1, 1) # (T,1)
[0421] fused_features[i] += weight * fused_dict[key]
[0422] return fused_features # shape: (M, T, D)
[0423] def run(self):
[0424] """
[0425] Execute the main process of cross-time fusion
[0426] :return: (M, T, D) model fusion output tensor
[0427] """
[0428] fused_dict = {}
[0429] for key, features in self.gated_interactions.items():
[0430] time_corr = self._build_time_correlation_matrix(features) # (T,T)
[0431] fused_feature = self._temporal_attention_pooling(time_corr,features) # (T, D)
[0432] fused_dict[key] = fused_feature
[0433] final_output = self._fuse_with_resonance(fused_dict).
[0434] S4. Build an anomaly judgment module, design a dynamic weighted anomaly scoring calculation method, and complete battery anomaly detection for new energy vehicles.
[0435] Furthermore, an abnormality judgment module is constructed to input the local sequence of the new energy vehicle battery , calculate the abnormal response value of each modeler to the input, combined with the dynamic weight , through the cross-time correlation matrix and time sliding weighting coefficient Fusion, combined with the anomaly scoring function of sparsity measurement, designed a dynamic weighted anomaly scoring calculation method. The specific mathematical model is:
[0436] ;
[0437] Where, is the number of initialized modelers, is the anomaly scoring function of the sparsity measure, where is the gated weighted interaction feature vector between modeler j′ and modeler j at time t, The initialization parameter set for each subdomain is finally scored based on the anomaly Dynamically set thresholds , initially set to 0.7, if , then it is judged that the new energy vehicle battery is abnormal. The specific implementation code is:
[0438] class AnomalyScorer:
[0439] def __init__(self, fused_features, lambda_weights=None, correlation_matrix=None, threshold_mode='adaptive'):
[0440] """
[0441] :param fused_features: ndarray(M, T, D), fused output
[0442] :param lambda_weights: ndarray(T,), time sliding weight coefficient
[0443] :param correlation_matrix: ndarray(M, M), inter-modeler synergy coefficient
[0444] :param threshold_mode: str, optional 'adaptive' or 'fixed'
[0445] """
[0446] self.fused_features = fused_features
[0447] self.num_models, self.time_steps, self.feature_dim = fused_features.shape
[0448] self.lambda_weights = lambda_weights if lambda_weights is notNone else np.ones(self.time_steps)
[0449] self.correlation_matrix = correlation_matrix if correlation_matrix is not None else np.eye(self.num_models)
[0450] self.threshold_mode = threshold_mode
[0451] def _compute_sparsity_score(self, feature_vector):
[0452] """
[0453] Sparsity measure: using normalized entropy as anomaly response function
[0454] The lower the entropy, the more sparse the vector is.
[0455] """
[0456] normed = np.abs(feature_vector) / (np.sum(np.abs(feature_vector))+ 1e-6)
[0457] return 1.0 - entropy(normed) / np.log(len(normed))
[0458] def _compute_model_response(self):
[0459] """
[0460] Calculate anomaly response values for each modeler at each time step
[0461] :return: ndarray(M, T)
[0462] """
[0463] responses = np.zeros((self.num_models, self.time_steps))
[0464] for m in range(self.num_models):
[0465] for t in range(self.time_steps):
[0466] responses[m, t] = self._compute_sparsity_score(self.fused_features[m, t])
[0467] return responses
[0468] def _dynamic_weight_fusion(self, responses):
[0469] """
[0470] Dynamic weighted fusion using time sliding factors and modeler collaboration
[0471] :param responses: ndarray(M, T)
[0472] :return: ndarray(T,) Final anomaly score for each time step
[0473] """
[0474] fusion_score = np.zeros(self.time_steps)
[0475] correlation_weights = softmax(self.correlation_matrix.sum(axis=1)) # (M, )
[0476] for t in range(self.time_steps):
[0477] temp_sum = 0.0
[0478] for m in range(self.num_models):
[0479] weight = correlation_weights[m] * self.lambda_weights[t]
[0480] temp_sum += weight * responses[m, t]
[0481] fusion_score[t] = temp_sum
[0482] return fusion_score
[0483] def _set_threshold(self, scores):
[0484] """
[0485] Dynamically set anomaly thresholds
[0486] """
[0487] if self.threshold_mode == 'fixed':
[0488] return 0.7 # fixed threshold
[0489] else:
[0490] mu = np.mean(scores)
[0491] sigma = np.std(scores)
[0492] return mu + 2 * sigma
[0493] def run(self):
[0494] """
[0495] Execute the anomaly scoring process
[0496] :return: (score_t, label_t)
[0497] """
[0498] responses = self._compute_model_response() # M x T
[0499] scores = self._dynamic_weight_fusion(responses) # T
[0500] threshold = self._set_threshold(scores)
[0501] labels = (scores>= threshold).astype(int) # 1=abnormal, 0=normal.
[0502] Furthermore, the BEACON 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 new energy vehicle battery-related data, which is input into the BEACON anomaly detection model after preprocessing.
[0503] Furthermore, the BEACON anomaly detection model realizes the effect of anomaly detection of new energy vehicle batteries as shown in the figure below. Figure 5 The figure shows the BEACON anomaly detection model's performance on three key battery sensor data types. From top to bottom, the time series signals for voltage, current, and temperature are shown, with the gray-shaded area representing the anomalous segments detected by the model. In the voltage curve, strong high-frequency oscillations occur between approximately 20 and 30 seconds. The BEACON model accurately identifies this segment as an extreme oscillatory voltage anomaly, demonstrating its high sensitivity in capturing perturbation trajectories and structural mutations. In the current curve, distinct quasi-sinusoidal periodic fluctuations appear around 50 seconds. The model also accurately locates the anomalous segment, demonstrating its multi-scale structural resonance modeling capabilities and its excellent ability to discern periodic structural differences. In the temperature curve, a physically impossible sudden drop occurs after approximately 75 seconds. The model promptly and accurately identifies this anomalous region, demonstrating its strong robustness to nonlinear mutations. Overall, the BEACON model can not only accurately identify anomalies of different forms, but also has good boundary judgment capabilities and timeliness. Its modular structure realizes multi-scale disturbance-guided feature extraction, completes dynamic fusion between modelers through structural resonance and gating mechanisms, and introduces sparse response and collaborative weighting to realize anomaly scoring and judgment, ultimately achieving high-precision detection of complex battery anomalies.
Claims
1. A method for detecting battery anomalies in new energy vehicles, characterized in that: The following steps are involved: S1. Collect battery-related data of new energy vehicles, build a data set, and divide the data set after preprocessing; S2. Construct a feature extraction adaptation module for domain robust anomaly features. The specific steps are as follows: S21. Calculate the loss of the subdomain in the training set and quickly update the initial parameters; S22. Propose a trajectory point generation method based on variable scale amplitude and time lag term, construct a multi-scale vector offset sequence of variable embedded trajectory, and design the rotation angle evolution factor and dynamic disturbance offset term to guide the disturbance response direction; S23. A topological perturbation bifurcation response factor is proposed. Combining the rotation angle evolution factor with the dynamic perturbation offset term, the topological perturbation bifurcation response factor is obtained, and the characteristic vector of the new energy vehicle battery is calculated. S3. Build a dynamic fusion module to dynamically suppress interference features. The specific steps are as follows: S31. Input the feature vector, introduce multi-scale resonance modeling, calculate the structural similarity and difference between modelers to obtain the resonance kernel, and construct the structural resonance expression to obtain the multi-scale interaction kernel; S32. An extended adaptive gating mechanism is proposed, which introduces a time dynamic adjustment mechanism, calculates the gating factor, and further combines the time sliding coefficient and weight to obtain the gated weighted interaction feature vector; S33, constructing a cross-time correlation matrix, fusing the gated weighted interaction feature vector, calculating the multi-scale interaction kernel, and fusing it with the resonance kernel to obtain the fusion feature; S4. Build an anomaly judgment module and design a dynamic weighted anomaly scoring calculation method to complete battery anomaly detection for new energy vehicles. The specific steps are as follows: For inputting local sequence of new energy vehicle batteries , calculate the abnormal response value of each modeler to the input, combined with the dynamic weight , through the cross-time correlation matrix and time sliding weighting coefficient Fusion, combined with the anomaly scoring function of sparsity measurement, designed a dynamic weighted anomaly scoring calculation method. The specific mathematical model is: ; Where, is the number of initialized modelers, is the anomaly scoring function of the sparsity measure, where is the gated weighted interaction feature vector between modeler j′ and modeler j at time t, The initialization parameter set for each subdomain is finally scored based on the anomaly Dynamically set thresholds Determine abnormal data of new energy vehicle batteries.
2. The method for detecting battery abnormality of a new energy vehicle according to claim 1, characterized in that: In the step S21, the local sequence of the new energy vehicle battery is input. , divide the sequence into multiple data segments ,initialization Modeler , and divide subdomains, of which For each subdomain, the initialization parameter set is used to calculate the loss of the new energy vehicle battery data segment in the input training set in each subdomain, and the optimal subdomain is selected to quickly update the initial parameters to obtain the updated parameters. The specific mathematical model is: ; Where, is the kth subdomain parameter of the jth modeler, After the parameters of the kth sub-domain are updated, the updated parameters of the data sub-segment corresponding to the new energy vehicle battery data in the i-th time period are updated. is the training sub-segment corresponding to the new energy vehicle battery data in the i-th time period, is the loss corresponding to the subdomain of the j-th modeler, where , is the learning rate, is the partial derivative vector.
3. The method for detecting battery abnormality of a new energy vehicle according to claim 2, characterized in that: In the above S22, the trajectory points based on the variable scale amplitude and time lag term are proposed. The generation method is to construct a multi-dimensional trajectory point sequence by sampling the current value of the variable and its previous value according to the preset lag interval within a fixed time window, forming a trajectory point and constructing a multi-scale vector offset sequence of the variable embedded in the trajectory. , design rotation angle evolution factor Quantify the local rotation curvature between continuous states. The specific mathematical model is: ; Where, is the length of the phase space trajectory after delayed embedding, is the inverse cosine function, is the inner product of two multi-scale vector offset sequences, is the norm, is the trajectory index, is a very small positive number, is a multi-scale vector offset sequence, where , Design a dynamic disturbance offset term for the lth trajectory point after delayed embedding of the new energy vehicle battery variable at time t and in the dth dimension To guide the disturbance response direction, the specific design is as follows: calculate the difference between the current new energy vehicle battery value and the historical mean value in the time window, and use the historical standard deviation to normalize the difference to obtain the dynamic disturbance offset term reflecting the new energy vehicle battery value. The specific mathematical model is: ; Where, is the value of the d-dimensional variable of the new energy vehicle battery at time t, is a fixed window length, is the standard deviation, is a very small positive number.
4. The method for detecting battery abnormality of a new energy vehicle according to claim 3, characterized in that: In the above S23, a topological perturbation bifurcation response factor is proposed. The construction process is as follows: the dynamic perturbation offset term of the new energy vehicle battery value is combined with standard deviation normalization and periodic phase modulation, the rotation angle evolution factor is integrated, and a composite triangular modulation function based on a dual phase term is proposed. At the same time, a fusion polynomial scale control term and a sigmoid adjustment factor are constructed to obtain the topological perturbation bifurcation response factor. , the specific mathematical model is: ; Where, is the dynamic disturbance offset term, is the rotation angle evolution factor, is a periodic modulation function based on the rotation angle, is a periodic modulation function based on the disturbance offset, is a constant weight factor, is a natural exponential function, and the topological perturbation bifurcation response factors of the j new energy vehicle battery variable dimensions are constructed into a diagonal modulation matrix , perform weighted adjustment on each dimension of the original new energy vehicle battery local sequence to generate the modulated new energy vehicle battery input , then each modeler uses the modulated new energy vehicle battery input and the updated parameters to perform feature extraction mapping to obtain the new energy vehicle battery feature vector , the specific mathematical model is: ; Where, After the parameters of the kth sub-domain are updated, the updated parameters of the data sub-segment corresponding to the new energy vehicle battery data in the i-th time period are updated. For the modulated new energy vehicle battery input, is the feature extraction function of the corresponding modeler.
5. The method for detecting battery abnormality of a new energy vehicle according to claim 4, characterized in that: In said S31, the new energy vehicle battery feature vector is input The multi-scale resonance modeling is introduced to calculate the nonlinear mapping between the similarities between the features of different modelers at multiple new energy vehicle battery scales, and the structural similarity and difference between the modelers are calculated at different scale levels to obtain the resonance kernel. , the specific mathematical model is: ; Where, is the scale number of the multi-scale structural resonance kernel, is the weight coefficient of the s-th scale, is the nonlinear mapping function of the s-th scale, To represent the new energy vehicle battery feature vector of the j′th modeler at time t based on its k′th subdomain, the corresponding structural resonance expressions are constructed at different new energy vehicle battery scale levels. , forming multiple levels of expert interaction tensors, and integrating the expert interaction information of different scales through the weight coefficients of each scale, and performing multi-scale hierarchical fusion to obtain the multi-scale interaction kernel .
6. The method for detecting battery abnormality of a new energy vehicle according to claim 5, characterized in that: In said S32, the new energy vehicle battery characteristic vector is input , proposed an extended adaptive gating mechanism and introduced a time dynamic adjustment mechanism. The specific design is as follows: construct a set of gating functions, use nonlinear activation functions to map the numerical difference information of the feature vectors extracted from the new energy vehicle battery data input at the same time into the dynamic participation weight of each pair of modelers, and obtain the gating factor between modelers j and j′ at time t , the specific mathematical model is: ; Where, is the Sigmoid activation function, is the difference in modeler features, 、 is the weight vector and bias, combined with the time dynamic adjustment factor , a time sliding weighting coefficient is designed. For each moment t, the extended adaptive gating mechanism is dynamically adjusted according to the input feature vector and the difference of the modeler features at the current moment. The specific mathematical model is: ; Where, is the time sliding weight coefficient between modelers j and j′ at time t. The feature vector is element-wise multiplied by the time sliding weight coefficient to obtain the gated weighted interaction feature vector dominated by modeler j and modeler j′ at time t. .
7. The method for detecting battery abnormality of a new energy vehicle according to claim 6, characterized in that: In the above S33, a cross-time correlation matrix is constructed based on the dynamic evolution law of the time series. , the gated weighted interaction feature vector dominated by input modeler j and modeler j′ at time t , through the multi-scale interaction kernel The specific mathematical model is: ; Where, is the activation function, is the gated weighted interaction feature vector between modeler j′ and modeler j at time t, and then the cross-expert temporal correlation matrix and the resonance kernel are used Fusion, get the new energy vehicle battery fusion characteristics .
Citation Information
Patent Citations
AIoT multi-modal data fusion decision-making method and system based on deep learning and application
CN119939525A
Power battery health state anomaly detection method based on machine learning
CN120142955A