# Physics-Guided Fault Diagnosis Method for Proton Exchange Membrane Fuel Cells Based on LSTM Neural Network

Chiara Pettorossi, Vincent Heiries, Raphaël Morvillier, Sébastien Rosini, Mathias Gerard

► To cite this version:

Chiara Pettorossi, Vincent Heiries, Raphaël Morvillier, Sébastien Rosini, Mathias Gerard. Physics-Guided Fault Diagnosis Method for Proton Exchange Membrane Fuel Cells Based on LSTM Neural Network. Journal of Power Sources, 2025, 626, pp.235696. 10.1016/j.jpowsour.2024.235696. cea-04875447

HAL Id: cea-04875447

https://cea.hal.science/cea-04875447v1

Submitted on 8 Jan 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Physics-guided fault diagnosis method for proton exchange membrane fuel cells based on LSTM neural network

Chiara Pettorossi<sup>a, *</sup>, Raphaël Morvillier<sup>b</sup>, Vincent Heiries<sup>b</sup>, Sébastien Rosini<sup>a</sup>, Mathias Gerard<sup>a</sup>

<figure><img src="image_2.png" /></figure>

## HIGHLIGHTS

* We propose a physics-guided LSTM method for PEMFC fault diagnosis.

* A physics-based model allows to improve the accuracy, without additional sensors.

* Contrarily to pure data-driven approaches, the method is robust to PEMFC aging.

* The validation is performed on a real-life dataset, comprising 1000 h of operation.

## ARTICLE INFO

**Keywords:**

PEMFC fault diagnosis
Hybrid method
Physics-guided
LSTM neural network

## ABSTRACT

In this paper, we propose a novel hybrid method for fault diagnosis of Proton Exchange Membrane Fuel Cells (PEMFCs) based on the combination of a physics-based model and a long short-term memory (LSTM) neural network. By incorporating the physics-based model in the fault diagnosis algorithm, we can access to several process variables not directly measured through sensors but related to the state of the PEMFC stack. The model estimates are subsequently combined with signals measured on the PEMFC stack and inputted to a LSTM neural network. The performance of the physics-guided LSTM is evaluated on an extensive dataset comprising a thousand hours of operation of a PEMFC stack under dynamic load profiles, proving the enhanced capability of the proposed fault diagnosis method in capturing complex fault patterns. Furthermore, the effectiveness of the proposed method in dealing with PEMFC aging is tested by using data from the initial phase of stack operation for algorithm training and reserving the data from the aged stack operation for the testing phase. The experimental results reveal that the proposed physics-guided LSTM method allows for a significant amelioration over purely data-driven LSTM.

## 1. Introduction

As environmental and global warming issues become increasingly severe, proton exchange membrane fuel cells (PEMFCs) are considered as one of the clean solutions for decarbonized transportation applications [1]. In order to get the best performances in terms of power generation, and to avoid accelerated degradation, PEMFCs must be operated in optimal conditions [2,3]. However, due to the dynamic nature of the system and the complexity to maintain an optimal control of the ideal conditions, this is hardly achievable in practice. In a PEMFC stack, faults are defined as anomalies in the internal operating conditions that cause significant performance losses, accelerated degradation of the catalyst and catalyst support and degradation of the membrane [4]. The

occurrence of faults limits PEMFCs durability and reliability, eventually hindering large-scale industrial deployment and commercialization of the technology. If one could limit the occurrence and the amplitude of faults through accurate diagnosis and effective control, serious damage to the PEMFC stack could be avoided and its durability could be extended [5]. Fault diagnosis is a well-established methodology in several industrial systems [6] that integrates knowledge, information and data, and aims at detecting and identifying any type of potential abnormality and fault in the system. Accordingly, fault diagnosis of PEMFCs has been receiving remarkably increasing attention during the last two decades, as it is considered crucial for improving the reliability and the durability of the stack, allowing an efficient and safe operation [7,8]. In fact, through functional early fault alarms and appropriate

<footnote><sup>a</sup> Univ. Grenoble Alpes, CEA, LITEN, 3800, Grenoble, France</footnote>

<footnote><sup>b</sup> Univ. Grenoble Alpes, CEA, LETI, 3800, Grenoble, France</footnote>

<footnote>* Corresponding author.</footnote>

<footnote>E-mail address: chiara.pettorossi@cea.fr (C. Pettorossi).</footnote>
dynamic adjustment of the operating conditions in real-time, the occurrence of severe stack degradation could be avoided. However, in practical applications, PEMFC fault diagnosis is challenging because the stack is operating in dynamic conditions and in a continuously evolving environment [9].

According to the current literature in the field, PEMFC fault diagnosis can be performed following two main approaches, the model-based and the data-driven methods [10]. Model-based diagnosis is a traditional way to identify faults in PEMFCs by building a model that describes the behavior of the stack in nominal conditions. The implementation of the model-based diagnosis method is that while running, the signals of the controller and actuators are sent to both the PEMFC and the model. Then, the model reconstructs the values of the signals expected in normal conditions and the model outputs are compared with the measured signals from the PEMFC stack, in order to detect any discrepancy. Finally, the occurrence of a fault is determined through residual analysis [11]. In Ref. [12] the authors combined a physics-based model of PEMFCs and a k-nearest neighbor (k-NN) classifier. The former generates the residuals and the latter classifies the anomalies as water management faults or fuel starvation faults. The diagnosis of the stack has been achieved by using only the voltage and the high frequency resistance, retrieved by means of electrochemical impedance spectroscopy (EIS). The work in Ref. [13] presents a residual-based fault diagnosis which makes use of a residual generated fault matrix to identify pressure sensor faults, temperature sensor faults and compressor faults in PEMFC systems. In Ref. [14] a gray box model based on analytical physical equations and decision trees is used to extract residuals and isolate faults in the air supply subsystem of a PEMFC. Based on this work, in Ref. [15] the approach is extended to several subsystems of the PEMFC and the diagnosis of seventeen different faults is successfully achieved by means of neural networks.

Contrary to model-based methods, data-driven methods do not consider explicitly the complex internal mechanisms and electrochemical reaction processes of the PEMFC. Data-driven methods can be subsequently classified in signal processing methods and pattern classification methods [10]. Several signal processing methodologies have been developed to diagnose faults in PEMFC [16]. These methods perform spectral analysis of the stack voltage by means of shapelet transform [17], empirical Fourier decomposition and Hilbert transform [18], wavelet transform [19,20], fast Fourier transform (FFT) [21], total harmonic distortion [22] or distribution of relaxation times (DRT) [23, 24]. The authors in Ref. [25] introduced the reservoir computing paradigm in the field of PEMFC fault diagnosis. This novel methodology is based on the analysis of the frequency response of the stack voltage under faulty conditions. With this approach, the authors can diagnose low air stoichiometry, defective cooling, CO poisoning and aging, achieving good performances during both offline training and online testing. In recent years, with the development of artificial intelligence, data-driven methods based on pattern classification are becoming popular for accomplishing fault diagnosis. Pattern classification methods make use of the information available from historical experimental data to recognize anomalous patterns attributable to faults by means of machine learning (ML) algorithms. Early attempts to perform data-driven fault diagnosis of PEMFCs made use of support vector machine (SVM) to detect and isolate four types of faults [26], namely low and high pressure faults, drying faults and low air stoichiometry fault. Later on, a methodology combining Fisher discriminant analysis (FDA) and spherical-shaped multiple-class SVM (SSM-SVM) has been proposed to isolate high current pulses and air stoichiometry faults in PEMFC stacks, by extracting information from individual cell voltage [27]. The work in Ref. [28] combined principal component analysis (PCA) and random forest (RF) classification to discriminate between three fault states of the PEMFC stack by using fifteen measured signals, obtained from sensors used to monitor the stack. In Ref. [29], a method based on k-NN classification has been proposed to discriminate different levels of membrane hydration and fuel starvation in the stack. A k-NN classifier has

also been employed in Ref. [30], where 1D cell voltage signals have been converted into 2D images, ad hoc features have been extracted from the 2D images by means of FDA and classification of flooding and drying faults has been achieved using k-NN. Recently, traditional ML algorithms, among which SVM, k-NN and RF, have been compared for diagnosing flooding and drying faults, proving that RF achieves the highest accuracy [8]. A detailed review of traditional ML methods used for fault diagnosis of PEMFC can be found in Refs. [31,32].

Nowadays, as deep learning (DL) is becoming overly popular, the application of DL-based fault diagnosis algorithms is experiencing fast expansion. In fact, a DL algorithm is capable of automatically extracting hierarchical representations from the data, avoiding dedicated features extraction techniques to analyze the measured signals [33]. A number of DL based methods has been proposed for fault diagnosis of PEMFC recently, which include long short-term memory (LSTM) neural networks [34], convolutional neural network (CNN) [35], or combining CNN with extreme gradient boosting (XGBoost) technique [36]. Among these algorithms, LSTM has proven to be very suitable for analyzing time series, and its effectiveness for PEMFC fault diagnosis has been widely demonstrated. In this regard, the work presented in Ref. [37] combines a bidirectional LSTM (BiLSTM) and t-distributed stochastic neighbor embedding (t-SNE) to diagnose flooding and drying states with high accuracy. However, it is worth noting that the authors have used fourteen measured signals to achieve the diagnosis. In practical embedded applications, a similar scenario, in which several sensors are available for monitoring the stack is hardly attainable. In Ref. [38] an ensemble of LSTM neural networks has been introduced for diagnosing flooding and drying faults in the PEMFC stack by means of voltage, temperature and relative humidity signals, showing better results with respect to using a single LSTM neural network. The authors in Ref. [34] employ a neural network consisting of multiple LSTM units to pre-diagnose flooding in a PEMFC stack. They showcase that the capability of the LSTM to process time series signals results in outstanding diagnosis performances.

The above research works have applied a variety of model-based and data-driven methods to PEMFC fault diagnosis, making significant contributions to the field. However, according to the authors, the presented methods have at least one of the following limitations or drawbacks. First, the results are obtained in static and not dynamic operating conditions, as it is the case in automotive applications. For instance, in Ref. [38] only two different values of current have been considered which are not enough to obtain an exhaustive representation of the scenarios experienced by the PEMFC stack. Second, strong assumptions are often made on the amount of the measured signals available for diagnosing the system [39]. In practice, using a high amount of precisely measured signals as input of the algorithm implies installing many accurate sensors on the PEMFC stack, leading to an increased cost and a decreased reliability. Third, the focus of some works is more on developing an algorithm with high diagnosis accuracy, than on providing a thorough description of the experimental data used. Since the data-driven methods rely on data for the recognition of anomalous patterns attributable to faults, their performance is indeed heavily dependent on the quality, quantity and representativeness of the data used for training. It is therefore of fundamental importance to provide a comprehensive description of the data. Moreover, the data used represent only a few hours of operation of the PEMFC stack. However, for the algorithm to be employed throughout the whole life of the stack, its validity has to be tested on a considerably broader range of operating hours. Eventually, insufficient description of the algorithms architecture and hyperparameters selected is provided, along with an inadequate justification of the metrics used to assess the performances. Also, cross validation of the algorithms is seldom performed.

In this article, we address the above gaps introducing a physics-guided LSTM method that combines a physics-based PEMFC model and a LSTM neural network. The physics-based PEMFC model, which has been introduced in Ref. [40], is used in parallel to the real PEMFC stack. However, instead of performing fault diagnosis based on residual
analysis as in traditional model-based approaches, the model estimates and the measured signals from the stack are aggregated together and used as input of the LSTM neural network. By so doing, the physics-based model offers access to new, unmeasured process variables of the PEMFC that might be more sensitive to fault signatures [41] and, consequently, can improve the ability of the algorithm to discriminate the different faults in the stack. Among others, the physics-based model can provide estimates of the membrane resistance, the membrane water content and the current density distribution. These model estimates are incorporated in the algorithm, thus resulting in a physics-guided LSTM neural network, which has an enhanced input space and gains representation power without increasing the number of sensors required on the stack. The crux of the proposed fault diagnosis method is in that it leverages the physics knowledge embedded in the physics-based PEMFC model, as well as the ability of the LSTM neural network of processing time series and extracting features to identify fault patterns in complex dynamic signals. Moreover, while pure data-driven algorithms struggle in discriminating between faults and aging as the PEMFC degrades [12] due to limited data and limited measured signals, the physics-based PEMFC model alleviates this issue. Four types of faults for the PEMFC stack are investigated under dynamic operating conditions, namely flooding, drying, air starvation and hydrogen starvation. This allows to cover the faults that induce the most severe degradation phenomena in PEMFC [42]. In a first step, the superior performances of the physics-guided LSTM method with respect to a pure data-driven LSTM algorithm is demonstrated for the first hours of operation of the stack. Then, the analysis is extended to the entire dataset available. Eventually, the robustness of the proposed method to PEMFC aging and signals degradation is assessed by training the algorithm on data collected at the beginning of life of the stack and testing it on the aged stack, that has been operating for hundreds of hours. In this scenario, the physics-guided LSTM neural network demonstrates the best performances, over the alternative data-driven LSTM, as well as other algorithms used for comparison, which fail in accurately diagnosing the system. To further support the results, the average time to detect a fault is introduced as an additional metric for the fault diagnosis method.

To the authors' knowledge, this is the first time a hybrid method combining a physics-based PEMFC model and a LSTM neural network has been proposed to address PEMFC stack fault diagnosis, the validity of which has been attested on a 1000 h long dataset.

The remainder of the paper is as follows. In Section 2 the physics-based PEMFC model is introduced and a description of PEMFC faults is provided. In Section 3 the proposed physics-guided LSTM for PEMFC fault diagnosis is described. In Section 4 the experimental data and the preprocessing steps are presented, together with the performance metrics. The different cases study are shown and the main results are discussed in Section 5. Finally, in Section 6 the main conclusions are drawn.

# 2. PEMFC stack system and physics-based model description

## 2.1. PEMFC stack technology

A PEMFC stack is an electrochemical converter that transforms air and hydrogen gases into electrical energy generating zero carbon emissions [43]. It consists of a certain number of bipolar plates stacked together with Membrane Electrode Assembly (MEA), assembled in series. The hydrogen is fed at the anode side and the air at the cathode side, the gases pass through the gas diffusion layer (GDL) and the electrochemical reaction takes place at the catalyst layer. The reaction generates electrical power, along with water that has to be removed from the stack.

The combination of electrical, fluidic and thermal phenomena that take place inside the PEMFC stack, makes it a complex system. The complexity is increased by the irreversible modifications of the physical and chemical properties of the materials composing the stack. In fact, the health and performance of a PEMFC stack gradually deteriorate

throughout its lifetime, due to usage, continuous start and stop cycles, environmental conditions, and non-optimal operating conditions, particularly when used for vehicular applications.

## 2.2. PEMFC physics-based model

The physics-based model of PEMFC used in this work is a quantitative mathematical model based on a set of theoretical equations that accounts for transport phenomena, mass balances, enthalpy balances and electrochemical processes governing the stack.

### 2.2.1. Model description

Detailed description of the physics-based PEMFC model can be found in the literature [40]. The main modelling assumption is to consider that all the cells composing the stack are identical and behave in the same way. Accordingly, the stack voltage is the product of the single cell voltage and the number of cells composing the PEMFC stack. Specifically, the cell voltage is calculated by means of a semi-empirical relation derived from the Butler-Volmer equation [40].

$$U_{\text{cell}} = U_{\text{rev}} - R_{\text{id}} + \eta \quad (1)$$

where $U_{\text{rev}}$ is the reversible cell voltage from the thermodynamic equilibrium, $R$ is the ohmic resistance of the cell, $i_{\text{d}}$ is the current density and $\eta$ is the overpotential accounting for the activation losses, given in Eq. (2)

$$\eta = \beta_1 + \beta_2 T + \beta_3 T \ln(i_d) + \beta_4 T \ln\left(\frac{P_{O_2}^*}{P^*}\right) + \beta_5 T \ln\left(\frac{P_{H_2}^*}{P^*}\right) + \beta_6 T \ln\left(\frac{P_{H_2O}^*}{P^*}\right) \quad (2)$$

where $T$ is the temperature, $P_{O_2}^*$, $P_{H_2}^*$ and $P_{H_2O}^*$ are the partial pressures of oxygen, hydrogen and water, respectively, $P^*$ is the standard pressure and $\beta_k$, $k = 1, \dots, 6$, are semi-empirical coefficients. The ohmic resistance $R$ is given by $R = R_c + R_m$ where $R_c$ is the contact resistance and $R_m$ is the membrane resistance, given in Eq. (3)

$$R_m = \frac{e_m}{\sigma(\lambda_m + \lambda_a)} + \frac{e_m}{\sigma(\lambda_m + \lambda_c)} \quad (3)$$

where $e_m$ is the membrane thickness, $\sigma$ is the membrane conductivity, $\lambda_a$, $\lambda_c$ and $\lambda_m$ are the membrane water content at anode and cathode, and inside the membrane, respectively, which can be computed with the semiempirical equation presented in Ref. [40].

The physics-based model gives access to global and local conditions of the PEMFC stack, for a wide range of operating conditions and with different levels of detail. Furthermore, it accounts for the effects of PEMFC degradation. Fuel cell degradation mechanisms have been the focus of a number of studies in the literature, and it has been demonstrated that platinum dissolution is the mechanism contributing the most to the overall degradation [2]. Accordingly, in Ref. [4] Eq. (2) has been adequately modified to include a simple equivalent model that accounts for the catalyst degradation by introducing the degradation rate $\tau_{\text{deg}}$ as follows

$$\eta = \beta_1 + \beta_2 T + \beta_3 T \ln\left(\frac{i_d}{\tau_{\text{deg}}}\right) + \beta_4 T \ln\left(\frac{P_{O_2}^*}{P^*}\right) + \beta_5 T \ln\left(\frac{P_{H_2}^*}{P^*}\right) + \beta_6 T \ln\left(\frac{P_{H_2O}^*}{P^*}\right) \quad (4)$$

Multiple approaches can be used to estimate $\tau_{\text{deg}}$. Since platinum dissolution rate exponentially increases with time [44], one can assume that the degradation rate $\tau_{\text{deg}}$ is also exponentially increasing over time. Thus, in this study we define $\tau_{\text{deg}} = a \cdot t^{-b}$, where $t$ is the operating time of the PEMFC stack, and $a$ and $b$ are empirical parameters.
### 2.2.2. Model calibration

In order for the physics-based model to be representative of a PEMFC stack, some parameters have to be set. Among these parameters, the physical properties of the membrane, catalyst layer, bipolar plates and GDL are usually known from the stack specifications. However, to improve the alignment between model estimates and measured signals, we resort to model calibration. Specifically, for the parameters $β_k, k = 1, ..., 6$, introduced in the previous paragraph, manual calibration is an impractical option and a dedicated procedure has been developed which makes use of experimental polarization curves [45]. Regarding the empirical parameters related to the degradation rate $τ_{deg}$, the calibration implies minimizing the mean squared error (MSE) of the voltage at different operation times, given the polarization curves at different operating conditions.

Once all the model parameters have been identified, the physics-based PEMFC model will be representative of the real PEMFC stack with a certain level of accuracy. In general, model calibration is a stochastic problem, and this, together with the missing physical representation of the modelling equations, has an impact on the model performance.

### 2.3. PEMFC faults description

The faulty mechanisms of PEMFC have been widely investigated in the literature [29,46]. Massive water droplets formation in the flow channels or inside the electrodes leads to a flooding fault, during which the excess of water prevents the gases to reach the reaction sites. Pressure drop increases inside the stack, eventually leading to oscillations in the partial pressures of the active sites and, thus, to oscillations of the stack voltage [32]. In the opposite case, a drying fault can appear if the membrane is poorly hydrated. Given that membrane ionic conductivity is highly dependent on its hydration, a drying fault will cause an increase in the ohmic resistance and therefore a drop in the voltage. Eventually, drying can also lead to accelerated formation of radicals, which speed up the degradation of the membrane. Moreover, poor gas control can lead to starvation fault, both of air and hydrogen. These faults are very common in PEMFC, specifically when dynamic current loads are imposed. Indeed, when the gas flow is insufficient to sustain the current load, local starvation can occur in the fuel cell and can induce variation in the current density distribution, as well as voltage decrease. Hence, we consider the following fault classes for the PEMFC stack: flooding fault (F1), drying fault (F2), air starvation fault (F3) and hydrogen starvation fault (F4). The stack in nominal condition is referred as healthy (H).

In order to immediately remedy the fault states and prevent the stack from being irreversibly damaged, it is essential to accurately monitor, in real-time, the state of the stack and correctly diagnose a fault when it occurs. Therefore, the main goal of this study is to develop a method that can accurately estimate the state of the PEMFC stack under dynamic conditions, from the signals monitored on the stack.

## 3. Fault diagnosis method

In this work, we aim to demonstrate the benefits of combining the knowledge embedded in a PEMFC physics-based model with a LSTM neural network for fault diagnosis. We propose to enhance the input space of the LSTM neural network by compounding the measured signals, collected through sensors on the PEMFC stack, with estimates of observable and unobservable variables provided by the physics-based PEMFC model, in which a degradation mechanism has been embedded. Since LSTM neural networks have proven to be particularly well-suited to capture temporal information in data and have shown an excellent ability to reveal hidden complex functional mapping between input and target fault labels [34,37,38], we select this type of DL algorithm to classify faults. Indeed, using LSTM neural networks, we can take

into consideration that the state of dynamical systems is not only correlated to the values of the diagnosis signals at the time of measurement, but also to their values at previous time steps.

### 3.1. LSTM neural network

Recurrent Neural Networks (RNNs) are designed to record and preserve correlation information from sequential data [47], thus are suitable for analyzing time series signals. LSTM neural network is a type of RNN which has been developed to address the problems of the vanishing or exploding gradient that are typically encountered when training a RNN [48]. The core of the LSTM neural network is the memory cell, that replaces the conventional neurons in the hidden layers. Let us consider a time series $X_T = (x_1, ..., x_T)$, i.e., an input signal containing the information from an initial time $t = 1$ until the current time $t = T$. In each memory cell, a cell state $C_t$ controls the network information using the input gate, output gate and forget gate. At time $t$, when a new observation $x_t$ is fed to the network, the forget gate determines whether to keep or remove the information of the preceding memory block output $h_{t-1}$. The output of the forget gate is

$$f_t = \sigma(W_f \bullet [h_{t-1}, x_t] + b_f) \qquad (5)$$

where $W_f$ and $b_f$ are the input weights and bias of the forget gate, respectively.

The input gate determines whether $x_t$ is stored in the cell state $C_t$

$$i_t = \sigma(W_i \bullet [h_{t-1}, x_t] + b_i) \qquad (6)$$

where $W_i$ and $b_i$ are the input weights and bias of the input gate, respectively. A tanh layer function is used to generate a new information vector $\tilde{C}_t$ to be added to $C_t$.

$$\tilde{C}_t = \tanh(W_c \bullet [h_{t-1}, x_t] + b_c) \qquad (7)$$

where $W_c$ and $b_c$ are the input weights and bias of the input gate, respectively. Then, the cell state $C_t$ is updated as follows

$$C_t = f_t \bullet C_{t-1} + i_t \bullet \tilde{C}_t \qquad (8)$$

Eventually, the output of the memory cell $h_t$ is generated by using the output gate and a tanh layer

$$o_t = \sigma(W_o \bullet [h_{t-1}, x_t] + b_o) \qquad (9)$$

$$h_t = o_t \bullet \tanh C_t \qquad (10)$$

where $W_o$ and $b_o$ are the input weights and bias of the input gate, respectively.

Eventually, a layer of the LSTM neural network consists of $N_c$ memory cells, which determine the expressive capacity of the network. Given $N$ time series signals, the input of the LSTM neural network is the multivariate time series $\tilde{X}_T \in \mathbb{R}^{T \times N}$. Then, each LSTM layer maps the input matrix to the hidden state matrix $\tilde{H}_T \in \mathbb{R}^{T \times N_c}$, and the output layer translates the last hidden state into a probability vector $\tilde{y}_t$ for the fault states of the system.

### 3.2. Physics-guided LSTM method

To perform PEMFC fault diagnosis, we propose a physics-guided LSTM method. It involves using the physics-based PEMFC model introduced in Section 2 in parallel to the PEMFC stack and an LSTM neural network as classification algorithm. The method is illustrated in Fig. 1.

Once it has been calibrated, the physics-based model takes as input the actuator signals, i.e., command variables inferred from the system, at time $t$, $a_t = [a_t^1 \quad a_t^N_a]_{i=1}^N$, where $a_t^i$ is the i-th actuator inferred signal and $N_a$ is the total number of actuator signals to be able to run the model. Then, the physics-based model outputs the estimates of several process vari-
<figure><img src="image_3.png" /><figcaption>Fig. 1. The flowchart of the proposed physics-guided LSTM method.</figcaption></figure>

ables, i.e., model estimates of the process variables at time t, $\underline{x}_t^m = [\underline{x}_t^{m,j}]_{j=1}^{N_m}$, where $\underline{x}_t^{m,j}$ is the j-th model estimate at time t and $N_m$ are the number of process variables estimated by the model. In addition, we have access to measured signals at time t, $\underline{x}_t^s = [\underline{x}_t^{s,j}]_{j=1}^{N_s}$, where $\underline{x}_t^{s,j}$ is the l-th signal measured from the stack and $N_s$ are the number of measured signals. Eventually, the model estimates and the measured signals are aggregated, i.e., $\underline{x}_t = [\underline{x}_t^m, \underline{x}_t^s] \in \mathbb{R}^{(N_m+N_s)}$ to enhance the information available for the LSTM neural network. The continuous stream of model estimates and measured signals during a time window of length T is then obtained as $\underline{X}_T = (\underline{x}_{t-T}, \dots, \underline{x}_t) = [\underline{x}_t^m, \underline{x}_t^s] \in \mathbb{R}^{T \times (N_m+N_s)}$, which in the extended form is given by the following multivariate time series

$$ \underline{X}_T = \begin{bmatrix} \underline{x}_{t-T}^{m,1} & \dots & \underline{x}_{t-T}^{m,N_m} & \underline{x}_{t-T}^{s,1} & \dots & \underline{x}_{t-T}^{s,N_s} \\ \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ \underline{x}_{t}^{m,1} & \dots & \underline{x}_{t}^{m,N_m} & \underline{x}_{t}^{s,1} & \dots & \underline{x}_{t}^{s,N_s} \end{bmatrix} \quad (11) $$

Finally, the LSTM neural network takes as input the multivariate time series $\underline{X}_T$ in Eq. (11) and outputs the fault state prediction $\hat{y}_T$.

It should be noted that among the model estimates $\underline{x}_t^m$ there are estimates of process variables that are not directly measurable [4,12]. This can be related to the unavailability of dedicated sensors for real-time applications, to the high cost of sensors or to the inherent non-observability of the variables. The assumption we make here is that the additional information given by these variables allows the algorithm to be more discriminative with respect to the PEMFC stack fault state. Thus, integrating them into the multivariate time series $\underline{X}_T$ as input of the LSTM neural network could be advantageous for a number of reasons. First, it allows for an increase in the representation power of the available information. In addition, the extended knowledge provided by the physics-based PEMFC model could increase the ability of the LSTM classification algorithm to better isolate the root causes of the faults, since different variables can capture different aspects of the underlying phenomena. For instance, the model estimates could enforce the disentanglement of similar patterns generated by different faults in the measured signals. Furthermore, the enhanced input space enforces the coupling between sensed signals and model estimates, guiding the LSTM neural network to be more generalizable and, thus, making it robust to noise fluctuations. In fact, while the measurements from sensors may be affected by noise and may deteriorate in time, there is no such an impact on the model estimates, which are rather affected by modelling errors, thus not depending on the environmental conditions. Conversely, the physics-based model has a positive effect in limiting the consequences related to the aging of the PEMFC stack, and of the

consequent distribution shift of the data, on the performances of the diagnosing algorithm. In a pure data-driven LSTM the complex degradation mechanism of PEMFC cannot be discerned from the faults due to the limited representativeness of the available data. By complementing the measured signals with informative and realistic model estimates, the LSTM has a larger set of inputs that allows it to capture a richer view of the data, and makes it less sensitive to shift caused by aging. Lastly, the interpretability of the algorithm, and more widely of the fault diagnosis method, is improved.

At training time, we have access to a dataset of measured signals, collected through sensors from the PEMFC stack, and to model estimates of the process variables provided by the physics-based PEMFC model. We also have access to the corresponding labels for the fault states of the stack. We are referring to a situation in which labelled data are available, therefore the standard supervised approach can be implemented for algorithms training. The validity of the proposed physics-guided LSTM method is assessed on a separate test set, and its feasibility is proven on three different cases study.

### 3.3. Diagnostic features

In the literature, it is widely mentioned that the stack voltage is a relevant indicator of a deviation in the state of the PEMFC stack. This, together with its easy online attainability, makes it the favored diagnosing signal in most of the PEMFC diagnostic algorithms [8,17,49]. However, the stack voltage alone falls short of effectively isolating the nature of the faults in the stack. Pressure drops at cathode and anode have been proposed as indicators of stack flooding and starvation [50] and proved to be beneficial in several diagnosis algorithms [29,37,51]. In the present work the current load and the coolant flow have also been included as monitoring signals to decouple the effect of load variation from the effect of state variation on the fault indicators. In fact, being the PEMFC stack a highly dynamic system, it is crucial to separate the two effects for effectively discriminating the system states, i.e., nominal and faulty. A complete overview of the measured signals $\underline{x}_t^s \in \mathbb{R}^{N_s}$ used in the present study is given in Table 1.

The physics-based PEMFC model takes as input the actuators signals $\underline{a}_t \in \mathbb{R}^{N_a}$, inferred from the PEMFC system. It is worth noting that, even though these signals are commonly attainable in PEMFC systems, they are usually affected by a certain level of uncertainty, and, in practice, only a rough estimate is available. A detailed overview of the actuator inferred signals is provided in Table 2.

Eventually, in Table 3 are listed the process variables estimated with the calibrated physics-based PEMFC model, which can be observable or unobservable variables. As previously mentioned, variables 1–3 are
<table><caption>**Table 1**
Measured signals from PEMFC stack.</caption><thead><tr><th>#</th><th>Symbol</th><th>Description</th><th>Units</th></tr></thead><tbody><tr><td>1</td><td></td><td>Current</td><td>[A]</td></tr><tr><td>2</td><td></td><td>Voltage</td><td>[V]</td></tr><tr><td>3</td><td></td><td>Cathode pressure drop</td><td>[Pa]</td></tr><tr><td>4</td><td></td><td>Anode pressure drop</td><td>[Pa]</td></tr><tr><td>5</td><td></td><td>Inlet coolant flow</td><td>[m³/s]</td></tr></tbody></table>

<table><caption>**Table 2**
Actuators inferred signals.</caption><thead><tr><th>#</th><th>Symbol</th><th>Description</th><th>Units</th></tr></thead><tbody><tr><td>1</td><td></td><td>Coolant temperature</td><td>[K]</td></tr><tr><td>2</td><td></td><td>H2 inlet relative humidity</td><td>[%]</td></tr><tr><td>3</td><td></td><td>Air inlet relative humidity</td><td>[%]</td></tr><tr><td>4</td><td></td><td>H2 stoichiometry</td><td>[-]</td></tr><tr><td>5</td><td></td><td>Air stoichiometry</td><td>[-]</td></tr><tr><td>6</td><td></td><td>H2 inlet pressure</td><td>[Pa]</td></tr><tr><td>7</td><td></td><td>Air inlet pressure</td><td>[Pa]</td></tr></tbody></table>

critical for diagnosing the PEMFC stack and are the model estimate equivalents of measured signals. Variables 4–8 are especially well adapted to describe phenomena related to water management faults in the stack [12], and variables 9–10 have been selected due to their correlation with starvation faults [29,52]. It should be pointed out that these process variables are usually unobtainable through sensors, either because the dedicated sensors are overly costly, or because the sensors cannot be adapted for online applications, or because the signal is not directly measurable. As a result, the proposed physics-guided fault diagnosis method relies on a more exhaustive and detailed representation of the PEMFC stack.

# 4. Experiment description

## 4.1. Data description

The dataset used for the validation of the proposed method has been collected in a previous work, presented in Ref. [12]. The PEMFC stack used comprises 20 cells, with an active surface of 220 cm², and can reach a maximum power of 2600 W. The proton exchange membrane consists of Nafion and has a thickness of 25 µm. The platinum load is 0.5 mg/m². The stack has been operating under Fuel Cell Dynamic Load Cycle (FC-DLC), derived from the New European Driving Cycle (NEDC) load profile, resulting in a highly dynamic current profile.

The PEMFC stack has been operated and monitored for more than 1000 h, during which water management faults and starvation faults have been occasionally injected. Concurrently, the stack voltage, the cathode pressure drop, the anode pressure drop, the coolant flow rate and the current, along with the actuators signals, have been recorded with a sampling frequency of 0.5 Hz.

During stack operation, irreversible degradation phenomena took

<table><caption>**Table 3**
Model estimates from the physics-based PEMFC model.</caption><thead><tr><th>#</th><th>Symbol</th><th>Description</th><th>Units</th></tr></thead><tbody><tr><td>1</td><td></td><td>Voltage</td><td>[V]</td></tr><tr><td>2</td><td></td><td>Cathode pressure drop</td><td>[Pa]</td></tr><tr><td>3</td><td></td><td>Anode pressure drop</td><td>[Pa]</td></tr><tr><td>4</td><td></td><td>Membrane resistance</td><td>[Ω]</td></tr><tr><td>5</td><td></td><td>Membrane water content</td><td>[-]</td></tr><tr><td>6</td><td></td><td>Membrane temperature</td><td>[K]</td></tr><tr><td>7</td><td></td><td>Relative humidity at cathode outlet</td><td>[%]</td></tr><tr><td>8</td><td></td><td>Relative humidity at anode outlet</td><td>[%]</td></tr><tr><td>9</td><td></td><td>Current density distribution</td><td>[A/m²]</td></tr><tr><td>10</td><td></td><td>Thermal power</td><td>[W]</td></tr></tbody></table>

place, as it can be observed in Fig. 2. The polarization curves recorded after 50 h, 300 h and 800 h show dissimilar levels of performance of the stack, with the 800 h curve presenting an average voltage loss of 0.67 V.

## 4.2. Model calibration and validation

The physics-based PEMFC model has been calibrated using the polarization curves collected in the first 50 h of operation of the PEMFC stack, following the procedure illustrated in Ref. [45] for determining the optimal values of the parameters $\beta_k$, $k = 1, ..., 6$. The parameters representing physical properties are obtained from the PEMFC characteristics provided by the manufacturer. Eventually, the empirical parameters for the degradation rate $\tau_{deg}$ have been set through a hands-on procedure to minimize the MSE on the stack voltage, which is obtained from the polarization curves collected in the first 250 h of stack operation. Albeit being a coarse approximation, by so doing we are able to capture the degradation trend in the data. The model validation results with respect to stack voltage are shown in Fig. 3a, for a frame of the FC-DLC cycle. The mean absolute error of the model on the stack voltage is 0.803 V and the mean relative error is 1.5 %. For illustrating purposes in Fig. 3b are given the model estimates of the membrane resistance and of the membrane water content, which are also inputted to LSTM neural network, to achieve PEMFC fault diagnosis.

## 4.3. Proposed algorithms architecture

This work aims at demonstrating the capability of the physics-guided LSTM method to accurately assess the faults in the PEMFC stack, and to compare its performance to that of a pure data-driven LSTM algorithm. The architecture of the LSTM neural network proposed in this study comprises 4 layers. The network has three initial LSTM layers, with number of hidden units equal to 20, 20 and 15, respectively, and one dense layer with 5 neurons and softmax activation function. We utilize the Adam algorithm with adaptive learning rate to optimize the training of the neural network. The initial learning rate is set to 0.02. The batch size is set to 512 and the number of epochs is set to 100.

To evaluate the effectiveness of the proposed method, a comparative analysis against traditional ML algorithms widely used in the literature for fault diagnosis of PEMFC is also included in the study. The ML algorithms implemented are: SVM, with regularization parameter $C = 2$ and Radial Basis Function (rbf) kernel; RF, with number of estimators equal to 10; GB, with number of estimators equal to 50; FNN, with 2 hidden layers, 50 neurons per layer.

From the exploration of the parameters space, we selected the hyperparameters so to maximize the accuracy on the test set and to ensure the best achievable performance. To thoroughly validate the performance of the algorithms, ensure a robust assessment and avoid

<figure><img src="image_4.png" /><figcaption>**Fig. 2.** Polarization curves at time 50 h, 300 h and 800 h.</figcaption></figure>
<figure><img src="image_5.png" /><figcaption>Fig. 3. Validation of the physics-based PEMFC model. (a) The stack voltage measured (blue) and estimated by the physics-based PEMFC model (red). (b) Membrane resistance (solid line) and membrane water content (dashed line) provided by the physics-based PEMFC model. (For interpretation of the references to colour in this figure legend, the reader is referred to the Web version of this article.)</figcaption></figure>

overfitting, stratified k-fold cross validation, with k = 5, is implemented.

## 4.4. Data preprocessing

The dimension of the input data $\underline{X}_T$ varies depending on the method selected. The pure data-driven LSTM takes in input solely the measured signals $\underline{X}_T^s$. The proposed physics-guided LSTM takes in input also the model estimates $\underline{X}_T^m$, thus it takes in input the multivariate time series $\underline{X}_T = [\underline{X}_T^s, \underline{X}_T^m]$. The input space to the LSTM neural network is normalized to a range [-1,1] by a min/max normalization given by the available dataset in the first 50 h of operation, and preprocessed with a sliding time window of size 20 s. The sliding time window means that the first sample comprises the signals from time 1–20 s, the second from 21 to 40 s, and so on. While the LSTM neural network processes the entire time series $\underline{X}_T = (\underline{x}_{T-1}, \dots, \underline{x}_T)$, the ML algorithms used in the comparative analysis take in input the average of the time series along the time window $T$.

## 4.5. Performance evaluation metrics

To quantitatively compare the performance of the fault diagnosis method, we apply the following metrics, which are commonly used in fault diagnosis algorithms: accuracy (acc), precision (prec), recall (rec) and F1 score (F1). They are defined as follows

$$acc = \frac{TP + TN}{TP + TN + FP + FN} \qquad (12)$$

$$prec = \frac{TP}{TP + FP} \qquad (13)$$

$$rec = \frac{TP}{TP + FN} \qquad (14)$$

$$F1 = 2 \frac{prec \times rec}{prec + rec} \qquad (15)$$

where TP is the number of correctly detected faults, FP that of incorrectly detected ones, TN is the number of correctly assigned fault-free cases and FN that of incorrectly assigned fault-free.

In addition to the above metrics, for a more precise characterization of the quality and robustness of the fault diagnosis method we propose the time to detect. This is the time between the moment the PEMFC stack changes state and the moment the algorithm detects the change, classifying it as the correct fault. The motivation behind this metric is that by detecting a fault as soon as possible, we can promptly restore nominal operating conditions, thus limiting the degrading effects that the fault has on the PEMFC stack.

# 5. Results and discussion

The application of the proposed method on the dataset introduced in the previous Section is presented below. Initially, to illustrate the benefits of using the physics-guided LSTM method over the pure data-driven counterpart, the performances are tested on the first 250 h of operation of the stack. Then, the methodology is tested over the entire dataset available, comprising 1000 h of operation. In addition, to demonstrate the generalization and the robustness to PEMFC stack aging of the physics-guided LSTM method, we train the algorithm exclusively with data of the first 250 h of operation and, then, we test the performance on the data collected after 600 h of operation, which is affected by distribution shift due to degradation.

## 5.1. Case study 1: validation of the methodology on the initial phase of stack operation

In this section, the performance of the proposed physics-guided LSTM method is evaluated and compared to a pure data-driven LSTM neural network, on the data collected at initial phase of stack operation. This allows to study the performance of the method with a limited effect of aging. We keep the data in the first 250 h of operation only, then we randomly split them into a train and a test set, with no overlap between them so to reduce the effect of overfitting. This is shown in Fig. 4.

We used a sliding time window of 20 s, resulting in a dataset consisting of 8437 samples for the nominal state (H), 3846 samples for the flooding fault (F1), 1692 samples for the drying fault (F2), 477 samples for the air starvation fault (F3) and 485 samples for the H2 starvation fault. The performance metrics for the physics-guided LSTM method and the data-driven LSTM, are shown in Table 4, validated with cross validation. Also, the performance of the other ML algorithms is given, for the data-driven as well as the physics-guided approach.

The results highlight that the physics-guided LSTM method surpasses the data-driven LSTM neural network, in all the metrics, with an increase of 3.00 % in the accuracy and of 3.86 % in the F1 score, as well as all the other ML algorithms considered. We evaluate the time to detect for the physics-guided LSTM neural network, which results in 10.1 s, in average, against 14.2 s for the data-driven LSTM, proving that the physics-guided method facilitates the diagnosis of the stack by reducing

<figure><img src="image_6.png" /><figcaption>Fig. 4. – Illustration of the dataset splitting for case study 1.</figcaption></figure>
<table><caption>**Table 4**
Comparison of different methods for fault diagnosis, over the initial phase (250 h) of stack operation.</caption><thead><tr><th></th><th>acc</th><th>prec</th><th>rec</th><th>F1</th></tr></thead><tbody><tr><td colspan="5">Data-driven</td></tr><tr><td>SVM</td><td>0.776</td><td>0.862</td><td>0.534</td><td>0.604</td></tr><tr><td>RF</td><td>0.939</td><td>0.945</td><td>0.908</td><td>0.925</td></tr><tr><td>GB</td><td>0.877</td><td>0.900</td><td>0.828</td><td>0.857</td></tr><tr><td>FNN</td><td>0.795</td><td>0.807</td><td>0.559</td><td>0.612</td></tr><tr><td>LSTM</td><td>0.966</td><td>0.964</td><td>0.954</td><td>0.958</td></tr><tr><td colspan="5">Physics-guided</td></tr><tr><td>SVM</td><td>0.947</td><td>0.968</td><td>0.871</td><td>0.913</td></tr><tr><td>RF</td><td>0.980</td><td>0.985</td><td>0.952</td><td>0.968</td></tr><tr><td>GB</td><td>0.959</td><td>0.975</td><td>0.927</td><td>0.949</td></tr><tr><td>FNN</td><td>0.954</td><td>0.959</td><td>0.919</td><td>0.938</td></tr><tr><td>LSTM</td><td><strong>0.995</strong></td><td><strong>0.995</strong></td><td><strong>0.994</strong></td><td><strong>0.995</strong></td></tr></tbody></table>

the time to detect of 28.9 %.

## 5.2. Case study 2: validation of the methodology on the entire dataset, with the aging effect

Considering that the PEMFC stack has a durability of thousands of hours, it is not enough to prove that the fault diagnosis algorithm is valid in the first 250 h of operation. In fact, under the effect of degradation phenomena the diagnosis signals tend to deteriorate. The effect of degradation phenomena cumulates with the effect of faults in the measured signals, e.g., the voltage, causing a shift in the distribution of the fault classes and eventually hindering fault discriminability. A robust fault diagnosis method must be capable of addressing this challenge. Accordingly, we extend the study of the previous paragraph to the entire dataset, which consists of more than 1000 h of operation of the stack. An illustration of the train-test splitting of the dataset is shown in Fig. 5. The splitting procedure ensures there is no overlap between the train and the test sets.

A sliding time window of 20 s is used to process the data, and the samples available for each system state are the following: 12726 for the nominal state (H), 5383 for the flooding fault (F1), 2682 for the drying fault (F2), 658 for the air starvation fault (F3) and 785 for the H2 starvation fault (F4). Table 5 shows the results, validated through cross validation for the physics-guided LSTM and the data-driven LSTM, as well as for the ML algorithms introduced for comparison.

The proposed physics-guided LSTM method outperforms the data-driven LSTM in terms of diagnostic performances, with an improvement is 5.89 % for the accuracy and 15.0 % for the F1 metrics. Although the ML algorithms considered show commendable performances in the physics-guided approach, they fall short of the physics-guided LSTM effectiveness. For the physics-guided LSTM method the time to detect has an average value of 17.9 s, while for the data-driven LSTM it is 43.2 s, corresponding to a reduction of 58.6 %.

## 5.3. Case study 3: assessment of the robustness of the methodology with unseen aging data

To further investigate the robustness of the physics-guided LSTM method to PEMFC stack aging, we split the entire dataset in train and test as shown in Fig. 6. The first 250 h are used to train the algorithms,

<figure><img src="image_7.png" /><figcaption>Fig. 5. Illustration of the dataset splitting for case study 2.</figcaption></figure>

<table><caption>**Table 5**
Comparison of different methods for fault diagnosis, over the 1000 h dataset.</caption><thead><tr><th></th><th>acc</th><th>prec</th><th>rec</th><th>F1</th></tr></thead><tbody><tr><td colspan="5">Data-driven</td></tr><tr><td>SVM</td><td>0.748</td><td>0.848</td><td>0.505</td><td>0.586</td></tr><tr><td>RF</td><td>0.904</td><td>0.916</td><td>0.859</td><td>0.885</td></tr><tr><td>GB</td><td>0.799</td><td>0.859</td><td>0.677</td><td>0.745</td></tr><tr><td>FNN</td><td>0.743</td><td>0.755</td><td>0.512</td><td>0.561</td></tr><tr><td>LSTM</td><td>0.933</td><td>0.913</td><td>0.881</td><td>0.859</td></tr><tr><td colspan="5">Physics-guided</td></tr><tr><td>SVM</td><td>0.944</td><td>0.968</td><td>0.871</td><td>0.913</td></tr><tr><td>RF</td><td>0.973</td><td>0.980</td><td>0.937</td><td>0.957</td></tr><tr><td>GB</td><td>0.939</td><td>0.972</td><td>0.866</td><td>0.912</td></tr><tr><td>FNN</td><td>0.944</td><td>0.951</td><td>0.907</td><td>0.928</td></tr><tr><td>LSTM</td><td><strong>0.988</strong></td><td><strong>0.990</strong></td><td><strong>0.987</strong></td><td><strong>0.988</strong></td></tr></tbody></table>

then the performance are tested on the last part of the dataset, from 600 h to 1000 h, so to validate the ability to discriminate faults when PEMFC aging is established and distribution shift becomes an issue in the measured signals. Since in real life it is hard to obtain a faulty dataset comprehending the whole operation time of the PEMFC stack to train the fault diagnosis algorithm, this study enables the validation of the robustness of fault diagnosis method in a more rigorous and realistic scenario.

For this study, the results for the physics-guided LSTM and the data-driven LSTM, and for the ML algorithms included for comparison, are shown in Table 6.

The findings presented in Table 6 illustrate that the sole method that achieves satisfactory performances in diagnosing the PEMFC stack under aging condition is the physics-guided LSTM. The accuracy score and the F1 score are 0.817 and 0.812, respectively. All the ML algorithms included for comparison, both data-driven and physics-guided, fail in accurately diagnosing the stack, underscoring the importance of adopting a LSTM neural network for correctly analyzing time series data. Compared to the data-driven LSTM neural network, the proposed physics-guided LSTM method shows a notable improvement, 55.9 % for the accuracy and 76.9 % for the F1 score. In order to illustrate the diagnosis performances more effectively, in Fig. 7 we provide the confusion matrices for the data-driven LSTM neural network and the physics-guided LSTM method.

The physics-guided LSTM diagnoses well the faults in the test dataset, remarkably showing a score of 0.978 for the hydrogen starvation fault (F4), while the data-driven LSTM is not capable of diagnosing starvation faults (F3, F4) and achieves inadequate scores on the other fault classes.

Furthermore, in Fig. 8 we show the 2D representation of the feature extracted by the LSTM neural network in the two methods, after the last hidden state, through t-SNE visualization. Fig. 8a shows the features extracted by the data-driven LSTM neural network, while Fig. 8b shows the distribution of the feature extracted by the physics-guided LSTM neural network. Only for the latter 5 different clusters, one for each fault state, are clearly distinguishable, highlighting the motivation behind the notable performance improvement.

Eventually, the time to detect metric confirms these results. The physics-guided LSTM requires 66.9 s to diagnose the faults at test time, against 298.1 s of the data-driven LSTM, with a reduction of the detection time of 77.6 %.

<figure><img src="image_8.png" /><figcaption>Fig. 6. – Illustration of the dataset splitting for case study 3.</figcaption></figure>
<table><caption>**Table 6**

- Comparison of different methods for fault diagnosis on the dataset shown in Fig. 6.</caption><thead><tr><th></th><th>acc</th><th>prec</th><th>rec</th><th>F1</th></tr></thead><tbody><tr><td colspan="5"><strong>Data-driven</strong></td></tr><tr><td>SVM</td><td>0.495</td><td>0.389</td><td>0.296</td><td>0.283</td></tr><tr><td>RF</td><td>0.448</td><td>0.378</td><td>0.302</td><td>0.296</td></tr><tr><td>GB</td><td>0.434</td><td>0.219</td><td>0.230</td><td>0.222</td></tr><tr><td>FNN</td><td>0.486</td><td>0.356</td><td>0.304</td><td>0.283</td></tr><tr><td>LSTM</td><td>0.524</td><td>0.584</td><td>0.439</td><td>0.459</td></tr><tr><td colspan="5"><strong>Physics-guided</strong></td></tr><tr><td>SVM</td><td>0.721</td><td>0.833</td><td>0.592</td><td>0.669</td></tr><tr><td>RF</td><td>0.731</td><td>0.731</td><td>0.541</td><td>0.579</td></tr><tr><td>GB</td><td>0.698</td><td>0.641</td><td>0.433</td><td>0.467</td></tr><tr><td>FNN</td><td>0.662</td><td>0.668</td><td>0.514</td><td>0.539</td></tr><tr><td>LSTM</td><td><strong>0.817</strong></td><td><strong>0.807</strong></td><td><strong>0.853</strong></td><td><strong>0.812</strong></td></tr></tbody></table>

## 5.4. Discussion

As stated in the introduction and demonstrated in the cases study, the proposed physics-guided LSTM method is designed to increase the discriminative power and improve the generalization ability of the fault diagnosis algorithm. The estimates of the fault related variables provided by the physics-based PEMFC model are informative of the state of the PEMFC stack and, as a result, increase the accuracy and decrease the time to detect of the physics-guided LSTM compared to the data-driven LSTM. Indeed, by integrating the model estimates and the measured signals, it is possible to significantly enhance the input space of the LSTM neural network without increasing the number of sensors installed on the stack. Furthermore, case study 3 evidences that the physics-

guided LSTM is the only method capable of adapting to degraded signals, and thus, it is robust to PEMFC aging, also indicating a greater generalization ability, which is a clear advantage with respect to the data-driven LSTM neural network, as well as traditional ML algorithms, i.e., SVM, RF, GB, FNN. These results yield several key insight.

1) The LSTM neural network is confirmed to be the most suited algorithm to deal with time series signals, collected through sensors on the PEMFC stack. Their ability to capture complex functional patterns in the input data yields a clear advantage in diagnosing the faults.

2) The model estimates of process variables compensate for the limited sensors that can be embedded on a PEMFC in real vehicular application. The physics-based model can thus provide meaningful insights on the PEMFC fault state, allowing to infer informative process variables not available from the measured signals, which demonstrate to be beneficial for diagnosing the stack.

3) Moreover, as proven in the last case study, the process variables provided by the model serves as additional information for the algorithms to better discern the faults, limiting the confusion given by the data distribution shift due to aging. Indeed, instead of relying only on voltage and pressure drop, we can also consider membrane temperature, membrane water content, relative humidity and current density. Increasing the amount of information that the LSTM neural network has access to, the algorithm has greater flexibility in representing complex phenomena and, thus, it can better capture the underlying relationship in the data.

However, to some extent, certain limitations in the presented method persist. First, the feasibility of the online implementation of the physics-based PEMFC model is not investigated here. Limited computational

<figure><img src="image_9.png" /><figcaption>**Fig. 7.** Confusion matrix for the data-driven LSTM (a) and the physics-guided LSTM (b) method. The train and test datasets are illustrated in Fig. 6.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>**Fig. 8.** Two-dimensional representation by means of t-SNE of the features extracted by the LSTM neural network, (a) data-driven LSTM, (b) physics-guided LSTM. The dataset is shown in Fig. 6.</figcaption></figure>
capability to embed it on the fuel cell management system is a general issue of physics-based models. This highlights the need for a dedicated model order reduction technique so to adapt the proposed method for online implementation. Another limitation is the need for labelled data. The required experimental campaign is time consuming and extremely expensive if it can only be used for a specific PEMFC technology. Adequate problem formulation should be explored, e.g., including domain adaptation, to extend the applicability to different PEMFC technologies.

It is also worth noting that, despite using a simple exponential degradation model for the PEMFC, more complex degradation models could be implemented in the physics-based PEMFC model, which could directly account for phenomena like Ostwald ripening [4], or membrane degradation [53], thus providing more accurate estimates of process variables, and eventually better fault diagnosis performances.

## 6. Conclusion

In this paper, a novel method for PEMFC fault diagnosis based on a physics-guided LSTM is proposed. A physics-based PEMFC model is used to estimate observable and unobservable process variables, which are related to the state of the PEMFC stack. The model estimates are aggregated with the measured signals to increase the information inputted to the LSTM neural network. The results show that the proposed method, by providing additional, physics relevant variables, can effectively increase the fault discrimination capability of the LSTM neural network, eventually imposing the generalization and the accuracy of the network without additional physical sensors. The physics-guided LSTM method represents a notable improvement for PEMFC fault diagnosis. Its ability to accurately diagnose the faulty states of the stack under dynamic load profiles and in a wide range of operation times is essential for making the PEMFC technology more reliable and reduce the effects of degradation on the diagnosis performances. We emphasize on the fact that this is the first time that a fault diagnosis method has been tested on a real-life faulty dataset, comprising 1000 h of operation of the PEMFC stack.

The benefits of the method we present in this work are threefold. First, as demonstrated in the cases study, the proposed physics-guided LSTM method has an improved diagnosing accuracy compared to the data-driven LSTM. Second, the detection time is considerably reduced. This is a critical aspect in PEMFC, since reducing the time the stack remains in a faulty state has a direct impact on its durability. Eventually, we demonstrated that the physics-guided LSTM method, contrary to the other algorithms considered, is highly robust to the degradation of the system, effectively tackling the issue of signals deterioration, making a significant advancement in extending the validity of the method and improving its generalization.

This work lays the ground for more innovations in the field, with the ultimate goal of extending PEMFC durability. Further studies will focus on employing model reduction techniques to allow for the online implementation of the physics-based model, aiming to make it more adaptable to the limited memory space of embedded systems.

## CRediT authorship contribution statement

**Chiara Pettorossi:** Writing – review & editing, Writing – original draft, Visualization, Validation, Software, Methodology, Formal analysis, Data curation, Conceptualization. **Raphaël Morvillier:** Writing – review & editing, Visualization, Validation, Software. **Vincent Heiries:** Writing – review & editing, Supervision, Project administration, Conceptualization. **Sébastien Rosini:** Writing – review & editing, Supervision. **Mathias Gerard:** Writing – review & editing, Supervision, Funding acquisition, Conceptualization.

## Declaration of competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

## Acknowledgements

This work was supported by a government grant managed by the French national research agency (ANR) under the France 2030 with reference "ANR-22-PEHY-0002".

## Data availability

The data that has been used is confidential.

## References

[1] J. Stoll, N. Zhao, X.-Z. Yuan, F. Girard, E. Kjeang, Z. Shi, Impacts of cathode catalyst layer defects on performance and durability in PEM fuel cells, J. Power Sources 583 (2023), https://doi.org/10.1016/j.jpowsour.2023.233565.

[2] L. Vichard, N.Y. Steiner, N. Zerhouni, D. Hissel, Hybrid fuel cell system degradation modeling methods: a comprehensive review, J. Power Sources 506 (2021), https://doi.org/10.1016/j.jpowsour.2021.230071.

[3] Z. Hua, Z. Zheng, E. Pahon, M.-C. Péra, F. Gao, A review on lifetime prediction of proton exchange membrane fuel cells system, J. Power Sources 529 (2022), https://doi.org/10.1016/j.jpowsour.2022.231256.

[4] C. Robin, M. Gérard, M. Quinaud, J. D'Arbigny, Y. Bultel, Proton exchange membrane fuel cell model for aging predictions: simulated equivalent active surface area loss and comparisons with durability tests, J. Power Sources 326 (2016) 417–427, https://doi.org/10.1016/j.jpowsour.2016.07.018.

[5] E. Dijoux, N.Y. Steiner, M. Benne, M.-C. Péra, B.G. Pérez, A review of fault tolerant control strategies applied to proton exchange membrane fuel cell systems, J. Power Sources 359 (2017) 119–133, https://doi.org/10.1016/j.jpowsour.2017.05.058.

[6] J. Peng, J. Huang, X. long Wu, Y. wu Xu, H. Chen, X. Li, Solid oxide fuel cell (SOFC) performance evaluation, fault diagnosis and health control: a review, J. Power Sources 505 (Sep. 2021) 230058, https://doi.org/10.1016/j.JPOWSOUR.2021.230058.

[7] Z. Li, Z. Zheng, F. Gao, Diagnosis and prognosis of proton exchange membrane fuel cells, in: A. Soualhi, H. Razik (Eds.), Electrical Systems 2, 2020, https://doi.org/10.1002/9781119720584.ch5. Ch. 5.

[8] G. Gibey, E. Pahon, N. Zerhouni, D. Hissel, Diagnostic and prognostic for prescriptive maintenance and control of PEMFC systems in an industrial framework, J. Power Sources 613 (2024), https://doi.org/10.1016/j.jpowsour.2024.234864.

[9] E. Zio, Prognostics and Health Management (PHM): where are we and where do we (need to) go in theory and practice, Reliab. Eng. Syst. Saf. 218 (2022), https://doi.org/10.1016/j.ress.2021.108119.

[10] J. Wang, et al., Recent advances and summarization of fault diagnosis techniques for proton exchange membrane fuel cell systems: a critical overview, J. Power Sources 500 (2021), https://doi.org/10.1016/j.jpowsour.2021.229932.

[11] M. Sani, M. Piffard, V. Heiries, Fault detection for pem fuel cells via analytical redundancy: a critical review and prospects, Energies 16 (14) (2023), https://doi.org/10.3390/en16145446.

[12] Gauthier Jullian, Catherine Cadet, S. Rosini, M. Gerard, V. Heiries, Christophe Bérenguer, Fault detection and isolation for proton exchange membrane fuel cell using impedance measurements and multiphysics modeling, Fuel Cell. 20 (2020) 558–569.

[13] E. Ariza, A. Correcher, C. Vargas-Salgado, PEMFCs model-based fault diagnosis: a proposal based on virtual and real sensors data fusion, Sensors 23 (17) (2023), https://doi.org/10.3390/s23177383.

[14] J. Won, et al., Hybrid diagnosis method for initial faults of air supply systems in proton exchange membrane fuel cells, Renew. Energy 180 (2021) 343–352, https://doi.org/10.1016/j.renene.2021.07.079.

[15] J. Young Park, I. Seop Lim, Y. Ho Lee, W.-Y. Lee, H. Oh, M. Soo Kim, Severity-based fault diagnostic method for polymer electrolyte membrane fuel cell systems, Appl. Energy 332 (2023), https://doi.org/10.1016/j.apenergy.2022.120486.

[16] D. Ritzberger, S. Jakubek, Nonlinear data-driven identification of polymer electrolyte membrane fuel cells for diagnostic purposes: a Volterra series approach, J. Power Sources 361 (2017) 144–152, https://doi.org/10.1016/j.jpowsour.2017.06.068.

[17] Z. Li, R. Outbib, S. Giurgea, D. Hissel, A. Giraud, P. Couderc, Fault diagnosis for fuel cell systems: a data-driven approach using high-precise voltage sensors, Renew. Energy (2019) 1435–1444, https://doi.org/10.1016/j.renene.2018.09.077.

[18] A. Cheikh, N.Y. Steiner, E. Pahon, C. Damour, M. Benne, D. Hissel, Proton exchange membrane fuel cell signal-based diagnostics using empirical fourier transform, in: 2022 IEEE Vehicle Power and Propulsion Conference, VPPC 2022 - Proceedings, 2022, https://doi.org/10.1109/VPPC55846.2022.10003412.

[19] H. Lu, J. Chen, C. Yan, H. Liu, On-line fault diagnosis for proton exchange membrane fuel cells based on a fast electrochemical impedance spectroscopy
measurement, J. Power Sources 430 (2019) 233-243, https://doi.org/10.1016/j.jpowsour.2019.05.028.

[20] M.A. Rubio, D.G. Sanchez, P. Gazdzicki, K.A. Friedrich, A. Urquia, Failure mode diagnosis in proton exchange membrane fuel cells using local electrochemical noise, J. Power Sources 541 (2022), https://doi.org/10.1016/j.jpowsour.2022.231582.

[21] A.H. Detti, S. Jemei, S. Morando, N.Y. Steiner, Classification based method using fast fourier transform (FFT) and total harmonic distortion (THD) dedicated to proton exchange membrane fuel cell (PEMFC) diagnosis, 2017 IEEE Vehicle Power and Propulsion Conference, VPPC 2017 - Proceedings 2018-Janua (2018) 1-6, https://doi.org/10.1109/VPPC.2017.8331040.

[22] N.J. Steffy, S.V. Selvaganesh, M. Kumar L, A.K. Sahu, Online monitoring of fuel starvation and water management in an operating polymer electrolyte membrane fuel cell by a novel diagnostic tool based on total harmonic distortion analysis, J. Power Sources 404 (2018) 81-88, https://doi.org/10.1016/j.jpowsour.2018.10.012.

[23] S. Nasarre Artigas, H. Xu, F. Mack, Use of distribution of relaxation times analysis as an in-situ diagnostic tool for water management in PEM fuel cells applications, J. Power Sources 600 (2024), https://doi.org/10.1016/j.jpowsour.2024.234179.

[24] Y. Ao, Z. Li, S. Laghouche, D. Depernet, D. Candusso, K. Zhao, Stack-level diagnosis of proton exchange membrane fuel cell by the distribution of relaxation times analysis of electrochemical impedance spectroscopy, J. Power Sources 603 (2024), https://doi.org/10.1016/j.jpowsour.2024.234420.

[25] Z. Zheng, et al., Brain-inspired computational paradigm dedicated to fault diagnosis of PEM fuel cell stack, Int. J. Hydrogen Energy 42 (8) (2017) 5410-5425, https://doi.org/10.1016/j.ijhydene.2016.11.043.

[26] Z. Li, et al., Online implementation of SVM based fault diagnosis strategy for PEMFC systems, Appl. Energy 164 (Feb. 2016) 284-293, https://doi.org/10.1016/J.APENERGY.2015.11.060.

[27] Z. Li, R. Outbib, S. Giurgea, D. Hissel, Diagnosis for PEMFC systems: a data-driven approach with the capabilities of online adaptation and novel fault detection, IEEE Trans. Ind. Electron. 62 (8) (2015) 5164-5174, https://doi.org/10.1109/TIE.2015.2418324.

[28] R.-H. Lin, Z.-X. Pei, Z.-Z. Ye, C.-C. Guo, B.-D. Wu, Hydrogen fuel cell diagnostics using random forest and enhanced feature selection, Int. J. Hydrogen Energy 45 (17) (2020) 10523-10535, https://doi.org/10.1016/j.ijhydene.2019.10.127.

[29] J. Aubry, Diagnostic, pronostic, contrôle tolérant aux défauts et au vieillissement d'une pile à combustible à membrane échangeuse de protons, appliqué à l'automobile [dissertation], France, Université de Franche-Comté (2022).

[30] Z. Liu, M. Pei, Q. He, Q. Wu, L. Jackson, L. Mao, A novel method for polymer electrolyte membrane fuel cell fault diagnosis using 2D data, J. Power Sources 482 (2021), https://doi.org/10.1016/j.jpowsour.2020.228894.

[31] S. Zhou, P.R. Shearing, D.J.L. Brett, R. Jervis, Machine learning as an online diagnostic tool for proton exchange membrane fuel cells, Curr. Opin. Electrochem. 31 (2022), https://doi.org/10.1016/j.coelec.2021.100867.

[32] A. Julie, Y.S. Nadia, M. Simon, Z. Noureddine, V.D.L. Fabian, H. Daniel, Fuel Cell prognosis using particle filter: application to the automotive sector, in: IEEE International Symposium on Industrial Electronics, 2022, vol. 2022-June, pp. 360-365, https://doi.org/10.1109/ISIE51582.2022.9831770.

[33] S. Khan, T. Yairi, A review on the application of deep learning in system health management, Mech. Syst. Signal Process. 107 (Jul. 2018) 241-265, https://doi.org/10.1016/j.YMSSP.2017.11.024.

[34] X. Gu, Z. Hou, J. Cai, Data-based flooding fault diagnosis of proton exchange membrane fuel cell systems using LSTM networks, Energy AI 4 (2021), https://doi.org/10.1016/j.egyai.2021.100056.

[35] S. Zhou, Y. Lu, D. Bao, K. Wang, J. Shan, Z. Hou, Real-time data-driven fault diagnosis of proton exchange membrane fuel cell system based on binary encoding convolutional neural network, Int. J. Hydrogen Energy 47 (20) (2022) 10976-10989, https://doi.org/10.1016/j.ijhydene.2022.01.145.

[36] F. Xiao, T. Chen, J. Zhang, S. Zhang, Water management fault diagnosis for proton-exchange membrane fuel cells based on deep learning methods, Int. J. Hydrogen Energy 48 (72) (Aug. 2023) 28163-28173, https://doi.org/10.1016/J.IJHYDENE.2023.03.097.

[37] J. Liu, Q. Li, H. Yang, Y. Han, S. Jiang, W. Chen, Sequence Fault diagnosis for PEMFC water management subsystem using deep learning with t-SNE, IEEE Access 7 (2019) 92009-92019, https://doi.org/10.1109/ACCESS.2019.2927092.

[38] K. Kim, et al., Pre-diagnosis of flooding and drying in proton exchange membrane fuel cells by bagging ensemble deep learning models using long short-term memory and convolutional neural networks, Energy 266 (2023), https://doi.org/10.1016/j.energy.2022.126441.

[39] Z. Tang, et al., Recent progress in the use of electrochemical impedance spectroscopy for the measurement, monitoring, diagnosis and optimization of proton exchange membrane fuel cell performance, J. Power Sources 468 (2020), https://doi.org/10.1016/j.jpowsour.2020.228361.

[40] C. Robin, M. Gerard, J. D'Arbigny, P. Schott, L. Jabbour, Y. Bultel, Development and experimental validation of a PEM fuel cell 2D-model to study heterogeneities effects along large-area cell surface, Int. J. Hydrogen Energy 40 (32) (2015) 10211-10230, https://doi.org/10.1016/j.ijhydene.2015.05.178.

[41] H. Yuan, H. Dai, X. Wei, P. Ming, Model-based observers for internal states estimation and control of proton exchange membrane fuel cell system: a review, J. Power Sources 468 (2020), https://doi.org/10.1016/j.jpowsour.2020.228376.

[42] J. Aubry, N.Y. Steiner, S. Morando, N. Zerhouni, D. Hissel, Fuel cell diagnosis methods for embedded automotive applications, Energy Rep. 8 (2022) 6687-6706, https://doi.org/10.1016/j.egyr.2022.05.036.

[43] A. Jacome, D. Hissel, V. Heiries, M. Gerard, S. Rosini, Prognostic methods for proton exchange membrane fuel cell under automotive load cycling: a review, IET Electr. Syst. Transp. 10 (4) (2020) 369-375, https://doi.org/10.1049/iet-est.2020.0045.

[44] F. Peng, L. Ren, Y. Zhao, L. Li, Hybrid dynamic modeling-based membrane hydration analysis for the commercial high-power integrated PEMFC systems considering water transport equivalent, Energy Convers. Manag. 205 (2020), https://doi.org/10.1016/j.enconman.2019.112385.

[45] G. Jullian, Diagnostic robuste de la pile à combustible PEM par modélisation physique et mesures d'impédance: prise en compte de conditions dynamiques et du vieillissement, Université Grenoble Alpes, 2016.

[46] Q. Xue, Z. Shan, J. Wang, Humidity impact on polarization dynamics in polymer electrolyte membrane fuel cells through distribution of relaxation times analysis, J. Power Sources 609 (2024), https://doi.org/10.1016/j.jpowsour.2024.234655.

[47] H.-P. Nguyen, J. Liu, E. Zío, A long-term prediction approach based on long short-term memory neural networks with automatic parameter optimization by Tree-structured Parzen Estimator and applied to time-series data of NPP steam generators, Appl. Soft Comput. J. 89 (2020), https://doi.org/10.1016/j.asoc.2020.106116.

[48] Y. Yu, X. Si, C. Hu, J. Zhang, A review of recurrent neural networks: lstm cells and network architectures, Neural Comput. 31 (7) (2019) 1235-1270, https://doi.org/10.1162/neco_a_01199.

[49] Z. Li, R. Outbib, S. Giurgea, D. Hissel, Fault diagnosis for PEMFC systems in consideration of dynamic behaviors and spatial inhomogeneity, IEEE Trans. Energy Convers. 34 (1) (2019) 3-11, https://doi.org/10.1109/TEC.2018.2824902.

[50] F. Jia, X. Tian, F. Liu, J. Ye, C. Yang, Oxidant starvation under various operating conditions on local and transient performance of proton exchange membrane fuel cells, Appl. Energy 331 (2023), https://doi.org/10.1016/j.apenergy.2022.120412.

[51] E. Pahon, N. Yousfi Steiner, S. Jemei, D. Hissel, P. Mo coteguy, A signal-based method for fast PEMFC diagnosis, Appl. Energy 165 (Mar. 2016) 748-758, https://doi.org/10.1016/j.APENERGY.2015.12.084.

[52] A. Mohammadi, A. Djerdir, N. Yousfi Steiner, D. Khaburi, Advanced diagnosis based on temperature and current density distributions in a single PEMFC, Int. J. Hydrogen Energy 40 (45) (2015) 15845-15855, https://doi.org/10.1016/j.ijhydene.2015.04.157.

[53] M. Chandesris, V. Médeau, N. Guillet, S. Chelghoum, D. Thoby, F. Fouda-Onana, Membrane degradation in PEM water electrolyzer: numerical modeling and experimental evidence of the influence of temperature and current density, Int. J. Hydrogen Energy 40 (45) (2015) 1353-1366, https://doi.org/10.1016/j.ijhydene.2014.11.111.