├── src
├── report.mlx
├── microgrid.slx
├── input_data_24h.mat
├── op_mode_siginal.mat
├── microgrid_parameters.m
├── icons
│ ├── scopes.svg
│ ├── consumer.svg
│ ├── pv_system.svg
│ ├── urfc_system.svg
│ └── grid.svg
├── photovoltaic_parameters.m
├── pv_panel.ssc
├── urfc_electrolyzer.ssc
├── urfc_fuel_cell.ssc
└── urfc_parameters.m
├── .gitattributes
├── LICENSE
└── README.md
/src/report.mlx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelfsb/hydrogen-energy-storage/HEAD/src/report.mlx
--------------------------------------------------------------------------------
/src/microgrid.slx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelfsb/hydrogen-energy-storage/HEAD/src/microgrid.slx
--------------------------------------------------------------------------------
/src/input_data_24h.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelfsb/hydrogen-energy-storage/HEAD/src/input_data_24h.mat
--------------------------------------------------------------------------------
/src/op_mode_siginal.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelfsb/hydrogen-energy-storage/HEAD/src/op_mode_siginal.mat
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.slx -crlf -diff -merge
2 | *.mdl -crlf -diff -merge
3 | *.mat -crlf -diff -merge
4 | *.mlx -crlf -diff -merge
--------------------------------------------------------------------------------
/src/microgrid_parameters.m:
--------------------------------------------------------------------------------
1 | addpath("icons")
2 | load("input_data_24h.mat")
3 |
4 | URFC = urfc_parameters;
5 | PV = photovoltaic_parameters;
6 | BUS.Voltage = 500; % [V]
7 | URFC_TANK.MaxLvl = 1000; % [g]
8 | URFC_TANK.MinLvl = 0.2*URFC_TANK.MaxLvl; % [g]
9 | URFC_TANK.IniLvl = 0.7*URFC_TANK.MaxLvl; % [g]
--------------------------------------------------------------------------------
/src/icons/scopes.svg:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/src/photovoltaic_parameters.m:
--------------------------------------------------------------------------------
1 | classdef photovoltaic_parameters < handle
2 | properties (Constant)
3 | % Physical constants
4 | Q = 1.6e-19; % Elementary charge
5 | K = 1.38e-23; % Boltzmann constant
6 | % Photovoltaic parameters
7 | N_ps = 8; % Number of panels in parallel
8 | N_ss = 300; % Number of panels in series
9 | T_ps = 298; % Temperature
10 | Tr = 298; % Reference temperature
11 | Isc = 3.27; % Short circuit current at Tr
12 | Kl = 0.0017; % Short circuit current temperature coeff
13 | Ior = 2.0793e-6; % Ior - Irs at Tr
14 | Ego = 1.1; % Band gap energy of the semiconductor
15 | A = 1.6; % Factor. cell deviation from de ideal pn junction
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Michael Barbosa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/icons/consumer.svg:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/src/icons/pv_system.svg:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/src/pv_panel.ssc:
--------------------------------------------------------------------------------
1 | component pv_panel
2 |
3 | inputs
4 | lambda = { 0, '1' }; % R:left
5 | end
6 |
7 | outputs
8 | p_mppt = { 0, 'W' }; % p:right
9 | end
10 |
11 | parameters(Access=private)
12 | k = { 1.3805e-23, 'N*m/K'};
13 | q = { 1.6e-19, 'C'};
14 | end
15 |
16 | parameters
17 | Nps = { 8, '1' }; % Nps - Number of PV modules in parallel connection
18 | Nss = { 300, '1' }; % Nss - Number of PV cells in series connection
19 | T = { 298.15, 'K' }; % T - Threshold voltage proportional to TS
20 | Tr = { 298.15, 'K' }; % Tr - Reference temperature
21 | Isc = { 3.27, 'A' }; % Isc - Short circuit current at Tr
22 | Kl = { 0.0017, 'A/K' }; % Kl - Short circuit current temperature coeff
23 | Ior = { 2.0793e-6, 'A' }; % Ior - Irs at Tr
24 | Ego = { 1.1, 'V' }; % Ego - band gap energy of the semiconductor
25 | A = { 1.6, '1' }; % A - factor. cell deviation from de ideal pn junction
26 | end
27 |
28 | nodes
29 | p = foundation.electrical.electrical; % +
30 | n = foundation.electrical.electrical; % -
31 | end
32 |
33 | annotations
34 | [p, n] : Side = right;
35 | lambda : Side = left;
36 | end
37 |
38 | branches
39 | i : p.i -> n.i;
40 | end
41 |
42 | variables (ExternalAccess = observe)
43 | v = { 0, 'V' };
44 | i = { 0, 'A' };
45 | end
46 |
47 | intermediates
48 | Vt = k*T/q;
49 | Iph = (Isc+Kl*(T-Tr))*lambda;
50 | Irs = Ior*(T/Tr)^3*exp(q*Ego*(1/Tr-1/T)/(k*A));
51 | end
52 |
53 | equations
54 | v == p.v - n.v;
55 | v == (Nss*Vt*A*(lambertw_approx(exp(1)*(1+(Iph/Irs)))-1));
56 | p_mppt == (v*(Nps*(Iph-Irs*(exp(v/(Nss*Vt*A))-1))));
57 | end
58 | end
59 |
60 | function out = lambertw_approx(x)
61 | definitions
62 | E = 0.4586887;
63 | out = (1+E)*log(6/5*x/log(12/5*x/log(1+12/5*x))) ...
64 | - E*log(2*x/log(1+2*x));
65 | end
66 | end
--------------------------------------------------------------------------------
/src/icons/urfc_system.svg:
--------------------------------------------------------------------------------
1 |
2 |
31 |
--------------------------------------------------------------------------------
/src/urfc_electrolyzer.ssc:
--------------------------------------------------------------------------------
1 | component urfc_electrolyzer
2 | % Electrolyzer mode model of a URFC
3 |
4 | outputs
5 | h2 = { 0.0, 'g/s' }; %H2
6 | end
7 |
8 | nodes
9 | p = foundation.electrical.electrical; % +
10 | n = foundation.electrical.electrical; % -
11 | end
12 |
13 | parameters(Access=private)
14 | mmH2 = { 2.01588, 'g/mol'};
15 | end
16 |
17 | parameters
18 | N_cells = { 10, '1' }; % Number of cells in the stack
19 | A_cell = { 100, 'cm^2' }; % Active cell area
20 | E_rev_0 = { 1.23, 'V' }; % Reversible potential of URPEMFC
21 | I_loss_internal = { 0.008, 'A/cm^2' }; % Lost internal current density
22 | I_o_anode = { 0.15, 'A/cm^2' }; % Anode exchange current density
23 | I_o_cathode = { 1.5e-4, 'A/cm^2' }; % Cathode exchange current density #TODO: Add value
24 | R_ion = { 0.01, 'Ohm*cm^2' }; % Area specific ion resistance
25 | R_CR = { 0.03, 'Ohm*cm^2' }; % Area specific contact resistance
26 | R_elect = {0, 'Ohm*cm^2' }; % Area specific resistance between plates and connections #TODO: Add value
27 | I_limit_anode = { 15, 'A/cm^2' }; % Anode limiting current density
28 | I_limit_cathode = { 2.5, 'A/cm^2' }; % Cathode limiting current density
29 | A_anodo = {0.0304 , 'V'}; % Anode constant
30 | A_catodo = {0.0507, 'V'}; % Cathode constant
31 | T = { 353.15, 'K' }; % Temperature of the cell
32 | R_gas = { 8.3145, 'J/(mol*K)' }; % Gas constant
33 | F_constant = { 96485, 'C/mol' }; % Faraday's constant
34 | n_electrons = { 2, '1' }; % Number of electrons
35 | end
36 |
37 | variables
38 | i = { 0, 'A' }; % Electrolyzer Current
39 | v = { 0, 'V' }; % Electrolyzer Voltage
40 | end
41 |
42 | intermediates
43 | I = abs(i) / A_cell;
44 | E_rev_EL = E_rev_0 + (R_gas * T) / (n_electrons * F_constant)*log(1 / (1 * .21^0.5));
45 | E_act_total = A_anodo * (log((I_loss_internal + I) / I_o_anode)) + A_catodo * (log((I_loss_internal + I) / I_o_cathode));
46 | E_ohm_total = I * (R_elect + R_ion + R_CR);
47 | E_conc_total = (R_gas * T) / (n_electrons * F_constant) * (log(1 - (I / I_limit_anode)) + log(1 - (I / I_limit_cathode)));
48 | E_EL = E_rev_EL + E_act_total + E_ohm_total + E_conc_total;
49 | end
50 |
51 | branches
52 | i : p.i -> n.i;
53 | end
54 |
55 | equations
56 | v == p.v - n.v;
57 | v == N_cells*E_EL;
58 | h2 == mmH2*N_cells*i/F_constant;
59 | end
60 | end
61 |
62 | % function approx = approx_asinh(x)
63 | % definitions
64 | % approx = log(x + sqrt(x^2 + 1))
65 | % end
66 | % end
67 |
--------------------------------------------------------------------------------
/src/urfc_fuel_cell.ssc:
--------------------------------------------------------------------------------
1 | component urfc_fuel_cell
2 | % Fuel Cell mode model of a URFC
3 |
4 | inputs
5 | h2_in = { 0.0, 'g/s' }; % H2_in
6 | end
7 |
8 | nodes
9 | p = foundation.electrical.electrical; % +
10 | n = foundation.electrical.electrical; % -
11 | end
12 |
13 | parameters(Access=private)
14 | mmH2 = { 2.01588, 'g/mol'};
15 | end
16 |
17 | parameters
18 | N_cells = { 10, '1' }; % Number of cells in the stack
19 | A_cell = { 100, 'cm^2' }; % Active cell area
20 | E_rev_0 = { 1.23, 'V' }; % Reversible potential of URPEMFC
21 | I_loss_internal = { 0.008, 'A/cm^2' }; % Lost internal current density
22 | I_o_anode = { 0.15, 'A/cm^2' }; % Anode exchange current density
23 | I_o_cathode = { 1.5e-4, 'A/cm^2' }; % Cathode exchange current density
24 | R_ion = { 0.01, 'Ohm*cm^2' }; % Area specific ion resistance
25 | R_CR = { 0.03, 'Ohm*cm^2' }; % Area specific contact resistance
26 | R_elect = {0, 'Ohm*cm^2' }; % Area specific resistance between plates and connections
27 | I_limit_anode = { 15, 'A/cm^2' }; % Anode limiting current density
28 | I_limit_cathode = { 2.5, 'A/cm^2' }; % Cathode limiting current density
29 | A_anodo = {0.0304 , 'V'};
30 | A_catodo = {0.0507, 'V'};
31 | T = { 353.15, 'K' }; % Temperature of the cell
32 | R_gas = { 8.3145, 'J/(mol*K)' }; % Gas constant
33 | F_constant = { 96485, 'C/mol' }; % Faraday's constant
34 | n_electrons = { 2, '1' }; % Number of electrons
35 | end
36 |
37 | variables
38 | i = { 0, 'A' }; % Fuel Cell Current
39 | v = { 0, 'V' }; % Fuel Cell Voltage
40 | end
41 |
42 | intermediates
43 | %i = (h2_in*F_constant)/(mmH2*N_cells);
44 | I = (h2_in*F_constant)/(mmH2*N_cells) / A_cell;
45 | E_rev_FC = E_rev_0 + ((R_gas * T) / (n_electrons * F_constant)) * log((1 * .21^0.5) / 1);
46 | E_act_total = ((R_gas * T) / (0.5*n_electrons * F_constant)) * (log((I_loss_internal + I) / I_o_anode) + log((I_loss_internal + I) / I_o_cathode));
47 | E_ohm_total = I * (R_elect + R_ion + R_CR);
48 | E_conc_total = (R_gas * T) / (n_electrons * F_constant) * (log(abs(1 - (I / I_limit_anode))) + log(abs(1 - (I / I_limit_cathode))));
49 | E_FC = E_rev_FC - E_act_total - E_ohm_total - E_conc_total;
50 | end
51 |
52 | branches
53 | i : p.i -> n.i;
54 | end
55 |
56 | equations
57 | if E_FC > 0
58 | v == N_cells*E_FC;
59 | else
60 | v == 0;
61 | end
62 | v == p.v - n.v;
63 | end
64 | end
65 |
66 | % function approx = log(x)
67 | % definitions
68 | % approx = log(x + sqrt(x^2 + 1))
69 | % end
70 | % end
71 |
--------------------------------------------------------------------------------
/src/urfc_parameters.m:
--------------------------------------------------------------------------------
1 | classdef urfc_parameters < handle
2 | % urfc_parameters - Class representing the parameters of the URFC model.
3 | %
4 | % Properties:
5 | % - R_gas: Gas constant [J/(mol*K)]
6 | % - F_constant: Faraday's constant [C/mol]
7 | % - n_electrons: Number of electrons involved in the reaction [dimensionless]
8 | % - N_cells: Number of cells in the stack [dimensionless]
9 | % - A_cell: Active cell area [cm^2]
10 | % - E_rev_0: Reversible potential of URPEMFC [V]
11 | % - I_loss_internal: Lost internal current density [A/cm^2]
12 | % - I_o_anode: Anode exchange current density [A/cm^2]
13 | % - I_o_cathode: Cathode exchange current density [A/cm^2]
14 | % - R_ion: Area specific ion resistance [Ohm*cm^2]
15 | % - R_CR: Area specific contact resistance [Ohm*cm^2]
16 | % - R_elect: Area specific resistance between plates and connections [Ohm*cm^2]
17 | % - I_limit_anode: Anode limiting current density [A/cm^2]
18 | % - I_limit_cathode: Cathode limiting current density [A/cm^2]
19 | % - K_anodo: Value [V]
20 | % - K_catodo: Value [V]
21 | % - T: Temperature of the cell [K]
22 | %
23 | % Example:
24 | % params = urfc_parameters;
25 | % gas_constant = params.R_gas;
26 | % faraday_constant = params.F_constant;
27 | %
28 | % See also: urfc_model
29 | %
30 | properties (Constant)
31 | % Gas constant [J/(mol*K)]
32 | R_gas = 8.3145;
33 | % Faraday's constant [C/mol]
34 | F_constant = 96485;
35 | % Number of electrons involved in the reaction [dimensionless]
36 | n_electrons = 2;
37 | % Number of cells in the stack [dimensionless]
38 | N_cells = 10;
39 | % Active cell area [cm^2]
40 | A_cell = 100;
41 | % Reversible potential of URPEMFC [V]
42 | E_rev_0 = 1.23;
43 | % Lost internal current density [A/cm^2]
44 | I_loss_internal = 0.008;
45 | % Anode exchange current density [A/cm^2]
46 | I_o_anode = 0.15;
47 | % Cathode exchange current density [A/cm^2]
48 | I_o_cathode = 1.5e-4;
49 | % Area specific ion resistance [Ohm*cm^2]
50 | R_ion = 0.01;
51 | % Area specific contact resistance [Ohm*cm^2]
52 | R_CR = 0.03;
53 | % Area specific resistance between plates and connections [Ohm*cm^2]
54 | R_elect = 0;
55 | % Anode limiting current density [A/cm^2]
56 | I_limit_anode = 15;
57 | % Cathode limiting current density [A/cm^2]
58 | I_limit_cathode = 2.5;
59 | % Value [V]
60 | K_anodo = 0.0304;
61 | % Value [V]
62 | K_catodo = 0.0507;
63 | % Temperature of the cell [K]
64 | T = 353.15;
65 | end
66 | end
67 |
--------------------------------------------------------------------------------
/src/icons/grid.svg:
--------------------------------------------------------------------------------
1 |
2 |
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://matlab.mathworks.com/open/github/v1?repo=michaelfsb/green-hydrogen-production&file=src)
2 |
3 | # Hydrogen Energy Storage
4 |
5 | ## Overview
6 | This repository houses my contributions to MathWorks' Excellence in Innovation [Project 204](https://github.com/mathworks/MathWorks-Excellence-in-Innovation/tree/main/projects/Green%20Hydrogen%20Production), as part of my MSc in Automation and Systems Engineering at the Federal University of Santa Catarina. The project focuses on the development of a DC microgrid integrating a regenerative fuel cell with a photovoltaic panel.
7 |
8 | ## Project Description
9 | The project delves into the feasibility and efficiency of green hydrogen as a sustainable energy storage solution in microgrids. It includes detailed modeling of unitized regenerative fuel cell (URFC) documented in `report.mlx` for in-depth understanding and provides a `microgrid.slx` file for simulation to analyze the system's behavior and performance, thus fostering advancements in sustainable energy practices.
10 |
11 | ## Authors
12 | - **Michael Barbosa** - Graduate Student, Federal University of Santa Catarina
13 | - **Gustavo de Andrade** - Supervisor, Federal University of Santa Catarina
14 |
15 | ## Dependencies
16 |
17 | This project has the following dependencies:
18 |
19 | - [MATLAB](https://www.mathworks.com/products/matlab.html): MATLAB is a high-level programming language and environment used for numerical computation, visualization, and algorithm development. It is the main software used for developing and running the simulations in this project.
20 |
21 | - [Simulink](https://www.mathworks.com/products/simulink.html): Simulink is an extension of MATLAB that provides a graphical environment for modeling, simulating, and analyzing dynamic systems. It is used to create the `microgrid.slx` Simulink model in this project.
22 |
23 | - [Simscape](https://www.mathworks.com/products/simscape.html): Simscape is a multidomain physical modeling and simulation tool that allows you to model and simulate complex systems. It is used in this project to model the regenerative fuel cell and other components of the microgrid system.
24 |
25 | ## License
26 | This project is licensed under the [MIT License](LICENSE.md) - see the file for details.
27 |
28 | ## How to execute
29 |
30 | The Simulink model, `microgrid.slx`, is shown below. This model represents the DC microgrid integrating a regenerative fuel cell with a photovoltaic panel.
31 |
32 | 
33 |
34 | To run the simulation and analyze the system's behavior and performance, follow these steps:
35 |
36 | 1. Make sure you have MATLAB, Simulink, and Simscape installed and properly configured in your MATLAB environment.
37 |
38 | 2. Open the `microgrid.slx` model in Simulink.
39 |
40 | 3. Click on the "Run" button in Simulink to start the simulation.
41 |
42 | 4. Once the simulation is complete, you can use the [Simulation Data Inspector](https://www.mathworks.com/help/simulink/slref/simulationdatainspector.html) to explore the simulation results or use the scopes insed the lock scopes.
43 |
44 | ## Demo
45 |
46 | The figure below shows the results of the simulation using the default scenario:
47 |
48 | 
49 |
50 | ## Anylse other operation scenarios
51 |
52 | ### Power Delivery by URFC
53 |
54 | The default scenario involves applying a current to the URFC that was calculated using numerical optimal control. This calculation will be explained in detail in my master's thesis (a link will be added after publication). You can modify the applied current by changing the scenario in the "Signal Editor" block.
55 |
56 | Power Delivery Scenarios:
57 | - Optimal_Trajectory (DEFAULT): The current applied to the URFC is determined by the optimal trajectory calculated using numerical optimal control.
58 | - Constant_Current: A constant current is applied to the URFC.
59 | - Only_Electrolyzer: Only the electrolyzer component of the URFC is powered.
60 | - Only_Fuel_Cell: Only the fuel cell component of the URFC is powered.
61 |
62 | IMPORTANT: To improve the simulation time, make sure to check the "Interpolate data" option in the "Signal Editor" block.
63 |
64 | ### Solar Radiation and Power Demand
65 |
66 | You can modify the file `input_data_24h.mat` to change the data of solar radiation and power demand in the consumer. You can adjust the values according to your specific scenario or location.
67 |
68 | Please note that the solar radiation values in the file are normalized at 1000 W/m^2.
69 |
70 | ### Modify system parameters
71 |
72 | To modify the system parameters, you can edit the values in the following files:
73 |
74 | - `photovoltaic_parameters.m`: This file contains the parameters related to the photovoltaic panel, such as number of panels in serie and paralel.
75 |
76 | - `urfc_parameters.m`: This file contains the parameters for the unitized regenerative fuel cell (URFC), including, stack area and number of cells.
77 |
78 | - `microgrid_parameters.m`: This file includes the parameters for the microgrid system, such as the bus votage and initial tank value.
79 |
80 | ## How to Contribute
81 |
82 | If you would like to contribute to this project, please follow these steps:
83 |
84 | 1. Fork the repository.
85 |
86 | 2. Create a new branch for your contribution.
87 |
88 | 3. Make your changes and commit them to your branch.
89 |
90 | 4. Push your branch to your forked repository.
91 |
92 | 5. Open a pull request to submit your changes for review.
93 |
94 | ## Acknowledgments
95 | I would like to express my gratitude to the following organizations for their support and contributions to this project:
96 |
97 | - MathWorks for providing the opportunity to work on this project and for their continuous support and guidance.
98 |
99 | - The Federal University of Santa Catarina for their support in my academic endeavors and for providing the necessary resources and facilities for conducting this research.
100 |
101 | I would also like to thank my supervisor, Gustavo de Andrade, for his valuable guidance, expertise, and mentorship throughout this project.
102 |
103 | ## References
104 |
105 | 1. C. Ogbonnaya, C. Abeykoon, A. Nasser, and A. Turan, “Unitized regenerative proton exchange membrane fuel cell system for renewable power and hydrogen generation: Modelling, simulation, and a case study,” Cleaner Engineering and Technology, vol. 4, p. 100241, Oct. 2021, doi: 10.1016/j.clet.2021.100241.
106 |
107 | 2. G. A. De Andrade, P. R. Da Costa Mendes, J. G. G. Clúa, and J. E. Normey‐Rico, “Control of a grid assisted PV-H2 production system: A comparative study between optimal control and hybrid MPC,” Journal of Process Control, vol. 92, pp. 220–233, Aug. 2020, doi: 10.1016/j.jprocont.2020.06.008.
108 |
109 | 3. E. Batzelis, G. Anagnostou, C. Chakraborty, and B. Pal, “Computation of the Lambert W function in photovoltaic modeling,” in Lecture notes in electrical engineering, 2020, pp. 583–595. doi: 10.1007/978-3-030-37161-6_44.
110 |
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------