This function calculates the cell voltage at each time step.
Parameters: |
-
variables
(dict )
–
The dictionary containing the variables calculated by the solver.
-
operating_inputs
(dict )
–
The dictionary containing the operating inputs.
-
parameters
(dict )
–
The dictionary containing the parameters.
|
Returns: |
-
Ucell_t ( list
) –
The cell voltage at each time step.
|
Source code in model/cell_voltage.py
def calculate_cell_voltage(variables, operating_inputs, parameters):
"""This function calculates the cell voltage at each time step.
Parameters
----------
variables : dict
The dictionary containing the variables calculated by the solver.
operating_inputs : dict
The dictionary containing the operating inputs.
parameters : dict
The dictionary containing the parameters.
Returns
-------
Ucell_t : list
The cell voltage at each time step.
"""
# Extraction of the variables
t, lambda_mem_t, lambda_ccl_t = variables['t'], variables['lambda_mem'], variables['lambda_ccl']
C_H2_acl_t, C_O2_ccl_t, eta_c_t = variables['C_H2_acl'], variables['C_O2_ccl'], variables['eta_c']
# Extraction of the operating inputs and the parameters
Tfc = operating_inputs['Tfc']
Hmem, Hcl, epsilon_mc, tau = parameters['Hmem'], parameters['Hcl'], parameters['epsilon_mc'], parameters['tau']
Re, kappa_co = parameters['Re'], parameters['kappa_co']
# Initialisation
n = len(t)
Ucell_t = [0] * n
# Loop for having Ucell_t at each time step
for i in range(n):
# Recovery of the already calculated variable values at each time step
lambda_mem, lambda_ccl = lambda_mem_t[i], lambda_ccl_t[i]
C_H2_acl, C_O2_ccl = C_H2_acl_t[i], C_O2_ccl_t[i]
eta_c = eta_c_t[i]
# Current density value at this time step
i_fc = operating_inputs['current_density'](t[i], parameters)
# The equilibrium potential
Ueq = E0 - 8.5e-4 * (Tfc - 298.15) + R * Tfc / (2 * F) * (np.log(R * Tfc * C_H2_acl / Pref) +
0.5 * np.log(R * Tfc * C_O2_ccl / Pref))
# The crossover current density
i_H2 = 2 * F * R * Tfc / Hmem * C_H2_acl * k_H2(lambda_mem, Tfc, kappa_co)
i_O2 = 4 * F * R * Tfc / Hmem * C_O2_ccl * k_O2(lambda_mem, Tfc, kappa_co)
i_n = i_H2 + i_O2
# The proton resistance
# The proton resistance at the membrane : Rmem
if lambda_mem >= 1:
Rmem = Hmem / ((0.5139 * lambda_mem - 0.326) * np.exp(1268 * (1 / 303.15 - 1 / Tfc)))
else:
Rmem = Hmem / (0.1879 * np.exp(1268 * (1 / 303.15 - 1 / Tfc)))
# The proton resistance at the cathode catalyst layer : Rccl
if lambda_ccl >= 1:
Rccl = Hcl / ((epsilon_mc ** tau) * (0.5139 * lambda_ccl - 0.326) * np.exp(1268 * (1 / 303.15 - 1 / Tfc)))
else:
Rccl = Hcl / ((epsilon_mc ** tau) * 0.1879 * np.exp(1268 * (1 / 303.15 - 1 / Tfc)))
# The total proton resistance
Rp = Rmem + Rccl # its value is around [4-7]e-6 ohm.m².
# The cell voltage
Ucell_t[i] = Ueq - eta_c - (i_fc + i_n) * (Rp + Re)
return Ucell_t