Proton exchange membrane fuel cell fault diagnosis method based on neural network
By building a neural network model based on CNN-Transformer, the problems of strong model dependence and insufficient feature extraction capability in existing proton exchange membrane fuel cell fault diagnosis methods are solved, realizing efficient and accurate fuel cell fault identification and improving the accuracy and robustness of diagnosis.
Patent Information
- Application Number
- CN202511805731.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-03
AI Technical Summary
Existing proton exchange membrane fuel cell fault diagnosis methods suffer from problems such as strong model dependence, insufficient feature extraction capability, low training efficiency, and poor generalization performance, resulting in a high misjudgment rate and difficulty in accurately identifying faults under complex operating conditions.
A CNN-Transformer-based neural network model was adopted. By building a PEMFC simulation model, fault injection experiments were conducted. Multi-dimensional sensor time-series data were collected, preprocessed, and then input into the CNN-Transformer neural network for feature extraction and fault classification. Continuous wavelet transform and Transformer encoder were used to capture global dependencies, thereby achieving efficient fault diagnosis.
It improves the accuracy of fault classification to 95.08%, which is better than traditional methods. It has good engineering applicability and robustness, and can efficiently identify fuel cell faults under complex operating conditions.
Smart Images

Figure CN121598159A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of proton exchange membrane fuel cell fault diagnosis, specifically involving a proton exchange membrane fuel cell fault diagnosis method based on neural networks, which is particularly suitable for real-time fault monitoring and diagnosis of PEMFC systems in new energy vehicles. Background Technology
[0002] Proton exchange membrane fuel cells (PEMFCs) not only possess the advantages of being clean and environmentally friendly, typical of fuel cells, but also offer greater advantages in operating temperature and specific power, making them a power generation device with enormous potential. Furthermore, hydrogen energy, as a low-carbon and clean energy source, is a crucial energy source in the future energy system and a vital component in promoting my country's energy structure transformation. In 2019, hydrogen was first included in the government work report; in 2020, it was first listed within the energy category; and in 2022, the state further clarified the energy importance of hydrogen, proposing that hydrogen energy is a key component of future energy. Currently, countries worldwide have invested significant resources in researching PEMFC electric vehicles.
[0003] As fuel cells are increasingly promoted and applied, their reliability is receiving growing attention. The complex operating conditions of fuel cell systems require meticulous attention to every detail; any overlooked issue can have devastating consequences, ranging from performance degradation to stack damage or even major safety incidents. However, the complex structure and harsh operating environment of fuel cells make failures inevitable. Therefore, fuel cell fault diagnosis technology is a crucial technology that must be carefully researched and developed. Fuel cell diagnostic systems need to be able to quickly and promptly diagnose problems, maximizing the protection of the fuel cell system while simultaneously reducing maintenance costs and promoting industrialization.
[0004] The core significance of fuel cell fault diagnosis lies in ensuring its safety, efficiency, and long lifespan during operation. As a key energy conversion device in current clean energy systems, PEMFCs have been widely applied in various cutting-edge fields such as new energy vehicles and distributed generation due to their advantages of high energy efficiency, low emissions, and rapid start-up. However, due to the complex multiphysics coupling processes involved within PEMFCs, coupled with the dynamic load changes and environmental disturbances they often face during actual operation, typical faults such as gas leakage, membrane drying, flooding, and catalyst poisoning are easily triggered. These faults not only lead to a significant decline in battery performance but may also cause safety accidents in severe cases, threatening the stable operation and lifespan of the system. Therefore, building an efficient fault diagnosis mechanism is crucial for ensuring the safe operation of PEMFC systems. In addition, the diagnostic results can provide data-driven decision-making basis for optimizing operating parameters, improving energy efficiency, and extending battery life, helping to reduce maintenance costs, improve system reliability, and promote the large-scale application and sustainable development of fuel cell technology on a larger scale.
[0005] The main purpose of fault diagnosis is to determine whether a system is operating normally through various means, and to identify the type and location of the fault when it occurs. Timely intervention before a fault occurs can prevent serious malfunctions. With the continuous development of fuel cells, fuel cell diagnostic technology has also made significant progress, and the performance of diagnostic systems has been gradually improved. Diagnostic methods are generally classified into three main categories: model-based, data-driven, and other methods.
[0006] In PEMFC fault diagnosis, faults are commonly categorized into membrane dryness, flooding, and gas leakage. However, this crude classification often fails to capture the realities of PEMFC malfunctions, leading to misdiagnosis. For expensive and easily damaged devices like PEMFCs, the best approach to fault diagnosis is to develop a PEMFC model that maintains consistent data across various operating conditions, based on the fuel cell itself. Fault injection experiments can then be conducted on this model. Real fuel cell systems generate numerous interference signals due to sensor characteristics and operating conditions. These signals are typically highly complex and deeply embedded in the frequency domain; observing time-series data alone yields limited information and can severely hinder fault identification. Summary of the Invention
[0007] To address the limitations of existing PEMFC fault diagnosis methods, such as strong model dependency, insufficient feature extraction capabilities, low training efficiency, and poor generalization performance, this invention conducts fault injection experiments based on a reliable commercial PEMFC model, simulating corresponding fault types by changing the input of the PEMFC model. Based on the model and fault samples, a novel CNN-Transformer fault diagnosis algorithm is proposed. The neural network fault diagnosis model is then trained, validated, and tested using data samples. Considering the interference of noise on sensor data, the anti-interference ability and fault classification accuracy of the proposed fault diagnosis algorithm are verified. This is of great significance for ensuring the safe, efficient, and long-life operation of PEMFC systems.
[0008] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A fault diagnosis method for proton exchange membrane fuel cells based on CNN-Transformer includes the following steps: S1. Build and verify the PEMFC simulation model. The model is based on the principles of thermodynamics, electrochemistry and mass transfer and can reflect the actual operating state of the fuel cell. S2. Collect multi-dimensional sensor time-series data of PEMFC under different operating conditions through fault injection experiments, and construct a dataset; S3. Preprocess the collected raw sensor data, including data standardization, missing value handling, nonlinear dimensionality reduction, and noise filtering; S4. Input the preprocessed data into the CNN-Transformer neural network model for feature extraction and fault classification. The CNN-Transformer model extracts local spatial features through a convolutional neural network and captures global dependencies through the self-attention mechanism of the Transformer encoder. S5. Output fault diagnosis results, which include a classification of seven operating conditions: hydrogen underpressure, hydrogen overpressure, air overpressure, air underpressure, anode pipe blockage, cathode pipe blockage, and normal state.
[0009] Preferably, in step S1, the actual single-cell voltage V of the PEMFC simulation model is determined by the thermodynamic electromotive force E. Nernst Activation polarization voltage loss V act and Ohmic polarization voltage loss V ohm The calculated expression is:
[0010] Among them, the thermodynamic electromotive force E Nernst The calculation formula is:
[0011] Preferably, the sensor data collected in the fault injection experiment in step S2 includes: fuel cell input current, fuel cell output voltage, air outlet pressure, air inlet pressure, air inlet temperature, hydrogen outlet pressure, cooling water outlet temperature, cooling water inlet temperature, air flow rate, hydrogen pump speed, and fuel cell input voltage.
[0012] Preferably, the preprocessing of the collected raw sensor data in step S3 specifically includes: S31. The kernel principal component analysis method is used to perform nonlinear dimensionality reduction on high-dimensional sensor data, and the top nine principal components with a cumulative contribution rate of more than 90% are extracted as the main input features. S32. Introduce Gaussian white noise into the dimension-reduced feature signal to simulate measurement error and environmental disturbance; S33. Use unscented Kalman filtering to dynamically filter noisy signals in order to suppress noise interference.
[0013] Preferably, before inputting the preprocessed data into the CNN-Transformer neural network model in step S4, a data transformation step is also included: S41. For the preprocessed nine-dimensional sensor time series data, use continuous wavelet transform to convert the data of 128 consecutive time domain sampling points into a 128*128 wavelet coefficient matrix. S42. Stack the wavelet coefficient matrices of the 9 sensor channels sequentially in the depth direction to form sample data with a size of 128*128*9, which will be used as the input of the CNN-Transformer neural network model.
[0014] Preferably, the CNN-Transformer neural network model in step S4 employs an improved weight update mechanism. This mechanism adds momentum to the standard gradient descent method to accelerate convergence and reduce oscillations. The weight update formula is as follows:
[0015] In the formula, Represents current momentum. Let be the weight at time t. For learning rate, Parameters at time t The loss gradient.
[0016] Preferably, the self-attention mechanism of the Transformer encoder in step S4 adopts a dynamic sparse attention mechanism to reduce computational complexity and memory usage.
[0017] Preferably, the model training process in step S4 includes: optimizing network weights through backpropagation using the training set, monitoring the training process and preventing overfitting using the validation set to determine the optimal model save point, and finally evaluating the model's classification performance on unknown samples using the test set.
[0018] The present invention also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor executes the program to implement the above-described method for fault diagnosis of proton exchange membrane fuel cells based on CNN-Transformer.
[0019] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method for fault diagnosis of proton exchange membrane fuel cells based on CNN-Transformer.
[0020] Compared with existing technologies, the beneficial effects and advancements of this invention are as follows: (1) Extracting data from nine-dimensional sensors based on continuous wavelet transform to better capture the global dependencies between data.
[0021] (2) Using CNN to extract features from the fused data has the advantages of accuracy and ease of implementation, and has good engineering applicability.
[0022] (3) The CNN-Transformer-based fault classification algorithm has a comprehensive classification accuracy of 95.08% for the six fault states, which is higher than the classification accuracy of traditional fault diagnosis algorithms. Attached Figure Description
[0023] Figure 1 The object of application of this invention: a physical image of a fuel cell; Figure 2 Comparison of air mass flow response during shutdown; Figure 3 The results of the principal component analysis are shown in the figure. Figure 4 This is a comparison image before and after adding noise; Figure 5 The result is an unscented Kalman filter. Figure 6 This is a structural framework diagram of the fault classification algorithm; Figure 7 A comparison of the accuracy of the four algorithms; Figure 8 The fault classification confusion matrix of the method proposed in this paper. Detailed Implementation
[0024] The present invention will be further described and illustrated below with reference to specific embodiments. The embodiments described are merely examples of the content of this disclosure and do not limit the scope of the invention. The technical features of each embodiment in the present invention can be combined accordingly, provided that there is no mutual conflict.
[0025] This invention discloses a PEMFC fault diagnosis method based on CNN-Transformer, which solves the problems of difficult fault identification and low identification rate caused by signal noise in the prior art, and includes the following steps: 1) Building and validating the fuel cell model, mainly introducing the voltage equation and comparing experimental simulation data.
[0026] 1.1) Fuel Cell Model a) Single-cell voltage output of hydrogen-oxygen fuel cells for:
[0027] In the formula: This represents the actual voltage of a single cell in a hydrogen-oxygen fuel cell. It is the thermodynamic electromotive force; This is to reduce the activation polarization voltage loss; This is the ohmic polarization voltage loss.
[0028] b) The thermodynamic electromotive force of a hydrogen-oxygen fuel cell is:
[0029] In the formula: Thermodynamic electromotive force, unit ; The Gibbs free energy change of the battery reaction is expressed in units. ; Let be the Faraday constant, taken as 96487. ; The entropy change of the battery reaction is expressed in units of... ; Let be the gas constant, taken as 8.314. ; This represents the partial pressure of hydrogen gas at the anode, expressed in units of... ; The partial pressure of oxygen at the cathode, in units. ; Battery temperature, unit ; For reference temperature, unit .
[0030] At room temperature and standard atmospheric pressure , , Substituting into the equation, we can obtain the following equation:
[0031] c) Activation loss electromotive force The activation loss electromotive force is calculated as follows: ; Among them, parameters - Calculations based on thermodynamics, electrochemical reactions, and fluid mechanics principles can yield the following: ; ; ; ; in, The standard state Gibbs free energy for chemisorption is given. Represents the activation coefficient of the cathode reaction. This indicates that in electrochemical reactions, the transport of electrons between reactants is a quantum process carried out via electric current. For area, and These represent the reaction rate parameters at the cathode and anode, respectively. , , These represent the liquid phase concentrations of hydrogen ions, water, and hydrogen gas at the membrane and gas interface, respectively. Since the chemical reaction principles involved in the parameter calculations here are too complex and do not affect the main theme of the fuel cell system model, this model uses empirical parameters obtained by combining experimental data. , , , .
[0032] d) Ohmic polarization electromotive force The formula for calculating the Ohmic polarization electromotive force is as follows:
[0033] In the formula, Current density, in units ; For membrane area, in units ; It is an ohmic resistance, measured in Ω.
[0034] 1.2) Model Validation By comparing the simulation results and experimental data under various operating conditions, within an acceptable error range, the PEMFC model can accurately reflect the actual operating state of the system and the changing trends of its key parameters, verifying its effective modeling capability for fuel cell performance under different operating conditions.
[0035] 2) CNN-Transformer Fault Diagnosis Algorithm Design 2.1) Conventional CNN CNNs are powerful at processing non-linear data. Their principle is to use convolutional layers to extract features from the input, and then use pooling layers to sparsify the feature maps, reducing computational load. Weight updates require the loss gradient to point in the direction of the current batch optimum; the update formula is as follows:
[0036] In the formula, Let be the weight at time t. For learning rate, Parameters at time t The loss gradient.
[0037] 2.2) Conventional Transformer The Transformer is a neural network based on an attention mechanism. Its encoder effectively captures the global dependencies between elements within a sequence and maps the symbols of the input sequence to a continuous representation of the sequence. The core principle of the Transformer network encoder is the self-attention mechanism. The self-attention mechanism uses scaled dot product attention to calculate the attention value of the feature matrix. First, the query matrix Q and the key matrix K are scaled by a dot product and normalized using Softmax to calculate the weight coefficients. Then, the value matrix (V) is weighted and summed according to the weight coefficients. The multi-head attention mechanism is defined as follows:
[0038] 2.3) Improved CNN-Transformer Neural Network a) Improve the weight update mechanism The standard gradient descent method is based on momentum, which is added to accelerate convergence and reduce oscillations.
[0039] The weight update formula becomes:
[0040] In the formula, This represents the current momentum.
[0041] b) Improve multi-head attention mechanisms Consider using dynamic sparse attention, where not all interactions between the query matrix Q and the key matrix K are necessary. Therefore, we can compute only a subset of the important attention weights, thereby reducing computational complexity and memory usage.
[0042] 2.4) Introduction to CNN-Transformer Fault Diagnosis Algorithm To better capture the global dependencies between data, the preprocessed nine-dimensional sensor time-series data is transformed into a 128*128 wavelet coefficient matrix using Continuous Wavelet Transform (CWT) from 128 consecutive time-domain sampling points. Subsequently, the wavelet coefficient matrices of the nine sensor channels are stacked sequentially along the depth direction, resulting in an output sample size of 128*128*9. Since this structured data is essentially a time-frequency feature matrix obtained from wavelet transform, exhibiting significant spatial distribution characteristics and inter-channel correlations, it is suitable for using a Transformer structure to model its long-range dependencies in both spatial and channel dimensions. Therefore, it is used as input to a CNN-Transformer neural network model. The CNN extracts local spatial features, and the Transformer further mines global correlations, ultimately achieving accurate classification of typical fault types in fuel cell systems.
[0043] 2.5) Neural Network Training During model training, the dataset is divided into a training set, a validation set, and a test set, used for learning model parameters, tuning hyperparameters, and evaluating generalization performance, respectively. The training set optimizes network weights through backpropagation, the validation set monitors the training process and prevents overfitting to determine the optimal model retention point, and the test set objectively evaluates the model's classification performance on unknown samples to ensure the reliability and practicality of the results.
[0044] The implementation process of the fuel cell fault diagnosis algorithm based on CNN-Transformer is as follows: 1) The first step is to model the PEMFC system. This invention builds and verifies a PEMFC simulation model based on the dSPACE commercial model and the PEMFC ontology. The PEMFC system mainly involves knowledge from many fields such as fluid dynamics, thermodynamics, mass transfer, and electrochemistry. The feasibility of the model is verified by comparing the simulation data of the model with the experimental data of the PEMFC ontology. (Appendix) Figure 1 The image shows a physical picture of the fuel cell, with accompanying drawings. 2 shows a comparison of air mass flow response during the shutdown phase.
[0045] 2) Fault injection experiment and data acquisition This invention utilizes an FCU and simulation platform to conduct fault injection experiments and acquire sensor signals. The fault injection experiments include seven operating conditions: hydrogen underpressure, hydrogen overpressure, air overpressure, air underpressure, anode pipe blockage, cathode pipe blockage, and normal operation. Data from 11 sensors in the PEMFC model were collected, including stack input current, stack output voltage, air outlet pressure, air inlet pressure, air inlet temperature, hydrogen outlet pressure, cooling water outlet temperature, cooling water inlet temperature, air flow rate, hydrogen pump speed, and stack input voltage. The sensor signal acquisition table is shown in Table 1, and the data volume for each operating condition is shown in Table 2.
[0046] Table 1 Sensor Signal Acquisition Table
[0047] Table 2 Data volume for each operating condition point
[0048] 3) Data processing The collected raw data underwent preprocessing steps such as standardization and missing value handling. Subsequently, kernel principal component analysis (KPCA) was used to perform nonlinear dimensionality reduction on the high-dimensional data, extracting the top nine principal components with a cumulative contribution rate exceeding 90%, which served as the main input features for the subsequent fault classification model. Finally, Gaussian white noise was introduced into the dimensionality-reduced nine-dimensional feature signal to simulate the impact of sensor measurement errors and environmental disturbances. Unscented Kalman filtering (UKF) was then used to dynamically filter the noisy signal, effectively suppressing noise interference.
[0049] Appendix Figure 3 The results of KPCA principal component analysis are presented, with appendix. Figure 4 The image shows a comparison of the signal before and after noise was added. Figure 5 The results of unscented Kalman filtering are shown in comparison.
[0050] 4) CNN-Transformer Fault Diagnosis Algorithm Design This invention proposes a fault diagnosis method combining Convolutional Neural Networks (CNNs) and Transformers. First, Continuous Wavelet Transform (CWT) is used to extract information from 128 consecutive data points of the sensor signal, mapping them to a 128*128 wavelet matrix. Then, the wavelet coefficient matrices of the nine sensor channels are stacked sequentially in the depth direction, resulting in an output sample size of 128*128*9. Subsequently, CNN is used to extract local features from the CWT-transformed data. Finally, a Transformer encoder module is introduced, utilizing its self-attention mechanism to model long-range dependencies between different time steps or channels. Figure 6The main structure of the fault classification algorithm is shown, demonstrating the entire process from input from a 9-dimensional sensor to the output classification result.
[0051] 5) Model training and testing The neural network fault diagnosis model is trained, validated, and tested based on PEMFC fault sample data. The proposed CNN-Transformer algorithm is compared with three commonly used algorithms: LSTM, DNN, and Transformer. To ensure the convergence and accuracy of the model, the preprocessing method for the training dataset is the same as that for the original model dataset. Due to the limited amount of data, the model is pre-trained first. After obtaining the pre-trained weights, transfer learning is used to load the pre-trained weights for the training task. The proposed CNN-Transformer algorithm is compared with three commonly used algorithms: LSTM, DNN, and Transformer. A learnable learning rate is used, and each algorithm is trained for 100 epochs. Figure 7 This is a comparison of the accuracy of four algorithms, with appendix. Figure 8 This is the confusion matrix for the test set of Method 4.
[0052] The LSTM algorithm converged after 60 epochs, stabilizing at 90.0% accuracy with a training loss of 0.42. Its highest accuracy reached 90.16%, at which point the training loss was 0.41. The DNN algorithm also converged after 60 epochs, stabilizing at 91.0% accuracy with a training loss of 0.40. Its highest accuracy reached 91.57%, at which point the training loss was 0.39. The Transformer algorithm converged after 60 epochs, stabilizing at 93.0% accuracy with a training loss of 0.25. Its highest accuracy reached 93.44%, at which point the training loss was 0.21. The CNN-Transformer algorithm converged after 75 epochs, stabilizing at 95.0% accuracy with a training loss of 0.15. Its highest accuracy reached 95.08%, at which point the training loss was 0.11.
[0053] Table 3 shows the fault classification results and evaluation metrics for the four algorithms. A comprehensive comparison of the four key metrics—Precision, Recall, F1-score, and Accuracy—reveales that the proposed CNN-Transformer model outperforms the other three methods in overall performance. Experimental results show that CNN-Transformer achieves a comprehensive diagnostic accuracy of 95.08%, surpassing other algorithms. It achieves a comprehensive diagnostic accuracy of 95.08% under seven operating conditions: hydrogen underpressure, hydrogen overpressure, air overpressure, air underpressure, anode pipe blockage, cathode pipe blockage, and normal operating conditions, demonstrating good classification accuracy and robustness. Further analysis of the model training process reveals that CNN-Transformer exhibits higher classification accuracy than other models from the initial training stage. Under the same training loss threshold constraint, the required number of training iterations is significantly reduced, indicating that the model not only has stronger learning ability and higher training efficiency but also effectively reduces overall computational resource consumption. These results validate the good generalization ability and practicality of CNN-Transformer in fuel cell fault diagnosis tasks, providing reliable technical support for efficient and high-precision fault identification under complex operating conditions.
[0054] Table 3. Fault classification results and evaluation metrics for the four algorithms.
[0055] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for fault diagnosis of proton exchange membrane fuel cells based on neural networks, characterized in that, Includes the following steps: S1. Build and verify the PEMFC simulation model. The model is based on the principles of thermodynamics, electrochemistry and mass transfer and can reflect the actual operating state of the fuel cell. S2. Collect multi-dimensional sensor time-series data of PEMFC under different operating conditions through fault injection experiments, and construct a dataset; S3. Preprocess the collected raw sensor data, including data standardization, missing value handling, nonlinear dimensionality reduction, and noise filtering; S4. Input the preprocessed data into the CNN-Transformer neural network model for feature extraction and fault classification. The CNN-Transformer model extracts local spatial features through a convolutional neural network and captures global dependencies through the self-attention mechanism of the Transformer encoder. S5. Output fault diagnosis results, which include a classification of seven operating conditions: hydrogen underpressure, hydrogen overpressure, air overpressure, air underpressure, anode pipe blockage, cathode pipe blockage, and normal state.
2. The method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1, characterized in that, In step S1, the actual single-cell voltage V of the PEMFC simulation model is determined by the thermodynamic electromotive force E. Nernst Activation polarization voltage loss V act and Ohmic polarization voltage loss V ohm The calculation yields the following expression: ; Among them, the thermodynamic electromotive force E Nernst The calculation formula is: 。 3. The method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1, characterized in that, The sensor data collected in the fault injection experiment in step S2 includes: fuel cell input current, fuel cell output voltage, air outlet pressure, air inlet pressure, air inlet temperature, hydrogen outlet pressure, cooling water outlet temperature, cooling water inlet temperature, air flow rate, hydrogen pump speed, and fuel cell input voltage.
4. The method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1, characterized in that, Step S3 involves preprocessing the collected raw sensor data, specifically including: S31. The kernel principal component analysis method is used to perform nonlinear dimensionality reduction on high-dimensional sensor data, and the top nine principal components with a cumulative contribution rate of more than 90% are extracted as the main input features. S32. Introduce Gaussian white noise into the dimension-reduced feature signal to simulate measurement error and environmental disturbance; S33. Use unscented Kalman filtering to dynamically filter noisy signals in order to suppress noise interference.
5. The method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1, characterized in that, Before inputting the preprocessed data into the CNN-Transformer neural network model in step S4, a data transformation step is also included: S41. For the preprocessed nine-dimensional sensor time series data, use continuous wavelet transform to convert the data of 128 consecutive time domain sampling points into a 128*128 wavelet coefficient matrix. S42. Stack the wavelet coefficient matrices of the 9 sensor channels sequentially in the depth direction to form sample data with a size of 128*128*9, which will be used as the input of the CNN-Transformer neural network model.
6. The method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1, characterized in that, The CNN-Transformer neural network model described in step S4 employs an improved weight update mechanism. This mechanism adds momentum to the standard gradient descent method to accelerate convergence and reduce oscillations. The weight update formula is as follows: ; In the formula, Represents current momentum. Let be the weight at time t. For learning rate, Parameters at time t The loss gradient.
7. A method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1 or 7, characterized in that, The self-attention mechanism of the Transformer encoder described in step S4 adopts a dynamic sparse attention mechanism to reduce computational complexity and memory usage.
8. The method for fault diagnosis of proton exchange membrane fuel cells based on neural networks according to claim 1, characterized in that, The model training process described in step S4 includes: optimizing network weights through backpropagation using the training set, monitoring the training process and preventing overfitting using the validation set to determine the optimal model save point, and finally evaluating the model's classification performance on unknown samples using the test set.
9. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements a neural network-based proton exchange membrane fuel cell fault diagnosis method as described in any one of claims 1 to 9.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements a neural network-based proton exchange membrane fuel cell fault diagnosis method as described in any one of claims 1 to 9.