Battery system fault identification method and system based on time sequence contrast learning encoder
By integrating a lightweight convolutional and Transformer hybrid encoder, combined with a contrastive projection head and a custom loss function, the problem of multi-scale feature modeling for fault identification in lithium battery energy storage power stations is solved, enabling efficient fault identification and early warning under complex operating conditions.
Patent Information
- Application Number
- CN202511432910.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-10-09
AI Technical Summary
Existing technologies struggle to effectively identify faults under complex operating conditions in lithium battery energy storage power stations. In particular, the lack of joint modeling capabilities for multi-scale time-series features and reliance on manually labeled data lead to unstable model generalization performance and difficulty in capturing short-term dynamic fluctuations and long-term gradual changes in battery data.
We employ a temporal contrastive learning encoder approach, which integrates a lightweight convolutional and Transformer hybrid encoding structure. We introduce a contrastive projection head and a custom contrastive loss function, extract multi-layer temporal features through convolutional embedding and Transformer modules, and enhance the separability of feature vectors by using contrastive learning.
It enhances the sensitivity and generalization ability of fault identification, effectively distinguishing between normal and abnormal states without requiring a large number of tags, and improves the ability to identify complex coupled faults, making it suitable for deployment in edge devices.
Smart Images

Figure CN120892801A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of battery system fault identification, in particular to a battery system fault identification method and system based on a time series contrast learning encoder. BACKGROUND
[0002] The statements in this section merely provide background information related to the present application and do not necessarily constitute prior art.
[0003] In complex energy systems such as lithium battery energy storage power stations, the running state of the battery directly relates to the safety of the equipment and the stability of the system. With the increase of system capacity and the diversification of operating conditions, traditional fault identification methods based on fixed thresholds or static models cannot meet the actual needs of early warning of faults, nonlinear dynamic detection and identification of new types of abnormalities. Therefore, an intelligent fault identification method that can adaptively learn the running characteristics of the battery, has the ability to model multivariate time series and is suitable for deployment is urgently needed to improve the intelligent level of battery system operation and maintenance and the running safety guarantee capability.
[0004] The existing technical methods for battery system fault identification mainly include two categories: one is the classification model based on supervised learning, such as LSTM combined with Softmax classifier; the other is the reconstruction model based on unsupervised learning, such as autoencoder (Autoencoder) and variational autoencoder (VAE). Although these methods have achieved certain results in some scenarios, there are still the following outstanding problems in complex actual working conditions: first, strong dependence on manual labeling: supervised methods usually need a large amount of labeled abnormal data for training, while in actual battery systems, fault samples are rare, incomplete in type, and labels are lagging or even wrong. This data imbalance problem leads to unstable model generalization performance and easy overfitting. Second, lack of joint modeling ability of multi-scale time series features: traditional sequence models can only model short-term dependencies (such as LSTM) or can only reconstruct sequence trends (such as Autoencoder), and it is difficult to capture both short-term dynamic fluctuations (such as sudden temperature rise) and long-term slowly varying characteristics (such as slow aging) in battery data, thereby limiting the recognition ability of complex coupled faults. SUMMARY
[0005] In order to solve the above problems, the present application proposes a battery system fault identification method and system based on a time series contrast learning encoder, which combines a hybrid encoding structure of lightweight convolution and Transformer, and introduces a contrast projection head and a self-defined contrast loss function, so that the model can effectively distinguish between normal and abnormal states in the battery system without a large number of labels, significantly improving the sensitivity and generalization ability of fault identification.
[0006] In order to achieve the above object, the present application adopts the following technical solutions: One or more embodiments provide a battery system fault identification method based on a time series contrast learning encoder, including the following steps: Convolutional embedding is performed on the multivariate time window sequence in the acquired EMS data stream to obtain an input sequence; A multi-layer time series feature extraction network with series-parallel mixed lightweight residual convolutional modules and time series Transformer modules is adopted to perform local time series pattern recognition and long-distance dependency relationship modeling on the input sequence, and after fusing the features extracted by each branch of the mixed structure, a feature vector is obtained A fault identification result is obtained after classification; In the training process of the multi-layer time series feature extraction network, the feature vector is Contrast space features are obtained by mapping the contrast projection head to another low-dimensional space, and a contrast loss is calculated through the contrast space features to enhance the separability of the feature vector.
[0007] One or more embodiments provide a battery system fault identification system based on a time series contrast learning encoder, including: An input sequence construction module configured to perform convolutional embedding on the multivariate time window sequence in the acquired EMS data stream to obtain an input sequence; An encoding module configured to adopt a multi-layer time series feature extraction network with series-parallel mixed lightweight residual convolutional modules and time series Transformer modules to perform local time series pattern recognition and long-distance dependency relationship modeling on the input sequence, and after fusing the features extracted by each branch of the mixed structure, a feature vector is obtained A fault identification result is obtained after classification; In the training process of the multi-layer time series feature extraction network, the feature vector is Contrast space features are obtained by mapping the contrast projection head to another low-dimensional space, and a contrast loss is calculated through the contrast space features to enhance the separability of the feature vector.
[0008] One or more embodiments provide a battery system fault identification system based on a time series contrast learning encoder, including: A data acquisition device and a processor; The data acquisition device is used to acquire an EMS data stream; The processor is configured to perform the steps of the battery system fault identification method based on the time series contrast learning encoder described above.
[0009] Compared with the prior art, the present application has the following beneficial effects: The application effectively considers short-term fluctuations and long-term trends in the multivariate time series data of the battery by fusing residual convolution and the Transformer structure, residual convolution is used for local feature extraction, the Transformer is used for global dependence modeling, and the structure is fused in parallel or series, the whole network realizes comprehensive perception of the battery time series data in multiple time scales, and the recognition ability of coupled and complex fault modes is improved.
[0010] The contrast learning mechanism of the application enhances the model's ability to distinguish abnormal states through the contrast projection head, especially in the case of rare abnormal data and fuzzy boundaries, improves the recognition robustness and accuracy. The contrast projection head projects the encoded feature vector into a new, low-dimensional contrast space to enhance the separability of different class samples in the embedding space, thereby improving the discriminant performance of the model.
[0011] The advantages of the application and the advantages of the additional aspects will be described in detail in the following specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0012] The drawings accompanying the specification of the application form a part of the application and serve to provide further understanding of the application, the illustrative embodiments of the application and their description serve to explain the application, and do not constitute a limitation of the application.
[0013] Figure 1 is a flowchart of the battery system fault recognition method of embodiment 1 of the application; Figure 2 is a structural schematic diagram of the lightweight residual convolution module of embodiment 1 of the application; Figure 3 is a structural schematic diagram of the Transformer encoder layer of embodiment 1 of the application; Figure 4 is a model inference schematic diagram of the battery system fault recognition method of embodiment 1 of the application; Figure 5 is a contrast learning training schematic diagram of embodiment 1 of the application; DETAILED DESCRIPTION The application will be further described below in conjunction with the drawings and embodiments.
[0014] It should be pointed out that the following detailed description is exemplary and is intended to provide further explanation of the application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as generally understood by those skilled in the art to which the application belongs.
[0015] It should be noted that the terminology used herein is for describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. It should be noted that, without conflict, the various embodiments and features within those embodiments can be combined with each other. The embodiments will now be described in detail with reference to the accompanying drawings.
[0016] Example 1 In one or more of the technical solutions disclosed in the embodiments, such as Figures 1 to 5 As shown, a battery system fault identification method based on a time-series contrastive learning encoder includes the following steps: Step 1: Perform convolution embedding on the multivariate time window sequence in the acquired EMS data stream to obtain the input sequence; Step 2: A multi-layer temporal feature extraction network, employing a hybrid of lightweight residual convolutional modules and temporal Transformer modules in series and parallel, is used to perform local temporal pattern recognition and long-distance dependency modeling on the input sequence. After fusing the features extracted from each branch of the hybrid structure, the extracted feature vector is obtained. The fault identification results are obtained after classification; During the training of a multi-layer temporal feature extraction network, the extracted feature vectors are... By mapping the contrast projection head to another low-dimensional space, contrast space features are obtained. Contrast loss is calculated using contrast space features to enhance the separability of feature vectors. This implementation first acquires time-series data containing multi-dimensional indicators such as voltage, current, and temperature from the Battery Management System (EMS), and forms a fixed-length multivariate time window sequence using a sliding window technique. The sequence is initially processed by a convolutional embedding layer to extract local features and form an embedding vector representing the input sequence. Subsequently, a hybrid multi-layer network consisting of a lightweight residual convolutional module and a temporal Transformer module is introduced. The residual convolutional module is mainly responsible for mining local short-term dynamic features, such as sudden current changes and temperature rises; the Transformer module focuses on modeling long-term dependencies, revealing trends such as battery aging or slow voltage drift. The features output from each branch of the network are concatenated or weighted to obtain a comprehensive feature vector, which is then input into a classifier to output the fault category. To improve recognition performance, a temporal contrastive learning mechanism is introduced during the training phase. A projection head maps features to a contrast space and calculates the contrast loss between positive and negative sample pairs, driving the model to learn a more discriminative embedding representation, thereby improving the ability to identify weak anomalies or early faults.
[0017] In this embodiment, by fusing residual convolution and Transformer structure, short-term fluctuations and long-term trends in battery multivariate time series data are effectively considered. Residual convolution is used for local feature extraction, Transformer is used for global dependence modeling, and the structure is fused in parallel or series. The whole network realizes comprehensive perception of battery time series data in multiple time scales, improves the recognition ability of coupled and complex fault modes. The contrast learning mechanism enhances the model's ability to distinguish abnormal states through contrast projection heads, especially in the case of rare abnormal data and fuzzy boundaries, improving the recognition robustness and accuracy. The contrast projection head projects the encoded feature vector into a new, low-dimensional contrast space to enhance the separability of different classes of samples in the embedding space, thereby improving the model's discriminant performance.
[0018] The network structure of this embodiment is lightweight, which is convenient for deployment in edge devices or industrial control systems, improves the system's intelligent and real-time operation capabilities, reduces the dependence on a large amount of labeled data, and reduces the training cost and actual application threshold.
[0019] In some embodiments, the above method process is implemented by a constructed time series contrast learning encoder, which includes: An input layer for convolutional embedding of the multivariate time window sequence in the acquired EMS data stream to obtain an input sequence; A multi-layer time series feature extraction network adopts a hybrid structure of serial and parallel connection of lightweight residual convolution modules and time series Transformer modules; including fusion of lightweight residual convolution modules and time series Transformer modules in series and parallel to consider local and global features; A time series Transformer module includes a multi-layer stacked Transformer encoder for modeling long-distance dependencies by introducing sparse attention to extract global semantic features; A lightweight residual convolution module extracts local detail features and short-term dynamic features through convolution and residual connection (ResNet) structure; A classifier module for classifying the extracted feature vector to obtain a fault recognition result; A contrast projection head, which is a multi-layer perceptron containing two levels of serially connected fully connected layers, is connected to the output of the multi-layer time series feature extraction network to output contrast space features, enhancing the contrast separability of the feature vector representation; In this embodiment, in step 1, the acquired EMS data stream refers to a multivariate operation monitoring data sequence collected and output in real time by an energy management system (EMS) in a battery energy storage power station, which can be periodically completed by a BMS (Battery Management System) through a sensor module built-in, and the sampling frequency is usually set to 1 time per second or higher (such as 10 Hz) according to the specific configuration of the energy storage power station, so as to ensure high sensitivity capture of subtle dynamic changes in the battery operation state. The collected data is uploaded to the central processing system in real time through CAN communication or other industrial bus protocols (such as Modbus, EtherCAT), and is standardized stored in the form of a CSV file or a database, providing an original basis for subsequent data preprocessing and model training.
[0020] Optionally, the collected raw data covers multiple key variables in the battery operation process, mainly including the voltage (Voltage), current (Current), temperature (Temperature), state of charge SOC (State of Charge) and state of health SOH (State of Health) of the battery pack, and alarm flag and fault code in the system operation. These data are collected in real time by various sensors, fully reflecting the operation state of the battery system, and are the basis for subsequent anomaly detection and fault identification.
[0021] Optionally, the acquired data is preprocessed to obtain a plurality of multivariate time window sequences, which can include the following steps: Step 11, normalization processing: Z-score standardization or Min-Max normalization is used for all variables to eliminate the influence of dimension; Step 12, denoising and smoothing: median filter or moving average filter is applied to the curve data to suppress high-frequency noise; the curve data can include temperature, voltage, etc. Step 13, outlier elimination: three standard deviations principle or local outlier factor (LOF) based algorithm is used to identify and eliminate obvious abnormal data points; Step 14, missing value processing: linear interpolation, K-nearest neighbor filling and other methods are used to complete the missing area of the sensor signal interruption or missing sampling; Step 15, sliding window construction: the continuous time series data is cut into multiple sub-sequences according to the fixed length of the sliding window, forming a sample segment, i.e. a multivariate time window sequence; Optionally, each window length is set to T (such as 10 seconds to 60 seconds adjustable), and the step length is set to S (such as 50% of T), allowing overlap to enhance sample diversity; each window contains multivariate data, constituting an input sample matrix wherein D is the dimension of the collected variables; The embodiment effectively alleviates the challenges of inconsistent time sequence length and strong data noise, and improves the adaptability of the model to the battery operating state under dynamic conditions, by normalizing, denoising and smoothing the original multivariate time sequence data including voltage, current, temperature, SOC, etc., and constructing a fixed-length time sequence segment based on a sliding window.
[0022] Step 1 is implemented through the input layer of the encoder, and the input layer can adopt 1*1 convolution as the input layer; the input layer receives the preprocessed multivariate time window sequence as the input, and maps the multivariate sensor data at each time step to a high-dimensional feature vector through one-dimensional convolution.
[0023] The embedding operation of the one-dimensional convolution mapping of the input layer of the embodiment is equivalent to preliminary feature extraction and dimensionality reduction on the original input, which prepares for subsequent deep network processing.
[0024] The lightweight residual convolution module, as shown in Figure 2 The shallow CNN subnetwork composed of a one-dimensional convolution layer and a residual connection is used to extract local patterns and short-term dynamic features in the input multivariate time window sequence; it includes a one-dimensional convolution layer I, a depth separable convolution layer, a batch normalization layer, a ReLU activation layer, a one-dimensional convolution layer II and a residual connection module connected in turn; the input multivariate time window sequence is sequentially subjected to convolution, depth separable convolution, batch normalization, ReLU activation, convolution and residual addition operation; The one-dimensional convolution layer I and the one-dimensional convolution layer II can be 1*1 convolution respectively; the residual connection module is used to connect the input layer and the second convolution layer for residual addition operation. Specifically, the processing process of the lightweight residual convolution module is as follows: The one-dimensional convolution layer I (1*1) transformation formula is as follows: ; Wherein, Conv1 represents the convolution operation of the one-dimensional convolution layer I (1*1 convolution kernel), is the data input into the one-dimensional convolution layer I.
[0025] The depth separable convolution processing formula is as follows: ; Wherein, represents the use of depth separable convolution to reduce the number of parameters; The batch normalization processing formula is as follows: ; The activation function (ReLU) formula is as follows: ; One-dimensional convolution layer II (1x1) transformation, the formula is as follows: ; Wherein, Conv2 represents one-dimensional convolution layer II (1x1 convolution kernel); Residual connection (jump connection), the formula is as follows: ; Wherein, Y is the final module output of the lightweight residual convolution module, X is the initial input, and the residual addition operation is performed, and the input and output dimensions are required to match.
[0026] The lightweight residual convolution module of the embodiment, the convolution layer captures the short-term change trend of the battery data, and the residual connection (ResNet structure) alleviates the gradient disappearance of deep training through the identity shortcut channel and improves the feature transmission efficiency. The module is designed to be lightweight, using shallow convolution layers, small convolution kernels and depth separable convolution technology to reduce the model parameter quantity and calculation overhead. The output is a new feature sequence output by the lightweight residual module after local feature extraction of the input sequence.
[0027] The time series Transformer module further encodes the input sequence features and outputs a feature sequence containing global information, including multiple stacked Transformer encoder layers responsible for modeling long-range dependencies and global patterns; each Transformer encoder layer includes a multi-head attention module, a first layer normalization module, a feedforward network, and a second layer normalization module; a position encoding module is arranged before each Transformer encoder layer; The position encoding module, the embodiment proposes an information position encoding module combined with battery state semantics. The core idea is to use time, sensory features and global context to generate semantic position embedding, and explicitly encode the evolution of the battery state over time; Specifically, the position encoding function of the position encoding module takes the original time, local features and global context as input, and outputs a dimensional position embedding vector , and the encoding function can be expressed as: ; Wherein, represents a multivariate feature vector extracted based on the state variable, represents the global context feature of the state evolution information up to time; represents a mapping function with a learnable parameter .
[0028] Optionally, in the position encoding process, the encoding function can be decomposed into three partial functions, respectively calculating the encoding value, including the time position component, the local state component and the global context component: The time position component is calculated by the formula: ; Where, represents the encoding of the original time t, which can be combined in a linear and periodic function to capture the linear increasing trend and periodic pattern of time, as follows: ; Where, is a normalization factor, and is the total sequence length of the input sequence; , Different scales can be selected to cover possible periods (such as daily cycles or charge and discharge cycles).
[0029] The continuous time encoding linear and periodic components in the above embodiment; unlike the Transformer sine position encoding, a function with a frequency or form closer to the battery working period can be selected, and the parameters can be further adjusted through learning.
[0030] The local state component is calculated by the formula: ; ; Where, is a scaling and normalization or nonlinear transformation of the original feature. The first part includes the normalized embedding representation of key values such as current voltage, current, temperature, SOC, etc.; the second part includes the change amount of key values such as voltage, current, temperature, SOC, etc. in the time to indicate the dynamic change rate. Several sampling intervals can be taken, which can describe the voltage rise / drop speed, temperature rise rate, etc. Through the two parts, the running state of the battery at this moment and the recent change trend can be reflected.
[0031] For example, when the battery enters the abnormal precursor stage, some variables (such as temperature) will show a continuous upward trend, the change slope can be captured, so as to reflect the abnormal signs in the position encoding.
[0032] The position encoding module fuses time and state information, which is different from the position encoding based purely on sequence index, and combines the original time (timestamp or sequence step) and the battery running state for encoding. For each time , the position encoding is not only a function of the multi-dimensional feature state at that time point current voltage, current, temperature, SOC). This enables the position vector to embody the operational phase of the battery at that moment. For example, in a charge-discharge cycle, the SOC level at different time points will affect the battery behavior, and the above-mentioned encoding can reflect this phase information.
[0033] The global context component is given by: where C(t) represents the background information across a certain time scale, which is used to explicitly represent the global state of the battery; Optionally, the background information across a certain time scale can include: cumulative cycle number, cumulative passed electric quantity, current estimated health degree (SoH), time from the beginning of the last complete charge-discharge cycle, remaining time estimation from the end of the expected life, and other global quantities.
[0034] An algorithm or sensor is designed for these global quantities, and then is mapped to a suitable position embedding vector. Specifically: where is the normalized vector of each global feature, is a learnable matrix that elevates it to d.
[0035] The global context component ensures that the encoding contains information about the life cycle phase of the battery. For example, in the early life and late aging stages of the battery, the same voltage fluctuation can have different meanings, so that the model can perceive this global difference.
[0036] Finally, the above three components are combined to obtain the complete position embedding: Each part of the above position encoding carries explicit semantic information. The resulting can directly replace the original position encoding vector in the Transformer and be added to the input sequence bit by bit as the input of the Transformer encoder. Through the design of the above formula, a semantic-rich position encoding function is realized, which integrates time, local battery state and global evolution information together.
[0037] The above position encoding implementation tracks the cumulative changes of the battery state over time by introducing global context information. By defining a global state vector that evolves over time, it contains the evolution features of the battery from the initial to the current, such as the number of cycles passed, the cumulative discharge amount, the estimated health state, etc. The position encoding is The mapping is performed so that the gradual aging of the battery or the accumulation of abnormal signs is reflected in the encoding. When entering the critical stage before failure, Significant changes occur, and the encoding vector explicitly identifies different stages before and after failure accordingly; The position encoding module takes into account the relative time of each variable change in the design in response to the delay relationship of variables such as voltage, current, temperature, etc. In the encoding, information such as "the time of the last current change" "the duration after the voltage reaches the peak / valley" "the lag time of temperature relative to current change" is integrated as additional dimensions, so as to capture the relative timing relationship between variables. These additional position features help the model understand the causal timing dependence between different sensor signals.
[0038] Through the above semantic-rich encoding, the position encoding module separates the time points of different semantic stages in the feature space. For example, two time series with similar running state evolution patterns, even if they occur at different absolute times, their position encodings in the high-dimensional feature space will be closer; Conversely, sequences occurring at different state stages of the battery (such as health period vs. pre-failure) will obtain significantly different encodings. In this way, after contrastive learning, the model is easier to distinguish between normal and abnormal behavior, achieving higher semantic separability.
[0039] Let the input multivariate time window sequence be matrix : ; Where: T is the number of time steps; D is the feature dimension of each time step; represents the input feature vector of the Tth time step; In order for the Transformer to perceive the time sequence information, a position encoding needs to be added to each time step before the input sequence is sent to the multi-head attention module, and then the encoded input is: ; Multi-head attention module, used for multi-head attention operation on the sequence after adding position encoding, the specific process is as follows: First, for each attention head , calculate the linear projection matrix: ; Where, are the linear projection query (Query), key (Key), and value (Value) matrices, respectively; represents the query (Query), key (Key), and value (Value) matrices of the hth attention head; Then, the scaled dot-product attention calculation is performed as follows: ; wherein, denotes the feature dimension of each attention head, and the superscript T denotes the transpose; Finally, the outputs of the multi-head attention are spliced and mapped, and the formula is as follows: ; ; ; wherein, denotes a linear projection matrix used for output splicing results; denotes the final output feature of the hth attention head; The Transformer encoder layer includes two sub-layers, a first sub-layer and a second sub-layer; the first sub-layer includes performing multi-head attention, residual connection, normalization operation, and is represented as follows: ; The first sub-layer output of the Transformer encoder layer is input to the second sub-layer for processing by a feedforward network, and is represented as follows: ; ; wherein, is the final output of the Transformer encoder layer; Each Transformer encoder layer contains a multi-head self-attention mechanism and a feedforward network sub-layer, and captures distant relevant time points in the sequence through self-attention. The Transformer module can process the entire sequence in parallel, effectively extracting global features. For example, when some sensors show relevant changes after a long time lag, the Transformer can directly model this long-range correlation through the attention mechanism. The Transformer encoder layer further encodes the input sequence features, and outputs a feature sequence containing global information.
[0040] In some embodiments, the multi-layer time sequence feature extraction network adopts a hybrid structure in which a light residual convolution module and a time sequence Transformer module are fused in series and parallel modes. Specifically, the hybrid structure includes one or more series branches and parallel branches. The series branch includes a light residual convolution module and a time sequence Transformer module connected in series. In the series mode of the series branch, data flows through the convolution residual module and the time sequence Transformer encoder in sequence, or flows through the time sequence Transformer module and the light residual convolution module in sequence. The parallel branch is a light residual convolution module and a time sequence Transformer module as separate branches. In the parallel mode of the parallel branch, data is simultaneously sent to the two modules for parallel processing, and the obtained features are finally fused.
[0041] The hybrid structure of the present embodiment combines a Transformer encoder with a light residual convolution module to form a hybrid feature extraction system, which can work in series and parallel modes. The time sequence Transformer module with a self-attention mechanism is used to extract global semantic features, and the light residual convolution module is used to extract local detail features. The former is good at capturing long-distance dependencies and global information, and the latter is good at extracting local patterns and low-level texture features of images. By combining these two types of modules in structure (in series or in parallel), the model can simultaneously utilize the inductive bias of convolution and the self-attention modeling capability of Transformer, thereby obtaining better comprehensive performance than using CNN or Transformer alone. The overall flow of data in the architecture varies depending on the mode: In some embodiments, in the series mode, the two modules are connected in sequence, and the output of the former module is used as the input of the latter module. The specific process can be selected in different order according to the requirements; Specifically, in the multi-layer time sequence feature extraction network, the light residual convolution module is connected in series with the time sequence Transformer module to form a series branch, and the data processing process is as follows: Step 21, after the light residual convolution module receives the time sequence, it extracts two-dimensional features through multiple layers of convolution and residual connection; Step 22, flatten or cut the two-dimensional features into a series of feature vector sequences (i.e., Token); Step 23, add position information coding to each feature vector sequence to retain spatial position information; wherein the position information coding is extracted by the position coding module described above; Step 24, use the sequence feature with position information as the input of the time sequence Transformer module, extract global features in the multi-head self-attention and feedforward network, and output high-level semantic representation.
[0042] The series connection mode of the convolution module and the Transformer in this embodiment utilizes the convolution module to efficiently extract local patterns, and reduces the input dimension that needs to be processed by the Transformer, which is conducive to the Transformer focusing on global correlation faster, improving the learning speed and overall performance.
[0043] Alternatively, the series connection branch can connect the lightweight residual convolution module with the time sequence Transformer module in sequence, and adopt the sequence of the Transformer followed by the convolution. In the multi-layer time sequence feature extraction network, the time sequence Transformer module is connected with the lightweight residual convolution module in series to form the series connection branch, and the data processing process is as follows: Step 201, for the input input sequence, the first output feature is extracted by the Transformer encoder of the time sequence Transformer module; Step 202, the output first output feature is arranged into a feature map with a spatial layout, and a reshape operation is performed according to the dimension requirement, or is projected to a set channel dimension through linear mapping, to obtain a feature with adjusted dimension; Step 203, the feature with adjusted dimension is decoded by the convolution residual module, and a two-dimensional feature map is extracted through multi-layer convolution and residual connection, to realize efficient feature expression and task solving; It should be noted that the data form is converted when the two modules are connected in series in this embodiment. If the sequence output of the Transformer is to be transmitted to the convolution module, the sequence output of the Transformer is reshaped (such as arranged in a two-dimensional grid according to the position) or projected to an appropriate channel dimension through linear mapping. Conversely, if the output of the lightweight residual convolution module is transmitted to the time sequence Transformer module in the series connection branch, the serialized feature output by the lightweight residual convolution module is injected into the position coding, so that the format is compatible and the semantic information is not lost when the information flows between different modules.
[0044] In some embodiments, in the parallel mode, the two modules independently extract features from the input data, and then fuse the outputs to form richer feature representation, which includes the following steps: Step 31, the original input sequence is fed into two branches respectively, one branch is a lightweight residual convolution module, and the other branch is a time sequence Transformer encoder module; Step 32, in the lightweight residual convolution module, the input sequence is first subjected to feature extraction by a one-dimensional convolution layer, a depth separable convolution layer, a batch normalization layer, and an activation function, and the output is a local feature map with a spatial structure; Step 33, in the Transformer branch, the input sequence is added with position encoding and then sent to the multi-head self-attention mechanism and the feedforward network to extract the long-range dependencies and global feature representation in the sequence; Step 34, the two sets of features output by the convolution branch and the Transformer branch are aligned in dimension, format or spatial arrangement; Optionally, the format can be unified by reshape, zero padding, linear mapping, etc. Step 35, the two sets of features after format alignment are fused to generate a comprehensive feature representation containing both local and global information for subsequent anomaly detection tasks.
[0045] Optionally, the fusion of the two sets of features after format alignment can be performed by concatenation, weighted average or attention fusion.
[0046] In this embodiment, through the parallel structure, the model realizes the complementarity of local semantics and global semantics: the convolution path retains the fine spatial details, and the Transformer path provides the wide-range dependency relationship, and the features extracted by the two parallel paths form a more rich representation after fusion. This parallel fusion method can effectively combine the ability of Transformer to capture local context and the ability of CNN to extract global features, significantly improving the richness and accuracy of the extracted features. To realize the smooth fusion of the features output by the two branches, the size or format of the two branches is adjusted and aligned, and the embedding dimensions of the two outputs are unified. When fusing, it can ensure that the features at corresponding positions or channels can be correctly combined to form the final representation.
[0047] To effectively extract the local dynamic patterns (such as short-term current fluctuations and temperature sudden changes) and long-range dependencies (such as the delayed correlation between voltage drop and subsequent temperature rise) in the battery multivariate time series, while meeting the computational resource constraints of edge devices, this embodiment designs a hybrid feature extraction architecture. The architecture combines lightweight convolution residual modules (good at capturing local features) and Transformer encoder modules (good at modeling global dependencies) through series and parallel methods, and obtains the extracted feature vector Zt by concatenating the feature vectors obtained through the series branch and the parallel branch of the multi-layer time series feature extraction network. In step 2, based on the extracted feature vector After classification, the fault recognition result is obtained, including the following steps: Step 221, in the global pooling layer, the global average pooling strategy is adopted to aggregate the extracted feature vector in the time series dimension, and the feature sequence with length T is compressed into a fixed-length global representation vector; Step 222, the compressed feature is classified by the classifier module to obtain the final classification result or fault recognition label; Optionally, the classifier module can employ a Softmax layer, or a support vector machine; Further, to improve the separability of different state sequence representations in contrastive learning, a multi-layer perceptron (MLP) structure containing two serial full connection layers is proposed as a contrastive projection head, which is used to map the global sequence representation output by the encoder to a low-dimensional representation space required for contrastive learning.
[0048] The contrastive projection head of the embodiment is a multi-layer perceptron (MLP) module containing two serial full connection layers. Specifically, the process of contrastive projection by the contrastive projection head includes the following steps: Step 31, obtaining the feature vector output by the multi-layer time sequence feature extraction network : ; Where D is the original feature dimension; Step 32, mapping the feature vector with dimension to a hidden layer with dimension m through the first layer full connection layer, and processing it through the ReLU activation function to obtain the hidden layer output vector : ; ; Where is the weight matrix of the first layer full connection layer, is the bias vector of the first layer full connection layer; Step 33, adjusting the hidden layer output vector through batch normalization and dropout processing of the Dropout layer to obtain the adjusted hidden layer output vector This step operation can suppress overfitting and adapt to the noise characteristics of EMS data; Step 34, the second layer full connection layer maps the adjusted hidden layer output vector to a low-dimensional space to form the final projection output vector ; ; ; Where is the dimension, and ; is the weight matrix of the second layer full connection layer, is the bias vector of the second layer full connection layer; In the training stage, the output vector The contrast loss function is constructed to enhance the separability of different class samples in the feature space; the low-dimensional output is specifically used for contrast learning loss calculation, which promotes the model to learn more discriminative features by comparing sample pairs under multiple views. The high-dimensional multivariate input is mapped to a fixed-length global feature vector, and then processed by a two-stage MLP projection head for dimension reduction, forming a low-dimensional representation with stronger discriminative ability, thereby providing an effective basis for constructing positive and negative sample pairs and calculating contrast loss, and improving the feature separability and convergence speed of the model during training.
[0049] The two-stage fully connected layer in this embodiment adopts a series structure: the output of the first layer is used as the input of the second layer, realizing step-by-step dimension reduction and nonlinear transformation of the encoder output vector. The projection head is designed to construct the low-dimensional feature space required for contrast learning during training, thereby improving the separability of feature representation and improving the target optimization effect. It should be noted that the projection head is usually only involved in calculation during the training stage, and the contrast learning loss is constructed based on its output; during the inference stage, the projection head can be omitted, and the high-dimensional features of the encoder output can be directly used for subsequent anomaly detection.
[0050] In this embodiment, special data processing design is performed for multivariate time series data of lithium battery energy storage power station EMS system. The original data collected by such system usually includes voltage, current, temperature, state of charge (SOC) and other information of the battery pack, with characteristics of high dimension, multiple features, strong volatility and possible noise. The contrast space features output by the projection head can not only accurately distinguish normal and abnormal states, but also learn stable representation distribution relying on self-supervised mechanism when there is no explicit label, so that the model still has strong recognition ability in unknown faults and new patterns, showing good generalization and anomaly detection sensitivity. For battery systems, it is not only suitable for common fault identification such as over-temperature, under-voltage, internal short circuit, etc., but also can show effective perception ability for subtle mode drift, long-term aging trend and other implicit anomalies, and is particularly suitable for deployment in battery management system (BMS) or EMS edge side for real-time running state monitoring and early warning.
[0051] Further, in order to improve the anomaly detection performance and combine the characteristics of the abnormal state clustering boundary, this embodiment innovatively designs a self-defined contrast loss function as follows: ; Wherein, represents the Euclidean distance between sample and its positive sample; represents the minimum distance between sample and all other samples (which may include normal or abnormal samples); is a preset boundary interval threshold, These are the weighting coefficients; For any sample The projection vector of , the corresponding positive sample projection vector is . The negative sample set is ; The first term of the comparison loss function : Used to minimize the distance between positive sample pairs; The second term of the comparison loss function Used to ensure that the distance between the anchor sample and any negative sample is at least a set value. That is, when the minimum negative sample distance is less than This incurs additional penalties, thereby forcibly pushing away negative samples and potentially anomalous samples; In unsupervised clustering, samples located at the boundaries of each cluster are often considered negative or outliers. Based on this, samples that might be at the cluster boundaries are treated as negative examples in the loss function, and this is further addressed through boundary margins. The design further enhances the separability between normal and abnormal samples, improving the sensitivity of anomaly detection. This embodiment uses this loss function to simultaneously encourage positive sample pairs to move closer together and negative sample pairs to move further apart, resulting in a compact internal structure within the normal state and clear cluster boundaries in the projection space.
[0052] Furthermore, this embodiment proposes an innovative loss function for multi-class fault classification. It combines three parts: weighted focus cross-entropy, uncertainty penalty, and embedding clustering constraint, to achieve a classification loss. ,as follows: ; in, This represents the batch sample size. Indicates sample After being activated by the Softmax function, it falls into its true fault category. The probability of; It corresponds to the real category The loss weighting coefficient; As a focus adjustment factor; Indicates sample The entropy of the predicted probability distribution; To compare the samples obtained from learning Embedded vector, For category The center vector in the embedding space; and These are the tradeoff coefficients for the uncertainty penalty term and the embedding clustering term, respectively.
[0053] Ultimately, the total loss is the sum of the proposed classification loss and the contrastive learning loss: ; wherein, is the loss of the contrastive learning module, and are coefficients to adjust the relative importance of the two.
[0054] As shown in Figure 4 , after the output of the global average pooling and the contrastive projection head, the feature space similarity calculation is performed to obtain the contrastive loss, and the abnormal score appears through the output of the classifier, and if it exceeds the set threshold, it can be regarded as a potential fault or abnormal working condition.
[0055] Further technical solutions, training is performed through a multi-layer time sequence feature extraction network, including the following steps: Step S1, constructing a positive sample pair for the features of the same time sequence window; forming a negative sample pair for one sample and other unrelated samples in the same batch; and the positive sample pair and the negative sample pair constitute a contrastive learning dataset; The construction method of the negative sample pair can adopt a semi-supervised enhancement method, and specifically: If some abnormal state samples are known, such as manually labeled fault periods, then: If the anchor point sample comes from a normal sequence, the negative sample is selected from known abnormal data; If the anchor point sample comes from an abnormal sequence, the negative sample is selected from normal working conditions; The above construction strategy further strengthens the distance difference between normal and abnormal states in the feature space.
[0056] Step S2, transmitting the data in the contrastive learning dataset to the time sequence contrastive learning encoder for training to obtain a classification result and a projection output vector of the contrastive projection head ; Step S3, calculating a classification loss and a contrastive loss based on the obtained classification result, adjusting parameters of the time sequence contrastive learning encoder, and iteratively training until a training stop condition is met to obtain a trained time sequence contrastive learning encoder.
[0057] To verify the application effect of the proposed fault identification method based on time sequence contrastive learning in multivariate battery operation data, and to compare and analyze with existing mainstream methods, to quantify its advantages in fault detection accuracy, recall rate, F1-score, AUC value, robustness, etc.
[0058] The dataset uses multivariate time series operation data collected by an actual lithium battery energy storage power station EMS system, including: voltage, current, temperature, SOC; recording period: 1Hz, covering multiple months of operation period; the abnormal label is annotated by experts based on system alarm log and waveform analysis, including over-temperature, under-voltage, internal short circuit, poor contact and other faults.
[0059] The method of the embodiment is compared with the existing LSTM+Softmax. The LSTM+Softmax method is: using a long short-term memory network (LSTM) to extract time series features, and connecting a Softmax layer for multi-class classification.
[0060] Comparison under the same preprocessed dataset and the same training / test division condition; the contrast learning method uses a sliding window length T=60 seconds and a projection dimension d=64; 5-fold cross-validation is used to evaluate stability, and the experimental comparison results are shown in Table 1; Table 1 Experimental effect comparison;
[0061] As can be seen from Table 1, the battery fault recognition method based on contrast learning proposed in the embodiment is superior to the existing mainstream method in terms of accuracy, recall rate, F1 score and robustness, especially in the scene of lacking accurate labels or distribution drift. At the same time, the method has strong early warning ability, and can identify fault signs 20-40 seconds earlier than traditional methods on average, which helps to improve the safety and stability of the battery system operation.
[0062] Embodiment 2 Based on embodiment 1, the battery system fault recognition system based on time series contrast learning encoder is provided in the embodiment, which includes: An input sequence construction module configured to perform convolution embedding on the multivariate time window sequence in the acquired EMS data stream to obtain an input sequence; An encoding module configured to use a multi-layer time series feature extraction network mixed by series-parallel connection of a light residual convolution module and a time series Transformer module to perform local time series pattern recognition and long-distance dependency modeling on the input sequence, and fuse the features extracted by each branch of the mixed structure to obtain a feature vector extracted; A fault recognition result is obtained after classification; In the training process of the multi-layer time series feature extraction network, the feature vector extracted The contrast space feature is obtained by mapping the contrast projection head to another low-dimensional space, and the contrast loss is calculated through the contrast space feature to enhance the separability of the feature vector.
[0063] Embodiment 3 Based on embodiment 1, the present embodiment provides a battery system fault identification system based on a timing contrast learning encoder, comprising: a data acquisition device and a processor; a data acquisition device for adopting an EMS data stream; the processor is configured to perform the steps of the battery system fault identification method based on the timing contrast learning encoder described in embodiment 1.
[0064] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Those skilled in the art can make various modifications and changes to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
[0065] The above describes the specific embodiments of the present application in conjunction with the accompanying drawings, but is not intended to limit the protection scope of the present application. Those skilled in the art should understand that various modifications or changes made by those skilled in the art on the basis of the technical solutions of the present application without creative labor are still within the protection scope of the present application.
Claims
1. A battery system fault identification method based on a time-series contrastive learning encoder, characterized in that, Includes the following steps: The multivariate time window sequence in the acquired EMS data stream is convolved and embedded to obtain the input sequence; A multi-layer temporal feature extraction network is adopted, which combines a lightweight residual convolution module and a temporal Transformer module in series and parallel. This network performs local temporal pattern recognition and long-distance dependency modeling on the input sequence. After fusing the features extracted from each branch of the hybrid structure, the extracted feature vector is obtained and classified to obtain the fault identification result. During the training of the multi-layer temporal feature extraction network, the extracted feature vectors are mapped to another low-dimensional space through a contrastive projection head to obtain contrastive space features. The contrastive loss is calculated using the contrastive space features to enhance the separability of the feature vectors.
2. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 1, characterized in that: Constructing a temporal contrastive learning-based encoder, including: The input layer is used to perform convolutional embedding on the multivariate time window sequence in the acquired EMS data stream to obtain the input sequence; The multi-layer temporal feature extraction network adopts a hybrid structure of lightweight residual convolutional modules and temporal Transformer modules connected in series and parallel; including the fusion of lightweight residual convolutional modules and temporal Transformer modules in a series and parallel manner to take into account both local and global features; The temporal Transformer module includes a multi-layer stacked Transformer encoder for extracting global semantic features by introducing sparse attention to model long-distance dependencies. The lightweight residual convolution module extracts local detail features and short-term dynamic features through convolution and residual connection structures. The classifier module is used to process the extracted feature vectors. The faults are classified to obtain the fault identification results; The contrast projection head includes a multilayer perceptron with two cascaded fully connected layers, which is connected to the output of a multilayer temporal feature extraction network to output contrast spatial features, thereby enhancing the contrast separability of the feature vector representation.
3. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 2, characterized in that: The lightweight residual convolution module includes a one-dimensional convolutional layer I, a depthwise separable convolutional layer, a batch normalization layer, a ReLU activation layer, a one-dimensional convolutional layer II, and a residual connection module connected in sequence. The input multivariate time window sequence is sequentially subjected to convolution, depthwise separable convolution, batch normalization, ReLU activation, convolution, and residual summation operations.
4. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 2, characterized in that: The temporal Transformer module includes multiple stacked Transformer encoders; each Transformer encoder layer includes a multi-head attention module, a first-layer normalization module, a feedforward network, and a second-layer normalization module; each Transformer encoder layer has a position encoding module connected in front of it.
5. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 1, characterized in that: In the multi-layer temporal feature extraction network, a lightweight residual convolutional module is connected in series with a temporal Transformer module to form a series branch. The data processing process is as follows: The lightweight residual convolution module receives the input sequence and extracts two-dimensional features through multiple convolutions and residual connections; Flatten or divide the two-dimensional feature into a series of feature vector sequences; Add positional information encoding to each feature vector sequence; The sequential features with location information are used as input to the temporal Transformer module. Global features are extracted from multi-head self-attention and feedforward networks to output high-level semantic representations.
6. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 1, characterized in that: In the multi-layer temporal feature extraction network, the temporal Transformer module is connected in series with a lightweight residual convolutional module to form a cascaded branch. The data processing procedure is as follows: For the input sequence, the first output feature is extracted by the Transformer encoder of the temporal Transformer module; The first output feature is organized into a feature map with spatial layout, and then flattened according to the dimensional requirements, or projected onto the set channel dimension through linear mapping to obtain the dimension-adjusted feature. The dimension-adjusted features are decoded through a convolutional residual module, and a two-dimensional feature map is extracted through multiple convolutions and residual connections.
7. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 1, characterized in that: The contrast projection head employs a multilayer sensor containing two cascaded fully connected layers. The contrast projection head performs the following steps during the contrast projection process: Obtain the feature vector output by the multi-layer temporal feature extraction network ; The dimension is connected through the first fully connected layer. eigenvectors The vector is mapped to a hidden layer of dimension m and processed by the ReLU activation function to obtain the hidden layer output vector; The adjusted hidden layer output vector is obtained by batch normalization and dropout processing. ; The second fully connected layer maps the adjusted hidden layer output vector to a lower-dimensional space, forming the final projected output vector. .
8. The battery system fault identification method based on a time-series contrastive learning encoder as described in claim 1, characterized in that: The loss function for training a multi-layer temporal feature extraction network includes classification loss and contrastive loss; The first term of the comparison loss is used to minimize the distance between positive sample pairs; The second term of the comparative loss is used to control the distance between the anchor sample and any negative sample to be at least a set value. When the minimum negative sample distance is less than Additional penalties are incurred to push away negative samples and potentially anomalous samples.
9. A battery system fault identification system based on a time-series contrastive learning encoder, characterized in that, include: Input sequence construction module: configured to perform convolutional embedding on the multivariate time window sequence in the acquired EMS data stream to obtain the input sequence; The encoding module is configured as a multi-layer temporal feature extraction network that combines a lightweight residual convolutional module and a temporal Transformer module in a series and parallel manner. It performs local temporal pattern recognition and long-range dependency modeling on the input sequence, and fuses the features extracted from each branch of the hybrid structure to obtain the extracted feature vector. The fault identification results are obtained after classification; During the training of a multi-layer temporal feature extraction network, the extracted feature vectors are... By mapping the contrast projection head to another low-dimensional space, contrast space features are obtained. Contrast loss is then calculated using these contrast space features to enhance the separability of the feature vectors.
10. A battery system fault identification system based on a time-series contrastive learning encoder, characterized in that, include: Data acquisition device and processor; Data acquisition device, used to collect EMS data streams; The processor is configured to perform the steps of the battery system fault identification method based on a time-series contrastive learning encoder as described in any one of claims 1-8.
Citation Information
Patent Citations
Battery RUL prediction method based on Transform combination model
CN117347866A
Method for predicting SOH (state of health) of battery based on Transform combination model
CN117347867A
Battery pack fault diagnosis method and system based on time sequence data and storage medium
CN117388716A
Cardiac ultrasound image recognition method based on query contrast learning framework
CN118154924A
High-resolution remote sensing image building extraction method of multi-scale mixed Transform model based on boundary refinement
CN118570634A
Cited By
Voice noise reduction method based on reasoning optimization and Bluetooth earphone
CN121506162A
Battery fault early warning model construction method
CN121902641A
A method for constructing a battery failure early warning model
CN121902641B