Fuel cell sensor fault diagnosis method, device and medium
By training the machine learning model and calculating the loss function difference, the problem of sensor type limitations in the existing technology is solved, and accurate diagnosis of various sensor faults in fuel cells is achieved. It has a wide range of applications and can identify the type and degree of faults.
Patent Information
- Application Number
- CN202410864739.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-01
AI Technical Summary
Existing fuel cell sensor fault diagnosis methods are applicable to fewer sensor types and have a narrow scope of application, and cannot effectively diagnose faults of other types of sensors except voltage sensors and current sensors.
By obtaining the target data set of the fuel cell sensor, training the machine learning model, and calculating the difference of the loss function to determine the sensor failure, it is suitable for any type of sensor, including voltage, current, air line pressure, etc., to realize the detection of multiple sensors. Troubleshooting.
It realizes fault diagnosis of any type of sensor in the fuel cell, improves the accuracy and applicable scope of diagnosis, can determine the fault type and degree, and maintains consistency with the status of the fuel cell system.
Smart Images

Figure CN118408588B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of fuel cell technology, and in particular to a fuel cell sensor fault diagnosis method, equipment and medium. Background Art
[0002] Fuel cell vehicles have become a hot spot for the development of new energy vehicles due to their pollution-free, wide energy sources, and long driving range. However, due to the complex electrochemical mechanism of fuel cells, the high pressure and high gas flow rate of the hydrogen path, and the need to cooperate with the air path for gas supply, a complete and accurate control system is required. The number and variety of sensors in fuel cell engines are numerous and complex, involving data acquisition of various branches and internal data. The accuracy of sensor values directly affects the final control effect of the fuel cell engine. In addition, in terms of fuel cell health prediction, the acquisition of sensor values will also affect a series of subsequent processes such as pattern recognition and state monitoring. Moreover, sensor values, as the most direct performance of fuel cells, have been widely valued by people. However, the complex working conditions of fuel cells can also cause various degrees of sensor failures. Therefore, it is particularly important to propose a fuel cell sensor fault diagnosis method.
[0003] Most of the prior art fuel cell sensor fault diagnosis methods are for a certain type of sensor or a few types of sensors, such as voltage sensors and current sensors, but are not applicable to other types of sensors. For example, some prior art diagnostic methods are only applicable to the fault diagnosis of voltage sensors, but not to the fault diagnosis of other sensors except voltage sensors. That is, the existing fuel cell fault diagnosis methods are applicable to fewer types of sensors and have a narrow scope of application. Summary of the invention
[0004] The present invention provides a fuel cell sensor fault diagnosis method, device and medium, which are used to solve the technical problems that the existing fuel cell sensor fault diagnosis method is applicable to fewer sensor types and has a narrow application range.
[0005] In a first aspect, the present invention provides a fuel cell sensor fault diagnosis method, comprising: obtaining a target data set collected by a fuel cell sensor within a preset time period; training a machine learning model through the target data set, and calculating a loss function target value corresponding to the trained machine learning model, wherein the input of the machine learning model is the collected data of other sensors, and the output is the collected data of the target sensor, and the other sensors and the target sensor constitute the fuel cell sensor; obtaining an initial value of the loss function corresponding to the machine learning model; calculating the difference between the target value of the loss function and the initial value of the loss function, and determining that the target sensor has a fault when the difference is greater than a first preset threshold.
[0006] In a feasible implementation, obtaining the initial value of the loss function corresponding to the machine learning model includes: obtaining an initial data set collected by the fuel cell sensor under normal working conditions; training the machine learning model through the initial data set, and calculating the initial value of the loss function corresponding to the trained machine learning model.
[0007] In a feasible implementation, after calculating the difference between the loss function target value and the loss function initial value, the method further includes: when the difference is less than or equal to the first preset threshold, determining that the target sensor is in a normal working state; and updating the loss function initial value to the loss function target value.
[0008] In a feasible implementation, after determining that the target sensor has a fault, the method further includes: obtaining a loss function fault value, including: obtaining data collected by the target sensor in a faulty working state and data collected by the other sensors in a normal working state, and constructing a fault data set, training the machine learning model through the fault data set, and calculating the loss function fault value corresponding to the trained machine learning model; determining the difference between the loss function fault value and the initial value of the loss function as a fault residual, and determining the difference between the loss function target value and the initial value of the loss function as a target residual; calculating the difference between the fault residual and the target residual, and when the difference is less than a second preset threshold, determining that the fault type and fault degree of the target sensor correspond to the faulty working state.
[0009] In a feasible implementation manner, after determining that the fault type and fault degree of the target sensor correspond to the faulty working state, the method further includes: updating the loss function fault value to the loss function target value.
[0010] In a feasible implementation manner, the data collected by the target sensor in a faulty working state includes: data collected by the target sensor on the fuel cell under a preset fault type and a preset fault degree.
[0011] In a feasible implementation, after calculating the target value of the loss function corresponding to the trained machine model, the method further includes: in the target data set, analyzing the change pattern of the collected data of the target sensor, and determining the current working condition of the target sensor based on the change pattern; obtaining the initial value of the loss function corresponding to the machine learning model under the current working condition; calculating the difference between the target value of the loss function and the initial value of the loss function, and determining that the target sensor has a fault when the difference is greater than a first preset threshold.
[0012] In a feasible implementation, after calculating the target value of the loss function corresponding to the trained machine learning model, the method further includes: obtaining the collected data of the target sensor within a historical preset time period; training the machine learning model through the collected data within the historical preset time period and the collected data of the other sensors, and calculating the initial value of the loss function corresponding to the trained machine learning model; calculating the difference between the target value of the loss function and the initial value of the loss function, and determining that the target sensor has a fault when the difference is greater than a third preset threshold.
[0013] In a second aspect, the present invention provides a fuel cell sensor fault diagnosis device, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor so that the at least one processor can execute a fuel cell sensor fault diagnosis method described in any of the above embodiments.
[0014] In a third aspect, the present invention provides a non-volatile computer storage medium, which is a non-volatile computer-readable storage medium, and the non-volatile computer-readable storage medium stores at least one program, each of which includes instructions, and when the instructions are executed by a terminal, the terminal executes a fuel cell sensor fault diagnosis method described in any of the above embodiments.
[0015] The fuel cell sensor fault diagnosis method, device and medium provided by the present invention have the following beneficial technical effects compared with the prior art:
[0016] (1) The present invention determines whether the target data set is contaminated by fault data by comparing the value of the loss function corresponding to the machine learning model trained with the target data set collected by the sensor, that is, comparing the target value of the loss function with the initial value of the loss function, thereby determining whether the target sensor is faulty. The present invention can be applied to the fault diagnosis of any sensor in the fuel cell, and has a wide range of applicable sensors.
[0017] (2) After determining whether the target sensor is normal or faulty, the present invention can update the initial value of the loss function or the fault value of the loss function used as a judgment basis to the target value of the loss function, so that the initial value of the loss function and the fault value of the loss function are closer to the actual normal working state and the faulty working state, and are consistent with the state of the fuel cell system, thereby improving the accuracy of fault diagnosis.
[0018] (3) After determining that the target sensor has failed, the present invention can also compare the target value of the loss function with the failure value of the loss function, thereby determining the type and degree of failure of the target sensor.
[0019] (4) The present invention can also determine the initial value of the loss function corresponding to the machine learning model under the current working condition used as a judgment benchmark based on the current working condition of the target sensor. The judgment benchmark is more consistent with the working condition of the target sensor, and the accuracy of fault diagnosis is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0021] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0022] Figure 1 A flow chart of a fuel cell sensor fault diagnosis method provided by the present invention;
[0023] Figure 2 A data transmission schematic diagram of a fuel cell sensor fault diagnosis method provided by the present invention;
[0024] Figure 3 A schematic diagram of a target data set for an air path pressure sensor provided by the present invention;
[0025] Figure 4 A schematic diagram of assigning weights to features using a random forest model provided by the present invention;
[0026] Figure 5 A schematic diagram of a random forest algorithm provided by the present invention;
[0027] Figure 6 A schematic diagram of data collection of an air path pressure sensor provided by the present invention under fixed deviation faults of different fault degrees;
[0028] Figure 7A schematic diagram of data collection of an air path pressure sensor provided by the present invention under complete deviation faults of different fault degrees;
[0029] Figure 8 A schematic diagram of the composition of a fault data set provided by the present invention;
[0030] Fig. 9 A schematic diagram of the RMSE of a machine learning model of an air path pressure sensor provided by the present invention under a fixed deviation fault;
[0031] Fig.10 A schematic diagram of the RMSE of a machine learning model of an air path pressure sensor provided by the present invention under a complete deviation fault;
[0032] Fig.11 A schematic diagram of the RMSE mean of a machine learning model of an air path pressure sensor provided by the present invention under a fixed deviation fault;
[0033] Fig.12 A schematic diagram of the RMSE mean of a machine learning model of an air path pressure sensor provided by the present invention under a complete deviation fault;
[0034] Fig.13 Shown is a schematic diagram of fault residuals corresponding to different fault types and fault degrees provided by the present invention;
[0035] Fig.14 A schematic diagram of a working condition in which the value of the collected data of a target sensor provided by the present invention changes from high to low;
[0036] Fig.15 A schematic diagram of a working condition in which the value of the collected data of a target sensor provided by the present invention changes from low to high;
[0037] Fig.16 A schematic diagram of a working condition of a numerical gradient change of collected data of a target sensor provided by the present invention;
[0038] Fig.17 A schematic diagram of a working condition of numerical oscillation change of collected data of a target sensor provided by the present invention;
[0039] Fig.18 A schematic diagram of the composition of a historical database provided by the present invention;
[0040] Fig.19 A flow chart of a method for diagnosing air path pressure sensor faults provided by the present invention;
[0041] Fig. 20 A schematic diagram of RMSE of a machine learning model provided by the present invention when the fault data is discontinuously distributed in the fault data set;
[0042] Fig.21 A schematic diagram of the structure of a fuel cell sensor fault diagnosis device provided by the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] The technical solution proposed by the present invention is described in detail below with reference to the accompanying drawings.
[0045] Figure 1 This is a flow chart of a fuel cell sensor fault diagnosis method provided by the present invention. Figure 1 As shown, the method includes the following execution steps:
[0046] S101. Acquire a target data set collected by a fuel cell sensor within a preset time period.
[0047] The fuel cell sensor in the present invention may be a sensor included in a fuel cell system, for example, a sensor in a fuel cell engine.
[0048] For example, Figure 2 The data transmission diagram of a fuel cell sensor fault diagnosis method provided by the present invention is shown in the figure. The fuel cell physical entity system provides sensor collection data, including data collected by various sensors of each subsystem: data collected by fuel cell sensors such as current sensor, voltage sensor, air flow sensor, humidity sensor, and hydrogen mass flow sensor. The collected data of the sensor is transmitted to the data transmission module via CAN communication. The wireless signal transmission module remotely transmits the collected data of each sensor to the cloud data platform. During the signal transmission process, the communication protocol should be consistent. The signal collection step size selects the minimum step size among all sensors to sample all sensor values. The data transmission module can upload a large amount of sensor data to the cloud data platform in real time with the help of 5G technology.
[0049] S102. Train the machine learning model using the target data set, and calculate the target value of the loss function corresponding to the trained machine learning model.
[0050] Among them, the input of the machine learning model is the collected data of other sensors, and the output is the collected data of the target sensor. The other sensors and the target sensor constitute the fuel cell sensor.
[0051] The present invention can regard the fuel cell system as a black box model. In theory, the data collected by the target sensor can be inferred from the data collected by a large number of other sensors distributed in other subsystems. This process can be achieved through a machine learning model.
[0052] After obtaining the target data set, the target data set can be used as a training set for the machine learning model. After training the machine learning model using the target data set, the value of the loss function of the trained machine learning model, that is, the target value of the loss function, is obtained.
[0053] In some embodiments, a portion of the target data set can be used as a validation set to obtain the loss function of the trained machine learning model.
[0054] For example, Figure 2 As shown in the figure, after collecting data from many types of sensors, the cloud data platform uses a data acquisition card (DAQ) to construct a target data set, and provides the target data set to the machine learning model for training to obtain the value of the loss function, that is, the target value of the loss function. The data set is constructed for the target sensor for detection, and the target data set is generated. The target sensor is the machine learning output value, and the sensor signals other than the target sensor are the machine learning model input values. For example, Figure 3 A schematic diagram of a target data set for an air path pressure sensor provided by the present invention, wherein the fuel cell system includes n sensors, and it is to be determined whether the air path pressure fails, that is, the target sensor is an air path pressure sensor, such as Figure 3 As shown, the collected data of the air path pressure sensor is set as the output of the machine learning model, and sensor 1, sensor 2, sensor 3, ..., sensor n-1 are set as the input of the machine learning model, so as to construct a target data set for the air path pressure sensor.
[0055] For example, the machine learning model can be a random forest model, and the loss function can be a root mean square error (RMSE). The data collected by the target sensor is used as the output value of the random forest algorithm model, and the data collected by all other sensors except the target sensor is used as the input, and the mapping relationship is established through the random forest algorithm. The sensor values can be normalized by formula (1):
[0056] (1)
[0057] Among them, y is the normalized value of the sensor data, x is the initial value of the sensor data, and x maxis the maximum value of the sensor data in the data set, x min is the minimum value of the sensor data collected in the data set, y min =0,y max = 1. Therefore, formula (1) can be simplified to formula (2).
[0058] (2)
[0059] Assume that the random forest model contains T Base learner { h (1), h (2), ... , h( T )},sample x The output of each base learner is h i ( x ), the numerical output adopts the combination strategy of averaging method to combine the learning results of each basic learner. In addition, the weighted average is used to combine the basic learners, as shown in formula (3):
[0060] (3)
[0061] in, H ( x ) is the output prediction value, T is the number of learners, and the weight of a single learner is w i , usually requires w i ≥0, .
[0062] Assuming that there are 35 sensors in addition to the target sensor in the fuel cell system, the random forest algorithm can assign feature weights to the 35 sensor inputs in each training process. Figure 4 A schematic diagram of assigning weights to features according to a random forest model provided by the present invention, wherein the horizontal axis is the feature number of the features corresponding to the collected data of 35 sensors, and the vertical axis is the weight corresponding to the feature.
[0063] After obtaining the output prediction value, the output prediction value can be denormalized to match the numerical dimension of the output prediction value with the target sensor data, and the root mean square error of the training set is calculated, as shown in formula (4). RMSE is the ratio of the square root of the deviation from the predicted value to the true value to the number of samples M in the training set. It measures the deviation between the predicted value and the true value and is sensitive to outliers in the data. The characteristics of RMSE include intuitiveness, interpretability, and sensitivity to outliers.
[0064] (4)
[0065] in, M is the total number of samples in the training set, H (x k ) is the output prediction of the kth sample, F (x k ) is the true value of the k sample output.
[0066] Theoretically, the rich sensor data of the fuel cell can be used to construct a black box model. When most of the sensor data except the air path pressure sensor are normal data, the specific value of the air path pressure sensor can be calculated in theory.
[0067] However, through the random forest algorithm, even if one or two sensors at the input end have fault data, when the data set is a high-dimensional large sample value, it can be Figure 4 The weight distribution shown ensures that the collected data of the sensor used to predict the collected data of the target sensor is a normal value.
[0068] Figure 5 A schematic diagram of a random forest algorithm provided by the present invention is shown in FIG. The random forest algorithm is used to learn the target data set corresponding to the air path pressure sensor generated in the above steps, and the data in the target data set are randomly sampled and then divided into m different sample groups, including sample group 1, sample group 2, sample group 3, ..., sample group m The actual number of samples between sample groups is randomly selected, and the training is generated according to the selected sample groups. m decision trees, including decision tree 1, decision tree 2, decision tree 3, ..., decision tree m , perform internal voting and weighted summation on the prediction results of each internal decision tree, obtain the average value of the prediction results of all decision trees, and output the regression result.
[0069] S103. Obtain the initial value of the loss function corresponding to the machine learning model.
[0070] In some embodiments, the initial value of the loss function corresponding to the machine learning model can be obtained from a historical database, where the historical database can be embedded in a cloud data processing platform.
[0071] As a possible implementation method, obtaining the initial value of the loss function corresponding to the machine learning model includes: obtaining an initial data set collected by the fuel cell sensor under normal working conditions; training the machine learning model with the initial data set, and calculating the initial value of the loss function corresponding to the trained machine learning model.
[0072] After training the machine learning model with an initial data set, the present invention verifies the trained machine learning model to obtain the value of the loss function of the trained machine learning model, that is, the initial value of the loss function.
[0073] In some embodiments, a portion of the initial data set may be used as a validation set to determine the value of the loss function of the machine learning model trained with the initial data set.
[0074] It can be understood that the initial data set in the present invention can be data collected during the actual operation of the fuel cell sensor, or can be collected data obtained by simulating the fuel cell sensor.
[0075] It should be noted that the machine learning model in this step before being trained with the initial data set is the same as the machine learning model in S102 before being trained with the target data set, and the loss functions used in the two steps are also the same.
[0076] S104: Calculate the difference between the target value of the loss function and the initial value of the loss function, and when the difference is greater than a first preset threshold, determine that the target sensor fails.
[0077] The prediction accuracy of the trained machine learning model in the present invention is affected by the data quality of the training set. The better the quality of the training data in the training set, the higher the prediction accuracy of the trained machine learning model, which is reflected in the loss function, that is, the value of the loss function is smaller. If the difference between the target value of the loss function and the initial value of the loss function is large, it can be considered that the training data in the target data set is contaminated by fault data, and it can be determined that the target sensor is faulty.
[0078] In some embodiments, a ratio of the first preset threshold to the initial value of the loss function can be set. For example, the first preset threshold can be 20% of the initial value of the loss function. That is, when the difference between the target value of the loss function and the initial value of the loss function is greater than 20% of the initial value of the loss function, it is determined that the target sensor has a fault.
[0079] In some embodiments, when the training data in the training set is data collected by the fuel cell sensor under normal working conditions, the quality of the training set is high, and the prediction accuracy of the trained machine learning model is higher and the value of the loss function is smaller when the training set is used to train the machine learning model. That is, when the initial data set is used for training, the loss function of the trained machine learning model is smaller.
[0080] However, if there is fault data in the training set, that is, data collected by the target sensor under faulty conditions, the loss function of the trained machine learning model will be larger if the data set contaminated by fault data is used to train the machine learning model.
[0081] The present invention takes the initial value of the loss function as a benchmark for comparison. When the initial value of the loss function is the value of the loss function corresponding to the machine learning model after training the initial data set, if the difference between the target value of the loss function and the initial value of the loss function is large, then it can be considered that the difference between the target data set and the initial data set is large, that is, the target data set is significantly different from the data set collected by the target sensor under normal working conditions, and it can be determined that the target sensor has a fault.
[0082] As a possible implementation method, when the difference between the loss function target value and the loss function initial value is less than or equal to a first preset threshold, it is determined that the target sensor is in a normal working state; and the loss function initial value is updated to the loss function target value.
[0083] When the difference between the target value of the loss function and the initial value of the loss function is small, it can be considered that the target data set is not contaminated by fault data, or the difference between the target data set and the initial data set is small, and it can be determined that the target sensor is in normal working condition.
[0084] As the fuel cell system is used, the actual working state of the sensor will change at different life stages of the fuel cell system, such as the early, mid, and end of life. In order to adapt to this change, after determining that the target sensor is in a normal working state, the initial value of the loss function can be updated to the target value of the loss function, that is, the initial value of the loss function used as a comparison benchmark is updated according to the actual situation. In this way, it can be ensured that the initial value of the loss function used for fault diagnosis changes with the fuel cell system, and can always reflect the true normal working state of the fuel cell system, thereby improving the accuracy of fault diagnosis.
[0085] As a possible implementation, after determining that the target sensor fails, the present invention may further determine the type and degree of the failure of the target sensor. After determining that the target sensor fails in S104, the method further includes the following execution steps:
[0086] S104. Obtain a loss function fault value.
[0087] Obtaining the loss function fault value includes: obtaining data collected by the target sensor in a faulty working state and data collected by other sensors in a normal working state, and constructing a fault data set, training the machine learning model through the fault data set, and calculating the loss function fault value corresponding to the trained machine learning model.
[0088] The present invention can collect data when the target sensor is in different fault working states, construct fault data sets corresponding to different fault working states, and obtain loss function fault values corresponding to different fault working states. When obtaining the loss function fault value, the loss function fault values corresponding to multiple different fault working states can be obtained.
[0089] It can be understood that the collected data of the target sensor and the collected data of other sensors in the present invention can be the collected data of the target sensor and other sensors during actual operation, or can be the collected data of simulated sensors obtained by simulating the target sensor and other sensors.
[0090] The actual faulty working state of the target sensor may be that a fault occurs after a period of normal operation. In order to be more in line with the actual faulty working state, when simulating the faulty working state of the target sensor, the collected data in the fault data set can be partly the collected data when the target sensor fails, and the other part is the collected data when the target sensor is in normal working state.
[0091] The actual faulty working state of the target sensor may also be that the fault occurs intermittently, and the collected data in the fault data set may be scatteredly inserted into the collected data of the target sensor in the normal working state.
[0092] As a possible implementation manner, the data collected by the target sensor in a faulty working state includes: data collected by the target sensor on the fuel cell under a preset fault type and a preset fault degree.
[0093] In some embodiments, the preset fault types include fixed deviation faults and complete deviation faults, wherein a fixed deviation fault may refer to a type of fault in which the measured value of the sensor differs from the true value by a constant constant, and a complete deviation fault, also known as a failure fault, may refer to a type of fault in which the measured value of the sensor is a constant constant.
[0094] In some embodiments, the preset fault level of the fixed deviation fault may be the difference between the measured value and the true value of the sensor.
[0095] It can be understood that the machine learning model before being trained with the fault data set in this step is the same as the machine learning model before being trained with the target data set in S102, and the loss functions used in the two steps are also the same.
[0096] For example, Figure 6 A schematic diagram of data collection of an air path pressure sensor provided by the present invention under fixed deviation faults of different fault degrees, Figure 6, from bottom to top, show the collected data of the air path pressure sensor under normal working conditions, and the collected data when the fixed deviations of the air path pressure sensor are +0.1, +0.2, +0.3 and +0.4.
[0097] Figure 7 A schematic diagram of data collection of an air path pressure sensor provided by the present invention under complete deviation faults of different fault degrees, Figure 7 2 shows the collected data of the air path pressure sensor in normal working state, and the collected data when the air path pressure sensor has a full deviation of 1.0, 1.5, 2.0 and 2.5.
[0098] For the above two types of faults, the air path pressure sensor is simulated to have a sudden fault at a certain moment: the collected data of other sensors in the fault data set are all collected data under normal working conditions; for the collected data of the air path pressure sensor, part of the collected data is collected data under normal working conditions, and the other part of the collected data is collected data under normal working conditions. Figure 6 The data collected under the fixed deviation fault as shown, or Figure 7 Data collected under a complete deviation fault is shown.
[0099] Figure 8 A schematic diagram of the structure of a fault data set provided by the present invention is shown in FIG. Figure 8 As shown, the collected data of other sensors in the fault data set are all collected data of other sensors in normal working conditions. The first 70% of the collected data of the air path pressure sensor in the fault data set are collected data of the air path pressure sensor in normal working conditions, and the last 30% of the collected data are collected data when the air path pressure sensor fails.
[0100] For each fault data set corresponding to a preset fault type and a preset fault degree, the machine learning model is trained 20 times, and the RMSE of the machine learning model after each training is recorded, such as Fig. 9 and Fig.10 It should be noted that each training is performed on the machine learning model that has not been trained with the fault data set, that is, the second training is still performed on the machine learning model that has not been trained with the fault data set, rather than the machine learning model that has been trained with the fault data set for the first time.
[0101] Fig. 9 A schematic diagram of the RMSE of a machine learning model of an air path pressure sensor provided by the present invention under a fixed deviation fault, Fig. 9It is shown that the collected data of the air path pressure sensor in the training set are the collected data of the air path pressure sensor in normal working state and with fixed deviations of +0.1, +0.2, +0.3 and +0.4. For each of the different training sets corresponding to different working states of the air path pressure sensor, the machine learning model of the training set is trained, and the RMSE of the machine learning model after the 1st, 2nd, ..., 20th training is obtained.
[0102] Fig.10 A schematic diagram of the RMSE of a machine learning model of an air path pressure sensor provided by the present invention under a complete deviation fault, Fig.10 It is shown that the collected data of the air path pressure sensor in the training set are the collected data of the air path pressure sensor in normal working state and when the complete deviation is 1.0, 1.5, 2.0 and 2.5. For each of the different training sets corresponding to different working states of the air path pressure sensor, the machine learning model of the training set is trained, and the RMSE of the machine learning model after the 1st, 2nd, ..., 20th training is obtained.
[0103] The 20 RMSEs of the machine learning model after the above 20 trainings are averaged to obtain the RMSE mean of the machine learning model under different fault types and fault degrees, such as Fig.11 and Fig.12 shown. Fig.11 A schematic diagram of the RMSE mean of a machine learning model of an air path pressure sensor provided by the present invention under a fixed deviation fault, Fig.11 A schematic diagram showing the mean RMSE of the machine learning model when the air path pressure sensor is in normal working condition and when the fixed deviations are +0.1, +0.2, +0.3 and +0.4; Fig.12 A schematic diagram of the RMSE mean of a machine learning model of an air path pressure sensor provided by the present invention under a complete deviation fault, Fig.12 The mean RMSE of the machine learning model is shown for the air path pressure sensor under normal working conditions and when the full deviation is 1.0, 1.5, 2.0 and 2.5.
[0104] S105: Determine the difference between the loss function fault value and the loss function initial value as the fault residual, and determine the difference between the loss function target value and the loss function initial value as the target residual.
[0105] The present invention may not obtain the loss function fault value, but directly obtain the fault residual, that is, directly obtain the difference between the loss function fault value and the initial value of the loss function.
[0106] In some embodiments, the loss function fault value or the fault residual may be obtained from a historical database.
[0107] For example, Fig.11 and Fig.12 The RMSE mean of the machine learning model of the air path pressure sensor shown in FIG. 1 under normal working conditions is determined as the initial value of the loss function. Fig.11 and Fig.12 The RMSE mean of the machine learning model of the air path pressure sensor shown in FIG. 1 for different fault types and different fault degrees is determined as the loss function fault value, and the deviation between the loss function fault value and the initial value of the loss function is calculated, and the deviation is determined as the fault residual, as shown in FIG. Fig.13 FIG. 1 is a schematic diagram of fault residuals corresponding to different fault types and fault degrees provided by the present invention. Fig.13 The fault residuals of the air path pressure sensor corresponding to fixed deviations of +0.1, +0.2, +0.3 and +0.4, and full deviations of 1.0, 1.5, 2.0 and 2.5 are shown.
[0108] S106, calculating the difference between the fault residual and the target residual, and when the difference is less than a second preset threshold, determining that the fault type and fault degree of the target sensor correspond to the faulty working state.
[0109] When the difference between the target residual and the fault residual in the present invention is small, it can be considered that the deviation between the target data set and the fault data set is small, that is, the deviation between the target data set and the data set collected by the target sensor in the faulty working state is small, then it can be determined that the target sensor is in the faulty working state corresponding to the fault data set.
[0110] As a possible implementation manner, after determining that the fault type and fault degree of the target sensor correspond to the faulty working state, the method further includes: updating the loss function fault value to the loss function target value.
[0111] After determining the fault type and fault degree of the target sensor, the loss function fault value corresponding to the fault type and fault degree can be updated to the loss function target value. In this way, the loss function fault value used to diagnose the fault type and fault degree is updated according to the actual situation. The loss function fault value can always reflect the real fault working state of the fuel cell system as the fuel cell system operates, thereby improving the accuracy of diagnosing the fault type and fault degree.
[0112] As a possible implementation, the initial value of the loss function used for fault diagnosis in the present invention can also be determined according to the current working condition of the target sensor. After calculating the target value of the loss function corresponding to the trained machine model, the method further includes:
[0113] S201. In a target data set, analyzing a change pattern of collected data of a target sensor, and determining a current working condition of the target sensor based on the change pattern.
[0114] The present invention can determine the current working condition of the target sensor according to the transformation rule of the collected data of the target sensor. For example, the working condition of the target sensor can have a changing trend such as changing from low to high, changing from high to low, gradient changing and oscillating changing.
[0115] Fig.14 A schematic diagram of a working condition in which the value of the collected data of a target sensor provided by the present invention changes from high to low, Fig.15 A schematic diagram of a working condition in which the value of the collected data of a target sensor provided by the present invention changes from low to high, Fig.16 A schematic diagram of a working condition of a numerical gradient change of collected data of a target sensor provided by the present invention, Fig.17 A schematic diagram of a working condition of numerical oscillation change of collected data of a target sensor provided by the present invention, Figure 14-17 The horizontal axis is time, and the vertical axis is the value of the data collected by the target sensor.
[0116] S202. Obtain the initial value of the loss function corresponding to the machine learning model under the current working condition.
[0117] Before obtaining the initial value of the loss function corresponding to the machine learning model under the current working conditions, the present invention can obtain the data collected by the target sensor in the normal working state under the preset working conditions and the data collected by other sensors in the normal working state, construct a preset working condition data set, train with the preset working condition data set, and calculate the value of the loss function of the trained machine learning model.
[0118] In some embodiments, the value of the loss function corresponding to the machine learning model under preset working conditions can be stored in a historical database.
[0119] After determining the current working condition of the target sensor, the initial value of the loss function corresponding to the machine learning model under the current working condition can be selected from the values of the loss function corresponding to the machine learning model under different preset working conditions.
[0120] like Fig.14 and Fig.15 The operating conditions of the target sensor shown can be fitted to the quadratic equation , where x is time, is the value of the target sensor data collection, a, b, c are constants. When the current working condition is this working condition, the quadratic coefficient a can be used as the characteristic value of the target sensor working condition, and compared with the characteristic value of the preset working condition to determine the preset working condition similar to the current working condition.
[0121] like Fig.16 The operating condition of the target sensor shown can be fitted into a step function as shown below:
[0122]
[0123] Where x is time, is the value of the data collected by the target sensor, and q, w, and e are constants.
[0124] When the current working condition is this working condition, the changing trend (decreasing or increasing) of q, w, e and the numerical values of q, w, e can be used to determine whether it is the same working condition, that is, the working condition can be determined based on the changing trend and numerical value.
[0125] like Fig.17 The target sensor conditions shown can be fitted into a trigonometric function , where x is time, is the value of the target sensor collecting data, A is the amplitude, w is the angular velocity, and t is the initial phase. At this time, the amplitude A, angular velocity w, and initial phase t can be used to determine whether they are in the same working condition. If the three are the same, they are in the same working condition.
[0126] S203: Calculate the difference between the target value of the loss function and the initial value of the loss function, and determine that the target sensor fails when the difference is greater than a first preset threshold.
[0127] After determining the current working condition of the target sensor, the present invention compares the target value of the loss function and the initial value of the loss function corresponding to the machine learning model under the current working condition, thereby increasing the consideration of the working condition of the target sensor. The preset working condition data set corresponding to the initial value of the loss function is closer to the data collected by the target sensor under normal working conditions under the current working condition. In this way, the initial value of the loss function is used as a benchmark for fault diagnosis, and the fault diagnosis result is more accurate.
[0128] Similarly, when the difference between the loss function target value and the loss function initial value is less than or equal to the first preset threshold, it is determined that the target sensor is in a normal working state. At this time, the loss function initial value corresponding to the machine learning model under the current working conditions can be updated to the loss function target value.
[0129] After determining that the target sensor has failed through the initial value of the loss function corresponding to the machine learning model under the current working condition in this implementation method, when determining the fault type and fault degree, the loss function fault value corresponding to the machine learning model under the current working condition can be obtained, and the fault residual under the current working condition corresponding to the loss function fault value corresponding to the machine learning model under the current working condition is used as a basis for comparison. For details, please refer to S104-S106, which will not be repeated here.
[0130] After determining the fault type and fault degree of the target sensor, the fault residual corresponding to the fault type and fault degree under the current working condition can be updated to the target residual, where the target residual is the difference between the target value of the loss function and the initial value of the loss function.
[0131] As the historical database in the cloud data platform continuously saves data and stores it in storage devices, it can cover various sensor working conditions, and obtain the initial value of the loss function corresponding to the machine learning model under various working conditions, the fault value of the loss function corresponding to the machine learning model under the fault state, and the fault residuals of different fault degrees of various fault types.
[0132] As a possible implementation method, after calculating the target value of the loss function corresponding to the trained machine learning model, the method also includes: obtaining the collected data of the target sensor within a historical preset time period; training the machine learning model through the collected data within the historical preset time period and the collected data of other sensors, and calculating the initial value of the loss function corresponding to the trained machine learning model; calculating the difference between the target value of the loss function and the initial value of the loss function, and determining that the target sensor has a fault when the difference is greater than a third preset threshold.
[0133] The historical preset time period in the present invention may be a time period adjacent to the preset time period for collecting target data. The value of the loss function corresponding to the machine learning model trained with the data collected by the target sensor and the data collected by other sensors within the historical preset time period is used as the initial value of the loss function. If the difference between the target value of the loss function and the initial value of the loss function is large, it can be considered that the difference between the target data set and the data collected by the target sensor and the data collected by other sensors within the historical preset time period is large. At this time, it can be determined that the target sensor has a fault.
[0134] Of course, after determining that the sensor fails through this implementation method, the target residual corresponding to the target value of the loss function can be compared with the fault residual to determine the fault type and degree of the target sensor. For details, please refer to S104-S106, which will not be repeated here.
[0135] Exemplarily, the target sensor is an air path pressure sensor, the random forest model is a random forest model, and the loss function adopts RMSE. Fig.18 A schematic diagram of the composition of a historical database provided by the present invention, the historical database contains three types of data: the first type of data is the RMSE of the random forest model of the air path pressure sensor under normal working conditions, the second type of data is the RMSE of the random forest model of the air path pressure sensor under different fault types and different fault degrees, that is, the loss function fault value, and the third type of data is the fault residual corresponding to different fault types and different fault degrees of the air path pressure sensor.
[0136] like Fig.18 As shown, the collected data of the air path pressure sensor under normal working conditions and the collected data of other sensors under normal working conditions are obtained to construct an initial data set, and the random forest model is trained through the initial data set. The RMSE of the trained random forest model is the RMSE of the random forest model of the air path pressure sensor under normal working conditions; the collected data of the air path pressure sensor under different fault types and different fault degrees and the collected data of other sensors under normal working conditions are obtained to construct a fault data set, and the random forest model is trained through the fault data set. The RMSE of the trained random forest model is the RMSE of the random forest model of the air path pressure sensor under different fault types and different fault degrees. The difference between the RMSE of the random forest model of the air path pressure sensor under different fault types and different fault degrees and the RMSE of the random forest model of the air path pressure sensor under normal working conditions is calculated, and the difference is determined as the fault residual corresponding to the different fault types and different fault degrees of the air path pressure sensor.
[0137] Fig.19 A flow chart of a method for diagnosing a fault of an air path pressure sensor provided by the present invention is shown in FIG. Fig.19 As shown, the method includes the following execution steps:
[0138] S1901, obtaining a target data set collected by the air path pressure sensor and other sensors within 1 second;
[0139] In this example, the duration of the preset time period is set to 1 second.
[0140] S1902. Train the random forest model using the target data set, and calculate the RMSE of the trained random forest model, that is, the target value of the loss function.
[0141] S1903. Check whether the difference between the loss function target value and the loss function historical value is greater than 50% of the loss function historical value.
[0142] In this example, the historical value of the loss function is the RMSE of the random forest model trained with the data set collected by the air path pressure sensor and other sensors within the last 1 second. The historical value of the loss function can be obtained from the historical database.
[0143] When the difference between the loss function target value and the loss function historical value is greater than 50% of the loss function historical value, execute S1904.
[0144] S1904: Determine that the air path pressure sensor is faulty.
[0145] When the difference between the loss function target value and the loss function historical value is less than 50% of the loss function historical value, execute S1905.
[0146] S1905. Check whether the difference between the target value of the loss function and the initial value of the loss function is greater than 20% of the initial value of the loss function.
[0147] The initial value of the loss function in this example is the RMSE of the random forest model after training with the initial training set, that is, the first category of data in the above historical database, and the initial value of the loss function can be obtained from the historical database.
[0148] When the difference between the loss function target value and the loss function initial value is greater than 20% of the loss function initial value, S1904 is executed to determine that the air path pressure sensor is faulty.
[0149] When the difference between the target value of the loss function and the initial value of the loss function is less than or equal to 20% of the initial value of the loss function, execute S1906-S1907.
[0150] S1906: Determine that the air path pressure sensor is in a normal state.
[0151] S1907. Update the initial value of the loss function to the target value of the loss function.
[0152] After determining that the air path pressure sensor is in normal working condition, this example can update the initial value of the loss function in the historical database, that is, the first type of data, to the target value of the loss function.
[0153] After executing S104 to determine that the air path pressure sensor is faulty, execute S1908-S1910.
[0154] S1908. Calculate the difference between the initial value of the loss function and the target value of the loss function, and determine the difference as the target residual.
[0155] S1909: Determine the fault type and fault degree of the air path pressure sensor based on the difference between the target residual and the fault residual.
[0156] In this example, the fault residual can be obtained from the historical database, that is, the third type of data in the above historical database. Based on the difference between the target residual and the fault residual, the fault type and degree of the air path pressure sensor are determined. For details, please refer to S104-S106, which will not be repeated here.
[0157] S1910: Update the fault residual corresponding to the fault type and fault degree to the target residual.
[0158] For example, after determining that a complete deviation fault occurs in the air path pressure sensor and the complete deviation is 1.0, the fault residual corresponding to the complete deviation fault and the complete deviation of 1.0 in the historical database may be updated as the target residual.
[0159] For example, in order to simulate the intermittent failure of the air path sensor, the fault data in the fault data set of the present invention can also be distributed discontinuously in the collected data of the air path pressure sensor, that is, the collected data of the air pressure sensor in the fault data set is the collected data under normal working conditions, and the collected data is the collected data when the fault occurs. For example, in the fault data set, 10-20ms, 60-70ms, 120-140ms, 340-350ms, 500-510ms, 600-610ms, 650-700ms, 740-770ms, 860-870ms, 990-1000ms, 1050-1060ms, 1100-1110ms, 1260-1270ms, 1290-1390ms, 1440- 1445ms, 1500-1505ms, 1597-1599ms, 1623-1626ms, 1688-1690ms, 1726-1729ms, 1726-1729ms, 1861-1872ms, 1922-1931ms, 2000-2350ms, 3300-3650ms, 3623-4973ms, 5500-5884ms…fault data is inserted at every moment.
[0160] Insert the fault data with a complete deviation of 1.2 at the above moment to obtain the first fault data set; insert the fault data with a complete deviation of 1.5 at the above moment to obtain the second fault data set; use the initial data set, the first fault data set, and the second fault data set corresponding to the air path pressure sensor in the normal working state to train the machine learning model 20 times respectively, and record the RMSE of the machine learning model after each training, such as Fig. 20 shown.
[0161] Fig. 20 A schematic diagram of the RMSE of a machine learning model provided by the present invention when the fault data is discontinuously distributed in the fault data set, Fig. 20 The figure shows the initial data set corresponding to the normal working state of the air path pressure sensor, and the first fault data set and the second fault data set corresponding to the fault working state of the air path pressure sensor with a complete deviation of 1.2 and 1.5. For each of these three data sets, the machine learning model is trained with the data set, and the RMSE of the machine learning model after the 1st, 2nd, ..., 20th training is obtained.
[0162] Will Fig. 20The RMSE mean of the machine learning model when the air circuit pressure sensor is in normal working condition is determined as the initial value of the loss function; Fig. 20 The mean RMSE of the machine learning model of the air path pressure sensor in the fault working state with a complete deviation of 1.2 and 1.5 is determined as the loss function fault value; the difference between the loss function fault value and the initial value of the loss function is calculated, and the difference is determined as the fault residual. Table 1 shows the fault residuals corresponding to the fault working state of the air path pressure sensor with a complete deviation of 1.2 and 1.5. As shown in Table 1, the fault residual corresponding to the fault working state with a complete deviation of 1.2 is 6.535*10 -5 , the fault residual corresponding to the fault working state with a complete deviation of 1.5 is 8.075*10 -5 .
[0163] Table 1 Fault residuals corresponding to the fault working states of the air path pressure sensor with a complete deviation of 1.2 and 1.5
[0164] Fault working status Fault residual The total deviation is 1.2 <![CDATA[6.535*10 -5 ]]> The total deviation is 1.5 <![CDATA[8.075*10 -5 ]]>
[0165] A fuel cell fault diagnosis method proposed by the present invention gets rid of the limitation of setting a threshold for a single sensor, uses the contamination degree of the training set by fault data to diagnose the fault, and classifies the fault by the RMSE of the trained machine learning model. It is a diagnostic method for all sensors of the fuel cell. In addition, by injecting faults into the historical database and continuously updating the threshold, it is ensured that the fault threshold always changes with the physical entity system of the fuel cell, and that the fault threshold can always reflect the real fault state of the fuel cell system as the fuel cell runs. In addition, in the fault diagnosis program, the fault is diagnosed by comparing with the previous moment through iteration, and / or, the preset threshold of similar working conditions is selected in the fault diagnosis program and the historical database for comparison and diagnosis of the fault. Among them, the specific implementation of the present invention can include a remote cloud data platform for online systems and offline systems, and the historical database and the random forest model are embedded in the remote cloud data platform.
[0166] The present invention can connect the fuel cell sensor data with the remote cloud data platform through the data transmission module, and fully utilize all the sensor data of the fuel cell through the historical database embedded in the data platform and the random forest algorithm. Instead of diagnosing a specific sensor, all the sensors inside the fuel cell are identified, and the identification range is wide. At the same time, the fault threshold changes continuously with the fuel cell system, and the comparison threshold in the historical database is also continuously updated.
[0167] Corresponding to the above-mentioned embodiment, the present invention also provides a fuel cell sensor fault diagnosis device. Fig.21A structural schematic diagram of a fuel cell sensor fault diagnosis device provided in an embodiment of the present invention, the device may include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute a fuel cell sensor fault diagnosis method as described in the above embodiment.
[0168] In a specific implementation, the present invention can also be provided as a non-volatile computer storage medium, wherein the storage medium is a non-volatile computer-readable storage medium, and the non-volatile computer-readable storage medium stores at least one program, each program includes instructions, and when the instructions are executed by the terminal, the terminal executes a fuel cell sensor fault diagnosis method as described in the above embodiment.
[0169] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0170] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0171] The above are only embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A fuel cell sensor fault diagnosis method, characterized in that: The method comprises: Acquire a target data set collected by a fuel cell sensor within a preset time period; Training a machine learning model through the target data set, and calculating a target value of a loss function corresponding to the trained machine learning model, wherein the input of the machine learning model is the collected data of other sensors, and the output is the collected data of the target sensor, and the other sensors and the target sensor constitute the fuel cell sensor; Obtaining an initial value of a loss function corresponding to the machine learning model; A difference between the target value of the loss function and the initial value of the loss function is calculated, and when the difference is greater than a first preset threshold, it is determined that the target sensor fails.
2. A fuel cell sensor fault diagnosis method according to claim 1, characterized in that: Obtaining the initial value of the loss function corresponding to the machine learning model, including: Acquiring an initial data set collected by the fuel cell sensor under normal working conditions; The machine learning model is trained using the initial data set, and an initial value of a loss function corresponding to the trained machine learning model is calculated.
3. A fuel cell sensor fault diagnosis method according to claim 1, characterized in that: After calculating the difference between the loss function target value and the loss function initial value, the method further includes: When the difference is less than or equal to the first preset threshold, determining that the target sensor is in a normal working state; Update the initial value of the loss function to the target value of the loss function.
4. A fuel cell sensor fault diagnosis method according to claim 1, characterized in that: After determining that the target sensor fails, the method further includes: Obtaining a loss function fault value, including: obtaining data collected by the target sensor in a faulty working state and data collected by the other sensors in a normal working state, and constructing a fault data set, training the machine learning model through the fault data set, and calculating a loss function fault value corresponding to the trained machine learning model; Determine the difference between the loss function fault value and the loss function initial value as a fault residual, and determine the difference between the loss function target value and the loss function initial value as a target residual; The difference between the fault residual and the target residual is calculated, and when the difference is less than a second preset threshold, it is determined that the fault type and fault degree of the target sensor correspond to the fault working state.
5. A fuel cell sensor fault diagnosis method according to claim 4, characterized in that: After determining that the fault type and fault degree of the target sensor correspond to the fault working state, the method further includes: The loss function fault value is updated to the loss function target value.
6. A fuel cell sensor fault diagnosis method according to claim 4, characterized in that: The data collected by the target sensor in a faulty working state includes: The target sensor collects data on the fuel cell under a preset fault type and a preset fault degree.
7. A fuel cell sensor fault diagnosis method according to claim 1, characterized in that: After calculating the target value of the loss function corresponding to the trained machine learning model, the method further includes: In the target data set, analyzing the variation pattern of the collected data of the target sensor, and determining the current working condition of the target sensor based on the variation pattern; Obtaining an initial value of the loss function corresponding to the machine learning model under the current working condition; A difference between the loss function target value and the loss function initial value is calculated, and when the difference is greater than a first preset threshold, it is determined that the target sensor fails.
8. A fuel cell sensor fault diagnosis method according to claim 1, characterized in that: After calculating the target value of the loss function corresponding to the trained machine learning model, the method further includes: Acquire the collected data of the target sensor within a preset historical time period; Training the machine learning model through the collected data within the historical preset time period and the collected data of the other sensors, and calculating the initial value of the loss function corresponding to the trained machine learning model; A difference between the loss function target value and the loss function initial value is calculated, and when the difference is greater than a third preset threshold, it is determined that the target sensor fails.
9. A fuel cell sensor fault diagnosis device, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute a fuel cell sensor fault diagnosis method according to any one of claims 1-8.
10. A non-volatile computer storage medium, characterized in that: The storage medium is a non-volatile computer-readable storage medium, and the non-volatile computer-readable storage medium stores at least one program, each of which includes instructions, and when the instructions are executed by the terminal, the terminal executes a fuel cell sensor fault diagnosis method according to any one of claims 1-8.
