Fault diagnosis method and system of fuel cell, electronic equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN UNIV OF TECH
- Filing Date
- 2024-12-06
- Publication Date
- 2026-07-21
Smart Images

Figure CN119812397B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fuel cell fault diagnosis, and specifically to a method, system, electronic device, and storage medium for fault diagnosis of fuel cells. Background Technology
[0002] Global warming has profoundly impacted the Earth's natural environment and human society, with greenhouse gas emissions being one of the main causes. Fuel cells, as a clean energy technology, play a crucial role in reducing greenhouse gas emissions, promoting energy transition, and addressing global warming. Proton exchange membrane fuel cells (PEMFCs), as the primary form of fuel cells, possess advantages such as high energy density, strong power performance, and zero emissions, demonstrating enormous application potential in transportation, energy storage and supply, aerospace, and military fields. However, in actual operation, fuel cells, as a complex nonlinear system composed of multiple coupled physical fields such as heat, electricity, and fluid, are susceptible to failure due to component aging, environmental changes, or improper control. Failure to promptly address these faults can reduce the performance of the fuel cell stack and, in severe cases, cause irreversible damage to the system. Therefore, timely and accurate diagnosis of faults occurring during fuel cell system operation is of paramount importance.
[0003] Currently, fault diagnosis in fuel cells primarily relies on machine learning techniques. This involves collecting operational data, extracting features, building models, and training these models to identify faults. This method can handle large amounts of data and automatically learn patterns within the data through algorithms, thus enabling rapid fault diagnosis. For example, some studies utilize support vector machines (SVM), neural networks, or deep learning methods to predict and classify different faults by analyzing parameters such as voltage, current, and temperature of the fuel cell.
[0004] While existing machine learning techniques have achieved some success in fuel cell fault diagnosis, several problems and challenges remain. In practical applications, extracting useful features from large amounts of operational data after collection is a complex process. As the diversity and complexity of data increase, feature selection and model training become even more difficult. Furthermore, during feature selection, some key features may be overlooked or over-reliance on certain features may occur, both of which can affect the accuracy of the diagnosis. Summary of the Invention
[0005] This invention proposes a method, system, electronic device, and storage medium for fault diagnosis of fuel cells, which solves the problem of poor diagnostic accuracy of existing fault diagnosis methods when dealing with multidimensional data.
[0006] To address the aforementioned technical problems, this invention provides a method for diagnosing faults in a fuel cell, comprising the following steps:
[0007] Step S1: Collect several types of operating data for the fuel cell under various operating conditions;
[0008] Step S2: Evaluate the importance of several types of running data, and take the running data with an importance score greater than a set threshold as feature data. Calculate the expectation, entropy, and hyperentropy of each type of feature data, and use all the feature data, the expectation, entropy, and hyperentropy of the feature data as the training set.
[0009] Step S3: Establish a fault diagnosis classification model and train the fault diagnosis classification model using the training set;
[0010] Step S4: Collect the feature data of the fuel cell to be diagnosed, and input the feature data of the fuel cell to be diagnosed, as well as the expectation, entropy and hyperentropy of the feature data, into the trained fault diagnosis classification model to obtain the fault type of the fuel cell.
[0011] Preferably, in step S2, the importance of the operating data is assessed by the Gini impurity, and the expression for calculating the Gini impurity is:
[0012]
[0013] In the formula, G m Gini impurity; K is the number of types of running data; p m,k Let m be the probability that the m-th running data belongs to the k-th class.
[0014] Preferably, the expression for calculating the expected value of the feature data in step S2 is:
[0015]
[0016] In the formula, Ex(k) is the expectation of the k-th feature data; x i (k) represents the i-th feature data in the k-th feature data; N represents the total number of data in the k-th feature data;
[0017] The expression for calculating the entropy of the feature data is:
[0018]
[0019] In the formula, En(k) is the entropy of the k-th feature data;
[0020] The expression for calculating the hyperentropy of the feature data is:
[0021]
[0022] In the formula, He(k) is the hyperentropy of the k-th feature data; S(k) is the variance of the k-th feature data.
[0023] Preferably, after collecting several types of operational data in step S1, the operational data is preprocessed, including the following steps:
[0024] Step S11: Clean the missing values, outliers, and duplicate data in the running data;
[0025] Step S12: Normalize the cleaned running data.
[0026] Preferably, the fault diagnosis classification model in step S3 is a random forest model.
[0027] Preferably, in step S3, the grid search algorithm (GS) is used to optimize the hyperparameters of the fault diagnosis classification model to obtain the optimal parameter combination of the fault diagnosis classification model.
[0028] The present invention also provides a fault diagnosis system for fuel cells, which is based on the above-mentioned fault diagnosis method for fuel cells, and includes: a data acquisition module, a feature extraction module, a fault diagnosis module and an iterative optimization module;
[0029] The data acquisition module: collects the operating data of the fuel cell to be diagnosed in real time;
[0030] The feature extraction module performs feature extraction on the operating data to obtain feature data of the fuel cell to be diagnosed.
[0031] The fault diagnosis module: establishes a fault diagnosis model, trains the fault diagnosis model using historical operating data of the fuel cell to be diagnosed, inputs the characteristic data of the fuel cell into the trained fault diagnosis model, and obtains the fault type of the fuel cell to be diagnosed.
[0032] The iterative optimization module iteratively optimizes the parameters of the fault diagnosis model based on the training results of the fault diagnosis model.
[0033] Preferably, the feature extraction module evaluates the importance of the running data and uses running data with an importance score greater than a set threshold as feature data.
[0034] The present invention also provides an electronic device, comprising: a memory, a processor, and a computer program, wherein the computer program is stored in the memory and configured to be executed by the processor to implement the above-described method for diagnosing a fuel cell fault.
[0035] The present invention also provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described method for diagnosing a fuel cell fault.
[0036] The advantages of this invention include at least the following:
[0037] 1. By assessing the importance of fuel cell operating data and filtering out characteristic data, we can remove data that does not contribute much to fault diagnosis, reduce model complexity, and improve diagnostic efficiency.
[0038] 2. By using feature data and its statistics together as a training set, more comprehensive data information can be provided for the fault diagnosis model, which helps the model learn deeper data patterns.
[0039] 3. By establishing a fault diagnosis classification model, faults in fuel cells can be diagnosed automatically, reducing manual intervention and improving the speed and accuracy of diagnosis. Attached Figure Description
[0040] Figure 1 This is a schematic diagram of the method flow according to an embodiment of the present invention;
[0041] Figure 2 The importance assessment results of the operational data in this embodiment of the invention;
[0042] Figure 3 This is a schematic diagram illustrating the fault classification accuracy of the fault diagnosis model in an embodiment of the present invention.
[0043] Figure 4 This is a schematic diagram of the fault classification confusion matrix in an embodiment of the present invention. Detailed Implementation
[0044] 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 protection scope of the present invention.
[0045] like Figure 1 As shown, this embodiment of the invention provides a method for fault diagnosis of a fuel cell, including the following steps:
[0046] Step S1: Collect several types of raw operating data of the fuel cell under normal, membrane dry and hydrogen leakage conditions respectively.
[0047] Specifically, the raw operating data collected in this embodiment of the invention originates from a fuel cell system with a dual stack structure. The raw operating data collected contains a total of 20 state variables, as shown in Table 1.
[0048] Table 1. State variables of fuel cell
[0049]
[0050]
[0051] The missing values, outliers, and duplicate data in the collected raw running data are cleaned, and the cleaned running data is then normalized.
[0052] Min-Max normalization can transform data with different dimensions into data of the same order of magnitude, reducing the differences between data points, accelerating the model convergence process, and balancing the contribution of each data point to the model, thus improving model performance. The formula used is as follows:
[0053]
[0054] In the formula, x * The normalized runtime data; x i x represents the i-th type of running data after cleaning; imax For x i The maximum value in; x imin For x i The minimum value in.
[0055] Step S2: Evaluate the importance of several types of running data, and use the running data with an importance score greater than a set threshold as feature data. Calculate the expectation, entropy, and hyperentropy of each type of feature data, and use all feature data, the expectation, entropy, and hyperentropy of the feature data as the training set.
[0056] Specifically, in this embodiment of the invention, the Random Forest (RF) algorithm is used to evaluate the importance of operational data, thereby selecting feature variables for fault diagnosis. RF uses Gini Impurity as an evaluation metric to assess the importance of operational data, with the evaluation standard being the highest purity achievable by each child node. The smaller the Gini Impurity after feature partitioning, the greater the purity of the resulting feature set, indicating a more important feature set. Conversely, the greater the Gini Impurity, the greater the uncertainty, indicating a lower importance for the feature set. Therefore, the importance of operational data can be assessed through Gini Impurity, thereby enabling feature selection. The calculation formula is as follows:
[0057]
[0058] In the formula, G m Gini impurity; K is the number of types of running data; p m,k Let m be the probability that the m-th running data belongs to the k-th class.
[0059] The feature importance evaluation results of the embodiments of the present invention are as follows: Figure 2 As shown in Table 2, a higher feature importance indicates richer information contained in the feature and a greater impact on the diagnostic results. To select the optimal combination of input features, this embodiment of the invention compared different combinations of running data, and the final feature selection is shown in Table 2.
[0060] Table 2 Feature selection results
[0061]
[0062] The normalized and feature-selected data samples were divided into training and test sets in a 7:3 ratio.
[0063] Furthermore, by extracting the expectation (Ex), entropy (En), and hyperentropy (He) of the data, the cloud model can capture the uncertainty and ambiguity in the data, which is equivalent to generating new uncertainty-related features for each feature. These new features provide additional information, revealing the hidden complexity in the data, thereby helping random forests better understand and process the data. Therefore, this embodiment of the invention fuses the features extracted by the cloud model with the original features, adding these features to the original training and test sets to obtain new training and test sets.
[0064] The expression for calculating the expectation of the feature data is as follows:
[0065]
[0066] In the formula, Ex(k) is the expectation of the k-th feature data; x i (k) represents the i-th feature data in the k-th feature data; N represents the total number of data in the k-th feature data;
[0067] The expression for calculating the entropy of feature data is:
[0068]
[0069] In the formula, En(k) is the entropy of the k-th feature data;
[0070] The expression for calculating the hyperentropy of feature data is:
[0071]
[0072]
[0073] In the formula, He(k) is the hyperentropy of the k-th feature data; S(k) is the variance of the k-th feature data.
[0074] Step S3: Establish a fault diagnosis classification model and train the fault diagnosis classification model using the training set.
[0075] Specifically, the fault diagnosis classification model in this embodiment of the invention employs a random forest model. A grid search algorithm (GS) is used to optimize the hyperparameters of the random forest model, and the obtained optimal parameters are then fed into the random forest model for training. The GS algorithm defines a search space for parameters such as the number of decision trees, maximum depth, and minimum number of sample splits. The grid search exhaustively searches all combinations, and the model performance is evaluated through cross-validation to ultimately obtain the optimal parameter combination. After finding the optimal parameters, the random forest model is retrained using data incorporating cloud model features, thereby improving the accuracy and robustness of fuel cell fault diagnosis.
[0076] The new test set is input into the trained random forest model to obtain diagnostic results, and the performance of the diagnostic results is verified. Figure 3 , 4 The diagrams show the fault diagnosis accuracy and confusion matrix of an embodiment of the present invention, respectively. As can be seen from the diagrams, the overall classification accuracy of the three data categories—normal, membrane dry, and hydrogen leakage—is 99.11%.
[0077] Step S4: Collect the feature data of the fuel cell to be diagnosed, and input the feature data of the fuel cell to be diagnosed, as well as the expectation, entropy and hyperentropy of the feature data, into the trained fault diagnosis classification model to obtain the fault type of the fuel cell.
[0078] To address the low accuracy and insufficient reliability of traditional data-driven fuel cell fault diagnosis methods, this invention proposes a fault diagnosis method based on cloud models and random forests. Cloud models capture the uncertainty and ambiguity in data by extracting three parameters: expectation, entropy, and hyperentropy. By fusing these parameters with the original data, the interpretability of the diagnostic model is enhanced, and the transparency of the diagnostic process is improved. Random forest models possess excellent anti-overfitting capabilities. By constructing multiple decision trees and integrating their results, the risk of overfitting from a single decision tree is effectively reduced, enhancing the model's generalization ability. Furthermore, random forests exhibit strong robustness; even with noise or outliers in the data, the integration of multiple trees significantly reduces the impact of noise on the prediction results. Combining cloud models and random forests results in a model that performs exceptionally well in handling complex and uncertain fault diagnosis tasks, while also addressing data noise and imbalance issues. Cloud models enhance the richness of feature representation, while random forests ensure the accuracy and robustness of classification, thereby achieving effective fault diagnosis of fuel cells.
[0079] This invention also provides a fault diagnosis system for fuel cells, based on the above-described fault diagnosis method for fuel cells, including a data acquisition module, a feature extraction module, a fault diagnosis module, and an iterative optimization module.
[0080] The data acquisition module is used to collect the operating data of the fuel cell to be diagnosed in real time.
[0081] The feature extraction module is used to extract features from the operating data to obtain the feature data of the fuel cell to be diagnosed.
[0082] The fault diagnosis module establishes a fault diagnosis model, trains the model using historical operating data of the fuel cell to be diagnosed, inputs the characteristic data of the fuel cell into the trained fault diagnosis model, and obtains the fault type of the fuel cell to be diagnosed.
[0083] The iterative optimization module is used to iteratively optimize the parameters of the fault diagnosis model based on the training results of the fault diagnosis model.
[0084] This invention also provides an electronic device, including: a memory, a processor, and a computer program, wherein the computer program is stored in the memory and configured to be executed by the processor to implement the above-described method for diagnosing a fuel cell fault.
[0085] The present invention also provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described method for diagnosing a fuel cell fault.
[0086] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described; only preferred embodiments of the present invention are illustrated. The descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. As long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0087] It should be noted that those skilled in the art can make various modifications and improvements without departing from the inventive concept, and these all fall within the scope of protection of this invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for fault diagnosis of a fuel cell, characterized in that, Includes the following steps: Step S1: Collect several types of operating data for the fuel cell under various operating conditions; Step S2: Evaluate the importance of several types of operational data, and use operational data with importance scores greater than a set threshold as feature data; calculate the expected value, entropy, and hyperentropy of each type of feature data, and use all the feature data, their expected values, entropy, and hyperentropy as a training set; the expression for calculating the expected value of the feature data is: ; In the formula, The expected value of the k-th feature data; Let be the i-th feature data in the k-th feature data; N is the total number of data in the k-th feature data; The expression for calculating the entropy of the feature data is: ; In the formula, The entropy of the k-th feature data; The expression for calculating the hyperentropy of the feature data is: ; ; In the formula, The hyperentropy of the k-th feature data; Let V be the variance of the k-th feature data; Step S3: Establish a fault diagnosis classification model and train the fault diagnosis classification model using the training set; Step S4: Collect the feature data of the fuel cell to be diagnosed, and input the feature data of the fuel cell to be diagnosed, as well as the expectation, entropy and hyperentropy of the feature data, into the trained fault diagnosis classification model to obtain the fault type of the fuel cell.
2. The method for fault diagnosis of a fuel cell according to claim 1, characterized in that: In step S2, the importance of the operating data is assessed using Gini impurity. The expression for calculating Gini impurity is as follows: ; In the formula, For impurity of the gin; The number of types of data being processed; For the first The running data belongs to the first The probability of a class.
3. The method for fault diagnosis of a fuel cell according to claim 1, characterized in that: After collecting several types of operational data in step S1, the operational data is preprocessed, including the following steps: Step S11: Clean the missing values, outliers, and duplicate data in the running data; Step S12: Normalize the cleaned running data.
4. The method for fault diagnosis of a fuel cell according to claim 1, characterized in that: The fault diagnosis classification model mentioned in step S3 is a random forest model.
5. A method for fault diagnosis of a fuel cell according to claim 4, characterized in that: In step S3, the grid search algorithm GS is used to optimize the hyperparameters of the fault diagnosis classification model to obtain the optimal parameter combination of the fault diagnosis classification model.
6. A fault diagnosis system for a fuel cell, implemented based on a fault diagnosis method for a fuel cell as described in any one of claims 1 to 5, characterized in that, include: Data acquisition module, feature extraction module, fault diagnosis module, and iterative optimization module; The data acquisition module: collects the operating data of the fuel cell to be diagnosed in real time; The feature extraction module performs feature extraction on the operating data to obtain feature data of the fuel cell to be diagnosed. The fault diagnosis module: establishes a fault diagnosis model, trains the fault diagnosis model using historical operating data of the fuel cell to be diagnosed, inputs the characteristic data of the fuel cell into the trained fault diagnosis model, and obtains the fault type of the fuel cell to be diagnosed. The iterative optimization module iteratively optimizes the parameters of the fault diagnosis model based on the training results of the fault diagnosis model.
7. A fault diagnosis system for a fuel cell according to claim 6, characterized in that: The feature extraction module evaluates the importance of the running data and uses running data with an importance score greater than a set threshold as feature data.
8. An electronic device, comprising: The memory, processor, and computer program are characterized in that: the computer program is stored in the memory and configured to be executed by the processor to implement a method for fault diagnosis of a fuel cell according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is executed by a processor to implement a fault diagnosis method for a fuel cell according to any one of claims 1 to 5.