A method for detecting anomalies in new energy vehicle battery systems applicable to multiple scenarios
By using the Trans-GAN model based on Transformer and the CUSUM method, the problem of anomaly detection in new energy vehicle battery systems under multiple scenarios was solved, improving detection accuracy and reducing computational costs, thus ensuring the safety of the battery system.
Patent Information
- Application Number
- CN202410720925.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-06-05
AI Technical Summary
Existing technologies struggle to effectively detect anomalies in new energy vehicle battery systems across various usage scenarios, and the dependence on the quantity and quality of sample data particularly limits the practicality of machine learning methods.
Unsupervised anomaly detection is performed using the Trans-GAN model based on Transformer. By partitioning the dataset, extracting features, and using the CUSUM method, combined with the data features of charging and discharging scenarios, an anomaly detection method for battery systems applicable to multiple scenarios is established. The method is trained using the reconstruction error and discrimination error loss function of the Trans-GAN generator and discriminator, and battery anomalies are judged by the CUSUM threshold.
It enables the detection of battery system voltage inconsistencies under different vehicle usage scenarios, improves detection accuracy and reduces computational costs, and ensures the safe operation of new energy vehicle battery systems.
Smart Images

Figure SMS_1 
Figure SMS_3 
Figure SMS_5
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fault diagnosis technology for power battery systems of new energy vehicles, and specifically relates to a method for detecting abnormalities in new energy vehicle battery systems applicable to multiple scenarios. Background Technology
[0002] Currently, many anomalies in automotive power battery systems during use are difficult to detect directly, requiring indirect assessment using parameters such as battery voltage, current, and state of charge (SOC). However, because these parameters exhibit different characteristics and trends in typical usage scenarios such as charging and discharging in new energy vehicles, existing technologies rarely offer battery system anomaly detection methods that are well-suited to various usage scenarios. While some existing technologies utilize data-driven anomaly detection methods based on machine learning, which can train relatively accurate battery anomaly prediction models using a large amount of battery sample data, their high dependence on the quantity and quality of the sample data limits their practicality. Summary of the Invention
[0003] In view of this, and to address the technical problems existing in this field, the present invention provides a method for detecting anomalies in new energy vehicle battery systems applicable to multiple scenarios, specifically including the following steps:
[0004] Step 1: Divide the historical data of new energy vehicles during normal operation into data segments based on charging and discharging scenarios, and use each data segment to construct a dataset corresponding to the charging and discharging scenarios respectively.
[0005] Step 2: Extract feature parameters related to battery voltage using the datasets from charging and discharging scenarios;
[0006] Step 3: Use the deep learning framework Tensorflow to build a Trans-GAN model. The generator and discriminator in the model are both based on the Transformer model. The generator accepts random noise as input and outputs fake battery voltage segments, which are then input into the discriminator along with real battery voltage segments to distinguish between real and fake segments. At the same time, the generator and discriminator generate corresponding reconstruction error loss and discrimination error loss, respectively.
[0007] Step 4: Train the established Trans-GAN model using the datasets from charging and discharging scenarios until a predetermined number of training iterations are reached or the loss functions of the generator and discriminator reach a certain convergence threshold.
[0008] Step 5: Compare the reconstructed voltage data obtained by the trained Trans-GAN model with the original voltage data during actual vehicle operation, and calculate the residual between the two; set a sliding window and calculate the cumulative sum of residuals (CUSUM) in each window; compare the calculated CUSUM value with the corresponding threshold, and if it exceeds the threshold, record that the battery has an anomaly in the corresponding scenario.
[0009] Furthermore, in step two, specifically for the charging scenario, Pearson correlation analysis is used to extract SOC and current data as feature parameters.
[0010] For discharge scenarios, the following feature extraction method based on the shape of time series data is specifically used:
[0011] First, find the midpoint between every two frames of the discharge data segment, denoted as:
[0012]
[0013] Where j represents the j-th data frame;
[0014] Then calculate the slope at the midpoint.
[0015]
[0016] And calculate the rate of change of slope between two adjacent slope segments:
[0017]
[0018] The average slope change rate of the discharge data segment is calculated based on the obtained slope change rate, and this average slope change rate is set as the threshold for the slope change rate.
[0019] Identify inflection points in data segments based on the set slope change rate threshold and the following criteria:
[0020]
[0021] Based on the identified inflection points, the peak and trough values of the data segments are determined according to the following criteria:
[0022]
[0023] By connecting all the inflection points, the dimensionality of the data is reduced and inconspicuous features are filtered out. The retained data curves are used as feature parameters corresponding to the discharge scenario.
[0024] Furthermore, in the Trans-GAN model established in step three, the specific form of the generator's reconstruction error loss function is as follows:
[0025]
[0026] Among them, L G The reconstruction error loss is G(z) = N / (N * N ... i ) represents the generator's response to input noise z i The generation result indicates that the generator generates random noise z. i The data generated in x i Let be the data of the i-th sample, which is the real data, and |·| represent the L2 norm of the vector, which is also the Euclidean distance;
[0027] The specific form of the discrimination error loss function of the discriminator is as follows:
[0028]
[0029] Among them, L D To identify the error loss, N is the number of samples, y i Let y be the label of the i-th sample, taking the value 0 or 1. If it is real data, then y i =1; if it is generated data, then y i =0; x i Let D(x) be the data for the i-th sample, which is either real data or generated data. i ) is the discriminator for sample x i The output result indicates that x i The probability of being identified as real data.
[0030] Furthermore, in step four, the training of the generator and discriminator is performed alternately, with the discriminator trained first and then the generator trained each time; the Adam optimizer is used to minimize the two error loss functions in the model to iteratively update the parameters of the generator and discriminator during training.
[0031] Furthermore, the CUSUM threshold set in step five is specifically determined based on the distribution of the calculated CUSUM values and the 3σ principle.
[0032] The above-mentioned anomaly detection method for new energy vehicle battery systems applicable to multiple scenarios provided by this invention performs dataset construction and feature extraction for different vehicle usage scenarios, and establishes an unsupervised anomaly detection model based on Trans-GAN. Based on this, an improved Cumulative Summation (CUSUM) method is used to effectively detect voltage inconsistencies in battery systems under different scenarios. The non-convolutional nature of the Trans-GAN model used gives this invention significant advantages in terms of accuracy and computational cost compared to other GAN-based methods. Detailed Implementation
[0033] The technical solution of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] The present invention provides a method for detecting anomalies in new energy vehicle battery systems applicable to multiple scenarios, specifically including the following steps:
[0035] Step 1: Divide the historical data of new energy vehicles (vehicles that are still running as of the time the data is obtained) during normal operation into data segments based on charging and discharging scenarios, and use each data segment to construct a dataset corresponding to the charging and discharging scenarios respectively.
[0036] Step 2: Extract feature parameters related to battery voltage using the datasets from charging and discharging scenarios;
[0037] Step 3: Use the deep learning framework Tensorflow to build a Trans-GAN model. The generator and discriminator in the model are both based on the Transformer model. The generator accepts random noise as input and outputs fake battery voltage segments, which are then input into the discriminator along with real battery voltage segments to distinguish between real and fake segments. At the same time, the generator and discriminator generate corresponding reconstruction error loss and discrimination error loss, respectively.
[0038] Step 4: Train the established Trans-GAN model using the datasets from charging and discharging scenarios until a predetermined number of training iterations are reached or the loss functions of the generator and discriminator reach a certain convergence threshold.
[0039] Step 5: Compare the reconstructed voltage data obtained by the trained Trans-GAN model with the original voltage data during actual vehicle operation, and calculate the residual between the two; set a sliding window and calculate the cumulative sum of residuals (CUSUM) in each window; compare the calculated CUSUM value with the corresponding threshold, and if it exceeds the threshold, record that the battery has an anomaly in the corresponding scenario.
[0040] In a preferred embodiment of the present invention, in step two, for the charging scenario, since the operating conditions are stable during charging, the voltage data curve is stable and less affected by external interference, the Pearson correlation analysis method is used to extract SOC and current data as feature parameters to improve the convergence speed of the model.
[0041] For discharge scenarios, the complex operating conditions during discharge are influenced by factors such as traffic conditions and individual driving habits, leading to large fluctuations in the voltage data curve. Directly using this data would reduce model computational efficiency and introduce significant errors. Therefore, it is necessary to reduce the dimensionality of the discharge process data while retaining important features. Specifically, the following feature extraction method based on the shape of time series data is utilized:
[0042] First, find the midpoint between every two frames of the discharge data segment, denoted as:
[0043]
[0044] Where j represents the j-th data frame;
[0045] Then calculate the slope at the midpoint.
[0046]
[0047] And calculate the rate of change of slope between two adjacent slope segments:
[0048]
[0049] The average slope change rate of the discharge data segment is calculated based on the obtained slope change rate, and this average slope change rate is set as the threshold for the slope change rate.
[0050] Identify inflection points in data segments based on the set slope change rate threshold and the following criteria:
[0051]
[0052] Based on the identified inflection points, the peak and trough values of the data segments are determined according to the following criteria:
[0053]
[0054] By connecting all the inflection points, the dimensionality of the data is reduced and inconspicuous features are filtered out. The retained data curves are used as feature parameters corresponding to the discharge scenario.
[0055] In a preferred embodiment of the present invention, the reconstruction error loss function of the generator in the Trans-GAN model established in step three takes the following specific form:
[0056]
[0057] Among them, L G The reconstruction error loss is G(z) = N / (N * N ... i ) represents the generator's response to input noise z i The generation result indicates that the generator generates random noise z.i The data generated in x i Let be the data of the i-th sample, which is the real data, and |·| represent the L2 norm of the vector, which is also the Euclidean distance;
[0058] The specific form of the discrimination error loss function of the discriminator is as follows:
[0059]
[0060] Among them, L D To identify the error loss, N is the number of samples, y i Let y be the label of the i-th sample, taking the value 0 or 1. If it is real data, then y i =1; if it is generated data, then y i =0; x i Let D(x) be the data for the i-th sample, which is either real data or generated data. i ) is the discriminator for sample x i The output result indicates that x i The probability of being identified as real data.
[0061] In a preferred embodiment of the present invention, the training of the generator and the discriminator is performed alternately in step four, with the discriminator being trained first and then the generator being trained each time; the Adam optimizer is used to minimize the two error loss functions in the model so as to iteratively update the parameters of the generator and the discriminator during the training process.
[0062] In a preferred embodiment of the present invention, the CUSUM threshold set in step five is specifically determined based on the distribution of the calculated CUSUM values, using the 3σ principle. By comparing the calculated CUSUM value with the corresponding threshold, if it exceeds the set anomaly detection threshold, the battery anomaly is recorded, and timely maintenance is performed to ensure the safe operation of the new energy vehicle battery system.
[0063] It should be understood that the sequence number of each step in the embodiments of the present invention does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0064] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for detecting abnormality of a new energy vehicle battery system suitable for multiple scenarios, characterized in that: Specifically comprising the following steps: Step one, divide the historical data of the new energy vehicle in normal operation into data segments based on charging and discharging scenarios, and use each data segment to construct a data set corresponding to the charging scenario and the discharging scenario respectively; Step two, use the data sets of the charging and discharging scenarios to extract the feature parameters related to the battery voltage respectively; for the charging scenario, specifically use the Pearson correlation analysis method to extract the SOC and current data as the feature parameters; For the discharging scenario, specifically use the following feature extraction method based on the shape of time series data: First, find the midpoint of each two frames of data in the discharging data segment, denoted as: Where j represents the jth data frame; Then the slope at the midpoint is calculated And calculate the slope change rate between the adjacent two slopes: According to the obtained average slope change rate of the discharging data segment, set it as the threshold value of the slope change rate; According to the set slope change rate threshold value and the following judgment basis, identify the turning points in the data segment: On the basis of the identified turning points, identify the peak value and the valley value of the data segment based on the following judgment basis: Connect all the turning points to realize dimension reduction of the data and filter out the unobvious features, and take the remaining data curve as the feature parameter corresponding to the discharging scenario; Step three, use the deep learning framework Tensorflow to establish a Trans-GAN model, and the generator and the discriminator in the model are both based on the Transformer model; the generator accepts random noise as input and outputs a fake battery voltage segment, and inputs the real battery voltage segment and the fake battery voltage segment into the discriminator to identify the authenticity of the segment, while the generator and the discriminator generate corresponding reconstruction error loss and discrimination error loss respectively; Step four, use the data sets of the charging and discharging scenarios to train the established Trans-GAN model respectively until a predetermined training number is reached or the loss functions of the generator and the discriminator reach a certain convergence threshold; Step five, compare the reconstructed voltage data obtained by the trained Trans-GAN model with the original voltage data in the actual vehicle operation, calculate the residual error between them; set a sliding window and calculate the cumulative sum CUSUM value of the residual error in each window; compare the calculated CUSUM value with the corresponding threshold value, if it exceeds the threshold value, record that the battery has an abnormality in the corresponding scenario.
2. The method of claim 1, wherein: In the Trans-GAN model established in step three, the specific form of the reconstruction error loss function of the generator is as follows: Among them, L G The reconstruction error loss is G(z) = N / (N * N ... i ) represents the generator's response to input noise z i The generation result indicates that the generator generates random noise z. i The data generated in x i Let be the data of the i-th sample, which is the real data, and |·| represent the L2 norm of the vector, which is also the Euclidean distance; The specific form of the discrimination error loss function of the discriminator is as follows: where L D is the discrimination loss, N is the number of samples, y i is the label of the i-th sample, taking value 0 or 1, y i = 1 if it is real data, and y i = 0 if it is generated data, x i is the data of the i-th sample, which is real data or generated data, D(x i ) is the output result of the discriminator on the sample x i , representing the probability of judging x i as real data.
3. The method of claim 1, wherein: In step four, the training of the generator and the discriminator is alternately carried out, and the discriminator is trained first, and then the generator is trained; use the Adam optimizer to minimize the two error loss functions in the model to iteratively update the parameters of the generator and the discriminator in the training process.
4. The method of claim 1, wherein: The CUSUM threshold value set in step five is specifically determined based on the 3σ principle according to the distribution of the calculated CUSUM value.
Citation Information
Patent Citations
Vehicle power battery system fault diagnosis method based on LSTM-GAN
CN117110888A