#### Abstract

The trajectory tracking problem of a proton exchange membrane (PEM) fuel cell is considered. To solve this problem, an optimal controller is proposed. The optimal technique has the objective that the system states should reach the desired trajectories while the inputs are minimized. The proposed controller uses the Hamilton-Jacobi-Bellman method where its Riccati equation is considered as an adaptive function. The effectiveness of the proposed technique is verified by two simulations.

#### 1. Introduction

A fuel cell is an electrochemical device that converts chemical energy stored in fuel into electricity. PEM fuel cells have seen a great amount of development in recent years. Fuel cell integrated to renewable energy systems offers many socioeconomic benefits. Understanding the behavior of PEM fuel cell stacks at varying loads is vital for the control of the efficiency.

There is some research about controllers applied to PEM fuel cells. In [1], a nonlinear-control strategy for PEM fuel cells by using the exact linearization approach is presented. In [2], a nonlinear controller is designed based on the proposed model to prolong the stack life of the PEM fuel cells. In [3], a higher-order sliding-mode supertwisting algorithm has been designed to control a motor that drives a compressor designed to feed the 33 kW fuel cell with air. Therefore, the controllers design to improve the performance of the PEM fuel cells would be of great importance; and none of the above researches introduces an optimal controller.

There are some works about control. Fuzzy controls for nonlinear systems are proposed in [4, 5]. In [6–10], robust controls of nonlinear systems are introduced. The bang-bang optimal control problem associated with hydraulic systems is addressed in [11]. The research of [12] deals with multiobjective optimization techniques for a class of hybrid optimal control problems in mechanical systems. In [13, 14], optimal controls of robotics arms are considered. None of the above studies is applied to PEM fuel cell; thereby, in this study, an optimal controller of a PEM fuel cell is introduced. The proposed controller uses the solution of the Hamilton-Jacobi-Bellman equations where its Riccati equation is considered as an adaptive function; that is, in other papers, the Riccati equation is solved in an inverse form using the final conditions, while in this paper, the Riccati equation is solved in a forward form using the initial conditions.

This paper is organized as follows. Section 2 presents the modified PEM fuel cell dynamic model which includes an external load. In Section 3, the optimal control of the PEM fuel cell is designed. In Section 4, the optimal method and dual proportional-derivative technique are compared by two simulations. Section 5 presents conclusions and suggests future research directions.

#### 2. Modified PEM Fuel Cell Dynamic Model

In this section, the PEM fuel cell dynamic model of [1] is described; it will be used in the following section for the control design. Furthermore, the PEM fuel cell dynamic model is modified to include an external load which makes it more approximated with the real process.

The following assumptions are applied to construct the simplified dynamic model for the PEM fuel cell [1]. The gases are ideal. The water management and the humidification of system are not considered in this paper. The oxygen flow rate is determined by the hydrogen-oxygen flow ratio from the reformer. The stack temperature is regulated 80°C by using an independent cooling system. The Nernst equation is applied.

##### 2.1. Modified PEM Fuel Cell Output Voltage Equation

The output stack voltage defined as a function of the stack current, reactant partial pressures, fuel cell temperature, and membrane humidity, is as follows [1, 2, 15, 16]: where is the thermodynamic potential of the cell or reversible voltage based on the Nernst equation, is the number of cells in the stack, is the cell-open-circuit voltage, is the operating temperature, , , and are the partial pressures of hydrogen, oxygen, and water gas inside the cell, respectively, is the gas constant (8.3144 J/K), is the Faraday constant (96439 C/mol), is the standard pressure (101325 Pa), and is the voltage loss due to the reactions of the electrodes surface. is the ohmic voltage drop from the resistances of proton flow in the electrolyte. is the voltage loss from the reduction of concentration gases or the transport of a mass of oxygen and hydrogen. The equations are given as follows [2, 15, 16]: where , is the output current density, is the internal current density related to the internal current losses, is the exchange current density related to activation losses, is a charge transfer coefficient, is the area-specific resistance related to resistive losses, and and are constants in the mass transfer voltage.

In this study, the output stack voltage of (1) is modified with the consideration of an external load as can be seen in Figure 1.

It is described as follows: where , , and are defined in (2), (3), and (4), respectively, is the load voltage, is the output current density, and is the load resistance.

##### 2.2. State Equations

The partial pressures of hydrogen, oxygen, and water on the cathode side are defined as the state variables of the system, and the relationship between the inlet and the outlet gases is as follows [1]:

Anode:

Cathode:

From the ideal gas law, it is known that the partial pressure of each gas is proportional to the amount of gas in the cell, to which there are three relevant contributions depending on the gas inlet flow rate, gas consumption, and gas outlet flow rate. Thus, the state equations are [1] where , is the cell active area, is defined in (2)–(4), is the operating pressure, is the anode volume, is the cathode volume, and are defined in (1), , , and are the inlet flow rates of the hydrogen, oxygen, and water of the cathode, respectively, and , , and are the partial pressures of hydrogen, oxygen, and water inside the cell, respectively.

##### 2.3. The Final System

The water input is not considered in the state equations because it is not an input of the process in most of the applications. Defining the states as , , and , the inputs as , , and and the output as give the following state space system: The nonlinear system (9) is rewritten as follows: where , , , , , , , , , , , , .

*Remark 1. *The dynamic model is proposed by [1]. Notwithstanding, the PEM fuel cell with an external load is proposed in this study.

#### 3. Optimal Control Applied to PEM Fuel Cell

In this section, the optimal control of the PEM fuel cell is designed.

Define the reference model as follows: where is the desired reference and is defined in (10). Subtracting (11) from (10), the closed-loop system is obtained as follows: where is the tracking error and , , and are defined in (10).

The following theorem presents the optimal control applied to the PEM fuel cell.

Theorem 2. *Consider the PEM fuel cell (10). Therefore, there exists an optimal controller to follow a desired behavior given as follows:
**
where ,, , , , , , , , , is a constant and positive definite matrix, is the system tracking error defined in (12), is a positive definite matrix,, , and are positive scalar varying with time parameters, and an adaptive equation is given as follows:
*

*Proof. *According to the optimal control technique [17, 18], a quadratic performance index is defined as
where is the average function and is a function of the final time. The Hamiltonian is defined as follows [17, 18]:
where . The equations to obtain the optimal control with the Hamilton-Jacobi-Bellman method are as follows [17, 18]:
Define the following quadratic performance index for the Hamilton-Jacobi-Bellman of this system [17, 18]:
where , , is the system input defined in (10), and is the final tracking error. Using (12) and (18), the Hamiltonian is
where and are defined in (10). Applying the first equation of (17) to the Hamiltonian (19), it gives the following optimal control function:
where is obtained by applying the second equation of (17) to the Hamiltonian (19) given as follows:
Define as follows:
Substituting (22) into (20), it gives the optimal control function (13). Substituting (22) and (13) into (21) and considering and (12), it gives the adaptive equation (14).

*Remark 3. *First, the process starts with the initial conditions of and ; the adaptive equation (14) is solved at a time to find ; then, the optimal control function (13) is solved at a time to find ; later, the fuel cell dynamic model (10) is solved to find . Then, the process starts again. The above-described process is directly solved using the software Simulink of MATLAB. is free in the numerical simulations because it can take different values without the requirement to remake additional calculus.

#### 4. Simulations

In this study, the dual proportional derivative control with nonlinear compensation of [19] called PD and the optimal control called Optimal are compared by two simulations. The objective is that the plant states reach a desired trajectory; that is, the states , , and of (10) should reach the desired trajectories , , and . The dual PD control is used because it yields good results for both continuous and noncontinuous set points [19].

The root mean square error (RMSE) is used for the controllers comparison; it is given as follows [13, 14, 20]: where is the tracking error and is the control function.

The parameters of the PEM fuel cell are given in Table 1 [1, 2].

The other parameters are , mA/cm^{2}, mA/cm^{2}, kcm^{2}, V, and cm^{2}/mA.

##### 4.1. Example 1

The dynamic model for the PEM fuel cell is given by (10) with , , states , , and , inputs , , and , and output , Pa being the initial conditions for the states; Pa from 0 s to 4 s are the desired references.

The gains of the PD technique are , , , , , , , and .

Optimal is given by (13), (14) with parameters , , , , , and ; is the initial condition of .

Figures 2, 3, and 4 show the trajectory tracking, control function, and output for Optimal and PD techniques applied to the PEM fuel cell, respectively. Table 2 shows the RMSE for the tracking error and control function.

**(a)**

**(b)**

**(c)**

**(a)**

**(b)**

**(c)**

From Figure 2, it can be seen that Optimal achieves better accuracy when compared with PD because the signals for the first follow better the reference signals than for the other. From Figures 3 and 4, it can be seen that Optimal is better than PD because the first reaches smaller inputs than the other. From Table 2, it can be observed that Optimal achieves better accuracy when compared with PD because the RMSE is smaller for the first than for the other.

##### 4.2. Example 2

The dynamic model for the PEM fuel cell is given by (10) with , , states , , and , inputs , , and , and output , Pa being the initial conditions for the states; Pa from 0 s to 1 s, Pa from 1 s to 2 s, Pa from 2 s to 3 s, and Pa from 3 s to 4 s are the desired references.

The gains of the PD technique are , , , , , , , and .

Optimal is given by (13), (14) with parameters , , , , , and ; is the initial condition of .

Figures 5, 6, and 7 show the trajectory tracking, control function, and output for Optimal and PD techniques applied to the PEM fuel cell, respectively. Table 3 shows the RMSE for the tracking error and control function.

**(a)**

**(b)**

**(c)**

**(a)**

**(b)**

**(c)**

From Figure 5, it can be seen that Optimal achieves better accuracy when compared with PD because the signals for the first follow better the reference signals than for the other. From Figures 6 and 7, it can be seen that Optimal is better than PD because the first reaches smaller inputs than the other. From Table 3, it can be observed that Optimal achieves better accuracy when compared with PD because the RMSE is smaller for the first than for the other.

#### 5. Conclusion

In this paper, the optimal controller applied to the PEM fuel cell was presented. The simulations showed that the optimal controller achieves better performance when compared with dual proportional-derivative technique for the trajectory tracking and inputs minimization. As a future work, some parameters in the controller will be approximated using the intelligent systems [21–26].

#### Conflict of Interests

The authors declare no conflict of interests regarding all the aspects related to this paper.

#### Acknowledgments

The authors are grateful to the editor and to the reviewers for their valuable comments and insightful suggestions, which helped to improve this research significantly. The authors thank the Secretaría de Investigación y Posgrado, Comisión de Operación y Fomento de Actividades Académicas del IPN, and Consejo Nacional de Ciencia y Tecnología for their help in this research.