**4. Fault Diagnosis of the PEM Fuel Cell System**

In this work, the Gaussian noise with variance of 0.1, 0.2, 0.5, and 1.0 are added to the PEM fuel cell simulator model, respectively. It is difficult to distinguish the Fault 0 to Fault 4 states in Table 2. Signals in a fault state are coupled with signals in other faults. Therefore, the traditional methods cannot diagnose the fault of the PEM fuel cell system effectively.

The Fault 0–4 states are simulated using the PEM fuel cell simulator model in the dynamic condition. Eight diagnostic variables are selected from the PEM fuel cell simulator model, and the eight diagnostic variables are fuel cell current (*If c*), fuel cell voltage (*Vf c*), compressor speed (ω*cm*), compressor outlet pressure (*Pcm*,*out*), compressor motor voltage (*Vcm*), compressor motor current (*Icm*), hydrogen inlet pressure (*PH*2,*in*), and air inlet pressure (*Pair*,*in*). Taking the Fault4 state as an example, Gaussian noise with variance of 1.0 is added to the PEM fuel cell simulator model. The fuel cell current, fuel cell voltage, compressor speed, compressor outlet pressure, compressor motor voltage, compressor motor current, hydrogen inlet pressure, and air inlet pressure change with time, respectively, are shown in Figures 3–10.

In this paper, the Gaussian noise with variance of 0.1, 0.2, 0.5, and 1.0 are added to the PEM fuel cell simulator model, respectively. The PFCM algorithm is used to filter samples with membership and typicality less than 90% and optimize the original dataset. The filtered data is used as the sample dataset. The sample dataset are divided into two groups, one is the training set sample and the other is the testing set sample. The training set sample number is 670, and the testing set sample number is 335. The penalty parameter *C* and kernel function parameter *g* of SVM are optimized using the ABC algorithm, and then establish the optimized SVM model. The testing set sample is used to test the accuracy of the fault diagnosis method.

**Figure 3.** Fuel cell current changes with time.

**Figure 4.** Fuel cell voltage changes with time.

**Figure 5.** Compressor speed changes with time.

**Figure 6.** Compressor outlet pressure changes with time.

**Figure 7.** Compressor motor voltage changes with time.

**Figure 8.** Compressor motor current changes with time.

**Figure 9.** Hydrogen inlet pressure changes with time.

**Figure 10.** Air inlet pressure changes with time.

The fault diagnosis steps of the fuel cell system based on the PFCM-ABC-SVM method are as follows: **Step 1** Initialize the parameters in the PFCM-ABC-SVM method as follows: set the fuzzy parameters, *m* = 2, *p* = 2; set the terminating threshold ε = 10−6; set the maximum number of iterations *L* = 100; set the number of initial iterations *l* = 0; initialize the cluster center *V*(0), initialize the membership matrix *U*(0), and initialize the typicality matrix *T*(0); set the number of bee colonies *n* = 20; set the maximum search number of honey sources *Limit* = 100; set the current search number of honey sources *d* = 0; set the maximum number of iterations *maxIter* = 10; set the search range of penalty factor *C*: [0.01, 100]; and set the search range of kernel function parameter *g*: [0.01, 100].

**Step 2** Get the original data of the PEM fuel cell system and select eight diagnostic variables. The eight diagnostic variables are fuel cell current, fuel cell voltage, compressor speed, compressor outlet pressure, compressor motor voltage, compressor motor current, hydrogen inlet pressure, and air inlet pressure.

**Step 3** Establish the original dataset with eight diagnostic variables and normalize the original dataset using mapminmax Function in Matlab(R2018b).

**Step 4** Adapt the PFCM algorithm to eliminate samples with membership and typicality less than 90%, filter the original dataset, and establish the sample dataset.

**Step 5** Divide the sample dataset into the training set sample and the testing set sample.

**Step 6** Optimize the penalty parameter *C* and kernel function parameter *g* of SVM using the ABC algorithm and establish the optimized SVM model.

**Step 7** Diagnose faults by the optimized SVM model and obtain the diagnostic result. The fault diagnosis flow chart of the fuel cell system based on PFCM-ABC-SVM method is shown in Figure 11.

**Figure 11.** Fault diagnosis flow chart of the fuel cell system based on the PFCM-ABC-SVM method.

When the Gaussian noise variance is 1.0, the PFCM-ABC-SVM method is compared with the GA-SVM, PSO-SVM and ABC-SVM methods. The comparison between the PFCM-ABC-SVM method and the other methods is shown in Table 3. The classification results of the PEMFC-ABC-SVM method when the Gaussian noise variance is 1.0 are shown in Figure 12. For the Fault 0–4 states, the accuracy of the training set sample is 95.67%, and the accuracy of the testing set sample is 92.84% using the PSO-SVM method; the accuracy of the training set sample is 95.82%, and the accuracy of the testing set sample is 94.03% using the ABC-SVM method; the accuracy of the training set sample is 97.46%, and the accuracy of the testing set sample is 97.31% using the PFCM-ABC-SVM method. Therefore, the PFCM-ABC-SVM method can effectively improve the accuracy of fault diagnosis of the PEM fuel cell system. The category label in Figure 12, "0" represents Fault0, "1" represents Fault1, "2" represents Fault2, "3" represents Fault3, and "4" represents Fault4. There are 335 samples in the testing set samples.

**Table 3.** The comparison between the PFCM-ABC-SVM method and the other methods.


**Figure 12.** The classification results of the PFCM-ABC-SVM method when the Gaussian noise variance is 1.0.

When the Gaussian noise variance is 0.5, the PFCM-ABC-SVM method is compared with the GA-SVM, PSO-SVM and ABC-SVM methods. The comparison between the PFCM-ABC-SVM method and the other methods is shown in Table 4. The classification results of the PEMFC-ABC-SVM method when the Gaussian noise variance is 0.5 are shown in Figure 13. The accuracy of the training set sample is 98.81% and the accuracy of the testing set sample is 97.91% using the PFCM-ABC-SVM method.

**Method** *C g* **Accuracy of the Training Set Sample Accuracy of the Testing Set Sample** GA-SVM 81.77 39.93 95.67% 92.84% PSO-SVM 100 128.77 95.52% 93.43% ABC-SVM 73.02 28.34 95.37% 94.63% PFCM-ABC-SVM 80.88 15.76 98.81% 97.91%

**Figure 13.** The classification results of the PFCM-ABC-SVM method when the Gaussian noise variance is 0.5.

When the Gaussian noise variance is 0.2, the PFCM-ABC-SVM method is compared with the GA-SVM, PSO-SVM and ABC-SVM methods. The comparison between the PFCM-ABC-SVM method and the other methods is shown in Table 5. The classification results of the PEMFC-ABC-SVM method when the Gaussian noise variance is 0.2 are shown in Figure 14. The accuracy of the training set sample is 98.81%, and the accuracy of the testing set sample is 98.21% using the PFCM-ABC-SVM method.


**Table 5.** The comparison between the PFCM-ABC-SVM method and the other methods.

**Figure 14.** The classification results of the PFCM-ABC-SVM method when the Gaussian noise variance is 0.2.

When the Gaussian noise variance is 0.1, the PFCM-ABC-SVM method is compared with the GA-SVM, PSO-SVM and ABC-SVM methods. The comparison between the PFCM-ABC-SVM method and the other methods is shown in Table 6. The classification results of the PEMFC-ABC-SVM method when the Gaussian noise variance is 0.1 are shown in Figure 15. The accuracy of the training set sample is 98.66%, and the accuracy of the testing set sample is 98.51% using the PFCM-ABC-SVM method.


**Table 6.** The comparison between the PFCM-ABC-SVM method and the other methods.

**Figure 15.** The classification results of the PFCM-ABC-SVM method when the Gaussian noise variance is 0.1.

In order to illustrate the advantages of the PFCM-ABC-SVM method, the GA-SVM, PSO-SVM and ABC-SVM methods are compared with it, in this work. The results of fault diagnosis are shown in Tables 3–6. Under the dynamic conditions with the variance of the Gaussian noise decreasing from 1.0 to 0.1, the accuracy of the testing set sample is as high as 98.51%. Comparing with the other methods, the PFCM-ABC-SVM method has a better effect in fault diagnosis of the PEM fuel cell system.
