A Fuzzy Model to Manage Water in Polymer Electrolyte Membrane Fuel Cells

In this paper, a fuzzy model is presented to determine in real-time the degree of dehydration or flooding of a proton exchange membrane of a fuel cell, to optimize its electrical response, and, consequently, its autonomous operation. By applying load, current, and flux variations in the dry, normal, and flooded states of the membrane, it was determined that the temporal evolution of the fuel cell voltage is characterized by changes in slope and by its voltage oscillations. The results were validated using electrochemical impedance spectroscopy and show slope changes from 0.435 to 0.52 and oscillations from 3.6 to 5.2 mV in the dry state, and slope changes from 0.2 to 0.3 and oscillations from 1 to 2 mV in the flooded state. The use of fuzzy logic is a novelty and constitutes a step towards the progressive automation of the supervision, perception, and intelligent control of fuel cells, allowing them to reduce their risks and increase their economic benefits.


Introduction
This document is an extension of the work originally presented at Icrera 2019 [1]. The great problems of today's society such as economic inequality, climate change, decreasing of the ozone layer, lack of resources, toxic pollution, diminishing biodiversity, human health, coastal settlements; must be confronted by the academy and decidedly by the engineering sciences. The hydrogen-powered fuel cell stack is the most promising energy source of the future [2], as it would help eliminate the world's serious problems [3,4]. The hydrogen economy-where hydrogen and fuel cells are essential partners-is estimated to grow from USD 122 billion in 2018 to USD 155 billion in 2022 [5,6].
The fuel cell stack converts the chemical energy into electrical power and produces water and heat as subproducts during its operation. The proton exchange membrane fuel cell (PEMFC), it is expected to play a key role in the future energy system since its favorable characteristics such as high-power density, zero pollution, low operating temperature, quick start-up capability, and long lifetime. PEMFC can be used in cell phones, electric vehicles, distributed power systems, submarines, and aerospace applications.
The PEMFC for its proper operation simultaneously requires both a high proton conductivity in the membrane and a sufficient supply of reactants; for this reason, water management is one of the most important issues and to manage it properly, it is necessary to know how it is transported and distributed through the different components of the PEMFC.
Different methodologies have been proposed to study, diagnose, and prevent failures in water management in PEMFC. On the one hand, methodologies based on analytical, physical, or experimental models and on the other hand, methodologies that are based on non-models and that use artificial intelligence, statistics, or signal processing techniques.
From the position of model-based methodologies, the problem of water management has been diagnosed considering models that involve multi-scale methods solved by electric circuits, numerical simulations [7][8][9], use of VOF in CFD, method of Lattice-Boltzmann, Eulerian-Lagrangian method (Eulerian for air and Lagrangian for water), neutron imaging technique, magnetic resonance imaging technique, and Kalman filter. Water management has been modelled in a stationary, dynamic, isobaric, and non-isobaric way [10][11][12][13], developing experimental techniques to predict its parameters and determine the distributions of water, gas, and of temperature in the PEMFC. The materials to build the membrane, the transient response produced by the dehydration of the membrane, the flooding of the gas diffusing layers and the dilution of the reagents in the flow channels have been analyzed [14][15][16][17].
While it is true that the results of model-based methodologies have broadened the understanding of liquid transport through porous media and facilitated the development of new models at the macro and micro level, it could be argued that there are still difficulties in measuring simultaneously multiple parameters and in many cases, the techniques and methods proposed require equipment that increases the costs of the PEMFC and complicates the timely detection of failures [18,19].
From the perspective of methodologies based on non-models, the problem of water management has been analyzed considering models that involve neural network methods, fuzzy logic, neural-fuzzy networks, and prognostics. Techniques have been developed to determine the diffusion time constant, Nyquist diagrams, relative humidity, hydration status, control air supply, and estimate the remaining life of the PEMFC, with fairly accurate results.
At first glance, the precision of the results of non-model-based methodologies maybe their great strength; on closer inspection, however, the results were obtained assuming that pressures are controlled, reactants are rapidly and constantly humidified, and there are no gas transmission losses.
Although many of the fuzzy logic studies have concluded that their results are accurate, some studies have assumed that the pressures are controlled and that the reagents humidify rapidly and constantly. These assumptions constitute a challenge and allow us to propose the objective of our study.
In this article, to optimize the electrical response of the PEMFC and consequently its operation, a fuzzy model is presented that allows-in real-time-to determine the degree of dehydration or flooding of its proton exchange membrane and to make control decisions about pressure and humidification of gases. The scope of this work is the polymeric membrane, limited to its dry and flooded states.
The remainder of the paper is organized as followed: Section 1 provides a review of the state-of-the-art and analyzes the precision and reliability of the different fault diagnosis and detection methodologies, which help prevent premature degradation of the PEMFC. Section 2 proposes an innovative, low-cost and easy-to-implement fussy technique to detect in real-time the degree of wetting of the PEMFC membrane. Section 3 analyzes the results and their validation, detecting three well-defined wetting states, dry, normal, and wet. Section 4 concludes this article and Section 5 presents some lines of future research.

State-of-the-Art Review
Diagnostic and troubleshooting tools help identify and isolate errors that may occur in a system that is being monitored in real-time. In the case of the PEMFC, its optimal operation is given by its electrical response, so the critical states that can cause a malfunction to depend on the energy demand of the load and are directly related to the hydration levels of the membrane. The purpose of this section is to analyze the precision and reliability of the different fault diagnosis and detection methodologies, which help prevent premature degradation of the PEMFC.

Model-Based Techniques
They require internal knowledge of the PEMFC to approximate it quantitatively, from differential equations to numerical methods; or qualitatively, from experiments to electrical circuits, for example, [20]. Electric circuits could be generated from methods based on non-models (neural network, fuzzy logic, and statistics). Models can adopt software and equipment used in electrical and electronic network analysis, such as Matlab/Simulink and electrochemical impedance meters (EIS). Impedance measurements are techniques widely used in the diagnosis of water management problems.
The electrical model has adequate characteristics for fault diagnosis since it can be characterized by differential equations that can be linearized around the desired operating point, obtaining information on the behavior of the battery. Its voltage signal as a function of time allows considering the different states of the PEMFC (initial, transient, and stationary), which allows proposing dynamic controls [21]. On the other hand, it can also be associated with the variation/estimation of the circuit parameters, allowing the use of a parametric approach for diagnosis, such as Kalman filtering [22].
An example of this is the mathematical model simulated in Matlab/Simulink that predicts the electrical response to various inputs, such as variable loads, and that allows predicting the performance of the PEMFC in terms of efficiency and energy production. Unfortunately, being a model designed for low temperatures, its response to high temperatures is not known [23].
Another work that serves as an example is the implementation of NEOPARD-X, a numerical model that analyzes in detail the physical processes that govern the PEMFC, that is, multiphase flow, non-isothermal flow, electric charge transport, and transport of oxygen. It is concluded that the contribution of diffusion to the total impedance is small, that the concentration gradients along the channel have a strong impact and that the inductive part of the impedance is dependent on humidity. The results were validated with impedance measurements under different operating conditions [24].
Another robust method that has been used is the neutron imaging technique to explore the possible contribution of two-phase flux in porous media to mass transport losses (one of the least understood contributors to overpotential in electrolyzers). The study found that the increase in mass transport losses with increasing current densities and operating pressures were not related to two-phase flow in most gas diffusion layers (GDL); concluding that the two-phase flow in the GDL is purely capillary and that the most probable is that the origin of the increase of the losses by mass transport, is in the interface between GDL and the catalyst layer (CL) [25]. Using the same technique, another study investigated the impact of temperature on two-phase flow and showed that, with increasing temperature, the saturation of the GDL decreases. According to the study, it also seems that at high temperatures (greater than 60 • C), the current density has an impact on the saturation of the anode GDL, so they recommend operating at high temperatures, to achieve an optimal transport of water and oxygen [26].
Another robust technique is magnetic resonance imaging that allows visualizing the water content in the membrane and that correlates the battery output voltage with its operating conditions [27]. On the other hand, measurements of the magnetic field surrounding the PEMFC have also been made (based on the relationship between current density-magnetic field), obtaining graphs that allow determining whether a stack is healthy. An unhealthy stack will be dry or flooded [28].
Another example of a model-based approach is predictive control with Kalman filters (PCKF). One study developed a robust estimator to determine at the cathode, the state of the pressure control relief valve in the gas supply subsystem [22]. Along similar lines, another study developed a preliminary estimator to regulate, on the anode side, the level of liquid water saturation in the GDLa, where the flooding of PEMFCs that are used especially in automobiles occurs [29]. It should be remembered that the PCKF requires measuring several states with enough precision, to later use them as initial values for subsequent calculations.

Non-Model-Based Techniques
Non-model-based methods require a large amount of data and techniques of artificial intelligence, statistics, or signal processing, to be able to diagnose faults. Some artificial intelligence methods are the neural network, fuzzy logic, and neural-fuzzy network [30].
The neural network is one of the most popular to diagnose faults since it allows learning and mapping a non-linear system if you have a set of input and output data. One of the most used is the Hamming neural network (HNN), designed to recognize binary patterns.
An illustration of the neural network is the diagnostic procedure for water management (drying and flooding), which identifies some parameters, among which the diffusion time constant with values close to 0.1 s stands out. However, the article does not mention the capillary time constant (surface tension) that is the most important in the analysis of water flow, whose value normally ranges between 80 and 180 s [31]. Another example is the neural network sensor model through Nyquist diagrams for the drying or flooding states of the PEMFC, without considering the control of the humid airflow [32].
Fuzzy Logic is a classification technique that organizes information and handles the imprecision of a system by mimicking human reasoning. It can be used for pattern recognition or residue generation since it allows fuzzy data to be grouped into several groups [1]. Each group is a fuzzy set whose elements are associated with a membership function. Membership functions can be trapezoidal, linear, or curved. They are based on heuristic rules of the form IF (cause) . . . THEN (effect) . . . .
Fuzzy logic is used when the processes are non-linear, subjective, or their complexity is so high that there is no precision in the mathematical models that describe them.
An illustration of fuzzy logic is the model to diagnose the hydration state of the PEMFC, considering the relative humidity in the membrane, the dynamics of the gases and the output voltage. Through gradual changes in the load and the water present in the air, the model determines whether the membrane should be flooded or dried. The results are presented using an impedance spectrum [33].
On the other hand, the air supply system to the PEMFC has characteristics of external disturbances and uncertain parameters, which make it difficult to obtain an accurate and stable model. One proposed model is an adaptive robust controller based on the type-2 fuzzy logic system, to control the excess oxygen ratio of the air supply system, validated by numerical simulation and hardware experimentation. Compared with type-1 fuzzy controller and proportional integral derivative (PID) controller, its performance is better. The model assumes that the anode pressure is controlled and that it is equal to the cathode pressure; those reagents are constantly humidified, and that high-pressure compressed hydrogen is available [34].
In the same line of controlling the air supply, using the Takagi-Sugeno fuzzy model, a moving average predictive controller has been proposed for automotive applications, which additionally suppresses fluctuations caused by load change. It is shown that the proposed method can precisely control the air supply to the desired values. The model assumes that the anode pressure is controlled and that it tracks the cathode pressure in real-time; that the reactants are humidified, that the humidity of the membrane is 100% and that there are no losses due to gas transmission [35]. Another example is an adaptive range type-2 fuzzy controller, which avoids oxygen starvation to the stack and maximizes energy production (optimizing the excess oxygen ratio). The theoretical and experimental results verified its effectiveness [36].
Neural-fuzzy integrates the adaptability of the neural network and the qualitative approach of fuzzy logic, one of the most popular being the adaptive Neuro-Logic system (ASNF). A work using a neuro-fussy model as an inference system and electrochemical impedance spectroscopy (EIS) as a sensor, allows predicting the relative humidity of a PEMFC [37].
Finally, prognostics is an engineering diagnosis method that can predict the remaining life of the system and assess its reliability. It can be model-based, non-model, or hybrid and has been applied in various areas such as telecommunications, materials, electrochemistry. An example is the prognostics method based on semi-empirical models that can predict PEMFC degradation and estimate its remaining useful life. The results show that it can achieve an accurate prediction of the degradation trend of PEMFCs, either of their complete profile or the degradation corresponding to the maximum operating current [38]. Another example in the same line is an ageing model based on prognostics and health management (PHM) technology. This model, in turn, uses physical principles based on the Butler-Volmer laws, where the voltage is a function of the current density and the physical parameters of the cell [39].

Real-Time Qualitative Model
The current work presents an innovative, low-cost and easy-to-implement fussy technique to detect in real-time the degree of wetting of the PEMFC membrane. It allows the detection of the conditions defined as NORMAL from the ABNORMAL (critical) condition, such as dehydration and flooding of the membrane, using time series analysis of the voltage response. The analysis makes it possible to extract the relevant characteristics of the voltage variation over time and propose a qualitative fuzzy model, classifying the state of the fuel cell [1].

Experimental Setup
To model the operation of the PEMFC, an experimental station is required to measure, control, and determine the operational parameters that allow their optimal performance. The characterization is given by the polarization curves, voltage-current, obtained by the system at different experimental conditions. Figure 1 shows the PEMFC characterization system, made up of the subsystems: Abstract: In this paper, a fuzzy model is presented to determine in real-time the degree of dehydration or flooding of a proton exchange membrane of a fuel cell, to optimize its electrical response, and, consequently, its autonomous operation. By applying load, current, and flux variations in the dry, normal, and flooded states of the membrane, it was determined that the temporal evolution of The PEMFC used in this work was designed and built in the Renewable Energy and Hydrogen Laboratory of the Center for Automation and Robotics. Table 1 shows the dimensions of its components: A test station with its controllers [40] was used to regulate the state variables: • The management of the supply of hydrogen and oxygen reactants to the anode and cathode respectively, through the flow (Q), the pressure (P) and the humification of the gases (% RH). The supply lines are separated for the safety of the system, avoiding the mixing of gases, in case a leak occurs. Additionally, the pressure regulation used avoids the condensation of the gas vapor at the outlet of the cell and consequently, it is flooding.

•
The thermal management of the cell using its temperature (T).

•
The electrical charge considering the voltage (V) and the current (I) generated by the PEMFC and, additionally, the electrical resistance (R) between the anode and the cathode.
Because the test station is modular, open, and flexible, it allows working with batteries of different sizes-whether they are hydrogen or direct methanol-and incorporating variables and new control algorithms.

Experimental Plan
The critical operating zones of the PEMFC are particularly linked to certain state variables (operating conditions), the power of the load, and the greater or lesser hydration of the membrane. The hydration of the membrane leads to the selection of three relevant states, corresponding to three different degrees of humidification: DRY, NORMAL, and FLOOD. The standard operating condition was used to set the NORMAL grade, while the conditions of the DRY and FLOOD states were triggered, operating the stack with a low or high-water content in its membrane. Numerous tests were carried out at atmospheric pressure and room temperature, varying flow, humidification, or temperature, alternately. In the case of humidification, the response was observed both when not humidifying the gases, and when humidifying them with different periods. In the case of flow rates, the flow rate is reduced from the initial value of 150 mL/min to 10 mL/min. The operating conditions for the three operating states are shown in Table 2. The experimental plan was planned and executed, following the methodology for the diagnosis and detection of failures of the PEMFC [41] which consists of: (1) Monitoring and processing Which consists of the generation of three types of disturbances:

•
Charging step (∆I) given by a current pulse of 40 mA. The immediate response represents the resistance of the membrane (Rm) and is related to its degree of humidity.

•
Current oscillations ( f ∆I). In this case, the applied disturbance is a load of variable intensity (sinusoidal) in time. The applied load has a medium intensity value, to which is superimposed a low amplitude and high-frequency sinusoidal intensity value (6 mV and 4 kH, respectively).

•
Flow path (∆Q) at the cathode, given by the experimentally obtained equation ∆Q = 2Q re f . Experimentally it was applied at three different points on the V-I polarization curve: • In the diffusion zone that corresponds to the short-circuit current (Icc).

•
In the ohmic loss zone that corresponds to Icc/2.

•
In the activation zone corresponding to Icc/10.
15,000 samples reached a stable state in approximately 6 s and allowed obtaining global information on the electrical behavior of the PEMFC.
(2) Characteristics extraction Once the disturbance has ended, the evolution of the voltage over time is analyzed to extract the relevant characteristics that adequately describe the three states. These characteristics must show very similar values for a particular degree of humidification, as well as values that are sufficiently different to discriminate between the three degrees of humidification.
Load step: Observing Figure 2a, after applying the "load step" disturbance, a characteristic that allows discriminating between dry-normal-flooded is detected and it is the voltage jump from a high value to a low value, when the response stabilizes, so:

•
If the voltage values are normalized, they could be compared between levels and opposite directions (by increases or decreases of load) with greater reliability. • Fuzzy logic incorporates the inherent uncertainty of the measurements of a real system. Therefore, normalized voltages can assign: · 1 to the initial voltage. · 0 to the final voltage.
and they vary linearly with the measured voltages. Mathematically: Processes 2021, 9, x FOR PEER REVIEW 8 of 17 • If the voltage values are normalized, they could be compared between levels and opposite directions (by increases or decreases of load) with greater reliability.
• Fuzzy logic incorporates the inherent uncertainty of the measurements of a real system. Therefore, normalized voltages can assign:  1 to the initial voltage.  0 to the final voltage.
and they vary linearly with the measured voltages. Mathematically: Where: : Normalized voltage at time t. Current oscillations: Observing Figure 2b, after applying the "current oscillation" disturbance a characteristic is detected that allows discriminating between dry-normalflooded, the higher the humidity the smaller the voltage fluctuation.
• This characteristic is the amplitude of the oscillation. Its value is calculated from the moving standard deviation (σv), for segments of n samples, (n < N) that are averaged in the form: where is the average voltage of n samples and N is the total number of samples.  The voltage that corresponds to a jump in the flow is: where is the voltage after the disturbance, the voltage before the disturbance and is the correction factor of the signal.  Current oscillations: Observing Figure 2b, after applying the "current oscillation" disturbance a characteristic is detected that allows discriminating between dry-normalflooded, the higher the humidity the smaller the voltage fluctuation.

•
This characteristic is the amplitude of the oscillation. Its value is calculated from the moving standard deviation (σ v ), for segments of n samples, (n < N) that are averaged in the form: where V is the average voltage of n samples and N is the total number of samples.

•
The voltage that corresponds to a jump in the flow is: where V f in is the voltage after the disturbance, V ini the voltage before the disturbance and f is the correction factor of the signal.
(3) Feature reduction The relevant characteristics that are selected are: • SLOPE CHANGE (∆P): Which is the point where the normalized voltage changes its slope (after a charge step) and which corresponds to the electrical response speed of the fuel cell. This is because normalization failed to properly separate the three states. • VOLTAGE OSCILLATION (σ v ): Which is the amplitude of the oscillation after applying the disturbance "current oscillation". This characteristic is selected because the sensitivity to a disturbance of the loading passage is directly related to the water content of the membrane. • VOLTAGE DELTA (∆V) :: The physical meaning of this parameter is direct, that is, the change in voltage with a change inflow, and its value varies depending on the water content in the membrane.
(4) Failure classification The fuzzy logic allows characterizing in real-time the degree of hydration of the PEMFC membrane. The estimation of the water contents is accompanied by transients in the voltage. The selected characteristics are defined as fuzzy variables. Their values are defined using fuzzy sets that have gradual transitions between them defined by trapezoidal functions (Figure 3).

(4) Failure classification
The fuzzy logic allows characterizing in real-time the degree of hydration of the PEMFC membrane. The estimation of the water contents is accompanied by transients in the voltage. The selected characteristics are defined as fuzzy variables. Their values are defined using fuzzy sets that have gradual transitions between them defined by trapezoidal functions (Figure 3).  Table 3.  The values of the membership functions of the linguistic variables (high, medium, and low) corresponding to the three characteristics, have the same profile and the same number of values (fuzzy sets), but different numerical values of the parameters that define the function trapezoidal: V1, V2, V3, and V4. The values of these four parameters are shown in Table 3. The membership function of a set indicates the degree to which each element of the variable voltage belongs to the set. The implementation of the fuzzy logic methodology is done through the fuzzy decision tree. In the current application, the evaluation criterion is discrimination, so the VOLTAGE OSCILLATION characteristic has the highest priority and is therefore at the root node.
From this node, depending on the membership values that correspond to the highest priority parameter, one or another branch of the fuzzy decision tree advances until it reaches a terminal node, finally reaching one of the seven states . . . very dry, dry, slightly dry, normal, slightly flood, flood and very flood (Figure 4). Since a high degree of resolution is not required (for the slightly dry and slightly flood states), and because the control tactics to get out of critical situations are similar (for the very dry-dry and very flood-flood states) they come together with the classes that appear at the extremes, leaving only the DRY, NORMAL, and FLOOD states. priority parameter, one or another branch of the fuzzy decision tree advances until it reaches a terminal node, finally reaching one of the seven states… very dry, dry, slightly dry, normal, slightly flood, flood and very flood (Figure 4). Since a high degree of resolution is not required (for the slightly dry and slightly flood states), and because the control tactics to get out of critical situations are similar (for the very dry-dry and very flood-flood states) they come together with the classes that appear at the extremes, leaving only the DRY, NORMAL, and FLOOD states.

Results Analysis
Multiple experimentation sessions were carried out taking the PEMFC to the three initially defined operating states (dry, normal, and flooded), to adjust the limits of the blurred labels (LOW, MEDIUM, and HIGH) corresponding to each of the characteristics selected. The results confirm that the characteristics of SLOPE CHANGE and VOLTAGE OSCILLATION are the priority ones and therefore their correct location in the decision tree. Figure 5 illustrates the power of discrimination: • In the SLOPE CHANGE characteristic (Figure 5a), the results are shown for different experimentation sessions before a load step disturbance. The characteristic allows three groups to be identified without overlapping between them, becoming a good discriminator between the operating states of the cell (flooded, normal, and dry). Physically, this parameter (change in slope before load step) corresponds to the instantaneous electrical response of the PEMFC and is directly related to the water content in the membrane.

Results Analysis
Multiple experimentation sessions were carried out taking the PEMFC to the three initially defined operating states (dry, normal, and flooded), to adjust the limits of the blurred labels (LOW, MEDIUM, and HIGH) corresponding to each of the characteristics selected. The results confirm that the characteristics of SLOPE CHANGE and VOLTAGE OSCILLATION are the priority ones and therefore their correct location in the decision tree. Figure 5 illustrates the power of discrimination:

•
In the SLOPE CHANGE characteristic (Figure 5a), the results are shown for different experimentation sessions before a load step disturbance. The characteristic allows three groups to be identified without overlapping between them, becoming a good discriminator between the operating states of the cell (flooded, normal, and dry). Physically, this parameter (change in slope before load step) corresponds to the instantaneous electrical response of the PEMFC and is directly related to the water content in the membrane.

•
In the VOLTAGE OSCILLATION characteristic (Figure 5b), the reproducibility of the results of the characteristic voltage oscillation amplitude in the three operating states of the PEM cell is observed. Although in the flooded state there are significant differences between different experimentation sessions, this difference is due to slightly different initial conditions of the water content in the membrane. It is confirmed that the reproducibility is sufficient to be able to adequately discern the state with this characteristic since there is no overlap between the three classes (states).
The joint discrimination power of the two selected characteristics is shown in Figure 6, where: • The three degrees of humidification are separated: The highest values in both characteristics correspond to DRY, the average values to NORMAL and the lowest values to FLOOD.

•
The results follow the algorithm selected for the fuzzy decision tree. Another combination could present greater uncertainty and would correspond to intermediate regions in the figure.
• In the VOLTAGE OSCILLATION characteristic (Figure 5b), the reproducibility of the results of the characteristic voltage oscillation amplitude in the three operating states of the PEM cell is observed. Although in the flooded state there are significant differences between different experimentation sessions, this difference is due to slightly different initial conditions of the water content in the membrane. It is confirmed that the reproducibility is sufficient to be able to adequately discern the state with this characteristic since there is no overlap between the three classes (states). The joint discrimination power of the two selected characteristics is shown in Figure  6, where:   Correlating the model with real data, in Figure 7 different V-I polarization curves are observed. Figure 7 in turn provides a proof of concept that using this fuzzy method can better regulate water transport in the PEMFC. Starting from the dry state (Test 1), the low performance of the battery can be observed when supplying 60 mA. As humidified gas is introduced with a humidification time of 100%, it is observed that the response improves (from Test 2 to Test 8), in such a way that, when it reaches the optimal conditions of electricity generation, the separation between curves consecutive V-I is decreasing. In the curve of Test 9, a voltage drop is observed as the stack is going from a normal state to a slightly flooded state. In the curve of Test 10, a recovery of the electrical response of the pile is observed, probably due to the disturbance of the two-minute flow jump, when dragging the water from the stack.   in turn provides a proof of concept that using this fuzzy method can better regulate water transport in the PEMFC. Starting from the dry state (Test 1), the low performance of the battery can be observed when supplying 60 mA. As humidified gas is introduced with a humidification time of 100%, it is observed that the response improves (from Test 2 to Test 8), in such a way that, when it reaches the optimal conditions of electricity generation, the separation between curves consecutive V-I is decreasing. In the curve of Test 9, a voltage drop is observed as the stack is going from a normal state to a slightly flooded state. In the curve of Test 10, a recovery of the electrical response of the pile is observed, probably due to the disturbance of the two-minute flow jump, when dragging the water from the stack.

Results Validation
Electrochemical impedance spectroscopy (EIS) is used to validate the methodology for estimating the degree of humidification of the PEM fuel cell proposed here. The impedance spectra for the DRY, NORMAL, and FLOOD grade are shown in Figure 6. The results that validate it are:

•
The membrane resistance (Rm) is higher in the DRY state.

•
The FLOOD state has a slight overlap with the NORMAL.
Of the impedance curves in Figure 8, the farthest from the imaginary axis is the DRY state. Its resistive value is the one that corresponds to the zero-crossing point with the real axis and indicates that the resistance of the membrane increases if it is dry.
For experimental reasons, a minimum frequency of 100 Hz was used since lower values produced incorrect measurements and stagnation in the frequency sweep. The maximum frequency was limited to 1 MHz. The sweep was downward, motivated by problems in the polarization of the membrane due to the deposit of ions on the electrodes. A voltage of 100 mV was used as the lower limit for the excitation signal in the PEM cell. The negative part of the spectrum in Figure 8 is the inductance that corresponds to the collector plates of the battery.
For experimental reasons, a minimum frequency of 100 Hz was used since lower values produced incorrect measurements and stagnation in the frequency sweep. The maximum frequency was limited to 1 MHz. The sweep was downward, motivated by problems in the polarization of the membrane due to the deposit of ions on the electrodes. A voltage of 100 mV was used as the lower limit for the excitation signal in the PEM cell. The negative part of the spectrum in Figure 8 is the inductance that corresponds to the collector plates of the battery.  The equivalent circuit to extract the data is shown in Figure 9. The equivalent circuit to extract the data is shown in Figure 9. Physically: Rm: Electrical resistance associated with the membrane. L: Inductance associated with the collector plates. Q1: Pseudo capacitance associated with the charge transport process at the electrodemembrane interfaces (electrochemical double layer).
R1: Resistance associated with the charge transport process at the electrode-membrane interfaces.
Q2: Pseudo capacitance associated with the mass transport process (adsorption and diffusion).
R2: Electrical resistance associated with the mass transport process (adsorption and diffusion). It only appears if the injected gas is hydrogen since in the case of air it presents unacceptable errors.
The data to obtain the EIS (O2/O2, T = 50 °C) are shown in Table 4. Physically: Rm: Electrical resistance associated with the membrane. L: Inductance associated with the collector plates. Q 1 : Pseudo capacitance associated with the charge transport process at the electrodemembrane interfaces (electrochemical double layer). R 1 : Resistance associated with the charge transport process at the electrode-membrane interfaces. Q 2 : Pseudo capacitance associated with the mass transport process (adsorption and diffusion). R 2 : Electrical resistance associated with the mass transport process (adsorption and diffusion). It only appears if the injected gas is hydrogen since in the case of air it presents unacceptable errors.
The data to obtain the EIS (O 2 /O 2 , T = 50 • C) are shown in Table 4.

Conclusions
The implementation of a methodology for the diagnosis and detection of failures of the PEMFC has been presented, using the fuzzy decision tree technique. From the generation of three types of disturbances (load step, current oscillation, and flow step), two characteristics SLOPE CHANGE and VOLTAGE OSCILLATION were selected to detect in real-time if the battery is in the DRY, NORMAL state, or FLOOD. The results show that the discrimination power of the two characteristics is very high, without any overlap (ambiguities). This can be seen in Figure 5, where the separation of the data between dry-normal-flood is observed. The results were validated using Electrochemical impedance spectroscopy, which shows us at the zero-crossing with the real axis, the resistive values of the PEMFC of the three states, the resistance being higher in the dry state.
The approximate reasoning model in the control of the degree of wetting of the PEM cell allows addressing the non-linearities of the electrical behavior of the cell, the imprecision of the real world and an autonomous and optimal control in real-time, of the performance of the PEMFC, by incorporating control actions that avoid their critical states.
Finally, this work constitutes a step towards the progressive automation of the supervision, perception, and intelligent control of fuel cells, allowing them to reduce their risks and increase their economic benefits.

Future Works
One of the critical issues in the operation of the PEMFC is the water content in the membrane, which is what was analyzed in this work. However, water does not only accumulate on the membrane, so future work would be:

1.
Design a robust model that considers the physical processes of transport and distribution of water in humidifiers, in catalytic layers, in the membrane, in gas diffusing layers, inflow channels; as a function of the humidity of the inlet gas, the porous structure of the electrodes, the composition of the membrane, the diffusion in the gas diffusing layers, the capillary pressure and the heat transfer. 2.
The robust model can involve in your solution: • Fuzzy logic methods. • Numerical simulations using the volume of fluid (VOF) in computational fluid dynamics (CFD).