Online Soft Sensor of Humidity in PEM Fuel Cell Based on Dynamic Partial Least Squares

Online monitoring humidity in the proton exchange membrane (PEM) fuel cell is an important issue in maintaining proper membrane humidity. The cost and size of existing sensors for monitoring humidity are prohibitive for online measurements. Online prediction of humidity using readily available measured data would be beneficial to water management. In this paper, a novel soft sensor method based on dynamic partial least squares (DPLS) regression is proposed and applied to humidity prediction in PEM fuel cell. In order to obtain data of humidity and test the feasibility of the proposed DPLS-based soft sensor a hardware-in-the-loop (HIL) test system is constructed. The time lag of the DPLS-based soft sensor is selected as 30 by comparing the root-mean-square error in different time lag. The performance of the proposed DPLS-based soft sensor is demonstrated by experimental results.


Introduction
Proton exchange membrane (PEM) fuel cells utilize the chemical energy from the reaction of hydrogen and oxygen to produce electricity, water, and heat. They have advantages such as faster start-up, high power density, low emissions, high efficiency, a simple design, safe operation, and environmental friendliness. As alternative power generators, PEM fuel cells are the most suitable for transport applications and portable power generation [1]. Maintaining proper membrane humidity is one of the key requirements for PEM fuel cell to reach its optimum performance because ionic conductivity depends critically on the hydration levels. Specifically, greater hydration will result in greater conductivity and thus a more efficient cell. However, excess hydration levels will result in a layer of liquid water to be formed and a variety of performance and durability problems [2], including voltage loss at high current density due to porous passages to be blocked by liquid water, voltage instability, unreliable startup under freezing conditions, and so forth [3].
Online monitoring humidity in the fuel cell is an important problem in maintaining proper membrane humidity. But the cost and size of existing humidity sensors are prohibitive for online measurements. In situ visualization is essential for a better understanding of liquid water in PEM fuel cell. Several techniques have been developed for visualization of liquid water inside the membrane electrode assembly (MEA) [4,5]. These visualization techniques mainly include direct visualization [6,7], magnetic resonance imaging (MRI) [8], neutron radiography [9,10], and X-ray imaging techniques. Among these techniques, the direct visualization has the advantage of providing high temporal and spatial resolution information about water transport in the gas flow channels. But the PEM fuel cell system should have a transparent window to facilitate optical observation. MRI is a widely available, inherently three-dimensional output data and capable of visualizing water in opaque structures. MRI is employed to the in-plane direction of a PEM fuel cell and observed the formation and slow propagation of a dehydration front from the gas inlet side to the gas outlet side of the cell. Neutron radiography is highly sensitive to water and a well-established technique for studying the water distribution in the MEA. In-plane neutron imaging of an operating PEM fuel cell is employed and produced a time 2 The Scientific World Journal series of images to evaluate the water management of a fuel cell system. The X-ray image technique can give the temporal and spatial resolutions, especially that the use of synchrotron radiation makes it capable to reach higher spatial resolutions.
In situ visualization technique can detect the liquid water in PEM fuel cell and convert into membrane humidity. However, the equipment used in these techniques is usually valuable and is not economic to measure the membrane humidity online when PEM fuel cell is acted as power sources of portable applications. Soft sensor is an alternative approach to obtain the membrane humidity online. Soft sensors have been widely used in the industrial process control to improve the quality of the product and assure safety in the production. The core of a soft sensor is to construct a soft sensing model. At a very general level, one can distinguish two types of soft sensors, namely, model driven soft sensor and data driven soft sensor.
Model driven soft sensors are based on equations describing mass-preservation principles, water balances, energy balances, and reaction kinetics underlying the PEM fuel cell process. There have been some studies of the model driven soft sensor of membrane humidity in PEM fuel cells. Pukrushpan et al. [11] developed a lumped parameter model for estimating relative humidity of the electrodes. A nonlinear estimator was developed for the estimation of membrane humidity and the pressure and inlet and outlet temperature at the electrodes. The estimation filter was also used to implement a feedback controller to regulate the excess oxygen ratio during changes in load [12]. Arcak et al. [13] developed a nonlinear observer for fuel-cell hydrogen estimation. Görgün et al. [14] developed an algorithm for estimating the membrane humidity in PEM fuel cells. Vepa [15] has applied nonlinear extended Kalman filtering to the estimates of the states of a PEM fuel cell.
However PEM fuel cell process is generally quite complex to model and are characterized by significant inherent nonlinearities, and model driven soft sensor may fail to provide satisfactory prediction performance when the process is operated under a wide range. Consequently, there has been an increasing interest toward the development of datadriven soft sensors using multivariate regression techniques. Because data-driven soft sensors are easy to develop and to implement online, they are potentially more attractive than model driven soft sensor. In this paper, we adopt data-driven soft sensors based on partial least squares (PLS) method because this method is one of the widely used regression techniques and its successful application to the development of soft sensors has been reported for different processes [16][17][18][19].

Partial Least Squares (PLS) Regression.
We briefly review the standard PLS in order to establish soft sensor model. Let be the × data matrix of predictors measured on samples and the × multivariate response data matrix with variables from the same samples. We assume that both of and are centered across the columns. PLS regression is typically based on the basic latent component decomposition.
Assume that and are linearly related by where is the coefficient matrix and is the noise matrix with appropriate dimensions. PLS regression is typically based on the basic latent component decomposition: where ∈ × is a matrix for the latent components and matrix ∈ × and ∈ × are known as the loading matrices. Matrices and are the corresponding residual matrices with appropriate dimensions. Equation (2) formulates the PLS outer model. The final goal of PLS is to describe as much variation of as possible and at the same time get a useful relation between and . The latent component matrix is defined as where ∈ × is a direction vectors, so that we have the prediction model PLS requires finding the columns of = ( 1 , 2 , . . . , ) from successive optimization problems. The criterion to find the th direction vector for univariate is formulated as where = and = / is the sample covariance matrix of .
There are two main formulations for finding PLS direction vectors which were originally derived from an algorithm, known as nonlinear iterative partial least-squares NIPALS [15], without a specific optimization problem formulation. Subsequently, a statistically inspired modification of PLS, known as SIMPLS, was proposed with an algorithm by directly extending the univariate PLS formulation.

Dynamic PLS.
The PLS regression implicitly assumes that they are independent between the current and past observations. This assumption is not valid in PEM fuel cell processes because the membrane humidity at an instant can result from the cumulative effects of past process conditions, such as temperature, pressure, and flow rate. Dynamic PLS is an extension of PLS which can be implemented by augmenting each observation vector with previous observations and stacking the predictor matrix in the following way: where is the -dimensional observation vector in the training set at time instant and −1 is the -dimensional observation vector in the training set at time instant − 1.
Using the predictor (ℎ) in PLS regression a dynamic PLS (DPLS) model will be obtained [14]. Including such time lags in the predictor data can provide information on the dynamic process conditions to the model.

Data Preprocessing.
DPLS-based soft sensor is data dependent. As a consequence, it is very important for analyzing and preprocessing the data used for PLS model calibration and validation. First, abnormal data need to be detected and removed from the dataset, as they will result in a DPLS-based model which is not representative of the ordinary process behavior [17]. Second, a suitable scaling procedure needs to be adopted [15].
Measurement noise causes errors in model estimation and has therefore to be dealt with by increasing the signal to noise ratio (SNR) of the data. A data variable is smoothed by using a weighted sum of previous measurements in a window of finite length (finite impulse response (FIR)): where is the filter length, are the filter coefficients, and is the denoised sample. If all previous measurements are used then an infinite length (infinite impulse response (IIR)) filter is obtained. An example of an IIR filter is the exponentially weighted moving average (EWMA) filter that is recursively implemented as where is an adjustable smoothing parameter with values between 0 and 1.
Outliers can be defined as samples that are not consistent with the majority of the data. Generally, there are two ways to treat outliers. The first one relies on detection and replacement of outliers with some reasonable values while the second one uses advantages of robust techniques for model parameters estimation which are less affected by presence of outliers in the data set.

Hardware-in-the-Loop Test System
How to get the data of the membrane humidity is the most important problem when the DPLS-based soft sensing is applied to the estimation of the membrane humidity in PEM fuel cell. High-resolution soft X-ray radiography can be used to observe the liquid water in single cell [18]. A vanadium thin-film was used as the target material for generating soft X-rays. The cell was carefully fixed on a computer controlled four-axis stage that was able to move in the , , and directions with a resolution of 1 mm and rotate around the -axis. The liquid water thickness was calculated using a dry image and an image with liquid water as references. Moreover, the liquid water thickness can be transformed into the membrane humidity and this method can be applied to the PEM fuel cell stack.
At present high-resolution soft X-ray radiography is not equipped in our laboratory. In order to obtain data of membrane humidity a hardware-in-the-loop (HIL) test system is set up. HIL test system is a well-established technique and increasingly being used as cost-effective means for rapid prototyping, integration, and validation of complex engineering systems. HIL test system is a real-time test methodology where real subsystem parts of a complex engineering system are coupled together with the numerical models of the remaining subsystems to form its complete representation. The schematic diagram of HIL test system is shown in Figure 1. In Figure 1 the test bench is FCATS G500 (GreenLight In. Co., Canada). The measurement unit is used to gather signals from FCATS G500. The control unit has two functions. One is to estimate the relative humidity an and ca , the others are to control the flow rate of cooling water cool , flow rate of compressed air cp , and flow rate of humidifier inj . The measurement unit and the control unit are developed by out laboratory. Based on the xPC Target product of MATLAB Target PC is used to obtain data of membrane humidity. There is a board, which is PCI6221 produced by National Instruments, in the industrial control computer to acquire data from FCATS G500. The water balance model of PEM fuel cell is built in the Target PC by using MATLAB, Simulink, and Real-Time Workshop. Target PC and the control unit are communicating through 4 The Scientific World Journal  controller area network (CAN) protocol. The real HIL test system is shown in Figure 2 and the real measurement unit and control unit are shown in Figures 3 and 4.
The relative humidity in anode and cathode an and ca is calculated by where V,an and V,ca are the partial pressure of vapor (kPa) in anode and cathode and sat,an and sat,ca are the partial pressure (kPa) of saturation vapor in anode and cathode. According to ideal gas law, the partial pressure of vapor in anode and cathode V,an and V,ca are calculated by where V,an and V,ca are the vapor mass (kg) in the anode and cathode, respectively, V is vapor gas constant, st is temperature (K) in fuel cell stack, and an and ca are the volume (cm 3 ) in the anode and cathode. The water masses in the anode and cathode are given by where V,mbr is the water transport through the membrane from the anode to the cathode, inj is the mass flow rate of injected water from humidifier, V,an,in and V,ca,in are the mass flow rate of inlet vapor in the anode and cathode, V,an,out and V,ca,out are the mass flow rate of outlet vapor in the anode and cathode, and H 2 O,gen is the mass flow rate of water generated in the fuel cell stack.
The governing equation for hydrogen, oxygen, and nitrogen can be written as [8] where H 2 ,in is flow rate of inlet hydrogen, H 2 ,out is flow rate of outlet hydrogen, N 2 ,in is flow rate of inlet nitrogen, N 2 ,out is flow rate of outlet nitrogen, H 2 ,rct and O 2 ,rct are the mass flow rate of hydrogen and oxygen consumed in the reaction respectively, O 2 ,in is flow rate of inlet oxygen, and O 2 ,out is flow rate of outlet oxygen.
In the cathode, inlet mass of oxygen, nitrogen, and vapor is related to mass flow rate and humidity of inlet air: The Scientific World Journal 5 where cp is flow rate of inlet air by using compressor, O 2 and N 2 are oxygen mole fraction and nitrogen mole fraction of dry air, and Ω atm is humidity ratio of air. The pressure of cathode is the sum of the partial pressure of oxygen, nitrogen, and vapor: According to ideal gas law, the partial pressure of oxygen, nitrogen, and vapor is where O 2 is oxygen gas constant and N 2 is nitrogen gas constant.
Outlet gas flow rate in cathode is calculated by ca,out = ca,out ( ca − rm,ca ) , where rm,ca is the pressure of return manifold in cathode.
The mass flow rate of each species out of the cathode is calculated as where ca = O 2 + N 2 +( V,ca ca V )/( st ) is the total mass of the cathode gas. The mass flow rate of hydrogen and oxygen consumed in the reaction and water generated in the reaction is calculated by , where st is the stack current. The outlet hydrogen and vapor mass flow rate is calculated by the following equations: (1 + Ω an,out ) an,out ,  Figure 5: The schematic diagram of the relative humidity's soft sensor.
The water transport across the membrane is achieved through two distinct phenomena: electro-osmotic and backdiffusion. Combining the two water transport mechanisms, the water transport through the membrane is given by The electro-osmotic drag coefficient and the diffusion coefficient vary with humidity in the membrane [8,20]: where = ( an + ca ) 2 . (24)

Experimental Results
In this section the DPLS-based soft sensor is applied to the membrane humidity prediction in PEM fuel cell. The schematic diagram of the membrane humidity's soft sensor is shown in Figure 5. In Figure 5 stack temperature and flow rate of humidifier inj are controlled by PID controller. The control method of flow rate of compressed air cp is the feedforward control. Soft sensing of the membrane humidity can be carried out by using stack temperature , stack current st , stack voltage st , flow rate of cooling water cool , flow rate of compressed air cp , and water flow rate of humidifier inj . Flow diagram of the proposed soft sensor is shown in Figure 6. The development of practical online prediction soft To investigate the fitting and predicting ability of a DPLS model, the root-mean-square error of calibration indicates the fit of the model to the calibration data [16]. It is defined as where thêis the value of the predicted variable when all samples are included in the model formation and is the number of calibration samples. The RMSEC for different numbers of time lags of the DPLS algorithm is shown in Figure 8. The time lag of the DPLS-based soft sensor is selected as 30. In the training stage DPLS is implemented by using CVX software [21].
After the parameters of DPLS-based soft sensor are trained this soft sensor is applied to predict ca and an . The prediction of ca and an under the condition of stepped current is shown in Figure 9. The stack current is stepped from 10 A to 50 A in the instance of 300 seconds. The figure indicates that the proposed DPLS based soft sensor performs well and can estimate ca and an accurately. during 4500-4800-second time period, and steps down to 20 A during 4800-5000-second time period. Experimental result is shown in Figure 10. The error between measured relative humidity and soft sensor's relative humidity with multiple stepped change of stack current is less than 0.15. These results demonstrate that DPLS-based soft sensor is available to predict humidity of anode and cathode in the continuous change of the stack currents. Speed-up is an important working condition when PEM fuel cell is applied to automobile. The soft sensor is tested in the speed-up condition and the typical change of stack current is shown in Figure 11. Figures 12, 13, 14, and 15 show the comparison of measured and soft sensor's relative humidity in the speed-up conditions when relative humidity in cathode is set from 0.95 to 0.65. These results demonstrate that DPLS-based soft sensor is available to predict membrane humidity in the speed-up condition when relative humidity of cathode is set in different humidity. All these experimental results show that the proposed DPLS-based soft sensor is feasible to estimate the humidity in PEM fuel cell and is an effective way to control relative humidity in cathode.

Conclusions
In this study, a DPLS-based soft sensor was developed for a PEM fuel cell in order to predict the membrane humidity. In order to obtain dataset which trains the soft sensor a HIL test system is constructed and demonstrates the feasibility and accuracy of DPLS-based soft sensor. The DPLS-based soft sensor is tested in different working conditions of PEM fuel cell. Experimental results display that the proposed DPLSbased soft sensor is feasible to estimate the humidity in PEM fuel cell and is an effective way to control relative humidity in cathode.