Keywords

1 Introduction

On the 10th of November 2018, the European Commission presented the new joint energy strategy of the European Union, which proposes to provide competitive, sustainable and safe energy. The new framework agreed by the European Council sets the European Union’s target to at least 27% in terms of renewable energy share in the EU by 2030.

Considering the increase estimates of the number of passenger vehicles by 2050, to 273 million in Europe and to 2.5 billion worldwide, a quasi-total decarbonization cannot be achieved only through development or efficiency increases for the current internal combustion engines (ICE), or only by using alternative fuels. The National Center for Hydrogen and Fuel Cells (NCHFC) has dedicated laboratories for PEM fuel cells. The laboratories are specialized on the development of fuel cells and stacks of high performance and the study of their behavior in different operating conditions with the purpose of improving their functional performances. The activities that are carried out in the laboratories are related to:

  • Development of batteries and fuel cell stacks in different construction variants for low and high temperatures;

  • Study of the behavior of fuel cells in transient regimes, repeated on-off cycles;

  • Studies on the behavior of fuel cells for low temperature operation;

  • Improvement of the functional performances of the fuel cells in the case of supplying gas mixture with different concentrations of toxic gases, both on the anode and cathode inlets, which simulate their real operating conditions;

  • Optimization of the functional parameters for electricity production during load variations using DC/DC or DC/AC converters with adapters for input impedance.

At present, in the transport sector, the technology of electric or hybrid vehicles with direct power supply from the network is constantly expanding.

The Romanian state facilitates the purchase of Evs and PHEVs by offering support vouchers, so that the prices are similar to those of vehicles with internal combustion. In addition, both state agencies and private traders offer free EV & PHEV charging solutions, all to encourage clean transportation—this free charge is expected to be discontinued as EV & PHEV numbers increase abruptly, thus energy consumption will have to be managed properly, including through pricing.

In this context, the integration of the PEM fuel cell for EV & PHEV aims to replace fossil fuels, with a significant impact on the environment. Fuel cells are electrochemical devices that convert the chemical energy of a fuel (hydrogen) into electricity. Fuel cells are considered to be a viable solution when it comes to alternative energy sources. In recent years, there is an increasing interest for green energy and renewable energy, this topic being the focus of many research centers.

The fuel cell having a proton exchange membrane was invented in the 50 s. Currently, this fuel cell is used in mobile applications, such as the automotive field, for powering electrical portables, as well as for stationary electricity generation systems. The power of these cells varies between 1 and 100 kW.

In the case of proton exchange membrane fuel cells, the electrolyte is a very thin membrane. The most used material for the membrane is Nafion. The electrodes are made of woven or carbonic paper on which fine particles of the catalyst (usually platinum) are deposited.

The following reactions occur at the electrodes:

  • At the anode: \(2H_{2} \to 4H^{ + } + 4e^{ - }\)

  • At the cathode: \(O_{2} + 4H^{ + } + 4e^{ - } \to 2H_{2} O\)

The operating temperature is about 80 °C.

The fuel cells domain is an objective of the big companies in the automotive field, hence, in order to reduce the costs, it is desired to develop fuel cell emulators using HIL and PHIL technology. In the literature, different mathematical models are presented related to integrated automotive applications simulated with Opal RT technology.

This chapter has as main objective the classification of PEM fuel cells, as well as the mathematical modeling and real time simulation of a PEM fuel cell using Opal RT technology.

As the topic of the book suggest, the mathematical modeling of the fuel cell represents a numerical method used for describing the functioning of a fuel cell, which converts chemical energy into electric energy.

The model of the proton exchange membrane fuel cell presented in this chapter aims to achieve a real-time emulator of the fuel cell. The need for a fuel cell emulator is due to the still very high cost of fuel cells. The role of the emulator is to replace a real fuel cell [1]. It allows the real time simulation of the fuel cell’s output voltage in both steady state and transient regime.

Fuel cells are considered as the energy sources of the future, representing a very active research field, but taking into account that there are some aspects to be improved, such as: cost, life time, etc. [2]. The emulator can be used in diagnosis or when it is desired to integrate a fuel cell into a real system, therefore the risk of fuel cell damage or destruction is excluded. The emulator also allows the validation of the fuel cell’s auxiliaries as well as the control methods before their implementation in a real system.

This chapter is structured as follows: in Introduction, the authors present the main objective of this chapter; in the second part, the research location with its main infrastructure is described; the third part consists of the mathematical modeling of the fuel cell and it is followed by the presentation of the Opal-RT simulator in the fourth part; in the fifth and last part, the conclusions are drawn and future developments are presented.

Based on its experience in the field of hydrogen and fuel cells, the ICSI Energy department aims to develop stationary and mobile applications that make use of hydrogen and fuel cells. In this context, comparing the classical system of electricity production with the system of electricity generation based on fuel cells, the following can be observed:

  • If H2 is obtained through renewable energy sources, the fuel cells produce electricity without generating CO2 emissions and does not pollute, thus reducing the greenhouse effect;

  • The efficiency of a fuel cell-based system (including also the electric power consumed by the auxiliary components) decreases down to 40–45%;

  • The fuel cell-based system is small in size. This system is relatively compact, precisely due to the conversion of electrochemical energy into electricity in a single stage.

2 Fuel Cell in ICSI Energy

ICSI Energy initiated in Romania the research activity in the production, storage and applications of hydrogen and fuel cells. At the same time, ICSI Energy represents a research and development facility having the mission to implement, develop and disseminate in Romania the energy technologies based on hydrogen, but also to support the national priorities in the field of energy and environment.

Researchers from the “Production and mobility of hydrogen” department focused on the development of technologies, products and services that compete to achieve a “hydrogen economy” in Romania. Based on the research infrastructure within the department, solutions were developed for hybrid mobility by carrying out experimental-demonstrative research that led to functional models which confirmed the degree of technical and commercial performances of hydrogen-based vehicles.

A special attention was given to PEM fuel cells due to the advantages of having a low operating temperature, a solid electrolyte and a compact shape. PEM fuel cells are used in a wide range of mobile and stationary applications, for example: cars, scooters and bicycle manufacturing industry, golf cars, utility vehicles, aerospace programs, military applications, ships and submarines, fuel cell powered locomotives, production of electrical energy both for domestic consumers and for the national electrical grid, being able to generate in the system powers between 1 and 33 kW. Within the department, there is an undergoing project related to the integration of PEM fuel cells into mobile charging stations for electric vehicles.

This study is part of the research activities within the project won by competition 36PCCDI/2018 with the title “Intelligent conductive charging stations, fixed and MobiLe, for electric propulsion transport” (SMiLE-EV), related to “Methods to simulate the functioning of the PEM fuel cell”.

The concept of fuel cell-based vehicle represents a huge leap in the automotive field, for a quasi-total decarbonization that cannot be achieved only through development or efficiency increases for the current propulsion systems based on internal combustion engines or only by using some alternative fuels. The lack of hydrogen supply infrastructure, as well as the cost of hydrogen production that is still high, represent a barrier in the series implementation of fuel cells and hydrogen-based vehicles [3].

Car manufacturers have approached this Green to Green concept by showing the real benefits of using hydrogen as an alternative fuel. Currently, Toyota Motor Corp. developed a series standard hybrid electric car (FC-Bat). Based on the use of innovative simulation techniques [4,5,6] regarding the integration of fuel cells in the hybrid system, Toyota constantly reports the progress regarding the implementation of this technology [7, 8].

The increased attention of car manufacturers in the development and implementation of a new fuel cell concept derives from the following key factors: fuel cell is not polluting; it has high efficiency and high performance. Of course, worldwide, it has been found that there is a need for an environmentally friendly energy source, and the one having as waste water represents a viable candidate. The energetic performance of fuel cell-based vehicles remains a complex issue as the dynamics of the proton exchange membrane fuel cell is relatively slow for automotive applications. In order to overcome this major disadvantage, it is necessary to store the excess energy in a battery or in an ultracapacitor. This will maintain performance during peak power requests, which are taken over by the ultracapacitor. Using one of the energy storage solutions mentioned above, efficiency problems are also solved by recovering power during the deceleration of the vehicle [9, 10].

When designing the entire complex assembly of the hybrid vehicle with fuel cells, advanced techniques of modeling, design and testing are used, taking into account the behavior of the fuel cell, the battery, the converters and the propulsion system, as a whole unit, in different operating and functioning regimes [11, 12]. In research/design, analysis techniques based on mathematical models are used to develop control systems dedicated to hybrid vehicles. This is due to the fact that the equipment is expensive, the development cycles are relatively short and, last but not least, due to the fact that the hybrid vehicles cu fuel cell—battery systems represent a new research direction in the automotive field.

The model-based control system requires an exact mathematical model of the different fuel cell-based hybrid vehicles (FCHV) subsystems. The modeling, development and testing of an FCHV is carried out on several levels. It starts from the modeling, dimensioning and control of each subsystem and, finally, the general optimization and control of the FCHV system [13, 14] is achieved through standard simulation or using hardware in the loop (HIL) simulators. In this study, the authors used Opal RT technology dedicated to real-time simulation of the proposed PEM fuel cell model.

3 Mathematical Modeling

Based on the literature study for the fuel cell as an important FCHV component, there are several mathematical models [15, 16]. In some cases, the mathematical models are not applied for the equilibrium state [17, 18], but, in most cases, these are equilibrium state models [13], mainly used for component sizing [19], cumulative fuel consumption [20], optimization of operating points or hybridization studies [21] and models of simulation [22]. The transient model has already been described as being dependent on temperature change. By applying small variations of current or a stepped load to the output terminals of the PEMFC, a dynamic of the behavior of a PEMFC stack (or cells) can be obtained [23, 24].

In recent years, through the use of advanced numerical computing algorithms, it has been possible to model PEMFC systems and individual components with better accuracy.

From the mathematical modeling point of view, for the PEMFC several components must be considered simultaneously: fluids that have multiple aggregation states and multi-dimensional flow, mass and heat transfer and electrochemical reactions. An example of a detailed dynamic model of fuel cells given in [13, 25, 26] includes reactant stoichiometry, hydration and voltage modeling in a single fuel cell and in a stack, but without taking into account the thermal effect on the PEMFC performance [27, 28].

A complete mathematical model is needed in order to characterize all physical, chemical and even mechanical simulations to better understand the complex phenomena that occur in an integrated FC system [11]. Moreover, a complete mathematical model is very important in the design, optimization and realization of a PEMFC.

The development and testing of a complex hybrid system are usually performed at several levels, starting from the individual subsystem sizing and control and ending with the general system optimization and control in standard and HIL simulation. Due to the size of the model and the technique of simulation used, the subsequent optimization and testing steps may take a longer period of time.

The mathematical model must be robust, accurate and provide fast solutions in the event of problems. For a wide range of operating conditions, the model must be able to determine PEMFC performance. The most important physical parameters of the cell to be included in a mathematical model for PEMFC are: the cell (physically—the parameters), the potential of the cell, the temperature, the pressure and the flow rates of the fuel and the oxidant, as well as the stoichiometry of the reactants.

One-dimensional mathematical models for thermal response and water management have been proposed, dynamic models to predetermine internal performances using the electrochemical reaction and the dynamic thermal equation. Two-dimensional models are also developed in order to determine PEMFC performances above and within (y–z axis) or along gas channels (x–z axis), but also three-dimensional mathematical models for evaluating PEMFC performances on all three axes (obviously, with the application of modeling restrictions in two or three dimensions) [29].

3.1 Modeling Criteria for a PEMFC Stack

By type: analytical, empirical or semiempirical. The equations distinguished in a mathematical model of a fuel cell can be: analytical equations, semiempirical equations and empirical equations [30, 49].

Analytical models. An analytical model uses the fundamental physical equations that allow the direct writing of the desired phenomenon. All parameters from the equation have a well-defined physical explanation. These equations are not specific only for a particular type of fuel cell, they also represent basic equations used for describing a phenomenon, which can be found in all types of fuel cells [31]. In the analytical models, the parameters are determined directly, starting from the material’s physical characteristics from which the stack is made. For some situations, the characteristics or properties of a certain material cannot be easily measured or determined. In this case, the physical parameters can be obtained based on some laboratory experiments for the modeled stack. Thus, for each modeled cell, the parameters of the governing equations could be simplified and extracted according to experimental data. This type of model is the most general and easiest to understand for fuel cell modeling [15].

Semiempirical models. In the case of semiempirical models, the fundamental equations are maintained for given physical phenomena, but some of them are modelled starting from experimental tests. These empirical equations are obtained for a given material and well-known test conditions. However, they cannot be used outside the experimental validated conditions, so the model loses some of its generality. However, in this type of model, the analytical equations represent the majority of the equations used.

Empirical models. An empirical model mainly uses empirical equations determined by experiments. The conditions used for the validation of the model are quite restrictive. However, the empirical equations are considered to be simpler when using this model type. For some situations, the empirical equation is represented by an interpolation. These empirical equations could also be extracted from the simplification of the base equations, given the specified test conditions.

By spatial dimension: 0-D, 1-D, 2-D, 3-D. A fuel cell can be developed according to needs with different spatial dimensions, described below [30].

0-D. A zero-dimensional model does not contain any equation including spatial dimension (x, y, z in the Cartesian plane). The physical equations of the model allow the description of the scalar variables, such as the voltage of a cell, the total amount of pressure from each channel, but they are not able to give the spatial distribution of a parameter like the temperature distribution for each cell. This type of model is frequently implemented in order to determine the polarization curve of a fuel cell.

1-D/pseudo 2-D. Compared to a zero-dimensional model, a 1-D model is able to describe on a spatial axis the physical phenomena [28]. The spatial axis is considered to be in the gas diffusion direction. With this type of model, the electrical, thermal and fluidic phenomena can be described according to the axis on which the diffusion takes place. For example, the distribution of water in the membrane can be obtained. The thermal effects can be introduced in this type of model in order to predict the temperature profile of each cell. However, the use of only one axis in modeling can limit the fluidic effects in the channels, since the direction of fluid in channels is perpendicular to the direction of gas diffusion. The 1-D and 2-D pseudo models described below are the most found models from the specialized literature. A pseudo 2-D model is similar to a 1-D model, but it also allows the description of fluidic pheromones in channels according to the fluid axis. Even so, the psuedo 2-D model cannot be considered a real 2-D model. We can observe two modeling axes in the model, but in a specific place, like the gas channels, there is only one modeling axis used for the model [28]. Both axes cannot be combined, meaning that the pair of coordinates (x, y) does not make sense.

2-D. A 2-D model comprises two modeling axes in the fuel cell layers. The two axes are chosen to be orthogonal axes in the fluid flow direction in the channels, which allow the clear modeling of the fluid field in 2-D channels. This type of model allows the study of several types of channels (straight, winded, inter-digital, etc.), and cannot be studied using a 1-D model. For the correct modeling of physical phenomena in 2-D through finite elements or finite volumes, fluid dynamic calculation (CFD) methods are applied.

3-D. A 3-D model is a complete model for a fuel cell. This type of model takes into account the three spatial axes for modeling the fuel cell [32]. With this type of model, the phenomena are described more precisely, for example, the convection of gases towards the diffusion layers of gases in channels (diffusion axis) in the same time with the flow of fluids (axis in the sense of fluids flow), which can be modeled in detail. In addition, the distribution of current density in the electric field, the thermal and fluid fields can also be present in 3-D. The CFD method is required for this model and, due to its complexity, the computing time is quite high.

By temporal nature. A stack model can also be described according to its temporal nature: a static model independent of time and a dynamic model which is time dependent.

Static models. A static model allows the description of the phenomena in the stack in a permanent regime (the parameters do not vary in time) [28]. This type of model does not contain the time derivatives of the state parameters in the physical equations. It is implemented for modeling fuel cells in static applications (power plants, uninterruptible power supplies, etc.) when the dynamic of the load is quite slow. It can also be implemented either in simple models of the fuel cell (for example, 1-D) in all application areas or in 2-D, 3-D models that allow the description of static fields of physical sizes.

Dynamic models. A dynamic model of the fuel cell is similar to the physical reality [33, 34]. For this model, the differential equations with respect to time are presented in a single domain or in several physical domains [1]. It allows the description of the transient regime between two operating points of the fuel cell. The dynamics is required for the modeling of stacks in mobile applications (for example in the automotive field) where the load dynamic is relatively high [35, 36]. In general, a dynamic model is often associated with a 1-D model, because dynamic modeling of a 2-D or 3-D model by the CFD method is usually reduced to a cell, or part of a cell.

By modeled species: stack, cell, individual layer. A fuel cell can be broken down into several individual layers [37]. It is not necessary for all layers to be included in some models: modeling the fluid channels in gas layers does not imply the membrane modeling. For a detailed model, each layer is individually modeled according to its physical properties [37]. Individual layers form the main elements for modeling a fuel cell. However, the individual layers and their detailed phenomena can be neglected and only one cell of the fuel cell stack can be considered. In fact, a fuel cell is composed of several cells connected in series, thus forming a stack of cells, in the literature being known as stack. In the model, the stack can be considered in general case without detailing the individual behavior of each cell. Thus, we discuss about the equivalent medium cell, after which, according to the hypothesis, all the other cells behave in an identical way: the model is isotropic. A fuel cell model can be obtained by stacking individual cells, themselves representing individual layers [38].

By modeled phenomena

Physical domains: electrochemical, fluidic, thermal. A fuel cell is a multi-physical device that covers different physical domains: electrochemical (electric), thermal and fluidic [30]. A model can cover all these fields or a single physical domain depending on the objectives pursued. As the fuel cell is a device that produces electricity, the electric model is generally introduced in all fuel cell models. Fluid phenomena, such as convection or diffusion, have a significant influence on the fuel cell performance. In order to have a more accurate model, the fluid field must also be introduced. If the cell temperature is to be controlled, the temperature variation due to conduction, radiation and convection must be taken into account [39]. In this case, the thermal field must be considered in the model.

Individual layers phenomena. Different physical features can be distinguished in each individual layer of the fuel cell. A complete cell model can take into account all phenomena in equations, but most of the existing models in the literature comprise only a part of these phenomena.

A usual model of a PEM fuel cell is a combination of several criteria presented above. For example, a model can be 1-D, dynamically and analytically, comprising three different physical domains with different phenomena modeled at individual layers.

Mann et al. [40] have introduced a generic model that can be applied for different types of fuel cells with different characteristics and sizes. The active surface and the thickness of the membrane are introduced as generic parameters. However, this model remains an isothermal model under permanent regime. In addition, it has only the electrochemical model. The obtained results are validated with a Ballard fuel cell powered by H2–air and H2–O2.

Baschuck et al. [41] presented a model for studying the flooding phenomenon. A water layer is inserted between the gas diffusion layer and the catalyst.

The phenomenon of water diffusion in this layer is described by Henry’s law. The purpose of this model is to predict the polarization curve by considering the flooding phenomenon in the fuel cell. The membrane is considered to be completely hydrated and despite the fact that the model is isothermal and in permanent regime, the results obtained are comparable to the experimental ones. This model shows that if the air is used as a fuel the electrode flooding can be reduced (as compared to the use of pure oxygen) due to a higher gas flow through the cathode channel. The temperature variation is not taken into account in this model, the simulation can be done only under certain operating conditions (permanent regime). In this model, the dynamics of the fuel cell is not taken into account.

Djihali et al. [42] presented another model of the fuel cell, focused on modeling the non-isothermal and non-thermal effects. This model takes into account the diffusion of gas through the porous electrode, the water transport caused by electro-osmosis, the convection, the generation of heat and the transfer of heat into the cell. The model was first validated under isothermal and isobaric conditions, then a non-isothermal and non-isobaric analysis was performed. The distribution of temperature through the cell was higher for several proposed thermal conductivities. The influence of temperature and pressure on cell performance and water transport in the cell were studied. This model shows that temperature and pressure variation are important in a fuel cell. However, it is a permanent regime model, it does not allow the simulation and evolution of the temperature in the transient regime.

Shan et al. [22] presented a complete model of the fuel cell. Both static and dynamic behavior are analyzed considering an uneven distribution of temperature. A stack with 10 cells was simulated, but the simulation results were not experimentally validated.

Haddad et al. [43] proposed a dynamic, nonlinear model of the fuel cell. Their model is an isothermal model for a single cell. For gas diffusion, Fick’s second law was used in order to obtain the dynamic diffusion behavior. The electrical phenomenon was modeled through the electric circuit method in order to determine the activation losses, ohmic and double layer capacity. The effect of the variation of the electric load, the pressure and the humidification of the gas on the behavior of the fuel cell are analyzed and simulated. The fluid and cooling channels are not taken into account and the temperature is considered uniform.

Park et al. [1] have developed a dynamic model of a 20-cell stack. The effect of temperature and the effect of water in liquid and vapor state are taken into account. An analysis was made on starting the fuel cell. The start time allows the fuel cell to reach the nominal operating temperature, being proportional to the current required, the flow rate of the coolant and the temperature of the coolant. However, mechanical losses in supply channels and condensation in channels are not considered in this model. The results show a good dynamic response of the fuel cell, but the experimental validation of the dynamic response of the voltage and temperature of the battery was not achieved.

Pukuspran et al. [44] have developed a dynamic model designed for control. The model includes the characteristics of the flow and the dynamics of the air compressor, the dynamics of the volumes (the connections between different subsystems of the cell), the evolution in time of the partial pressure of the reactant and the water content of the membrane.

3.2 Fuel Cell Mathematical Modeling (Electrochemistry)

As mentioned before, the electrochemical reactions taking place in the same time in the fuel cell are the following:

At anode side: \(H_{2} \to 2H^{ + } + 2e^{ - }\)

At cathode side: \({\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 2}}\right.\kern-0pt} \!\lower0.7ex\hbox{$2$}}O_{2} + 2H^{ + } + 2e^{ - } \to H_{2} O\)

Overall: \(H_{2} + {\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 2}}\right.\kern-0pt} \!\lower0.7ex\hbox{$2$}}O_{2} \to H_{2} O\)

For the overall reaction, one can compute the enthalpy (or heat) of reaction, denoted with ΔH, being defined as the difference of the enthalpies of formation for products and reactants:

$$\Delta H = \left( {h_{f} } \right)_{{H_{2} O}} - \left( {h_{f} } \right)_{{H_{2} }} - {\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 2}}\right.\kern-0pt} \!\lower0.7ex\hbox{$2$}}\left( {h_{f} } \right)_{{O_{2} }}$$
(1)

where, \(\left( {h_{f} } \right)_{{H_{2} O}}\), \(\left( {h_{f} } \right)_{{H_{2} }}\) and \(\left( {h_{f} } \right)_{{O_{2} }}\) represent the heat of formation for water, hydrogen and oxygen. Using the values from Table 1, at 25 °C, the enthalpy is:

Table 1 Enthalpy and entropy for products and reactants of the fuel cell
$$\Delta H = - 286\;{\text{kJ}}\;{\text{mol}}^{ - 1}$$
(2)

The amount of enthalpy which can be transformed in electricity is given by the Gibbs free energy, defined by the following equation:

$$\Delta G = \Delta H - T\Delta S$$
(3)

where \(\Delta S\) is the entropy, which can be computed in a similar way with the enthalpy:

$$\Delta S = \left( {s_{f} } \right)_{{H_{2} O}} - \left( {s_{f} } \right)_{{H_{2} }} - {\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 2}}\right.\kern-0pt} \!\lower0.7ex\hbox{$2$}}\left( {s_{f} } \right)_{{O_{2} }}$$
(4)

\(\left( {s_{f} } \right)_{{H_{2} O}}\), \(\left( {s_{f} } \right)_{{H_{2} }}\), \(\left( {s_{f} } \right)_{{O_{2} }}\) representing the entropies for water, hydrogen and oxygen. Using the values from Table 1, at 25 °C, the entropy is:

$$\Delta S = - 0.163285\;{\text{kJ}}\;{\text{mol}}^{ - 1} K^{ - 1}$$
(5)

Therefore, the Gibbs free energy for the overall reaction, at 25 °C (298.15 K), is:

$$\Delta G = - 237.34\;{\text{kJ}}\;{\text{mol}}^{ - 1}$$
(6)

In order to obtain the theoretical fuel cell potential, we start from the general equation of the electrical work:

$$W_{el} = qE$$
(7)

where \(W_{el}\) is the electrical work, \(q\) is the charge and \(E\) is the theoretical potential. The charge \(q\) can be expressed as:

$$q = n * N_{AVG} * q_{el} = nF$$
(8)

where \(n\) is the number of electrons/molecule (for H2 there are 2 electrons), \(N_{AVG}\) is the Avogadro’s number (=6.022 * 1023 molecules/mol) and \(q_{el}\) is the electric charge of one electron (=1.602 * 10−19 C/electron); the product between \(N_{AVG}\) and \(q_{el}\) is known as Faraday’s constant (F = 96485 C/electron mol)

Therefore, taking into account that the Gibbs free energy corresponds to the total amount of energy given by a fuel cell, the electrical work can be expressed as:

$$W_{el} = nFE = - \Delta G$$
(9)

By extracting the cell potential from the previous equation, the theoretical fuel cell potential is:

$$E_{th} = \frac{ - \Delta G}{nF} = \frac{{237340\;{\text{J}}\;{\text{mol}}^{ - 1} }}{{2 * 96485\;{\text{As}}\;{\text{mol}}^{ - 1} }} = 1.23V$$
(10)

If the effect of pressure is also taken into account, the theoretical value decreases even further, according to the following equation:

$$E_{T,P} = E_{th} + \frac{RT}{nF}\ln \frac{{P_{{H_{2} }} P_{{O_{2} }}^{0.5} }}{{P_{{H_{2} O}} }}$$
(11)

where \(R\) is the ideal gas constant (=8.314 J mol−1K−1), and \(P_{{H_{2} }}\), \(P_{{O_{2} }}\) and \(P_{{H_{2} O}}\) are partial pressures. For example, for a fuel with a temperature operating point of 60 °C, the resulted value of the potential will be:

$$E_{T,P} = 1.189V$$
(12)

When the fuel cell is operating, but without a closed electrical circuit, one expects to get an open circuit voltage (OCV) approximately equal to the theoretical fuel cell potential previously computed. In reality, there are some voltage losses further discussed which lead to a value actually less than 1 V. If the circuit is closed, the potential decreases even lower. The main voltage losses are related to:

  • The activation polarization

  • Internal currents and crossover losses

  • The ohmic (or resistive) losses

  • The concentration polarization

Therefore, a good representation of the fuel cell potential can be given by the following equation:

$$E_{cell} = E_{T,P} - \frac{RT}{\alpha F}\ln \frac{i}{{i_{0} }} - \frac{RT}{nF}\ln \frac{{i_{L} }}{{i_{L} - i}} - iR_{i}$$
(13)

where: \(\alpha\) is the transfer coefficient, \(i\) is the current density, \(i_{0}\) is the exchange current density, \(i_{L}\) is the limiting current density and \(R_{i}\) is the total internal resistance of the fuel cell.

The theoretical fuel cell efficiency is given by the equation below:

$$\eta = \frac{\Delta G}{\Delta H} = 83\%$$
(14)

In reality, this efficiency is much smaller than the theoretical one due to several factors: heat, electrode kinetics, electric and ionic resistance, mass transport, fuel processor, power conditioning, balance of plant etc.

3.3 Testing and Simulation Infrastructure

For modeling and developing PEMFC single cells or PEMFC stacks, an OPAL-RT simulation system was purchased within the ICSI Energy department. The simulators are widely used, as it has been proven to be effective in developing, optimizing and testing new technical process management solutions for PEMFC. OPAL-RT includes the integrated software hardware for eMEGAsim, HYPERSIM, eFPGAsim, ePHASORsim [45]. The eMEGAsim software application is flexible and scalable, user-friendly, being a hybrid real-time simulator with analog and digital inputs and outputs and includes RT-LAB, ARTEMiS and RT-EVENT software. RT-LAB software is based on SimPowerSystem from MATLAB (SIMULINK) [46]. The great advantage of this software package is the fact that it meets the requirements of simulating the transient states of PEMFC and the electrical, electromagnetic and automation systems, in which PEMFC are integrated. SIL (software in-the-loop), HIL (hardware in-the-loop) and PIL (power in-the-loop) software is an important factor in PEMFC development and implementation, as it provides greater prediction and accuracy of the PEMFC behavior under different construction and operating conditions.

4 RT-LAB Multicore Simulator

RT-LAB is the real-time simulation software environment, which has revolutionized the model-based design mode.

Being flexible and scalable, RT-LAB can be used in almost any simulation application or control system, therefore adding computing power to the simulations. The RT-LAB software is fully integrated with MATLAB/Simulink.

The use of the OPAL RT Technology simulator is absolutely necessary because it can quickly correct the design errors before the physical implementation of the PEMFC hybrid system. In addition, the design time can be low if the parallelism is used in the implementation of the workflow. It is the indispensable tool for successful real-time simulations, such as: Hardware In-the-Loop (HIL) tests, Power In-the-Loop (PHIL) tests, Rapid Control Prototyping (RCP). The configuration of the OPAL RT simulator can be described as a distributed system in which the master PC manages all communications of both multi-targets and multi-host (Fig. 1).

Fig. 1
figure 1

OPAL-RT technology system

The ability to use multi-host allows the grouping of end-users per PC-host, thus facilitating ping of targets. The master PC has total control of the accessed simulator. The host PCs have access only to view the signals obtained from the simulator. The management of the inputs and outputs can be achieved through the designated processors, distributed in several nodes of the network.

Regarding the communication protocols, OPAL-RT has implemented the following standards: IEC 61850 (digital communication interface implementation to non-conventional instrument transformers using GOOSE), IEEE C37.118 (synchronized phasor measurements used in electric power systems Standards, Fig. 2) [47, 48], DNP3 Distributed Network Protocol (IEEE Std 1815TM-2012), OPC, SPECTRACOM, Ethernet communication, CanOpen, Foundation Fieldbus, RS232 serial communication.

Fig. 2
figure 2

Distributed architecture using C37.118 standard

CAN represents the communication protocol between OPAL-RT equipment and fuel cell. For this communication predefined Simulink blocks were used, available in RT-LAB/O/_CANdb_/Softing library:

  • OpCanAc2Recv—this block has the role of receiving the current signal;

  • OpCanAc2Send—through this block the state variables are sent (signals to be viewed on the interface);

  • OpCanAc2Controller.

Messages sent/received have a specific address, this address being specified in the block setting. Communication between the mathematical model and the CAN bus is made in the master subsystem.

The RT-Lab system is generally used to simulate electrical networks. RT-Lab proposes unique methods and specific solving solutions for real-time simulation in microseconds (μs). This feature is particularly important for models of AC networks (50/60 Hz) and for simulation of power electronics models (1 to 100 kHz). With RT-Lab, each period of an alternating voltage (current) or a PWM wave, can be simulated and observed in real time.

In recent years, the application areas for RT-Lab have started to converge, RT-Lab providing solutions for mobile applications. The real-time processor is the core of a real-time simulation platform. Its performance has a direct, very important impact on the overall performance of the system in real time. The RT-Lab system uses the Intel x86 processor family. This family includes Core2 Duo, Quad, Intel Xeon, etc. Typical tact frequency of processors is between about 2 and 3 GHz.

In most cases, real-time simulation of very complex mathematical models cannot be performed with the help of a single processor. RT-Lab offers simulation solutions distributed on several processors. The critical problem, in a multi-processor system, is the efficient synchronization of multi-core processing during real-time simulation. In a typical configuration, RT-Lab proposes a multi-core processor (up to 6 computing cores, such as Intel Xeon) for multi-core simulation. The model can be sent on different cores, in a single processor. The synchronization and exchange of data between different cores is done through a high speed L1 memory, integrated in the processor.

On a real-time simulation platform, the model of the real-time user program must be stored and loaded into the processor during startup. During the simulation, the model output data could be saved in the platform for post-processing. RT-LAB uses common PC hard drives for data/software storage. Therefore, storage capacity can reach up to several GB.

Real-time simulation platforms are widely used in loop hardware tests. In order to interact with the external environment, the real-time platform should have different input/output (I/O) ports. Those ports include analog and digital inputs/outputs, digital/analog converters, analog/digital converters, PWM wave generator, CAN bus controller (Fig. 3), RS232 port, I2C port.

Fig. 3
figure 3

PCI CAN-AC2 card used in the RT-Lab system for CAN bus communication

The device driver package is usually provided by a third-party company. Therefore, in some rare cases, there may be incompatibilities in the MATLAB/Simulink development environment.

RT-LAB uses a third-party Linux-based operating system—QNX. RT-Lab has modified the standard LINUX boot sequence to meet platform requirements over real time. It should be noted that LINUX is a standard x86 operating system, which is not just used for real-time simulations. In fact, the user can use standard LINUX commands on an RT-LAB platform like on a PC with LINUX operating system.

As it can be seen in the previous sections, RT-Lab uses the x86 PC and Linux standard to support their platform. Thus, the boot time of the system is close to that of a regular computer. After performing all the necessary actions: checking the BIOS, starting the different components, and loading the Linux, the boot time of an ordinary RT-Lab system, can take up to a minute.

RT-Lab uses MATLAB/Simulink (software developed by MathWorks) or LabVIEW (software developed by National Instrument) as a user monitoring interface, installed on the computer connected to the platform. RT-Lab does not offer its own interface among their solutions.

Method for implementing and testing the PEMFC mathematical model

The following methodology is a real-time test method with the aim of rapidly simulating a PEMFC under real conditions:

  1. 1.

    Create a new project

  2. 2.

    Build the model

    1. a.

      Subgrouping of the mathematical model into subsystems (Fig. 4)

      Fig. 4
      figure 4

      Grouping the model into subsystems

    2. b.

      Naming the subsystems

    3. c.

      Adding OpComm blocks

    4. d.

      Maximizing parallel execution

    5. e.

      Setting simulation parameters

  3. 3.

    Load the Model on OPAL RT Simulator

  4. 4.

    Execute the Model

  5. 5.

    Use the Console to Interact with the Simulation

  6. 6.

    Stop the Simulation

The models developed, implemented and simulated in the RT-LAB software are dedicated to mobile and stationary applications, being used mainly in areas such as: the automotive industry, the naval industry (fully electric powered ships), the railway industry (electric trains and rail electric network), in aerospace industry (robotics and ship propulsion), energy, robotics, civil engineering, etc.

In order to execute the mathematical models realized in MATLAB/SIMULINK on the RT-LAB platform using the OPAL-RT simulator, the following requirements must be met:

  • The mathematical models implemented in MATLAB/SIMULINK must run in SIMULINK without errors;

  • The models made must be grouped into three subsystems called: Master, Slave and Console, each subsystem running in a different core of the simulator processor. Master and Slave have a role in the calculation of the elements of the SIMULINK model, and the Console has the role of display and user interface. In Fig. 4 you can see the Master subsystem loading into a real-time target core, connecting to the Host PC via TCP/IP and loading the Console subsystem into the PC-host;

  • RT-LAB converts the SIMULINK model into C code;

  • In order to save time in executing the implemented routines, the OpComm block is used for all of the input signals in the subsystems. In Fig. 5 an OpComm block with a single entry is represented;

    Fig. 5
    figure 5

    OpComm block with one entry

  • The time step must be fixed for real-time running of the model. In choosing the step, the hardware capacity of OPAL-RT and the requirements of the model are taken into account;

  • Also, through RT-LAB, each subsystem (Master, Slave, Console) is loaded into the simulator cores.

Finally, the models are run with RT-LAB (Fig. 6) and analyzed in order to observe the behavior of the proposed system according to the conditions defined by the user.

Fig. 6
figure 6

PEMFC RT LAB model

The mathematical model was run in RT-LAB, and the results obtained demonstrate the efficiency of RT-LAB in designing and testing PEMFC.

5 Conclusions

Real-time simulations represent a great advantage in the field of research/design by corroborating three decisive factors: the speed of implementation, the flexibility in development, the predictability of the results. In this chapter, the OPAL-RT simulation system was presented as an alternative in demanding/developing PEM fuel cells.

The most important advantage of this simulator is the connectivity between RT-LAB and MATLAB/Simulink. RT-LAB is a very powerful tool for designing, testing and analyzing power electronics and power systems. Such simulators are used in the defense industry, in the aerospace, automotive and obviously in academic research.