Auxiliaries modules

This module is used to calculate intermediate values for the auxiliaries flows calculation.

auxiliaries_int_values(t, solver_variables, operating_inputs, parameters)

This functions calculates intermediate values for the auxiliaries flows calculation.

Parameters:
  • t (float) –

    Time (s).

  • solver_variables (dict) –

    Variables calculated by the solver. They correspond to the fuel cell internal states.

  • operating_inputs (dict) –

    Operating inputs of the fuel cell model.

  • parameters (dict) –

    Parameters of the fuel cell model.

Returns:
  • Mext( float ) –

    Molar mass of the ambient air outside the stack (kg/mol).

  • Pagc( float ) –

    Global pressure in the anode gas channel (Pa).

  • Pcgc( float ) –

    Global pressure in the cathode gas channel (Pa).

  • Phi_agc( float ) –

    Relative humidity in the anode gas channel.

  • Phi_cgc( float ) –

    Relative humidity in the cathode gas channel.

  • y_cgc( float ) –

    Oxygen ratio in dry air in the cathode gas channel.

  • Magc( float ) –

    Molar mass of all the gas species in the anode gas channel (kg/mol).

  • Mcgc( float ) –

    Molar mass of all the gas species in the cathode gas channel (kg/mol).

  • Pr_aem( float ) –

    Pressure ratio in the anode external manifold.

  • Pr_cem( float ) –

    Pressure ratio in the cathode external manifold.

  • Maem( float ) –

    Molar mass of all the gas species in the anode external manifold (kg/mol).

  • Masm( float ) –

    Molar mass of all the gas species in the anode supply manifold (kg/mol).

  • Mcem( float ) –

    Molar mass of all the gas species in the cathode external manifold (kg/mol).

  • Mcsm( float ) –

    Molar mass of all the gas species in the cathode supply manifold (kg/mol).

  • k_purge( float ) –

    Purge coefficient. It is equal to 1 if the purge is active and 0 otherwise.

  • Abp_a( float ) –

    Area of the back pressure valve in the anode external manifold (m²).

  • Abp_c( float ) –

    Area of the back pressure valve in the cathode external manifold (m²).

  • i_n( float ) –

    Internal current density (A/m²).

Source code in modules/auxiliaries_modules.py
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
def auxiliaries_int_values(t, solver_variables, operating_inputs, parameters):
    """This functions calculates intermediate values for the auxiliaries flows calculation.

    Parameters
    ----------
    t : float
        Time (s).
    solver_variables : dict
        Variables calculated by the solver. They correspond to the fuel cell internal states.
    operating_inputs : dict
        Operating inputs of the fuel cell model.
    parameters : dict
        Parameters of the fuel cell model.

    Returns
    -------
    Mext : float
        Molar mass of the ambient air outside the stack (kg/mol).
    Pagc : float
        Global pressure in the anode gas channel (Pa).
    Pcgc : float
        Global pressure in the cathode gas channel (Pa).
    Phi_agc : float
        Relative humidity in the anode gas channel.
    Phi_cgc : float
        Relative humidity in the cathode gas channel.
    y_cgc : float
        Oxygen ratio in dry air in the cathode gas channel.
    Magc : float
        Molar mass of all the gas species in the anode gas channel (kg/mol).
    Mcgc : float
        Molar mass of all the gas species in the cathode gas channel (kg/mol).
    Pr_aem : float
        Pressure ratio in the anode external manifold.
    Pr_cem : float
        Pressure ratio in the cathode external manifold.
    Maem : float
        Molar mass of all the gas species in the anode external manifold (kg/mol).
    Masm : float
        Molar mass of all the gas species in the anode supply manifold (kg/mol).
    Mcem : float
        Molar mass of all the gas species in the cathode external manifold (kg/mol).
    Mcsm : float
        Molar mass of all the gas species in the cathode supply manifold (kg/mol).
    k_purge : float
        Purge coefficient. It is equal to 1 if the purge is active and 0 otherwise.
    Abp_a : float
        Area of the back pressure valve in the anode external manifold (m²).
    Abp_c : float
        Area of the back pressure valve in the cathode external manifold (m²).
    i_n : float
        Internal current density (A/m²).
    """

    # Extraction of the variables
    C_v_agc, C_v_cgc = solver_variables['C_v_agc'], solver_variables['C_v_cgc']
    lambda_mem = solver_variables['lambda_mem']
    C_H2_agc, C_H2_acl = solver_variables['C_H2_agc'], solver_variables['C_H2_acl']
    C_N2, C_O2_ccl, C_O2_cgc = solver_variables['C_N2'], solver_variables['C_O2_ccl'], solver_variables['C_O2_cgc']
    T_acl, T_mem, T_ccl = solver_variables['T_acl'], solver_variables['T_mem'], solver_variables['T_ccl']
    Pasm, Paem, Pcsm = solver_variables['Pasm'], solver_variables['Paem'], solver_variables['Pcsm']
    Pcem, Phi_asm, Phi_aem = solver_variables['Pcem'], solver_variables['Phi_asm'], solver_variables['Phi_aem']
    Phi_csm, Phi_cem = solver_variables['Phi_csm'], solver_variables['Phi_cem']
    Abp_a, Abp_c = solver_variables['Abp_a'], solver_variables['Abp_c']
    # Extraction of the operating inputs and the parameters
    T_des = operating_inputs['T_des']
    Hmem, Hcl, kappa_co = parameters['Hmem'], parameters['Hcl'], parameters['kappa_co']
    t_purge, type_purge = parameters['t_purge'], parameters['type_purge']

    # Molar mass of the ambient air
    Mext = Phi_ext * Psat(Text) / Pext * M_H2O + \
           yO2_ext * (1 - Phi_ext * Psat(Text) / Pext) * M_O2 + \
           (1 - yO2_ext) * (1 - Phi_ext * Psat(Text) / Pext) * M_N2

    # Physical quantities inside the stack
    #       Pressures
    Pagc = (C_v_agc + C_H2_agc) * R * T_des
    Pcgc = (C_v_cgc + C_O2_cgc + C_N2) * R * T_des
    #       Humidities
    Phi_agc = C_v_agc / C_v_sat(T_des)
    Phi_cgc = C_v_cgc / C_v_sat(T_des)
    #       Oxygen ratio in dry air
    y_cgc = C_O2_cgc / (C_O2_cgc + C_N2)
    #       Molar masses
    Magc = C_v_agc * R * T_des / Pagc * M_H2O + \
           C_H2_agc * R * T_des / Pagc * M_H2
    Mcgc = Phi_cgc * Psat(T_des) / Pcgc * M_H2O + \
           y_cgc * (1 - Phi_cgc * Psat(T_des) / Pcgc) * M_O2 + \
           (1 - y_cgc) * (1 - Phi_cgc * Psat(T_des) / Pcgc) * M_N2

    # Internal current density
    T_acl_mem_ccl = average([T_acl, T_mem, T_ccl],
                                  weights=[Hcl / (2 * Hcl + Hmem), Hmem / (2 * Hcl + Hmem), Hcl / (2 * Hcl + Hmem)])
    i_H2 = 2 * F * R * T_acl_mem_ccl / Hmem * C_H2_acl * k_H2(lambda_mem, T_mem, kappa_co)
    i_O2 = 4 * F * R * T_acl_mem_ccl / Hmem * C_O2_ccl * k_O2(lambda_mem, T_mem, kappa_co)
    i_n = i_H2 + i_O2

    # Physical quantities in the auxiliary system
    if parameters["type_auxiliary"] == "forced-convective_cathode_with_anodic_recirculation" or \
       parameters["type_auxiliary"] == "forced-convective_cathode_with_flow-through_anode":
        # Pressure ratios
        Pr_aem = (Pext / Paem)
        Pr_cem = (Pext / Pcem)
        # Oxygen ratio in dry air
        y_cem = (Pcem - Phi_cem * Psat(T_des) - C_N2 * R * T_des) / (Pcem - Phi_cem * Psat(T_des))
        # Molar masses
        Maem = Phi_aem * Psat(T_des) / Paem * M_H2O + \
               (1 - Phi_aem * Psat(T_des) / Paem) * M_H2
        Masm = Phi_asm * Psat(T_des) / Pasm * M_H2O + \
               (1 - Phi_asm * Psat(T_des) / Pasm) * M_H2
        Mcem = Phi_cem * Psat(T_des) / Pcem * M_H2O + \
               y_cem * (1 - Phi_cem * Psat(T_des) / Pcem) * M_O2 + \
               (1 - y_cem) * (1 - Phi_cem * Psat(T_des) / Pcem) * M_N2
        Mcsm = Phi_csm * Psat(T_des) / Pcsm * M_H2O + \
               yO2_ext * (1 - Phi_csm * Psat(T_des) / Pcsm) * M_O2 + \
               (1 - yO2_ext) * (1 - Phi_csm * Psat(T_des) / Pcsm) * M_N2
        # Purge
        if type_purge == "no_purge":
            k_purge = 0
        elif type_purge == "constant_purge":
            k_purge = 1
        elif type_purge == "periodic_purge":
            purge_time, delta_purge = t_purge
            if (t - int(t / (purge_time + delta_purge)) * (purge_time + delta_purge)) <= purge_time:
                k_purge = 1
            else:
                k_purge = 0
        else:
            raise ValueError("The type_purge variable should be correctly referenced.")
        # Back pressure valve area
        if Abp_a > A_T:
            Abp_a = A_T
        elif Abp_a < 0:
            Abp_a = 0
        if Abp_c > A_T:
            Abp_c = A_T
        elif Abp_c < 0:
            Abp_c = 0
    else:  # parameters["type_auxiliary"] == "no_auxiliary"
        Pr_aem, Pr_cem, Maem, Masm, Mcem, Mcsm, k_purge, Abp_a, Abp_c = [0] * 9

    return (Mext, Pagc, Pcgc, Phi_agc, Phi_cgc, y_cgc, Magc, Mcgc, Pr_aem, Pr_cem, Maem, Masm, Mcem, Mcsm,
            k_purge, Abp_a, Abp_c, i_n)