Designing Hydrogen and Oxygen Flow Rate Control on a Solid Oxide Fuel Cell Simulator Using the Fuzzy Logic Control Method

: A solid oxide fuel cell (SOFC) is an electrochemical cell that converts chemical energy into electrical energy by oxidizing fuel. SOFC has high efficiency and cleans oxidation residues. Research has shown the importance of SOFC control. Voltage output control is needed because of nonlinearity, slow dynamics, and proper SOFC operating restrictions. This study aims to design an SOFC simulator with output voltage control to optimize the flow rate of fuel (hydrogen) and air (oxygen). This SOFC simulator is designed based on a microcontroller model. The controller is designed using the fuzzy logic method. Tests show that the output voltage can approach the set point with an average of 340.6 volts. The pressure difference ( ∆ Pressure) between the two gases averaged 4428 Pa, and the fuel/gas flow rate was in the range of 0.7 mol/s. The controller can correct both the output voltage of the SOFC simulator and the difference in gas pressure under 8106 Pa (0.08 atm).


Introduction
A solid oxide fuel cell (SOFC) is a device that converts electrochemical energy into electricity directly based on ceramic materials. If the fuel used in the equipment is hydrogen, it will produce waste products in the form of water vapor and heat. The main components of an SOFC are anodes, electrolytes, and cathodes. Cells are made of ceramic material with an operating temperature of 500-1000 °C [1]. Hydrogen (H2) is supplied to the anode, while air/oxygen (O2) is supplied to the cathode. A SOFC uses ceramic materials such as zirconium oxide as electrolytes. In the presence of electrolytes, hydrogen gas will not be mixed with oxygen. If the anode and cathode are connected to an electrical conductor, electrons will flow from the anode to the cathode, and a chemical reaction will produce an electric current [2][3][4].
Research focuses on maximizing the performance of single cell stacks of SOFCs. At the stack level, several factors cause a loss of performance due to the fragile nature of SOFC ceramics, the type of current collector, the channel size, and the mismatch thermal expansion of stack components. However, the design of fuel/gas flow is one of the most significant factors affecting the performance of a single cell SOFC stack. In other words, the distribution of fuel/gas with the flow channel in the interconnection is one of the most important parameters in the SOFC stack design [5].
The latest study on SOFCs is quite interesting for researchers because of its dynamic system and proper operational limitations. Optimal PI control has been proposed for active power demand in a distributed SOFC electricity network connection system. SOFC has two control strategy designs, namely the pressure difference controller at the anode and that at the cathode. The controller is applied to a stack of 450 cells. This system is adjusted to maintain fuel use at 85% (0.85), and the pressure difference is maintained between 0 and 0.08 atm [6].
The SOFC plant has nonlinearity and slow dynamics. The combined control structure has been applied to feedback and forward feedback. The basic PI feedback control is used to accommodate nonlinearities. Dynamic response is accelerated through feedforward actions. The simulation shows that the resulting performance is similar to the predictive control design (MPC) [7].
This study aims to separate the interaction between thermal and electrical parameters with hydrogen fuel. This study focuses on the design of decoupling controls for the thermal and electrical characteristics of SOFC systems through offgas anode (AOR) recycling. The decoupling control system independently manipulates thermal and electrical parameters. Interactions with each other in many cases, such as stack temperature, furnace temperature, system flow, and system power. For electricity problems, the decoupling control scheme shows its advantages compared to conventional controllers in alleviating fast load accumulation and avoiding fuel depletion [8].
Fuel cells are an attractive choice for alternative power and usage in a variety of applications. This paper proposes a state space model for an SOFC-based power system consisting of a fuel cell, a DC-DC buck converter, and a load. In this investigation, we have taken a case study for an SOFC that gives a DC load where the DC-DC buck converter acts as an interface between the load and the source. A proportional-integral controller (PI) is used together with pulse width modulation (PWM), which calculates the pulse width and replaces the MOSFET at the right time so that the desired voltage is obtained. The proposed model is validated through extensive simulations using MATLAB/SIMULINK. The controller for the fuel cell power system (FCPS) in the prototype uses the XC3S500E development board containing SPARTAN 3E Xilinx FPGA [9].
Optimal control can ensure safe system operation with high efficiency. However, only a few papers discuss optimal control strategies for solid oxide fuel cell (SOFC) systems. Therefore, a robust optimal control strategy is proposed, which involves three parts: an SOFC model with parameter uncertainty, a robust optimizer, and robust controllers. To ensure the safe SOFC operation, two feedforward controllers and a higher-order robust sliding mode controller are presented to control the fuel utilization ratio, the air excess ratio, and afterwards the stack temperature. The results show that the proposed optimal robust control method can maintain the safe SOFC system operation with maximum efficiency [10].
Some of the references above [5][6][7][8][9][10] show software-based SOFC stack simulations. Some of them use MATLAB. Some control methods are also used, such as robust control and PI. Generally, the research is related to SOFC output regulation. SOFC output is correlated with fuel/gas flow rate and fuel usage. So far, research related to microcontroller-based simulator models and electronic components has not been encountered. Therefore, in this study, the design of microcontroller-based simulators and fuzzy logic control methods is proposed. The SOFC simulator design is expected to provide characteristics that resemble actual installations. SOFC simulators are used to be able to see the output voltage control and optimize the flow rate of hydrogen and oxygen. These parameters can help solve SOFC cell performance.

Hardware Design
In general, SOFC simulator hardware design includes hydrogen (H2) and oxygen (O2) flow rate controllers. The device includes an electronic circuit with two microcontrollers, namely Arduino Nano and STM32F103C8T6. Arduino Nano is used for SOFC stack simulators. STM32F103C8T6 is used for H2 and O2 flow rate control. Broadly speaking, the relationship between systems is shown in the block diagram in Figure 1.
The system starts by providing input values for the H2 flow rate, the O2 flow rate, the temperature, and the input current (external). These values are then processed on the Arduino Nano microcontroller. The Arduino Nano microcontroller produces output H2 pressure, O2 pressure, and SOFC simulator voltage. The output is then conditioned so that it can move the potentiometer combined with the servo motor, so the output is in the range of 0-5 volts. The maximum output of 5 volts is again conditioned to 3.3 volts. The conditioned parameter values are then processed by the STM32F103C8T6 microcontroller. The STM32F103C8T6 microcontroller output is the servo angle for the H2 flow rate and the O2 flow rate. The output value of the flow rates of the two gases is equally conditioned to a maximum of 3.3 volts. The second set of flow rates is a potentiometer that is combined with a servo motor. The output for the SOFC simulator is designed using a potentiometer coupled with a servo motor actuator. As shown in Figure 2. This circuit produces an output value from the SOFC simulator between 0 and 3.3 volts, because the micro input works at a maximum of 3.3 volts. The SOFC simulator design consists of an input part (temperature, current, and flow rate of the two gases); the processing part is the Arduino Nano microcontroller; the output part is hydrogen pressure, oxygen pressure, and SOFC voltage.  Figure 3 shows the algorithm flow chart for the simulator system. This algorithm is systemically carried out on the first microcontroller. The steps in the algorithm are described as follows:

SOFC Simulator Algorithm
1. The input port and output actuator port used are initialized. The parameter values from the SOFC model are then initialized. 2. The hydrogen/oxygen flow rate, the external SOFC current, and the SOFC temperature are read. 3. The input process is obtained from the flow rate of hydrogen/oxygen, external SOFC currents, and SOFC temperatures. 4. The partial pressure, voltage losses, Nernst voltage, and SOFC voltage are calculated. 5. The output process produces hydrogen/oxygen pressure and SOFC voltage. 6. The system returns to repeat after the output process is finished.  Figure 4 is a flow diagram for a hydrogen/oxygen flow rate control system algorithm. The flow rate control algorithm is performed on the second microcontroller (STM32F103C8T6). The steps in the flow chart are as follows:

Flow Rate Controller Algorithm
1. The sensor input port to be used is initialized. The set point value that has been given is then read. 2. The value of the SOFC voltage, the hydrogen/oxygen flow rate, the hydrogen/oxygen pressure, and the SOFC temperature are read.
3. The input process is obtained from two inputs, namely the SOFC voltage and the given external SOFC current. The value of the set point voltage is calculated with the SOFC output voltage. Both the error value and ∆ error are obtained. 4. Errors and ∆errors are classified and processed using the fuzzy logic method with a predetermined membership function and rule base. 5. The average weighting value is calculated through the weighted average method, including the flow rate for hydrogen/oxygen. 6. Data from the SOFC simulator are sent to the graphic user interface on the personal computer using the USB TTL CH340. 7. The system returns to repeat after the output process is finished. The basic rules of fuzzy logic control (FLC) in this software are to regulate the flow rate of hydrogen and oxygen. FLC is designed to match the characteristics of the SOFC simulator. The output of this FLC is the angle value of the hydrogen/oxygen channel valve rotation. The valve output produces a voltage of 0-5 volts according to the microcontroller input characteristics [11,12].

Control Design
The design of the control system includes a fuzzy logic method to obtain values from the valve opening angle parameters H2 and O2 flow rates. The value of the fuzzy controller function membership is obtained from the output voltage data obtained from the SOFC simulator, which has been tested for maximum output limits. Meanwhile, the determination of the fuzzy rule base is the result of observing the characteristics of the SOFC simulator system diagram when heading towards its stabilizing output voltage. Figure 5 is a block controller of the H2 and O2 flow rates. The fuzzy logic control method in this design obtains the input from the output voltage generated by the SOFC simulator. The output is in the form of an angle, which will be used to turn the valve to produce the expected H2 and O2 flow rates. The design of this fuzzy logic control method is divided into three: fuzzyfication, the rule base, and defuzzyfication.

Fuzzyfication
There is a membership function that plays the role of blurring (fuzzy), and this can be grouped into a set of memberships that have been determined. The processes in the fuzzyfication for H2 and O2 flow rates have the same input.
The fuzzy logic control has the input in the form of error and ∆error from the reading process of the SOFC output voltage values on the set point. The set point used is 333 volts. The error and ∆error membership functions are shown in the membership set graph in Figures 6 and 7. The limit of the error membership set value is obtained from the maximum voltage value that can be generated by the SOFC simulator when the hydrogen and oxygen flow rates reach 1 mol/s. The limit of the membership set value of ∆error is then obtained from the most frequent error value changes.

Rule Base
Rule base in the design is divided into 2 pieces, namely the rule base angle of hydrogen flow rate and oxygen flow rate angle. Determination of the rule base is done by looking at the characteristics of the SOFC simulator when not using a controller.
The rule base parameter values are obtained through tuning with random angle values according to the characteristics of the system. Experiments carried out several times produce the best constant values as shown in Table 1 and Table 2. The meaning of the variable "C" is closed, "S" is small, "A" is average, "W" is wide, and "VW" is very wide. The meanings of Z (zero), S (small0, M (medium), H (high), and VH (very high) are variables that are made to facilitate controller programming. Table 1 is 25 fuzzy rules used for hydrogen flow. As an example; if the error is Negative (Z) & the ∆error is Negative (Z) then the hydrogen flow rate angle is closed (C). The oxygen flow rate angle is closed (C). So in this condition the angle position is at the smallest (closed) in order to stabilize the system.

Negative Error
Zero Table 2 is 25 fuzzy rules used for hydrogen flow. As an example; 25. If the error is Positive (VH) & error is Positive (VH) then the hydrogen flow rate angle is closed (C). The oxygen flow rate angle is closed (C). The oxygen flow rate angle is closed (C). So in this condition the angle position is at the smallest (closed) in order to stabilize the system.

Negative Error
Zero

Singleton
This is the real value used to produce the output from FLC hydrogen and oxygen flow rates in the form of valve angles. It uses 2 singleton fruits-1 pieces for valve hydrogen flow rates and 1 piece for valve oxygen flow rates, as shown in Figures 8 and 9 below:  Back in Figure 2 that the servo motor is used to rotate the potentiometer angle. The angle of the servo motor used is not full 180 degrees There is an offset of about 20 degrees so that the range is only around 150 degrees. By trial and error the best results are obtained for the angles of hydrogen, as shown in Figure  8. While the best results are for the angles of oxygen, as shown in Figure 9. The

Defuzzyfication
This is the final stage in designing fuzzy control methods. It uses the Sugeno fuzzy logic method with the weighted average method in order to obtain fuzzy output values for each rule. The weighted average method is carried out by summing each weight with the output value produced, and dividing that by the number of weights as shown below: (1)

SOFC Simulator Model
The characteristics of the simulator include a number of conditions in its design. The SOFC cell stack model will be based on the following assumptions: The stack is fed with hydrogen and oxygen channels. -Channels that carry gas along the electrode have a fixed volume and a small length, so they only need to determine a single pressure in the interior. - The removal of each channel is through a single orifice. - The temperature is stable at all times. - The only source of loss is ohmic. - The Nernst equation can be applied.
According to [13], in relation to the characteristics of exhaust of channels, an orifice that is considered choked, when fed with a mixture of average molar gas (kg/kmol) and similar specific heat ratios, at a constant temperature, meets the following characteristics: where W is the mass flow [kg/s], K is the valve constant [ /( )], and Pu is the pressure in the channel. For the case of the anode, the concept of using fuel can be introduced, as a comparison between the flow of the reacting fuel and the flow of fuel injected into the stack.
is also a way to express the molar fraction of water at discharge. According to this definition, Equation (2) can be written as where is the mass flow through the anode valve [kg/s]; is the anode valve constant /( )] ; , are the molecular mass of hydrogen and water, respectively [kg/kmol]; Pan is the internal pressure on the anode channel [atm].
If it can be assumed that the molar flow of any gas through the valve is proportional to the partial pressure in the channel, then it can be stated according to the following: where , are the molar flows of hydrogen and water through the anode valve [kmol/s]; , are partial pressures of hydrogen and water [atm]; , are hydrogen and water valve molar constants (kmol/(s atm)).
The design parameters of the simulator process are needed to calculate the value of the plant output. All of these are assumed as shown in Table 3. Partial pressure is calculated based on Equations (6), (8), and (10), while calculating the prototype of the SOFC simulator [7,13]. This equation is still in the form of a transfer function. In the use of a microcontroller, the equation must be converted into a time equation that is to be converted into C programming language. An equation is used to find the partial pressure value of H2: For example, It is then transformed in reverse to its time version as shown below: Next, it is made discrete by the method of backward differences, so the value of the H2 partial pressure equation can be obtained based on the time changes: The description of H2 partial pressure calculation from Equation (5)  Equation (7) is used to find the value of the partial pressure of H2O with the description as follows: For example, It is then transformed reversely into the time equation as shown below: Next, it is made discrete by the backward difference to obtain the value of the H2O partial pressure, as shown below: The description of partial pressure calculation of H2O from Equation (7)  This then forms Equation (9), which is used to calculate the O2 partial pressure value, as follows: For example, = _ , 3 = 1 , = _ − .

It is then transformed reversely into
This is then discredited by the backward difference method to obtain the equation for O2 partial pressure as shown below: The above equation then resulted into the equation ( ) = • ( − 1) + • ( ), which is to be applied in C language with = and F= Usually, the real output voltage may be reduced because of ohmic, activation, and concentration losses. The SOFC simulator process calculation has voltage losses consisting of Vohmic, Vact, and Vconc, and these are expressed mathematically by Equations (12)- (14) [7,14].

= × (12)
= + ln (13) where I is the load current or SOFC output current. The SOFC output voltage can be calculated based on the following equation: where is the Nernst voltage equation, which is given as where E0 is the voltage associated with the reaction free energy (V), R is the gas constant [J/kmol K], and Ncell is the number of cells.

Simulator Uncontrolled
SOFC simulators are tested with 300 A input current (external) with 1273 K temperature. The flow rate is given above 0.7 mol/s for hydrogen and 0.6 mol/s for oxygen. The results of the tests are shown in Figures 10, 11, 12, and 13, respectively.   The average values of the test results are shown in Table 4. The average SOFC output voltage does not reach the set point value of 333 volts. The difference in pressure (∆pressure) of hydrogenoxygen exceeds 8000 Pa. The flow rates of hydrogen and oxygen are 0.79 and 0.67 mol/s.

Testing without Disturbance
The SOFC simulator is tested using a controller with an input current (external current) of 300 A and a temperature of 1273 K. Graphs of output voltage, flow rate, and hydrogen-oxygen pressure are shown in Figures 14-17.  The average values of the test results are given in Table 5. The SOFC output voltage value is 340.60 volts and reaches the set point of 333 volts with an error of about 7.6 volts. The value of hydrogen-oxygen pressure is in the range of 4000 Pa, far below the pressure difference (∆Pressure) without a controller. Hydrogen and oxygen flow rates are 0.79 and 0.72 mol/s.   The average value of the test results is given in Table 6

Testing with Positive Disturbance
The positive disturbance test is the same as that done at the time of 30,000 ms with an external current that is reduced to around 260 A. Thus, the SOFC output voltage will rise to around 380 volts. Graphs of these test results are shown in Figures 22-25.  The average value of the test results is given in Hydrogen and oxygen flow rates are 0.51 and 0.56 mol/s.

Discussion
The average value of the SOFC output voltage can be corrected by the controller to the 333 volt set point from 352.09 to 340.60 volts. Hydrogen-oxygen pressure value can be controlled in the range of 4000 Pa, from 17,122 to 4428.68 Pa. Furthermore, the flow rates of hydrogen and oxygen produced in uncontrolled testing are 0.67 and 0.79 mol/s and can then be controlled to 0.72 and 0.79 mol/s. The hydrogen-oxygen pressure difference (∆Pressure) is below 0.08 atm or 8106 Pa [6]. Comparison of the test results is shown in Table 8.

Conclusions
SOFC simulators and hydrogen and oxygen flow rate controllers were designed quite well. The controller can correct the SOFC output voltage value to the set point of 333 volts, i.e. from the voltage of a controller without 352.09-340.60 volts with an error value of 7.6 volts. The pressure difference (∆Pressure) between hydrogen and oxygen in the SOFC simulator can also be maintained between 4000 and 8000 Pa. When the controller is given a negative disturbance SOFC output voltage below the set point, the voltage is 332 volts. When given a positive disturbance SOFC output voltage above the set point, the voltage is 348 volts. The system in general is still able to improve when the external current is enlarged and reduced from its normal value.
There is a correlation between the pressure difference and the ratio of hydrogen inflows to oxygen flow . By maintaining around 1145 with a controlled system. The pressure difference between the two gases can be maintained below 0.08 atm (8106 Pa).
In the negative disturbance test, the average output voltage from the SOFC is 332.72 volts with a set point of 333 volts. The difference in hydrogen and oxygen pressure is an average of 6782.3 Pa. The controller can correct the value of the output voltage that changes due to negative interference.
In positive disturbance testing, the average output voltage of the SOFC is 348.58 volts with a set point of 333 volts. The average pressure difference between hydrogen and oxygen is 8178.6 Pa. The controller cannot correct the output voltage value that changes due to positive interference, and the controller can meet the safety limit of the pressure difference between the two gases.
Based on the graph in Figure 17, there is still a large overshoot. This means improvements still must be made to the control system. Improvements can employ a hybrid fuzzy PID controller.
Author Contributions: For this research article the authors have their respective roles as follows: Darjat, correspondence, SOCF theory, hardware and software design; Sulistyo, SOFC field; A.T., control design; Sudjadi hardware and control; A.K., design of controls, hardware and software.