The initial part of the work presents a simplified model of a power-to-power system, including an electrolyzer, a hydrogen storage tank and a fuel cell. The entire model is developed within a MATLAB/Simulink® (R2024a) environment, which enables the simulation of the dynamic behaviour of the system’s components. This modelling approach provides a detailed and accurate representation of the time-dependent interactions among the various elements, offering a flexible framework for system design, analysis and performance optimization.
The chosen simulation time step has been deliberately chosen to capture the natural fluctuations in PV generation and load demand. These short-term variations are critical for accurately reflecting the behaviour of key components such as the electrolyzer and fuel cell, particularly their start-up events and dispatch dynamics. A coarser resolution (e.g., hourly) would smooth out these fluctuations, potentially introducing errors in the energy balance and masking important system behaviours like surplus peaks or deficit spikes. The one-second resolution strikes a good balance between accuracy and computational cost, ensuring that both technical performance and economic comparisons across control strategies are realistically represented.
2.1. Electrolyzer Model
The focus is placed exclusively on the Proton Exchange Membrane (PEM) electrolyzer technology. After comparing this with an alkaline electrolyzer model, it was concluded that the PEM electrolyzer offers higher efficiency and better dynamic behaviour. As a result, the alkaline electrolyzer model has been excluded from further discussion in this work.
Model assumptions are listed as follows:
A steady-state electrochemical mechanism for the electrolyzer is used, implying that the system exhibits an instantaneous response to input changes, with no time delays. This assumption is supported by the fact that typically, the response time of PEM electrolyzers is rapid, approximately 50 ms for a PEM stack [
21]; thus, this simplified approach is justified.
The electrolyzer is assumed to be isothermal (average cell temperature is considered); thus, the thermodynamic model is considered static as well.
Gases are approximated as ideal gases.
Thermodynamic and electrochemical [
22] considerations are discussed below.
The minimum voltage needed to be applied between the electrodes of each cell is the reversible voltage, and it is calculated taking into consideration the partial pressures of hydrogen, oxygen and water (
,
,
).
The first term
is also obtained as a function of temperature (
):
, and are the universal gas constant, the number of electrons transferred per reaction and the Faraday constant, respectively.
The cell voltage is given by the sum of the reversible voltage, the activation, the ohmic and the concentration overvoltages. The last term will be neglected since it is not significant at moderate current densities [
22].
The activation overvoltage (
) is calculated, respectively, for the anode and the cathode through the Butler–Volmer equation:
where
is the charge transfer coefficient,
corresponds to the current density and
represents the exchange current density. The final values used in the model are listed in
Table 1.
The ohmic overpotential (
) is calculated as the product between the ohmic resistance of each cell in the stack (
) and the current (
). Since the cell is composed of plates and a membrane, the equivalent resistance can be defined as the sum of the resistance of electrodes and the one due to the membrane as follows:
The ohmic resistance of the membrane (
) is bigger than the one measured at the electrodes [
23]; so in this model, only the former is considered using the expression below:
The
term represents the thickness of the electrolyte membrane, and its value is reported in
Table 1, while the
is the conductivity of the membrane itself, which can be calculated through the following expression [
22,
23]:
The
term is the degree of humidification of the membrane, which is generally assumed to be in the range 14–21 [
23] in the case of an electrolyzer. For this study, a value of 20 is chosen.
The model employed in this study builds upon the foundational work of H. Görgun [
24], which was later subjected to dynamic testing by Yigit et al. [
22]. Each module—anode, cathode and membrane—is developed independently, but they are tightly interconnected, as the output from one module often serves as the input for another. The model adheres to the principle of mass (or mole) conservation at both the anode and cathode, while the membrane is characterized by water transport mechanisms, including electro-osmotic drag and diffusion processes. These interactions ensure an accurate representation of the physical processes occurring within the system.
2.1.1. Anode Module
The anode module is responsible for water separation and the half-reaction of oxidation, where oxygen is generated and water is consumed. The system dynamics are accurately captured by the governing Equations (7) and (9), which, respectively, describe the rate of oxygen generation (
) and the rate of water consumption (
). These equations reflect the mass balances and reaction kinetics occurring within the anode, ensuring that the behaviour of key species, such as oxygen and water, is properly quantified under dynamic operating conditions.
where
—inlet molar flow of oxygen, , which is assumed to be equal to zero since water is the only input on the anode side;
—outlet molar flow of oxygen, ;
—rate of oxygen generated,
, obtained through the general Faraday law:
where
corresponds to the number of cells. The dynamic flow of water in anode is described through the equation of mass conservation:
where
—inlet molar flow of water, ;
—outlet molar flow of water, ;
—electro-osmotic drag, since the water is dragged to the cathode by the hydrogen ions, ;
—diffusion flow due to water concentration gradient across the membrane;
—pressure gradient (convection) flow.
The inlet molar flow of water is a defined value that is continuously provided to the anode, and it is assumed to be proportional to the water required to make the reaction possible through the Faraday law:
The partial pressures of oxygen and water in the anode can be calculated through the ideal gas law. Finally, the total anode pressure is given by the sum of the partial pressures.
Oxygen and water mole fractions at the anode outlet are obtained, respectively, as
Molar fractions are needed to compute the outlet flows of oxygen and water on the anode side, that, respectively, are
where
is the total amount of out-flow, obtained by the difference between total pressure at anode and external standard pressure, multiplied by the anode outlet flow coefficient
:
2.1.2. Cathode Module
The second module is the one that regards the cathode electrode, where the half-reaction of hydrogen reduction occurs. Consequently, the species present are hydrogen and water. The balance of flows is analyzed in the following equations, which show the rate of generation of hydrogen and the water hold-ups:
where
—inlet molar flow of hydrogen, , which is assumed to be equal to zero since there is no inlet flow on the cathode side;
—outlet molar flow of hydrogen, ;
—rate of hydrogen generated,
, obtained through the general Faraday law:
The dynamic flow of water in the cathode is described similarly to (9), again through the equation of mass conservation:
where
—inlet molar flow of water, , which is assumed to be equal to zero, since there is no inflow on the cathode side;
—outlet molar flow of water, ;
—electro-osmotic drag, since the water is dragged to the cathode by the hydrogen ions, ;
—diffusion flow;
—convection.
The partial pressures of hydrogen and water in the cathode can be calculated again through the ideal gas law, and the total cathode pressure is then obtained.
Equations (11)–(15) are also implemented for the cathode, where the oxygen is substituted by hydrogen.
2.1.3. Membrane Module
The last module is the one related to the membrane, where the hydrogen ions pass through. However, the water can also cross the membrane because it is transported by convection, diffusion and the electro-osmotic drag. The convection is generated by a difference in pressure between the two electrodes, but since, in this case, the anode and cathode are assumed to be at the same pressure, it will be neglected.
Water diffusion is given from Fick’s first law as follows:
where
is the water diffusion coefficient,
and
are the water concentrations for the cathode and anode surfaces of the membrane and
is the thickness of the membrane. However, the hypothesis about the equilibrium of the membrane with the liquid water on both sides of the cell has been established, so the difference between water concentrations is assumed to be null and, consequently, the
can also be neglected.
The last contribution that has to be taken into consideration within the membrane is related to the phenomenon of the electro-osmotic drag [
25], which is obtained through the following equation:
In fact, it has been tested that every proton is able to transport some molecules of water from the anode to the cathode, and this is represented by the electro-osmotic drag coefficient
, whose value can be calculated in different ways as explained by Li et al. [
25]. The one used in this work is given by Equation (21), which shows a linear dependence on the temperature (in K).
2.1.4. Model Implementation
The model described up to now shows a molar balance in the anode and cathode without specifying the state of the water inside. In fact, using the equations already mentioned, it is understandable that the total water is considered to be vapour by Yigit et al. [
22]. This is a common approach in the literature, as shown also by Correa et al. [
26]. However, this strong simplification does not take into account the fact that the PEM electrolyzer actually works with liquid water, since the relatively low temperature and pressure do not allow it to reach full gasification. For this reason, changes are applied to the previous model, applying some changes to the equations mentioned above.
Starting again from the anode side, the molar balance, Equation (9), of water in the anode becomes
It is worth underlining that the inlet water is provided as liquid, while the water exiting can be distinguished between liquid and vapour. Indeed, when the saturation pressure is reached, the water becomes liquid, so the amount of liquid water exiting the anode also has to be established. On the cathode side, the same assumptions are made, and the molar balance equation described in (18) changes into
The main assumptions are related to the input parameters needed.
Table 1 shows the values chosen for the electrolyzer model.
Table 1.
Input parameters for the electrolyzer model.
Table 1.
Input parameters for the electrolyzer model.
Symbol | Parameter | Value | Ref. |
---|
Anode | | | |
| Anode total pressure | | [23] |
| Anode exchange current | | [23,27] |
| Anode charge transfer coefficient | | [23,27] |
| Anode outlet flow coefficient | | |
Cathode | |
| Cathode exchange current | | [23,27] |
| Cathode charge transfer coefficient | | [23,27] |
| Cathode outlet flow coefficient | | |
Other parameters of the electrolyzer |
| Faraday constant | 96,485.3 | [28] |
| Universal gas constant | | [28] |
| Number of cells | | |
| Temperature | 80 °C | |
| Standard atmospheric pressure | 101,325 | |
| Thickness of electrolyte membrane (Nafion 117 PFSA DuPont) | | [29] |
2.4. Case Study
This work presents a methodology for determining the optimal sizing of the hydrogen-based energy storage system integrated into a microgrid with PV generation and a connection to the electrical grid. The case study simulates a power-to-power system that utilizes surplus electricity produced by photovoltaic panels. This approach offers a preliminary assessment of component sizing and enables an evaluation of how different economic strategies can influence the system’s design and overall cost.
The analysis is based on the selection of representative production and load profiles from a typical day in April 2023, which is considered a reference for the entire month. In Barcelona, solar PV generation exhibits a seasonal pattern: Summer months deliver the highest yields thanks to longer daylight hours and a higher solar altitude, whereas winter months record the lowest output because of shorter days and a shallower sun angle. April, therefore, lies in an intermediate band, with irradiance levels that closely track the annual mean [
30]. The data used in this study was sourced from Dexma Energy Intelligence software [
31], which provides historical electricity generation data from photovoltaic panels in Catalunya and detailed energy consumption information. Specifically, the PV production data (
Figure 1) was obtained from a 167 kW photovoltaic system installed at the Campus Nord of Universitat Politècnica de Catalunya (UPC), located near the industrial zone where the system is intended to be implemented. This proximity ensures that the production data accurately reflects the solar generation potential of the actual site.
The electricity power consumption profile (
Figure 1) was also obtained from the same software. The selected profile corresponds to the Biblioteca Rector Gabriel Ferratè, a university library characterized by relatively stable energy demand throughout the year. By selecting a typical day in April as a representative sample, this approach captures typical consumption patterns while minimizing the influence of seasonal variability, under the assumption that demand remains nearly constant during the year.
Using real-world production and consumption data enhances the realism of the simulation and improves the accuracy of system performance assessments.
While actual electricity consumption can vary significantly from day to day, this analysis adopts a simplified approach by using a single reference day. This allows for a clearer understanding of the fundamental operation of the power-to-power system. Electricity price data was obtained from the Esios—Red Eléctrica de España website [
32], using a typical April 2023 day as a reference.
The main techno-economic parameters are summarized in
Table 3. The cost of solar panels is based on the current market price of 0.9 EUR/W, applied to the system size of 167 kW.
The electrolyzer cost is assumed to be 1188 EUR/kW. Its sizing is determined using a simplified approach: it is set equal to the maximum power input it may receive, defined as the highest positive difference between PV production and electricity demand. The efficiency of the DC/DC converter, assumed to be 95% [
33], is also taken into account in this calculation.
For the fuel cell, the cost is estimated at 1520 EUR/kW. Its sizing corresponds to the maximum power shortfall between energy demand and PV generation—effectively, the peak power the fuel cell must deliver. Both the DC/DC (95%) and DC/AC (94%) conversion efficiencies [
33] are included in the sizing process to account for power electronics losses.
The overall round-trip efficiency of the power-to-power system is assumed to be constant at 0.35. This is derived from the average electrolyzer efficiency (0.64) and the nominal fuel cell efficiency (0.55), both evaluated from the simulation model. As a result, any PV surplus energy that is stored and later recovered through the hydrogen cycle is adjusted according to this round-trip efficiency, capturing the energy losses inherent in the electrolysis and fuel cell conversion processes.
Table 3.
Main techno-economic assumptions.
Table 3.
Main techno-economic assumptions.
Parameter | Value | Reference |
---|
PV price | | Given by the PV producer [34] |
PV lifetime | | [35] |
Electrolyzer price | | [36] |
Electrolyzer lifetime | | [37] |
Fuel cell price | | [38] |
Fuel cell lifetime | | [39] |
DC/DC converter efficiency | | [33] |
DC/AC converter efficiency | | [33] |
Several studies (e.g., [
36,
40]) have forecasted potential changes in the costs of these components, as illustrated in
Table 4 below. The projected costs of the electrolyzer and fuel cell are expected to decrease over time. These cost reductions are taken into account to assess the economic feasibility of the power-to-power system with adjusted component prices, considering the forecasts in 2050, thus 314 EUR/kW [
36] and 500 EUR/kW [
40] for the electrolyzer and fuel cell, respectively.
2.5. Control Strategies
The objective of the following chapter is to determine the most economically viable operating strategy for the hydrogen-based storage system, taking into account fluctuations in electricity market prices. The analysis adopts a step-by-step approach, beginning with a base case scenario and progressively incorporating additional features or variables across successive strategies.
Multiple system configurations are assessed, and for each, the total weekly costs (and revenues, where applicable) are calculated. These include the capital costs of photovoltaic (PV) panels, electrolyzers, fuel cells and expenditures related to electricity purchases. Operational and maintenance costs are excluded from the analysis, as they are assumed to be consistent across all configurations and thus do not influence the comparative evaluation. Similarly, the cost of the hydrogen storage tank is not considered, given that its physical size is fixed for all strategy variants. The optimal configuration within each strategy is identified as the one that yields the lowest total weekly cost.
A weekly hydrogen-mass balance is enforced for Strategy 1, where the system operates off-grid; the tank must finish the week at the same state of charge it started with to avoid long-term drift. In the grid-connected Strategies 2, 3, and 4, the electrical grid acts as a buffer: surplus PV or grid imports automatically prevent the tank from emptying or over-filling, so the hydrogen inventory is monitored as well to remain within safe limits.
The four operating strategies (
Figure 2) developed under these assumptions are presented in the following sub-chapters.
2.5.1. Strategy 1
The first strategy replicates a basic power-to-power system designed to meet the electricity demand exclusively through solar energy, without any connection to the electrical grid. When the PV generation exceeds the load, the surplus energy is directly used to operate the electrolyzer, producing hydrogen that is stored in a dedicated tank. Conversely, during periods of insufficient PV production, hydrogen is drawn from storage and converted back into electricity via the fuel cell to cover the deficit. A schematic representation of this configuration is provided in
Figure 2 to facilitate an understanding of the system’s operation.
The design approach focuses on determining the optimal PV panel size required to fully meet the energy demand. Specifically, the PV production profile is scaled by a constant multiplier (k), thereby increasing the effective installed capacity and corresponding energy output. The system must ensure complete energy self-sufficiency, either by meeting demand directly from PV production or by storing excess energy for later use. A series of simulations were conducted using the full model described in the previous chapter. The methodology involves manually adjusting the k value and monitoring the hydrogen storage levels to avoid depletion or overfilling. For each value of k, the optimal solution is identified as the configuration in which the hydrogen mass at the end of each day matches the level recorded at the beginning of the week, ensuring system balance over the analysis period.
2.5.2. Strategy 2
This enhanced strategy builds upon the previous configuration by introducing the possibility of purchasing electricity from the grid to directly satisfy the power demand, thereby reducing reliance on the fuel cell. Under this scheme, the user’s energy needs can be met through three distinct pathways. First, when solar generation is sufficient, direct consumption is prioritized. If solar output is inadequate, the system can either draw electricity from the grid or activate the fuel cell to convert stored hydrogen—produced during periods of PV surplus—into electricity. A schematic representation of these operating modes is provided in
Figure 2.
To determine the most cost-effective and operationally sustainable strategy, a price threshold is defined. This threshold represents the electricity price below which purchasing from the grid is economically favourable. When the market price exceeds this threshold, the system prioritizes the use of hydrogen via the fuel cell. This control parameter, referred to as Threshold 2, is calibrated to maintain a consistent hydrogen storage level over a daily cycle. By ensuring that the mass of hydrogen in the tank remains stable from day to day, the strategy prevents depletion and supports balanced energy management across the simulation period.
The value of Threshold 2 is not fixed a priori: during the simulation, it is swept from 25 to 105 EUR/MWh in 1 EUR/MWh increments.
For each candidate value, the model runs a one-week simulation, computes the total weekly cost, and selects the Threshold 2 that minimizes
.
By enforcing this cost-optimal set-point, a stable daily hydrogen inventory is maintained, avoiding both tank depletion and overfilling. This allows for a consistent evaluation of the resulting PV, electrolyzer and fuel cell costs. Since the optimization horizon is limited to one representative week, the total cost is expressed in EUR/week as the sum of all weekly contributions.
2.5.3. Strategy 3
This strategy builds upon the previous one by introducing an additional feature: not only does it allow electricity purchases from the grid to meet energy demand—as in Strategy 2—but it also actively promotes electricity procurement specifically for hydrogen production via the electrolyzer, as illustrated in
Figure 2. This approach takes advantage of periods with low electricity prices to increase hydrogen generation, which is subsequently stored and utilized by the fuel cell during high-price periods. In doing so, the system enhances overall efficiency and economic viability. Electricity purchases for hydrogen production are permitted only when the market price falls below a defined threshold.
From this point onward, Threshold 1 refers to the price limit below which electricity is purchased for hydrogen production, while Threshold 2 denotes the threshold below which electricity is directly used to meet the load demand (as in Strategy 2). The decision-making logic is depicted in the flowchart shown in
Figure 3.
The methodology involves combining different combinations of Threshold 1 and Threshold 2 values.
Threshold 1 and Threshold 2 were first pre-selected by analyzing the hourly electricity prices, focusing on the most significant price fluctuations. These values reflect key points in the pricing trend, which should ensure cost-effective use of grid electricity for both load satisfaction and hydrogen production.
The optimization proceeds in three nested loops. First, a value of k is chosen to scale the nominal PV output, so that several possible array sizes can be assessed. For that specific k, we explore a grid of price limits: Threshold 1, which defines when cheap grid electricity is diverted to the electrolyzer, and Threshold 2, which defines when cheap grid electricity is taken directly to meet the load. Threshold 1 and Threshold 2 are varied independently from 25 to 100 EUR/MWh in 10 EUR/MWh increments. For every pair, the model runs a full-week simulation. During each run, it determines the extra grid energy required to keep the hydrogen storage quasi-steady, allocates this energy between hydrogen production and direct consumption according to the two thresholds and converts the result into a constant purchase power. The PV, electrolyzer and fuel cell sizes follow directly from the peak powers observed, and their annualized capital costs are added to the week-specific cost of the electricity purchased for hydrogen production and for load supply. The sum of these components yields the total weekly cost for that configuration. Keeping k fixed, Threshold 2 is then stepped through its entire range while Threshold 1 is held constant; once all Threshold 2 values have been evaluated, Threshold 1 is incremented and the process repeats. After the full grid has been scanned, the entire procedure is restarted with the next k value. The global optimum is simply the combination of k, Threshold 1 and Threshold 2 that produces the minimum total cost among all simulations.
2.5.4. Strategy 4
A power-to-power system can serve not only for self-consumption purposes but also offers an attractive alternative opportunity for energy trading. Strategy 4 introduces this concept by enabling electricity purchases from the grid when prices are low and selling electricity back to the grid during high-price periods, thereby offering the potential for profit generation. The operational logic largely mirrors that of the previous strategy, using the same values for Threshold 1 and Threshold 2. However, as depicted in
Figure 2, the key innovation in this strategy lies in the incorporation of bidirectional energy exchange, allowing the system to act as both a consumer and supplier of electricity, thereby optimizing both energy use and financial return based on market fluctuations. To maximize revenues, electricity export is scheduled during the period from 20:00 to 24:00, which is typically characterized by peak market prices. Two constant power levels—5 kW and 10 kW—are considered for each hour within this evening window. This configuration introduces variability in system performance and cost-effectiveness, depending on the selected power export level.
The methodology for purchasing electricity to generate hydrogen through the electrolyzer remains consistent with that used in Strategy 3 but now includes the additional energy required for export. As in previous strategies, the total energy to be purchased is divided by the number of hours when the electricity price is below Threshold 1 in order to determine the power input needed.
The electrolyzer size is then calculated based on the combined energy contributions from both PV surplus and electricity purchased from the grid. However, in contrast to earlier strategies, fuel cell sizing requires further consideration due to the added export requirement. Since peak electricity demand and export both occur during the night, when solar generation is unavailable, the fuel cell must be sized to cover both load demand and the fixed export power during the 20:00–24:00 period. As such, the fuel cell’s rated power is defined as the maximum of the net power deficit (demand minus PV contribution) plus the scheduled export power.
Finally, revenue from grid sales is calculated. For the sake of simplicity, the selling price is assumed to be equal to the purchasing price, although this assumption may differ in practical applications. This parity assumption represents an intentional upper-bound test: the most favourable feed-in tariff is adopted so that, if the export strategy proves uneconomic even under these conditions, any realistic reduction in the selling price can only further increase its cost disadvantage.
Finally, all cost components—including PV costs, fuel cell costs and revenues from electricity sales—are combined for various combinations of Threshold 1 and Threshold 2 to identify the configuration that minimizes the total cost for each selected size of the photovoltaic system. This holistic approach allows for optimizing the entire system, considering both the cost of purchased energy and the potential financial benefits of selling energy during low-demand periods, as shown in the following equation:
Table 5 provides a summary of the key variables, their definitions and their relationships with system costs for each operating strategy. The table uses arrows to indicate how changes in each variable impact the overall cost.