A method for modeling and fault diagnosis of dynamic characteristics of heat efficiency change rate of proton exchange membrane fuel cell stack based on contrast learning
By constructing a model of the thermal efficiency change rate of a fuel cell stack and using comparative learning methods for feature extraction and similarity analysis, the problem of capturing the dynamic changes in fuel cell thermal efficiency in existing technologies is solved, and highly sensitive fault diagnosis and performance evaluation are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TIANJIN UNIV
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies are unable to capture the dynamic changes in the thermal efficiency of proton exchange membrane fuel cell stacks with high sensitivity under complex operating conditions. Existing diagnostic methods are sensitive to noise and changes in operating conditions and are unable to reflect subtle changes in the internal energy conversion mechanism of the system.
By collecting operating signals from the fuel cell system, an instantaneous thermal efficiency model of the stack is constructed, the rate of change of thermal efficiency is calculated, time series enhancement is used to generate sample pairs, and a contrastive learning model is used for feature extraction. The similarity of feature representation vectors is calculated to achieve unsupervised fault diagnosis.
It achieves highly sensitive modeling of the dynamic changes in thermal efficiency of fuel cell stacks under complex operating conditions and high noise conditions, and has robustness and good generalization ability, making it suitable for online deployment of intelligent monitoring and fault diagnosis.
Smart Images

Figure CN122246184A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent monitoring and fault diagnosis technology for fuel cell systems, and in particular to a method for modeling the dynamic characteristics of the thermal efficiency change rate of a proton exchange membrane fuel cell stack and for fault diagnosis based on comparative learning. Background Technology
[0002] Proton exchange membrane fuel cells (PEMFCs), as efficient and clean electrochemical energy conversion devices, are widely used in new energy vehicles, distributed power generation, and backup power supplies. The thermal efficiency of a fuel cell system directly reflects its ability to convert the chemical energy of hydrogen into electrical energy and is an important indicator for evaluating the system's operating status and performance degradation.
[0003] During long-term operation of fuel cell stacks, the thermal efficiency can slowly drift or suddenly fluctuate due to factors such as load fluctuations, hydrogen supply control, thermal management conditions, and material aging. These changes often precede obvious faults such as voltage decay and are important precursors to potential system failure. However, existing diagnostic methods for fuel cell thermal efficiency mainly focus on steady-state efficiency calculations or monitoring methods based on empirical thresholds, which are difficult to capture the dynamic changes in thermal efficiency under complex operating conditions and are sensitive to noise and changes in operating conditions.
[0004] Furthermore, thermal efficiency typically changes relatively gradually, making it difficult to directly monitor its numerical value and reflect subtle changes in the internal energy conversion mechanism of the system. Therefore, if we can model its dynamic evolution characteristics from the perspective of the rate of change of thermal efficiency, combined with advanced unsupervised feature learning methods, we can more sensitively characterize the performance degradation process of fuel cell systems.
[0005] Based on this, the present invention proposes a diagnostic method for the thermal efficiency change rate of fuel cell stacks that combines time series comparative learning, which enables early identification of abnormal energy conversion performance of the system without the need for manual data annotation. Summary of the Invention
[0006] The purpose of this invention is to propose a dynamic feature modeling and fault diagnosis method for the thermal efficiency change rate of proton exchange membrane fuel cell stacks based on contrastive learning. By learning the potential feature representation of the water content change rate curve under different health states, the method can realize unsupervised diagnosis and life assessment of the water management performance of fuel cell systems.
[0007] To achieve the above objectives, the present invention provides the following solution: A method for dynamic feature modeling and fault diagnosis of thermal efficiency variation rate of proton exchange membrane fuel cell stacks based on contrastive learning includes: The operating signals of the fuel cell system are collected; wherein, the operating signals include: stack output voltage, output current, hydrogen flow rate, temperature and pressure signals; Based on the operating signals, an instantaneous thermal efficiency model of the fuel cell stack is constructed, and a central difference calculation is performed on the instantaneous thermal efficiency model of the fuel cell stack to obtain the thermal efficiency change rate curve. Time series enhancement is performed on the aforementioned thermal efficiency change rate curve to generate sample pairs; The sample pairs are input to the contrastive learning model to extract features and obtain the feature representation vector of the curve. Calculate the similarity between the feature representation vectors of different curves, and determine the energy conversion performance status of the fuel cell stack based on the similarity.
[0008] Optionally, before constructing the instantaneous thermal efficiency model of the fuel cell stack based on the operating signal, the following steps are included: The operating signals are preprocessed; The preprocessing includes: data synchronization and cleaning, signal smoothing and normalization, and operating condition segmentation.
[0009] Optionally, the instantaneous thermal efficiency model of the fuel cell stack is: ; in, This is the ratio of the output electrical power of the fuel cell stack to the input chemical energy of hydrogen. and These are the fuel cell output voltage and current, respectively. Hydrogen has a low calorific value. This represents the amount of hydrogen consumed per unit time.
[0010] Optionally, performing central difference calculations on the instantaneous thermal efficiency model of the fuel cell stack includes: The first-order time derivative of the ratio of the output electrical power of the fuel cell stack to the input power of hydrogen chemical energy is calculated using the central difference method to obtain the rate of change of thermal efficiency. The thermal efficiency change rate is smoothed and the change rate sequence is divided into a fixed-length sliding window to obtain the thermal efficiency change rate curve.
[0011] Optionally, time-series enhancement is performed on the thermal efficiency change rate curve to generate sample pairs, including: By applying different enhancement methods to the same window in the thermal efficiency change rate curve, two different views can be obtained. This constitutes a positive sample pair; Randomly sample from windows of different health states or different working conditions to form negative sample pairs; The sample pairs are formed based on the positive and negative sample pairs.
[0012] Optionally, the sample is input to the contrastive learning model to extract features, and the feature representation vector of the curve is obtained, including: The sample pairs are linearly mapped to obtain the sequence embedding matrix; Add positional encoding to the sequence embedding matrix; The sequence embedding matrix with added position encoding is input into the Transformer encoder layer to extract high-level features of the time series and obtain feature vectors. The feature vector is projected into the contrast space through a two-layer fully connected network to obtain the projection vector, which serves as the feature representation vector of the curve.
[0013] Optionally, the contrastive learning model is trained using the InfoNCE loss function. The training is self-supervised and requires no manual annotation. The training samples are automatically generated from historical running data.
[0014] Optionally, calculating the similarity between the feature representation vectors of different curves and determining the energy conversion performance status of the fuel cell stack based on the similarity includes: The feature representation vector of the curve is compared with the feature vector set of historical healthy samples, and the average cosine similarity is calculated. Set a similarity threshold; When the average cosine similarity is less than the similarity threshold, it is determined that the current operating state of the fuel cell stack deviates significantly from the normal energy conversion characteristics, and the system is considered to have abnormal thermal efficiency or degraded energy conversion performance. If cluster analysis is performed on the feature vectors of samples under different abnormal operating states to form multiple abnormal feature clusters, then the similarity between the feature vector of the sample to be tested and the center of each abnormal feature cluster is calculated, and the corresponding abnormal type is determined according to the principle of minimum distance or maximum similarity.
[0015] Optionally, the method further includes: long-term online monitoring of the energy conversion performance of the fuel cell stack, including: Based on the similarity calculation results of continuous time windows, a stack thermal efficiency health index is defined. The thermal efficiency health index of the fuel cell stack is fitted over time. When its rate of decline exceeds a preset threshold, the system is determined to have entered the performance degradation stage. Combined with the number of hours the fuel cell stack operates, the remaining service life is further predicted.
[0016] The beneficial effects of this invention are as follows: This invention proposes a dynamic feature modeling and fault diagnosis method for the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning. This method constructs an instantaneous thermal efficiency model of the fuel cell stack by collecting relevant signals such as voltage and current during operation, and further calculates the time series of the thermal efficiency change rate. A time series enhancement strategy is used to generate positive and negative sample pairs, constructing a contrastive learning network including an encoder and a projection head to dynamically extract features from the thermal efficiency change rate time series. In the feature space, the similarity between different operating states is calculated by analyzing the evolution trajectory of feature vectors over time, and based on the similarity index, the method identifies and provides early warnings for states such as energy conversion performance degradation, abnormal hydrogen supply, and abnormal thermal management of the fuel cell stack.
[0017] This invention eliminates the need for manual data annotation and enables highly sensitive modeling of the dynamic changes in the thermal efficiency of fuel cell stacks under complex operating conditions and high noise levels. It has advantages such as strong robustness, good generalization ability, and suitability for online deployment, and can be used for intelligent monitoring, fault diagnosis, and life assessment of fuel cell systems. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of a method for modeling the dynamic characteristics of the thermal efficiency change rate of a proton exchange membrane fuel cell stack and for fault diagnosis based on contrastive learning, according to an embodiment of the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and 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.
[0021] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0022] like Figure 1 As shown, this embodiment proposes a method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning, including: S1. Acquire operating signals of the fuel cell system; wherein, the operating signals include: stack output voltage, output current, hydrogen flow rate, temperature and pressure signals; S2. Construct an instantaneous thermal efficiency model of the fuel cell stack based on the operating signal, perform central difference calculation on the instantaneous thermal efficiency model of the fuel cell stack, and obtain the thermal efficiency change rate curve; S3. Perform time series enhancement on the thermal efficiency change rate curve to generate sample pairs; S4. Extract features from the input contrastive learning model of the sample pairs to obtain the feature representation vector of the curve; S5. Calculate the similarity between the feature representation vectors of different curves, and determine the energy conversion performance status of the fuel cell stack based on the similarity.
[0023] Furthermore, before constructing the instantaneous thermal efficiency model of the fuel cell stack based on the operating signals, the following steps are included: The operating signals are preprocessed; The preprocessing includes: data synchronization and cleaning, signal smoothing and normalization, and operating condition segmentation.
[0024] Specifically, in this embodiment, S1 performs data acquisition and preprocessing: S101. Acquire time-series signals of the fuel cell system during operation, including but not limited to stack output voltage. Output current Hydrogen flow rate, temperature, and pressure signals were collected. The acquired signals underwent time synchronization, outlier removal, smoothing filtering, and normalization to ensure data quality and time consistency.
[0025] S102. Data Synchronization and Cleaning: To ensure the time consistency of each signal, timestamp alignment and interpolation are performed on data from different sensors. Abnormal data points (such as abrupt changes caused by sensor drift or communication interruption) are removed using a sliding median filter.
[0026] S103. Signal Smoothing and Normalization: The time series is smoothed using a Savitzky-Golay filter or an exponentially weighted moving average to eliminate high-frequency noise. Then, all signals are normalized to the interval [0,1] or a standard normal distribution for subsequent feature extraction.
[0027] S104. Operating condition segmentation: Based on load, current density or power changes, the entire operating data is divided into multiple operating condition segments (e.g., startup phase, steady state phase, step change phase), with each segment having a consistent length (e.g., 100~300s).
[0028] Furthermore, the central difference calculation of the instantaneous thermal efficiency model of the fuel cell stack includes: The first-order time derivative of the instantaneous thermal efficiency model of the fuel cell stack is calculated using the central difference method to obtain the rate of change of thermal efficiency; The thermal efficiency change rate is smoothed and the change rate sequence is divided into a fixed-length sliding window to obtain the thermal efficiency change rate curve.
[0029] Specifically, in this embodiment, S2. Constructing a model of the instantaneous thermal efficiency of the fuel cell stack: S201. Thermal efficiency modeling: Constructing an instantaneous thermal efficiency model for a fuel cell stack: ; Among them, hydrogen consumption rate Based on Faraday's law, the following can be calculated from the current: ; S202. To prevent differential amplification of noise, perform another smoothing operation on the rate of change sequence, or limit abnormal gradient changes by using a threshold: ; in, This is an empirical coefficient (usually taken as 3~5). is the standard deviation of the rate of change.
[0030] S203. Divide the rate of change sequence into a fixed-length sliding window: ; Window length The time frame is determined based on the system's dynamic response period, which is generally 20 to 100 seconds. Each window serves as an independent sample input to the model.
[0031] Furthermore, time-series enhancement is performed on the thermal efficiency change rate curve to generate sample pairs, including: By applying different enhancement methods to the same window in the thermal efficiency change rate curve, two different views can be obtained. , forming a positive sample pair; where a is scaled by 5% amplitude and b is scaled by 8% amplitude.
[0032] Randomly sample from windows of different health states or different working conditions to form negative sample pairs; The sample pairs are formed based on the positive and negative sample pairs.
[0033] Specifically, in this embodiment, S3. Time series enhancement and sample construction: To achieve self-supervised training for contrastive learning, various enhancement operations are performed on each window of samples to generate positive and negative sample pairs.
[0034] S301. For the same window By performing different enhancement transformations, two views are obtained. , constitute positive sample pairs .
[0035] S302. Randomly sample from windows of different health states or different working conditions to form negative sample pairs.
[0036] S303. Enhancement operations include one or more of the following: time pruning: randomly selecting a sub-interval of a window; time stretching: non-linearly stretching or compressing the time axis; amplitude scaling: amplifying or reducing the overall signal; noise perturbation: superimposing small-amplitude Gaussian noise with zero mean; occlusion: randomly replacing some time points with zero or mean values; inversion: reversing the time series (used for feature robustness enhancement). Through the above enhancements, a rich dataset of unsupervised sample pairs is formed.
[0037] Furthermore, the sample pairs are input to the contrastive learning model for feature extraction, and the feature representation vector of the curve is obtained, including: The sample pairs are linearly mapped to obtain the sequence embedding matrix; Add positional encoding to the sequence embedding matrix; The sequence embedding matrix with added position encoding is input into the Transformer encoder layer to extract high-level features of the time series and obtain feature vectors. The feature vector is projected into the contrast space through a two-layer fully connected network to obtain the projection vector, which serves as the feature representation vector of the curve.
[0038] Specifically, in this embodiment, the contrastive learning model includes an encoder and a projection head. The encoder is a one-dimensional convolutional neural network, a long short-term memory network, or a temporal Transformer structure.
[0039] Encoder: Used to extract high-level features from time series data. Its structure can be: a one-dimensional convolutional neural network to capture local morphology; a long short-term memory network to capture temporal dependencies; or a Transformer-based attention mechanism model to model long-term dependencies. The encoder takes a time series data as input. Output low-dimensional feature vectors .
[0040] Projection head module: projects feature vectors The projection vector is obtained by projecting the vector onto the contrast space through two fully connected layers. : ; in This is the projection head function.
[0041] Comparative learning objective function: The model is trained using the InfoNCE loss function. ; in, For cosine similarity, The temperature parameter is used. The training objective is to make the features of different enhanced versions of the same window more similar, and the features of different windows more distinct.
[0042] Model training strategy: Model training employs a self-supervised approach, requiring no manual annotation. Training samples are automatically generated from historical runtime data. The optimizer used is Adam, with an initial learning rate of 1e-3 and a batch size of 128. An early stopping strategy is employed during training, terminating training when the validation set loss shows no decrease for 10 consecutive epochs.
[0043] Furthermore, calculating the similarity between the feature representation vectors of different curves, and determining the energy conversion performance status of the fuel cell stack based on the similarity, includes: The feature representation vector of the curve is compared with the feature vector set of historical healthy samples, and the average cosine similarity is calculated. Set a similarity threshold; When the average cosine similarity is less than the similarity threshold, it is determined that the current operating state of the fuel cell stack deviates significantly from the normal energy conversion characteristics, and the system is considered to have abnormal thermal efficiency or degraded energy conversion performance. If cluster analysis is performed on the feature vectors of samples under different abnormal operating states to form multiple abnormal feature clusters, then the similarity between the feature vector of the sample to be tested and the center of each abnormal feature cluster is calculated, and the corresponding abnormal type is determined according to the principle of minimum distance or maximum similarity.
[0044] Specifically, in this embodiment, S5. Based on feature matching, similarity calculation, and fault determination: S501. Feature Extraction: Using the trained encoder, the feature extraction of the window to be tested... Extracting feature vectors .
[0045] S502. Similarity Calculation: [The following text appears to be incomplete and requires further context: "will..."] The feature vector set of historical healthy samples Compare the results and calculate the mean cosine similarity: ; S503. Threshold Determination and Diagnostic Judgment: Setting a similarity threshold It can be determined by the mean and standard deviation of the normal sample similarity distribution: ; in, This is the adjustment coefficient (usually taken as 2~3).
[0046] when If the current operating state of the fuel cell stack deviates significantly from the normal energy conversion characteristics, it is considered that the system is in a state of abnormal thermal efficiency or degraded energy conversion performance.
[0047] S504. If cluster analysis is performed on the feature vectors of samples under different abnormal operating states to form multiple abnormal feature clusters, the similarity between the feature vector of the sample to be tested and the center of each abnormal feature cluster can be calculated, and the corresponding abnormal type can be determined according to the principle of minimum distance or maximum similarity.
[0048] Furthermore, the method also includes: long-term online monitoring of the energy conversion performance of the fuel cell stack, including: Based on the similarity calculation results of continuous time windows, a stack thermal efficiency health index is defined. The thermal efficiency health index of the fuel cell stack is fitted over time. When its rate of decline exceeds a preset threshold, the system is determined to have entered the performance degradation stage. Combined with the number of hours the fuel cell stack operates, the remaining service life is further predicted.
[0049] Specifically, in this embodiment, S6. Health index calculation and trend analysis: S601. Health Definition: To achieve long-term online monitoring of the energy conversion performance of fuel cell stacks, a stack thermal efficiency health index is defined based on the similarity calculation results of continuous time windows. ; in, For the first Similarity of time windows.
[0050] S602. Trend Analysis and Lifespan Prediction: [This section appears to be incomplete and requires further context.] By performing time series fitting, the system is determined to have entered a performance degradation phase when the rate of decline exceeds a preset threshold. Combined with the stack's operating hours, the remaining service life can be further predicted.
[0051] S7. System device implementation: This method can be implemented through a hardware system, including the following modules: a data acquisition module, responsible for collecting fuel cell operating data; a preprocessing module, performing filtering, normalization, and differencing; a feature extraction module, enabling inference for the contrastive learning model; a similarity calculation module, completing feature similarity evaluation; and a diagnostic output module, outputting fault type, health index, and alarm signal.
[0052] Each module can be integrated into the vehicle control unit or fuel cell system monitoring terminal to achieve real-time online diagnostics.
[0053] The overall process of this embodiment includes data acquisition and preprocessing (S1), thermal efficiency estimation and rate of change calculation (S2), sample segmentation and data augmentation (S3), feature extraction and comparative learning training based on Transformer (S4), similarity calculation and fault determination (S5), health index and trend analysis (S6), and system implementation and deployment (S7). The complete mathematical expressions, implementation details, and recommended parameters for each step are given below.
[0054] S1: Data Acquisition and Preprocessing During the operation of the fuel cell system, the controller periodically collects the operating time-series data of the fuel cell stack via the bus interface, including but not limited to: stack output voltage. Output current or current density fuel cell stack temperature Cathode gas flow rate Anode gas flow rate Hydrogen supply pressure or pressure difference And auxiliary signals related to hydrogen consumption. Sampling frequency. A frequency of 1–5 Hz is recommended (in this embodiment, 1–5 Hz is used). ), each monitoring cycle Data is captured from 1800 to 3600 seconds. Data is written to the buffer in real time for subsequent processing.
[0055] S102 Original Signal Outliers are removed using a statistical threshold: if ( The historical mean and standard deviation of this channel. If the value is 3~5, the point is marked as an anomaly and repaired using linear interpolation or spline interpolation. Subsequently, a low-pass filter is applied to each channel to suppress high-frequency noise; a second-order Butterworth low-pass filter is used, whose difference equation can be implemented in discrete time as a standard digital filter or directly using SciPy's butter / filtfilt. Exponential smoothing (EWMA) can also be used in engineering descriptions. ; smoothness coefficient Finally, all channels are standardized: ; This step ensures consistent input dimensions and reduces training difficulty.
[0056] S2: Calculation of fuel cell stack thermal efficiency: S201 is used to characterize the energy conversion performance of fuel cell stacks, and an instantaneous thermal efficiency model of the stack is constructed. It is defined as the ratio of the output electrical power of the fuel cell stack to the input power of the hydrogen chemical energy: ; in, and These are the fuel cell output voltage and current, respectively. Hydrogen has a low calorific value. This represents the amount of hydrogen consumed per unit time.
[0057] In the absence of a direct hydrogen consumption sensor, hydrogen consumption is estimated from the current signal according to Faraday's law: ; S202 Thermal Efficiency Change Rate Calculation: To characterize the dynamic variation of the stack's thermal efficiency, the thermal efficiency sequence was analyzed. The first-order time derivative is calculated using the central difference method to obtain the rate of change of thermal efficiency: ; To further suppress noise in differential amplification, Applying first-order exponential smoothing: ; in This implementation takes If outlier gradient values exist, the following rules apply: ; in The standard deviation of the historical rate of change Values range from 3 to 5.
[0058] S203 Sliding Window Sample Construction: For subsequent model training and feature learning, the smoothed thermal efficiency change rate sequence will be used. Divide the window into sections of length using a sliding window method. Time series samples: ; Among them, window length Corresponding to 40 to 200 sampling points (in this embodiment, we take...) (Approximately 50 seconds), adjacent windows can be overlapped by 50% to increase the number of samples and improve temporal continuity.
[0059] S3: Sample Segmentation and Time Series Augmentation S301 for each window Construct two enhanced views This forms a positive sample pair. The specific operations and mathematical expressions for enhancement are as follows: Time clipping: Randomly select from... Extract a subsequence from the original length and linearly interpolate it back to its original length. Let the truncation and retention ratio be set. The starting point is randomly selected, and the interpolation function is either linear or cubic spline. Time scaling: This involves adjusting the time index. Applying nonlinear mapping Common methods include piecewise linear or random B-spline-based time stretching, which can be simply implemented by multiplying each time point by a rate coefficient. Resample to Point. Take. Amplitude scaling: Multiply the entire sequence by a coefficient. ,Right now Noise disturbance: Gaussian noise is added at each time point. ,Pick Random occlusion: randomly selects... The proportion of time points is set to the mean or zero. .
[0060] Enhanced As a positive counterpart, other windows in the same batch are considered negative samples during training. To avoid excessive bias introduced by "false negative samples", samples that are too close to the reference window in time or space (if there is a device ID) can be excluded when constructing negative samples (e.g., excluding windows that are adjacent to each other in the same batch or time period), or a large batch / memory queue strategy can be adopted to increase the diversity of negative samples.
[0061] S4: Feature extraction and contrastive learning training based on Transformer: S401 Input Embedding: Per Window First, the sequence embedding matrix is obtained through linear mapping. : ; in , 1 represents the length A column vector of all 1s. To preserve positional information, ... Add position encoding The position encoding uses the classic sine and cosine form: ; Obtain encoder input .
[0062] S402 Transformer Encoder Layer: The encoder consists of... Stacked in the same layer (in this implementation) The computation flow for a single layer follows the standard Transformer expression: given input... First, calculate multi-head attention: ; in Dimensions per head (Head count in this implementation) Each ,therefore (Or may be adjusted according to resources). Multiple outputs are spliced together and then subjected to linear transformation: ; Then residuals and layer normalization are applied: ; The feedforward network (FFN) is a two-layer MLP: ; repeat Post-layer output .
[0063] S403 Pooling and Projection: [The following is a continuation of the previous sentence, but the translation is incomplete Perform global average pooling (or location-based [CLS] token pooling) to obtain : ; The projector head has a two-layer fully connected network: ; in, express Normalization (make) The final projection dimension is taken as .
[0064] S404 Contrast Loss InfoNCE: Given a batch (including) There are 10 windows, each window generates two views, for a total of 100 windows. (sample number), for the first sample A positive one The loss is ; in (because Normalized (inner product is cosine), the overall loss is (Calculate symmetrically for both views). Temperature Recommended value is 0.05~0.2 (this implementation uses 0.05~0.2). ).
[0065] S405 Training Details: AdamW optimizer used, initial learning rate... Weight decay Batch size (i.e., 32 window pairs), 200-400 training epochs. A 10% learning rate warmup is used followed by cosine annealing for decay. To prevent overfitting or feature degradation, early stopping and dropout (0.1) are employed. For more negative samples, momentum queues or larger batch strategies can be used, but memory / computing power must be considered in implementation.
[0066] S5: Feature Similarity Calculation and Fault Determination: S501 Inference phase for each test window After undergoing the same preprocessing, windowing, embedding, Transformer encoding, and projection as training, we obtain... .
[0067] S502 similarity calculation uses the normalized inner product form: ; If you need to use multiple reference sample sets Compare and take the average similarity: ; S503 threshold The determination was made using statistical methods: the similarity distribution was calculated on the healthy samples, and the mean was obtained. with standard deviation Recommended settings: ; like If an anomaly is detected, it is determined that the anomaly is an anomaly. To further distinguish different anomaly operation modes, historical anomaly samples are clustered in the feature embedding space to form multiple anomaly feature clusters. During the inference phase, the distance between the sample to be tested and the center of each anomaly feature cluster is calculated, and the anomaly type to which it belongs is determined according to the principle of minimum distance.
[0068] S6: Health Index and Trend Analysis, Life Expectancy Prediction: S601 at each time point Summary of recent events The average similarity of the windows is used as the Water Management Health Index (WMI). ; S602 performs Savitzky-Golay filtering on the WMI sequence for smoothing, and then calculates the first-order difference. If continuous Each window satisfies (For example The system outputs a degradation warning.
[0069] To estimate the remaining useful life of S603, a regression model can be constructed using historical WMI time series data. ; in For the regression function used in training, This represents the historical window length. The regression model should be trained on labeled historical decommissioning / failure data.
[0070] S7: For real-time online deployment, the entire inference pipeline consists of: Data Acquisition Preprocessing / Differential Windowing Model inference yields Similarity calculation Health status updates and alerts.
[0071] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A method for dynamic feature modeling and fault diagnosis of thermal efficiency change rate of proton exchange membrane fuel cell stack based on contrastive learning, characterized in that, include: The operating signals of the fuel cell system are collected; wherein, the operating signals include: stack output voltage, output current, hydrogen flow rate, temperature and pressure signals; Based on the operating signals, an instantaneous thermal efficiency model of the fuel cell stack is constructed, and a central difference calculation is performed on the instantaneous thermal efficiency model of the fuel cell stack to obtain the thermal efficiency change rate curve. Time series enhancement is performed on the aforementioned thermal efficiency change rate curve to generate sample pairs; The sample pairs are input to the contrastive learning model to extract features and obtain the feature representation vector of the curve. Calculate the similarity between the feature representation vectors of different curves, and determine the energy conversion performance status of the fuel cell stack based on the similarity.
2. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, Before constructing the instantaneous thermal efficiency model of the fuel cell stack based on the aforementioned operating signals, the following steps are included: The operating signals are preprocessed; The preprocessing includes: data synchronization and cleaning, signal smoothing and normalization, and operating condition segmentation.
3. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, The instantaneous thermal efficiency model of the fuel cell stack is as follows: ; in, This is the ratio of the output electrical power of the fuel cell stack to the input chemical energy of hydrogen. and These are the fuel cell output voltage and current, respectively. Hydrogen has a low calorific value. This represents the amount of hydrogen consumed per unit time.
4. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 3, characterized in that, The central difference calculation for the instantaneous thermal efficiency model of the fuel cell stack includes: The first-order time derivative of the instantaneous thermal efficiency model of the fuel cell stack is calculated using the central difference method to obtain the rate of change of thermal efficiency; The thermal efficiency change rate is smoothed and the change rate sequence is divided into a fixed-length sliding window to obtain the thermal efficiency change rate curve.
5. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, Time series enhancement is performed on the thermal efficiency change rate curve to generate sample pairs, including: By transforming the same window in the thermal efficiency change rate curve with different enhancement methods, two different views are obtained, forming a positive sample pair; Randomly sample from windows of different health states or different working conditions to form negative sample pairs; The sample pairs are formed based on the positive and negative sample pairs.
6. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, The sample pairs are input to the contrastive learning model to extract features, resulting in the feature representation vector of the curve, which includes: The sample pairs are linearly mapped to obtain the sequence embedding matrix; Add positional encoding to the sequence embedding matrix; The sequence embedding matrix with added position encoding is input into the Transformer encoder layer to extract high-level features of the time series and obtain feature vectors. The feature vector is projected into the contrast space through a two-layer fully connected network to obtain the projection vector, which serves as the feature representation vector of the curve.
7. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, The contrastive learning model is trained using the InfoNCE loss function. The training is self-supervised and requires no manual annotation. The training samples are automatically generated from historical running data.
8. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, Calculating the similarity between the feature representation vectors of different curves, and determining the energy conversion performance status of the fuel cell stack based on the similarity, includes: The feature representation vector of the curve is compared with the feature vector set of historical healthy samples, and the average cosine similarity is calculated. Set a similarity threshold; When the average cosine similarity is less than the similarity threshold, it is determined that the current operating state of the fuel cell stack deviates significantly from the normal energy conversion characteristics, and the system is considered to have abnormal thermal efficiency or degraded energy conversion performance. If cluster analysis is performed on the feature vectors of samples under different abnormal operating states to form multiple abnormal feature clusters, then the similarity between the feature vector of the sample to be tested and the center of each abnormal feature cluster is calculated, and the corresponding abnormal type is determined according to the principle of minimum distance or maximum similarity.
9. The method for dynamic feature modeling and fault diagnosis of the thermal efficiency change rate of a proton exchange membrane fuel cell stack based on contrastive learning according to claim 1, characterized in that, The method further includes: long-term online monitoring of the energy conversion performance of the fuel cell stack, including: Based on the similarity calculation results of continuous time windows, a stack thermal efficiency health index is defined. The thermal efficiency health index of the fuel cell stack is fitted over time. When its rate of decline exceeds a preset threshold, the system is determined to have entered the performance degradation stage. Combined with the number of hours the fuel cell stack operates, the remaining service life is further predicted.