Modeling and simulation of an electrolyser for the production of HHO in MatlabSimulink®
Modelamiento y simulación de un electrolizador para la producción de HHO
Erick Daniel Rincón-Castrilloa1 , José Ricardo Bermúdez-Santaellab 2, Luis Emilio Vera-Duartec 3 , Juan José García-Pabón4
aElectromechanical Engineer email@example.com https://orcid.org/0000-0002-2425-3833
Universidad Francisco de Paula Santander, San José de Cúcuta, Colombia.
bMagister in Automation and Instrumentation firstname.lastname@example.org
https://orcid.org/0000-0001-9265-0083 Universidad Francisco de Paula Santander, San José de Cúcuta, Colombia.
c Magister in Thermal Engineering, Mention Thermofluidics, correo: email@example.com, https://orcid.org/0000-0001-8756-7779 Universidad Francisco de Paula Santander, San José de Cúcuta, Colombia.
d PhD in Mechanical Engineering firstname.lastname@example.org , https://orcid.org/0000-0002-1894-534X Universidade Federal de Itajubá, Itajubá, Brasil.
E.D. Rincon-Castrillo, J.R. Bermudez-Santaella, L.E. Vera-Duarte, J.J. Garcia - Pabon “Modeling and simulation of an electrolyser for the production of HHO in Matlab-Simulink®”. Respuestas, vol. 24, no. 2, 6-15.
Recivido: Agosto 10, 2018; Aceptado: Noviembre 15, 2018
The electrolyzers work through an electrochemical process, their derivatives (H2, O2, and HHO) are used as enriching fuels due to the electrolysis of water, being cleaner than gasoline and diesel. This article presents the dynamic model of an alkaline electrolyzer that uses an electrolyte (KOH o NaHCO3) dissolved in distilled water to accelerate the production of oxyhydrogen (HHO). The model shows the phase change that occurs inside the electrolytic cell. The EES® software was used to determine the values of enthalpy, entropy, and free energy that vary during the electrochemical reaction; the equations were simulated in Matlab-Simulink® to observe their dynamic behavior. The Simulations presented varying every 5 g the electrolyte until reaching 20 g. The flow rate of HHO with potassium hydroxide (20 g) is higher than 0.02 L / s, and with sodium bicarbonate (20 g) it is above 0.0006 L / s, confirming what the literature of alkaline cells state, that the most efficient electrolyte for its energy conversion is KOH.
Keywords:Alkaline electrolyser, dynamic model, simulation, Matlab-Simulink®, EES.
Los electrolizadores funcionan mediante un proceso electroquímico, sus derivados (H2, O2, y HHO) debido a la electrólisis del agua son utilizados como combustibles enriquecedores, siendo más limpios que la gasolina y diesel. Este artículo presenta el modelo dinámico de un electrolizador alcalino que utiliza un electrolito (KOH o NaHCO3) disuelto en agua destilada para acelerar la producción de oxihidrógeno (HHO). El modelo muestra el cambio de fase que ocurre en el interior de la celda electrolítica. Se utilizó el software EES® para determinar los valores de entalpía, entropía, y energía libre que varían durante la reacción electroquímica, las ecuaciones fueron simuladas en Matlab-Simulink® para observar su comportamiento dinámico. Las simulaciones fueron realizadas variando cada 5 g el electrolito hasta llegar a 20 g. El caudal de HHO con hidróxido de potasio (20 g) es superior a 0.02 L/s, y con bicarbonato de sodio (20 g) está por encima de 0.0006 L/s, permitiendo confirmar lo que se enuncia en la literatura de celdas alcalinas, donde se establece que el electrolito más eficiente para su conversión energética es KOH.
Keywords:Electrolizador alcalino, modelo dinámico, simulación, Matlab-Simulink®, EES.
Voltaic cells and electrolytic cells are fuel cells that operate by means of an electrochemical process in which reagents and products are subjected to an energy imbalance due to the fact that the reaction can be exothermic (it gives off energy) or endothermic (it needs to be supplied with energy), from this perspective the spontaneity of these devices is studied .
Fuel cells are a cleaner choice compared to gasoline and diesel used in internal combustion engines . The efficiency of the cells is another parameter that must be taken into account, being approximately twice as high as the thermal engines because the latter are affected by the following limitations established by Carnot’s Theorem .
There are several types of fuel cells, currently the classification that is made for these devices is taking into account the type of electrolyte they use, this way we have the AFC (Alkaline Fuel Cells), PEMFC (Proton Exchange Membrane Fuel Cells), DMFC (Direct Methanol Fuel Cells), PAFC (Phosphoric Acid Fuel Cells), MCFC (Fused Carbonate Fuel Cells) and SOFC (Solid Oxide Fuel Cells) . The versatility of the cells has allowed them to have a field of application in the industry specifically in transportation, stationary power systems and portable systems, the last three sectors is where its impact has been most noticeable , .
The effect caused by fuel cells in industry is largely due to their efficiency in conversion and energy input, to understand the above is necessary to understand the principle of operation of these devices being necessary to identify the mathematical equations that model their dynamic behavior.
In this article the modeling of an electrolyzer or alkaline electrolytic cell (AFC) with a single output will be carried out, for the study of the production of oxyhydrogen gas (HHO) as a clean energy, in this way it can be used as an enriching fuel or enhancer in the processes where combustion takes place. In this research, concepts of thermodynamics, chemistry, thermochemistry, and electrochemistry are taken into account for the approach of the equations, thus enunciating a thermodynamic model, electric model, chemical model, and thermal model. The EES software is used to determine the value of the variables of the thermodynamic model (enthalpy, entropy and free energy), the equations of the other models are simulated in Matlab-Simulink® because some do not present linearity, and others are empirical electrochemical relations.
Figure 1. Alkaline fuel cell.
The electrolysis of water in an alkaline medium in an electrolyser is generated by means of a redox reaction (oxidation - reduction) that occurs in the electrodes 
, this process is shown in Figure 1. Source: 
2. Materials and methods
Alkaline electrolytic cell
The phase change (liquid to gaseous state) of the water that occurs in the alkaline electrolyser to be modelled, occurs when energy is supplied to the electrochemical reaction in the form of electrical work (non-spontaneous process) .
In order to know in detail what happens in the electrodes of the cell, the generation of gaseous oxygen in the anode is presented by means of (1), and the generation of gaseous hydrogen is shown in the cathode with (2).
OH− (aq) : Hydroxyl ion (water-based solution)
O2(g): Oxygen (gaseous)
H2O(l): Water (Liquids)
H2(g): Hydrogen (gaseous)
The two previous semirreactions allow to arrive at the general reaction (3) that governs the process, it is necessary to mention that the change of phase that is carried out is thanks to the electrolysis (decomposition of the water molecule by the passage of the current in it) 
Figure 2. Electrolyzer modeled in SolidWorks®, a) diagonal view, b) cross-section view.
In the electrolytic cell there is a conversion of electrical energy to chemistry, in this process there are some thermodynamic variables that suffer energy imbalance, it is for this reason that the mathematical model is divided Figure 2 shows the electrolyzer modeled in SolidWorks®, consisting of a stack of cells composed of 9 plates (1 positive, 2 negative, and 6 neutral) of 316 stainless steel, 2 sheets of acrylic, and 10 PVC rings. into four stages: thermodynamic model, electrical model, chemical model, and thermal model.
To get the most energy available for useful work, a status function, called free energy (G) 
, is defined by (4).
H∆ : Change of enthalpy
S∆ : Change of entropy
G∆ : Free energy exchange
T : Temperature
In a non-spontaneous electrochemical process the change of free energy ( ∆G ) is equivalent to the electrical work (Welectric) that is necessary to supply for the reaction to occur 
, in (5) the above can be appreciated, non-spontaneity is represented by leaving the work expressed in a positive way.
The electrical work is equivalent to the irreversible voltage (Uirrev) of the electrolyser, for this reason the above equation is expressed with a voltage that is irreversible by the present losses 
by means of (6).
z : Number of electrons ( 2e− )
F : Faraday Constant (96500 C)
When a reversible reaction is assumed, i.e. without losses, the process energy (H) is worked with as shown in (7) with a reversible voltage (U_rev).
The effect of irreversibilities (losses) can be seen when calculating the irreversible and reversible voltages that result in Uirrev
= 1.22 v and Urev
=1.48 v, these stress values were calculated from enthalpy and entropy values under standard reaction conditions, i.e. at 25 °C and 1 bar.
The electric model is designed to determine the current (I) and voltage of the electrolyzer, the relationship between these two variables is modeled by means of (8) found in 
A: Electrode area
Table I. ADJUSTED VALUES OF r, s, and t.
The power consumed by the cell is directly proportional to the number of cells (N) that make up the stack, this relationship is established with (10).
The calculation is made by means of the product between the number of cells connected in series (nc
) with The coefficients r, s and t model the overvoltages (irre-versibilities), to express their value in a more precise way they are left expressed in such a way that they depend on the temperature through (9), so it is stated 
.with the number of cells connected in parallel ( ) by means of (11)
By setting the temperature (T) of the electrolyte this part consists of 2 equations (power consumed with (10), and voltage between electrolyser terminals expressed in (9)) with 2 unknowns (U, I) and its resolution determines the operating point of the electrolyser.
Faraday’s law states that the rate of production of oxyhy-drogen in a cell is proportional to the transfer of elec-trons in the electrodes, i.e., to the intensity supplied by the electrical work, (12) shows this relationship 
The expression used for the calculation of Faraday’s Effi-ciency is that proposed by 
, where the effect of stray currents is modelled. It is determined by means of (13), is caused by stray currents and these increase by current densities.
The dependence of the coefficients and with the tempe-rature is obtained by means of the experimental tests ca-rried out by 
, by means of measurements in different points of operation, obtaining polynomial expressions depending on the temperature with (14), and (15).
n the calculation of Faraday’s Efficiency the values of , and , in Table II you can see these data for certain tem-T
Table II. COEFFICIENT VALUES f1 and f2.
With the data from Table II, the coefficients of the poly-nomials (17) and (18) are calculated by making an adjust-ment of minimum squares to relate , and with tempera-ture, because the function is not known.
Figure 3 shows a straight line (grade 1 polynomial), because a linear dependence on the temperature of the electrochemical reaction has been assumed in the least squares setting.
Figure 3. Dependence of f1 on reaction tempera-ture.
Of (17) we have:
Figure 4 shows a curve (grade 2 polynomial), because a quadratic dependence on the temperature of the electro-chemical reaction in the least squares setting has been assumed.
Figure 4. Dependence of f2 on reaction temperature.
Of (18) we have:
The overvoltages r, s and t present in the electric model are a function of the temperature, it is for this reason that the thermal model is raised, in order to obtain the value of this one, for which a balance of energy is made in the electrolyser with (16).
∆E= Q −P∆V
∆E: Energy shift
Q: Heat at the entrance.
Because the mathematical model focuses on the phase change of the solution (electrolyte dissolved in water) that by means of an electrochemical reaction at atmospheric pressure, the work (P∆V) is neglected in (17).
In order to calculate the behaviour of temperature over time, it is necessary to calculate all the heat involved in the energy balance and obtain the resulting heat, as ex-pressed in (18) 
: Thermal capacitance
The heat generated is the one contri-buted to the solution in the reaction due to the irreversi-bilities in the electrolysis process, by means of (19) this energy transfer is modelled.
The voltage efficiency relates the thermoneutral voltage (reversible) and the actual voltage (irreversible) applied to the cell through (20).
The voltage efficiency may be greater than the unit be-cause the irreversible voltage is less than the reversible voltage.
Electrolyte heat: In the literature of alkaline cells (AFC) when modeling is considered, the energy provided by the electrolyte in the reaction is not studied. Contrary to the previous thing in this investigation the energetic contri-bution of the conductor of second species for this process is analyzed.
The heat of the electrolyte models the calorific or energy potential provided by KOH or NaHCO during the elec-trolysis of water, for its calculation the speed constant (k) and the concentration (CA) must be taken into account by means of (21) 
The speed constant varies with temperature as des-cribed by (22)  
E: Activation energy
R: Ideal gas constant(8.3144 J/mol°C)
For the calculation of the frequency factor (Ko) the mo-les of the reagents, and of the products must be conside-red, as well as it expresses it.
It is necessary to know the activation energy (E) to de-termine the constant speed of the reaction, thus establi-shing an energy variation at standard conditions (T= 25 °C, and P°=1 bar), at how the electrochemical reaction is carried out experimentally (24).
To determine the concentration (CA) it is necessary to identify the solubility of potassium hydroxide (119 g in 100 g of water), and sodium bicarbonate (10.3 g in 100 g of water), taking into account that 900 g of distilled water are used during the process.
The heat lost models the amount of energy expelled into the environment, by means of (25) the abo-ve is shown. This is the expression that finally allows the calculation of the temperature 
: Reaction temperature
: Ambient temperature
The thermal resistance is calculated on the acrylic sheets that are part of the electrolyzer as expressed in (26).
L : Thickness of acrylic sheet
K: Thermal conductivity of acrylic
A: Surface of acrylic sheet
With the above values of L, K and A, the thermal resis-tance of the acrylic film is calculated (R1= 6.66 k/W), this value takes great relevance in the simulation.
Figura 5. Subsystems of the proposed models.
Implementation of the model in Matlab-Simulink®.
The thermodynamic variables (H, S, and G) used in the model have been obtained as a function of the standard conditions (T=25 °C, and P°=1 bar) of an electrochemical reaction, the commercial tool EES® was used.
For the implementation of the mathematical model in Si-mulink, the previously defined equations are added and the respective connection is made. Figure 5 shows the subsystems of the process, where you can see the propo-sed models that simulate the behavior of the electrolytic cell, in which the input variables are the voltage (13.8 V) supplied by the DC source in the process, and the elec-trolyte mass (in kg) in the solution, in order to analyze the reaction temperature and HHO volumetric flow.
Results and analysis
The modeling and simulation of the alkaline electrolyser takes into account the energy contributed by the elec-trolyte ( Qelectrolito
) in the reaction, contrary to the approa-ches of the mathematical models of , ,  con-sulted in the literature concerning this type of cells, in these investigations the calorific potential contributed by the second species conductor in the process is not considered. Next, the effect of the calorific potential of the electrolyte on the temperature, and flow (volumetric flow) of HHO when sodium bicarbonate ( NaHCO3
), and potassium hydroxide ( KOH) are used is analyzed.
Figure 6 shows the behaviour of the electrolyser tempe-rature using, it was dosed every 5 g until reaching 20 g to perceive the increase in temperature at different concen-trations of the electrolyte, the simulated maximum value is above 45°C. On the other hand, the establishment time for the different quantities supplied coincides in 25 s.
Figura 6. Temperature variation of the elec-trolyser with KOH.
Figure 7 shows the variation of the electrolyser tem-perature using , as well as with potassium hydroxide, the amount of sodium bicarbonate was simulated every 5 g to 20 g, a maximum temperature reached for this last concentration above 25.8 °C was recorded, and the settling time for all curves is 35 s.
Figura 7. Temperature variation of the electrolyser with NaHCO3
When comparing Figure 6 and Figure 7 it is important to highlight the difference between the temperatures, with 20 g of sodium bicarbonate is obtained in the simulation more than 25.8 °C, with the same amount of potassium hydroxide is above 45 °C the temperature of the reaction generated in the cell, this occurs because the solubility of KOH (119 g in 100 g of water) is higher compared to NaHCO3 (10.3 g in 100 g of water), in turn the flow of the current increases, and the temperature rises; with this the directly proportional relationship between the varia-bles is evident, before the increase of some of them the others are also increasing. The time of establishment of the temperature with KOH is less (25 s), that is to say, the reaction is faster due to the chemical properties of the electrolyte.
Figure 8 and Figure 9 show the variation of the HHO flow rate in the electrolyser with KOH, and NaHCO3, accor-ding to the simulation a HHO flow rate above 0.02 L/s with potassium hydroxide (20 g) is recorded, in the case of sodium bicarbonate (20 g) a lower flow rate is produ-ced (above 0.0006 L/s).Figure 6.
Figura 8. HHO flow rate of the electrolyser with KOH.
Figura 9. HHO flow rate of the electrolyser with NaHCO3
The electric current circulating through the electrolyser affects the temperature as previously mentioned and the HHO flow of the cell, as the simulation increases the con-centration of the electrolytes, the flow of the current in-creases, in the case of potassium hydroxide increases in greater proportion and for this reason produces 0.02 L/s of oxyhydrogen, when these values are compared with sodium bicarbonate (above 0.0006 L/s), KOH is establi-shed as the best electrolyte alternative for electrolytic cells.
The modeling was performed, and the simulation of an alkaline electrolytic cell that produces oxyhydrogen, in the thermal model the values of the thermal capacitance and thermal resistance influenced notably in the dynamic behavior of the temperature, because Ct adjusts its time of establishment and Rt can make vary its value.
The dynamic behavior in the simulation of the elec-trolyzer with potassium hydroxide was better in compa-rison of sodium bicarbonate, because in the flow (most significant variable) with (20 g) is higher than 0.02 L/s, and with (20 g) is above 0.0006 L/s, allowing to confirm what is stated in the literature of alkaline cells, where it is established that the electrolyte with the most efficient operates is.
The variables analyzed (temperature and flow) showed a behavior directly proportional to each other, ie, as the amount of electrolyte was increased (each 5 g to 20 g) both the temperature and flow increased, this behavior is presented because the current flow is gradually higher, thus happens experimentally in this type electrochemical processes.
In the simulation of the electric and chemical model, it was necessary to calculate some correcting coefficients of adjustment with the nominal operating conditions, and constructive parameters of the electrolyzer, the results were Alpha = 1.038, and Beta = 1.082, these values allow to establish the proximity or the existing closeness be-tween the simulated mathematical model, and the beha-vior of an electrolytic cell experimentally.
 A. C. Turkmen, S. Solmaz, and C. Celik, “Analysis of fuel cell vehicles with advisor software,” Renew. Sustain. Energy Rev., vol. 70, pp. 1066–1071, 2016.
 E. D. Rincón, J. J. García, and J. R. Bermúdez, “ESTADO DEL ARTE DE LAS CELDAS DE COMBUSTIBLE,” Rev. Colomb. Tecnol. Av. Recib., vol. 1, no. 33, pp. 36–49, 2019.
 P. L. Cabot, F. Alcaide, and E. Brillas, “Applications - Stationary | Cogeneration of Energy and Chemicals: Fuel Cells,” Ref. Modul. Chem. Mol. Sci. Chem. Eng., pp. 146–156, 2013.
J. Alvarado, “Estudio comparativo de las diferentes tecnologías de celdas de combustible,” Bol. la Soc. Española Cerámica y Vidr., vol. 52, no. 3, pp. 105–117, 2013.
 Á. O. Díaz, J. E. González, and O. A. González, “Análisis de un generador de HHO de celda seca para su aplicación en motores de combustión interna,” Rev. UIS Ing., vol. 17, no. 1, pp. 143–154, 2018.
W. Osorio and Ó. H. Giraldo, “Sobre la termodinámica de las soluciones electrolíticas,” Rev. Fac. Ing. Univ. Antioquia, vol. 40, pp. 7–21, 2007.
 R. Battino, “Comments on the teaching of chemistry, doing chemistry demonstrations, and a passion for chemical thermodynamics,” J. Chem. Thermodyn., vol. 123, pp. 74–78, 2018.
 M. L. Lladó and A. H. Jubert, “Trabajo útil y su relación con la variación de energía de Gibbs,” Educ. Quim., vol. 22, no. 3, pp. 271–276, 2011.
 T. Wilberforce et al., “Modelling and simulation of Proton Exchange Membrane fuel cell with serpentine bipolar plate using MATLAB,” Int. J. Hydrogen Energy, vol. 42, no. 40, pp. 25639–25662, 2017.
 M. M. De Souza, R. S. Gomes, and A. L. De Bortoli, “A model for direct ethanol fuel cells considering variations in the concentration of the species,” Int. J. Hydrogen Energy, vol. 43, no. 29, pp. 13475–13488, 2018.
 O. Ulleberg, “Modeling of advanced alkaline electrolyzers: a system simulation approach,” Int. J. Hydrogen Energy, vol. 28, pp. 21–33, 2003.
 A. Ursúa and P. Sanchis, “Static-dynamic modelling of the electrical behaviour of a commercial advanced alkaline water electrolyser,” Int. J. Hydrogen Energy, vol. 37, no. 24, pp. 18598–18614, 2012.
 M. Sánchez, E. Amores, L. Rodríguez, and C. Clemente-Jul, “Modelado y simulación de sistemas de producción de hidrógeno vía electrolisis alcalina a partir de energías renovables,” in Congreso Iberoamericano de Hidrógeno y Pilas de Combustible 2017, 2017, pp. 183–186.
 G. Yan et al., “An Arrhenius equation-based model to predict the residual stress relief of post weld heat treatment of Ti-6Al-4V plate,” J. Manuf. Process., vol. 32, pp. 763–772, 2018.
 D. Michel, “Test of the formal basis of Arrhenius law with heat capacities,” Phys. A Stat. Mech. its Appl., vol. 510, pp. 188–199, 2018.
 K. Naveršnik and R. Jurečič, “Humidity-corrected Arrhenius equation: The reference condition approach,” Int. J. Pharm., vol. 500, no. 1–2, pp. 360–365, 2016.
 M. Hammoudi, C. Henao, K. Agbossou, Y. Dubé, and M. L. Doumbia, “New multi-physics approach for modelling and design of alkaline electrolyzers,” Int. J. Hydrogen Energy, vol. 37, no. 19, pp. 13895–13913, 2012.
Commons Reconocimiento-NoComercial 4.0 Internacional