Abstract

A fuel cell is a complex system, which produces electricity through an electrochemical reaction. For the formal application of control strategies on a fuel cell, it is very important to have a precise dynamic model of it. In this paper, a dynamic model of a real hydrogen fuel cell is obtained to predict its response. The data used in this paper to obtain the model have been acquired from a real fuel cell subjected to different load patterns by means of a programmable electronic load. Using this data, a nonlinear model based on a hybrid intelligent system is obtained. This hybrid model uses artificial neural networks to predict the output current of the fuel cell in a very precise way. The use of a hybrid scheme improves the performance of neural networks reducing to half the mean squared error obtained for a global model of the fuel cell.

1. Introduction

The problems derived from pollution, and the increasingly alarming climate change, have led modern society to look for clean energy sources. One of the most promising technologies for accomplishing hybrid energy topologies is based on renewable sources centers on hydrogen, due to its possible generation by electrolysers and then its storage. Subsequently, from this gas, the generation of electrical energy by fuel cells is absolutely feasible [1]. In this sense, fuel cell based systems are an energy source that appears as a hopeful choice as a result of their increased performance, high reliability in steady applications, and small environmental incidence, space and automotive applications [2].

A fuel cell is a complex system consisting of a series connection of individual cells (a stack), where the electric current is produced by an electrochemical reaction, combined with all other systems necessary for its operation, that is, filters and systems that condition the gases involved in the reaction ( and ), a cooling system, and, of course, a control system [3]. Compared to other clean technologies, such as wind or photovoltaic generation, fuel cells do not require a specific location to obtain higher performance. In addition, they are very respectful of the environment. Proton Exchange Membrane (PEM) fuel cells (PEMFC) offer high energy density and a number of advantages, such as their low volume and weight compared to other technologies. PEMFC operate at low temperatures (50°C–100°C), which allow them to start more quickly (requiring less heating time), and result in less wear and tear on system components and better durability. PEMFC are commercially available in a large range of powers (from some watts to several MW), permitting their use in a large number of applications [2]. For example, in stationary applications, fuel cells can be connected to the electrical network [4], installed as separate generators [5], or operate in landfills and wastewater treatment plants [6]. Its use is also interesting in transport applications, owing to the scarcity of fossil fuels and their polluting effects [7, 8], or on other types of mobile stations [9].

A fuel cell behaves as a nonlinear dynamical system, which generates electrical energy through an electrochemical reaction. The energy generated by the fuel cell is not regulated; thus, a control system is necessary for its efficient use [1013]. In this way, for the formal application of control strategies on a fuel cell, it is very important to have a model of its dynamic behaviour [1, 1418]. Hou et al. [19] analysed stack voltage response to current steps measuring voltage variation rate, initial value of dynamic voltage, time to reach steady state and dynamic resistance factor. The results of this investigation show that the dynamic response of the stack voltage is different for increases and decreases in current [20], what must be taken into account when establishing a test pattern to obtain data from the fuel cell.

It is important to be able to predict the behaviour of fuel cells for their efficient use; hence, obtaining an accurate model is a very important task before designing a control strategy. Achieving an accurate model of a system is a fundamental part of its study; however, we do not always have enough information to obtain an acceptable mathematical model. Therefore, we must resort to modelling techniques based on input–output data [2125]. In control systems this process is even more critical, since it requires a model as accurate as possible, both to perform analysis on the system [2628] and to design a suitable and efficient controller for it [2931].

For the current prediction in this paper, several regression techniques had been checked. The algorithms based on multiple regression analysis are accepted regression methods used in several applications [3237]. Some previous works have shown the use of these methods despite its low performance [33, 3840]. In this paper, to overcome this limitation, we propose to use hybrid intelligent system to accomplish the regression task, more specifically, an artificial neural network (ANN) hybrid system as the ones used in [4146], since ANNs allow obtaining simple and very accurate nonlinear models [4750].

This work is divided into the following sections. After to the current introduction, the case study is described in detail. Afterwards, the model approach and the employed algorithms are presented. The results section explains the best achieved configuration of the hybrid model, and the validation of the accomplished prediction model. Lastly, conclusions are explained and future works are depicted.

2. Case of Study

A single fuel cell of a PEM stack consists of an electrolyte layer in contact with an anode and a cathode on both sides; see Figure 1. A PEM fuel cell produces electrochemical energy when a hydrogen-rich gas passes through the anode and a gas rich in oxygen (or air) passes through the cathode with an electrolyte between the anode and the cathode, which allows the exchange of electrical charge (ions) [51]. The dissociation of hydrogen molecules produces the flow of ions through the electrolyte and an electric current through an external circuit. The only residue generated is pure water. A usual single fuel cell produces approximately V under normal operating conditions. For the creation of higher power systems, cells are connected in series forming a stack.

The data used for the realisation of the model were acquired through laboratory tests of an air-cooled polymer electrolyte fuel cell (AC-PEFC). Specifically, a PEM FCgen-1020AVS stack from Ballard was used [52]. This stack was built with 80 BAM4G cells [53] based on polymeric composition. The anode and cathode side are made of a porous carbon cloth with a catalyst based on platinum and platinum-ruthenium [54]. The stack was assembled with graphite plates and sandwiched between aluminium end plates by compression. The PEM FCgen-1020AVS stack is designed to provide up to 3.4 kW stable nonregulated electrical power with V and A. This stack is air-cooled, and a dead-ended configuration is used; thus, it does not require external humidification of the air or hydrogen. The inlet hydrogen pressure can vary from to bar. The oxidant and cooling subsystem were built based on the manufacturer’s instructions [55]. The complete sequence to put into operation the individual devices that make up the stack, the oxidation and cooling subsystem, the electric subsystem, and the implementation of the balance of plant (BoP), whose schema is shown in Figure 2 and a real image of the laboratory in Figure 3, were thoroughly explained in [56]. To test the system an Amrel PLA5K-120-1200 programmable electronic load was used. A system was implemented to monitor all the fuel cell systems and store the data resulting from the tests, which was described in [57, 58]. In [59], a detailed thermal model based on differential equations is established according to the conservation equations of mass and energy for a 16 cells PEMFC stack. In this work, the effects of the temperature on the operation of the cell are demonstrated. In order to avoid these effects of operation, the used BoP includes a temperature control system to guarantee the maintenance of the fuel cell at its optimum value. In addition, it is necessary to keep in mind that the hydrogen gas should be vented periodically to the atmosphere and replaced with fresh hydrogen using a purge process according to [55].

3. Model Approach

The model proposal implemented in this work is illustrated in Figure 4, where the inputs are the voltage and the temperature measured at the BoP and the output is the present value of the current. To take into account the process dynamic, the inputs of the model include the previous measured values of voltage, temperature, and current.

An internal layout of the model with the mentioned previous variable values is shown in Figure 5, where the hybrid model is represented. Due to the possible nonlinear response, this hybrid model is built upon clustering; the modelling dataset is divided in groups with similar characteristics. A different regression model was created for each cluster with the objective to increase the whole model performance.

Figure 6 represents the operation of the hybrid model shown in Figure 5. The number of clusters is obtained by testing different topologies. This figure represents a general hybrid model, with clusters and models with the specific parameters for each one.

To create a hybrid model, the modelling process could be divided into the following steps (Figure 7):(1)Clustering phase(2)Regression modelling phase for each cluster(3)Selection of the best local model (by cluster)(4)Selection of the best topology for the hybrid model

For the clustering phase, the k-means algorithm has been used to achieve the groups with similar features. To perform the regression modelling phase, the ANN algorithm was chosen considering its capacity to predict the output of nonlinear systems with a simple internal configuration. Although this is a hybrid system, the model achieves better results if the regression algorithms are intelligent systems than if they are traditional regression methods. The regression modelling phase uses k-fold to achieve a more real approach in the model performance measurement. The k-fold testing method is explained in Figure 8. The data for each cluster is divided into times and models with the same configuration and are trained with different test data.

As it is shown in Figure 8, the errors values between the measured and the predicted output for each model are stored. When the k-fold process finished, all the data of a specific cluster is used to test the model, and the performance could be achieved. When all the different possible configurations for the models are tested, the best regression algorithm for each group is chosen based on the lowest error reached.

For the hybrid model topology definition, the number of clusters must be determined. This choice is done based on the global error considering the samples quantity for every cluster and estimating a weighted error. The best hybrid configuration is the one with the best whole performance.

3.1. K-Means Algorithm

The k-means method is used to create a certain number of groups in an unlabeled data set. The idea is to place centroids in the corresponding hyperspace, so that the data belonging to the same centroid have similar characteristics and represent a data cluster [60, 61].

Every new sample, once the centroids are trained and correctly placed in the hyperspace, is compared with them and is associated with the centroid that is closest in terms of the chosen distance, usually the Euclidean [62].

This algorithm has an initial training phase that needs to know the number of clusters to divide the data. This phase could be slow depending on the number of groups and the data size; however, once the training is finished, the cluster assignment is very fast for new data [63].

The initial location of the centroids is chosen randomly. Then, the location varies, until reaching the greatest distance between them, according to the following procedure:(i)Each sample is associated with the nearest centroid and is included in a specific list.(ii)After checking all the samples and being associated with the list of the corresponding centroid, the list of labelled samples will be available.(iii)The location of the centroid is recalculated obtaining the center of the set of samples that have been associated with it.(iv)The procedure is repeated until the centroids are no longer displaced in the successive calculations.

Moreover, as the initial centroids are randomly selected, the procedure is repeated several times until the largest distance between centroids is reached.

3.2. Artificial Neural Networks

The ANN is an intelligent algorithm that uses small processing units called neurons. These neurons are interconnected between each other through links, and each one calculates a function taking into account the different inputs. All the inputs to each neuron have its weight in the activation function inside the neuron [64].

The main specific characteristics of ANNs are that they can learn from experience through the generalization of cases [65]. The ANNs are adaptive intelligent systems that can carry out certain functions through training. The ANNs create their own internal representation of the problem with the training and respond according to the situations, although they had not previously learned a specific situation. Then, the ANNs are able to generalize from previous cases to new ones [66].

The activation function defines the new state, or output, of the neuron as level of excitation [67]. The activation degree of the artificial neuron can usually vary between a range (normally [, ] or [-1, ]). This value indicates the state of the neuron: inactive ( or -1), active , or an intermediate state between these limits which indicates its activation degree.

The topology, or architecture, of an ANN is determined by the organization of the neurons, their arrangement, and their connections. The architecture depends on four main parameters: the layers quantity in the system, the number of neurons of every layer, the connectivity between neurons, and the activation functions [68].

The basic structure to interconnect neurons is the multilayer perceptron. This type of ANN is organized in several layers: input, intermediate or hidden and output. A layer is a set of neurons whose input information comes from the same source: the inputs of the ANN for the input layer or the previous layer for the rest of the layers. The output of the neurons in the same layer has the same destination too: the next layer or the output of the ANN (in the case of the output layer).

Normally, the output layer neurons use special activation functions depending on the use of the ANN; for regression, the typical is the linear function.

3.3. Data Processing

The data set in this research is collected using the BoP system described in the case study section. With this equipment, the samples from two different days were collected. A total of 774391 samples were recorded from these tests and, after discarding the bad measurements, the data sets were reduced to 774,385. As the model used previous values, it was necessary to eliminate the samples that did not have all the inputs values to model.

Although there were 774,379 valid samples, only 1/5 of them were used to train the hybrid model; they were selected randomly to ensure the generalization of the model. Then, only 154,875 samples were used in the modelling phase.

In addition, the samples of another different day were used to validate the hybrid model achieved. 4,832 samples, which were not used in the modelling phase, were recorded from two separate tests (1,489 and 3,343 samples each), and they were used in the validation phase of the research.

4. Results

The results of this research could be divided into three different parts: the clustering, the modelling, and the validation.

4.1. Clustering Results

The clusters were created with the explained k-means algorithm. Nine hybrid systems were created with different number of clusters (between 2 and 9), as the optimal number of groups was previously unknown. The algorithm was trained with random initialisation of the centroids, and the training was repeated 20 times to ensure the best divisions, the furthest centroids. The number of samples used in the modelling phase for each cluster is shown in Table 1.

4.2. Modelling Results

The ANN regression algorithm is configured with only a single hidden layer. The input layer has 5 inputs, one for each variable explained in the model approach section, and only 1 output in the last layer. Several configurations of the ANNs for each cluster were trained, all of them with tan-sigmoid activation function for the internal neurons (in the hidden layer) and, in the output layer, a linear activation function was used. The difference in the several configurations was the hidden layer neurons’ quantity. This layer size varied from 1 to 15 neurons.

To train each ANN configuration, the Levenberg-Marquardt optimization algorithm was used. Moreover, to finish the training phase, gradient descent was used base on the MSE (mean squared error). The best ANN configurations for each cluster are indicated in Table 2.

The selection of these advantageous configurations uses the MSE as a performance measurement for the created models. In Table 3 it is possible to see the lowest error for each cluster achieved with the configuration that is shown in Table 2.

To calculate the best hybrid configuration for the whole model, as explained, the number of samples was considered. The performance of the different hybrids and the global model is presented in Table 4. It is shown that the best configuration implies a hybrid model with two clusters, and the error using a global model is more than the double.

4.3. Validation Procedure

Two validation data sets were used to check the final hybrid model accomplished with 2 clusters and configurations of 15 and 12 internal neurons. The first test is shown in Figure 9, where the current has few changes, but it is possible to appreciate that the real data (blue dotted line) and the output of the model (green continuous line) are very close all the time.

The second validation data set (Figure 10) shows a usual test for the fuel cells. In this case, the current is increased until its maximum and, then, reduced gradually. The predicted value in this case shows the biggest error in the middle of the test when the current has the highest values.

In Table 5 different error values are shown for the validation data: MSE, NMSE (normalize mean square error), MAE (mean absolute error), and MAPE (mean absolute percentage error). Despite the graphical error shown for the second validation data in Figure 10, the error values are very good. The worst value is the MAE because, in the test, the current has very high values; however, the other error values are lower than the ones obtained in the first validation data. This fact could be confirmed with Figure 11, where the percentage absolute error of the second validation data is in the worst part of the test (the central part of Figure 10).

5. Conclusions

A model of a fuel cell based on hydrogen has been developed in this work. The model predicts the current in the fuel cell under different working points, and it could be used in several ways as control or fault detection. As an example, in the fault detection field, the model output must be similar to the real measure of a current sensor, and if the measured value deviates from the modelled one, a sensor failure or a system malfunction could be represented.

Since the fuel cell is a nonlinear system, a hybrid model instead of a global is selected. In this paper, ANNs are used as regression algorithm due to its accuracy. Furthermore, with the hybrid model, the performance of the ANNs is increased up reducing to half the MSE obtained with a global model.

Very good results are obtained in terms of error in the predicted current considering that the MSE value is 0.0021 for the hybrid model with 2 clusters. One of them used an ANN with 15 internal neurons and the other an ANN with 12 neurons. To validate the model, two different data sets were used and, although the maximum MAE was 0.1889, the maximum NMSE was only 0.0043.

As for future works, the possibility of predicting the future values of the current will be examined. This future prediction would increase the fuel cell performance, since it could be adapted faster to new working points.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This work has been funded by the Spanish Ministry of Economy Industry and Competitiveness through the H2SMART-GRID (DPI2017-85540-R) project.