def _get_param(self, name: str): """Helper method to convert data stored in a DMF resource into a Pyomo rule. The intermediate form, :class:`TidyUnitData`, is constructed from the data stored in the JSON of the DMF resource. Args: name: Primary alias of DMF resource with stored data. Returns: function for `initialize` keyword of `Param` class constructor. Raises: KeyError: Resource not found ValueError: Data in resource is missing or malformed Side-effects: For future reference, the resource itself is stored in an instance dict called `self._property_data` where the keys are the parameter names and the values are instances of :class:`idaes.dmf.resource.Resource`. """ r = _dmf.find_one(name=name) if not hasattr(r, "data"): raise KeyError(f"No resource named {name} was found") try: dframe = TidyUnitData(r.data) except ValueError as err: raise ValueError(f"While extracting data for {name}: {err}") self._property_resources[name] = r return extract_data(dframe.param_data)
def build(self): """ Callable method for Block construction. """ super(PropParameterData, self).build() self._state_block_class = PropStateBlock # phases self.Liq = LiquidPhase() # components self.H2O = Solvent() self.Na = Solute() self.Ca = Solute() self.Mg = Solute() self.SO4 = Solute() self.Cl = Solute() # molecular weight mw_comp_data = { "H2O": 18.015e-3, "Na": 22.990e-3, "Ca": 40.078e-3, "Mg": 24.305e-3, "SO4": 96.06e-3, "Cl": 35.453e-3, } self.mw_comp = Param( self.component_list, mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight", ) self.dens_mass = Param( mutable=False, initialize=1000, units=pyunits.kg / pyunits.m**3, doc="Density", ) self.cp = Param(mutable=False, initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K)) # ---default scaling--- self.set_default_scaling("temperature", 1e-2) self.set_default_scaling("pressure", 1e-6)
def build(self): ''' Callable method for Block construction. ''' super(PropParameterData, self).build() self._state_block_class = PropStateBlock # phases self.Liq = LiquidPhase() # components self.H2O = Solvent() self.NaCl = Solute() self.CaSO4 = Solute() self.MgSO4 = Solute() self.MgCl2 = Solute() # molecular weight mw_comp_data = { 'H2O': 18.015e-3, 'NaCl': 58.44e-3, 'CaSO4': 136.14e-3, 'MgSO4': 120.37e-3, 'MgCl2': 95.21e-3 } self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight") self.dens_mass = Param(mutable=False, initialize=1000, units=pyunits.kg / pyunits.m**3, doc="Density") self.cp = Param(mutable=False, initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K)) # ---default scaling--- self.set_default_scaling('temperature', 1e-2) self.set_default_scaling('pressure', 1e-6)
def build(self): ''' Callable method for Block construction. ''' super(NaClParameterData, self).build() self.state_block_class = IdealStateBlock self.component_list = Set(initialize=['H2O', 'NaCl']) self.phase_list = Set(initialize=['Liq'], ordered=True) # List of components in each phase (optional) self.phase_comp = {"Liq": self.component_list} # Source: google mw_comp_data = {'H2O': 18.0E-3, 'NaCl': 58.4E-3} self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight Kg/mol")
def build(self): ''' Callable method for Block construction. ''' super(HDAParameterData, self).build() self.state_block_class = IdealStateBlock self.component_list = Set( initialize=['benzene', 'toluene', 'hydrogen', 'methane']) self.phase_list = Set(initialize=['Liq', 'Vap'], ordered=True) # List of components in each phase (optional) self.phase_comp = { "Liq": self.component_list, "Vap": self.component_list } # List of phase equilibrium index self.phase_equilibrium_idx = Set(initialize=[1, 2, 3, 4, 5]) self.phase_equilibrium_list = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")], 3: ["hydrogen", ("Vap", "Liq")], 4: ["methane", ("Vap", "Liq")], 5: ["diphenyl", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_ref = Param(mutable=True, default=101325, doc='Reference pressure [Pa]') self.temperature_ref = Param(mutable=True, default=298.15, doc='Reference temperature [K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_crit_data = { 'benzene': 48.9e5, 'toluene': 41e5, 'hydrogen': 12.9e5, 'methane': 46e5, 'diphenyl': 38.5e5 } self.pressure_crit = Param(self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_crit_data), doc='Critical pressure [Pa]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid temperature_crit_data = { 'benzene': 562.2, 'toluene': 591.8, 'hydrogen': 33.0, 'methane': 190.4, 'diphenyl': 789 } self.temperature_crit = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_crit_data), doc='Critical temperature [K]') # Gas Constant self.gas_const = Param(within=NonNegativeReals, mutable=False, default=8.314, doc='Gas Constant [J/mol.K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid mw_comp_data = { 'benzene': 78.1136E-3, 'toluene': 92.1405E-3, 'hydrogen': 2.016e-3, 'methane': 16.043e-3, 'diphenyl': 154.212e-4 } self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight Kg/mol") # Constants for liquid densities # Source: Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) dens_liq_data = { ('benzene', '1'): 1.0162, ('benzene', '2'): 0.2655, ('benzene', '3'): 562.16, ('benzene', '4'): 0.28212, ('toluene', '1'): 0.8488, ('toluene', '2'): 0.26655, ('toluene', '3'): 591.8, ('toluene', '4'): 0.2878, ('hydrogen', '1'): 5.414, ('hydrogen', '2'): 0.34893, ('hydrogen', '3'): 33.19, ('hydrogen', '4'): 0.2706, ('methane', '1'): 2.9214, ('methane', '2'): 0.28976, ('methane', '3'): 190.56, ('methane', '4'): 0.28881, ('diphenyl', '1'): 0.5039, ('diphenyl', '2'): 0.25273, ('diphenyl', '3'): 789.26, ('diphenyl', '4'): 0.281 } self.dens_liq_params = Param( self.component_list, ['1', '2', '3', '4'], mutable=False, initialize=extract_data(dens_liq_data), doc="Parameters to compute liquid densities") # Boiling point at standard pressure # Source: Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) bp_data = { ('benzene'): 353.25, ('toluene'): 383.95, ('hydrogen'): 20.45, ('methane'): 111.75, ('diphenyl'): 528.05 } self.temperature_boil = Param( self.component_list, mutable=False, initialize=extract_data(bp_data), doc="Pure component boiling points at standard pressure [K]") # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid # Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) cp_ig_data = { ('Liq', 'benzene', '1'): 1.29E5, ('Liq', 'benzene', '2'): -1.7E2, ('Liq', 'benzene', '3'): 6.48E-1, ('Liq', 'benzene', '4'): 0, ('Liq', 'benzene', '5'): 0, ('Vap', 'benzene', '1'): -3.392E1, ('Vap', 'benzene', '2'): 4.739E-1, ('Vap', 'benzene', '3'): -3.017E-4, ('Vap', 'benzene', '4'): 7.130E-8, ('Vap', 'benzene', '5'): 0, ('Liq', 'toluene', '1'): 1.40E5, ('Liq', 'toluene', '2'): -1.52E2, ('Liq', 'toluene', '3'): 6.95E-1, ('Liq', 'toluene', '4'): 0, ('Liq', 'toluene', '5'): 0, ('Vap', 'toluene', '1'): -2.435E1, ('Vap', 'toluene', '2'): 5.125E-1, ('Vap', 'toluene', '3'): -2.765E-4, ('Vap', 'toluene', '4'): 4.911E-8, ('Vap', 'toluene', '5'): 0, ('Liq', 'hydrogen', '1'): 0, # 6.6653e1, ('Liq', 'hydrogen', '2'): 0, # 6.7659e3, ('Liq', 'hydrogen', '3'): 0, # -1.2363e2, ('Liq', 'hydrogen', '4'): 0, # 4.7827e2, # Eqn 2 ('Liq', 'hydrogen', '5'): 0, ('Vap', 'hydrogen', '1'): 2.714e1, ('Vap', 'hydrogen', '2'): 9.274e-3, ('Vap', 'hydrogen', '3'): -1.381e-5, ('Vap', 'hydrogen', '4'): 7.645e-9, ('Vap', 'hydrogen', '5'): 0, ('Liq', 'methane', '1'): 0, # 6.5708e1, ('Liq', 'methane', '2'): 0, # 3.8883e4, ('Liq', 'methane', '3'): 0, # -2.5795e2, ('Liq', 'methane', '4'): 0, # 6.1407e2, # Eqn 2 ('Liq', 'methane', '5'): 0, ('Vap', 'methane', '1'): 1.925e1, ('Vap', 'methane', '2'): 5.213e-2, ('Vap', 'methane', '3'): 1.197e-5, ('Vap', 'methane', '4'): -1.132e-8, ('Vap', 'methane', '5'): 0, ('Liq', 'diphenyl', '1'): 1.2177e5, ('Liq', 'diphenyl', '2'): 4.2930e2, ('Liq', 'diphenyl', '3'): 0, ('Liq', 'diphenyl', '4'): 0, ('Liq', 'diphenyl', '5'): 0, ('Vap', 'diphenyl', '1'): -9.707e1, ('Vap', 'diphenyl', '2'): 1.106e0, ('Vap', 'diphenyl', '3'): -8.855e-4, ('Vap', 'diphenyl', '4'): 2.790e-7, ('Vap', 'diphenyl', '5'): 0 } self.cp_ig = Param(self.phase_list, self.component_list, ['1', '2', '3', '4', '5'], mutable=False, initialize=extract_data(cp_ig_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid # fitted to Antoine form # H2, Methane from NIST webbook pressure_sat_coeff_data = { ('benzene', 'A'): 4.202, ('benzene', 'B'): 1322, ('benzene', 'C'): -38.56, ('toluene', 'A'): 4.216, ('toluene', 'B'): 1435, ('toluene', 'C'): -43.33, ('hydrogen', 'A'): 3.543, ('hydrogen', 'B'): 99.40, ('hydrogen', 'C'): 7.726, ('methane', 'A'): 3.990, ('methane', 'B'): 443.0, ('methane', 'C'): -0.49, ('diphenyl', 'A'): 4.345, ('diphenyl', 'B'): 1988, ('diphenyl', 'C'): -70.82 } self.pressure_sat_coeff = Param( self.component_list, ['A', 'B', 'C'], mutable=False, initialize=extract_data(pressure_sat_coeff_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid dh_vap = { 'benzene': 3.387e4, 'toluene': 3.8262e4, 'hydrogen': 0, 'methane': 0, "diphenyl": 6.271e4 } self.dh_vap = Param(self.component_list, mutable=False, initialize=extract_data(dh_vap), doc="heat of vaporization")
def build(self): ''' Callable method for Block construction. ''' super(MethaneParameterData, self).build() # Component list - a list of component identifiers self.H2 = Component() self.N2 = Component() self.O2 = Component() self.CH4 = Component() self.CO = Component() self.CO2 = Component() self.H2O = Component() self.NH3 = Component() # List of all chemical elements that constitute the chemical species self.element_list = Set(initialize=['H', 'N', 'O', 'C']) # Elemental composition of all species self.element_comp = { 'H2': { 'H': 2, 'N': 0, 'O': 0, 'C': 0 }, 'N2': { 'H': 0, 'N': 2, 'O': 0, 'C': 0 }, 'O2': { 'H': 0, 'N': 0, 'O': 2, 'C': 0 }, 'CH4': { 'H': 4, 'N': 0, 'O': 0, 'C': 1 }, 'CO': { 'H': 0, 'N': 0, 'O': 1, 'C': 1 }, 'CO2': { 'H': 0, 'N': 0, 'O': 2, 'C': 1 }, 'H2O': { 'H': 2, 'N': 0, 'O': 1, 'C': 0 }, 'NH3': { 'H': 3, 'N': 1, 'O': 0, 'C': 0 } } # Thermodynamic reference state self.pressure_reference = Param(mutable=True, default=101325, doc='Reference pressure [Pa]', units=pyunits.Pa) self.temperature_reference = Param(mutable=True, default=1500, doc='Reference temperature [K]', units=pyunits.K) # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid Cp_Vap_A_data = { ('CH4'): 1.925e1, ('CO'): 3.087e1, ('CO2'): 1.980e1, ('H2'): 2.714e1, ('H2O'): 3.224e1, ('N2'): 3.115e1, ('NH3'): 2.731e1, ('O2'): 2.811e1 } Cp_Vap_B_data = { ('CH4'): 5.213e-2, ('CO'): -1.285e-2, ('CO2'): 7.344e-2, ('H2'): 9.274e-3, ('H2O'): 1.924e-3, ('N2'): -1.357e-2, ('NH3'): 2.383e-2, ('O2'): -3.680e-6 } Cp_Vap_C_data = { ('CH4'): 1.197e-5, ('CO'): 2.789e-5, ('CO2'): -5.602e-5, ('H2'): -1.381e-5, ('H2O'): 1.055e-5, ('N2'): 2.680e-5, ('NH3'): 1.707e-5, ('O2'): 1.746e-5 } Cp_Vap_D_data = { ('CH4'): -1.132e-8, ('CO'): -1.272e-8, ('CO2'): 1.715e-8, ('H2'): 7.645e-9, ('H2O'): -3.596e-9, ('N2'): -1.168e-8, ('NH3'): -1.185e-8, ('O2'): -1.065e-8 } Cp_Vap_E_data = { ('CH4'): 0, ('CO'): 0, ('CO2'): 0, ('H2'): 0, ('H2O'): 0, ('N2'): 0, ('NH3'): 0, ('O2'): 0 } self.cp_mol_vap_comp_coeff_A = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K, doc="Vapor phase Cp parameter A", initialize=extract_data(Cp_Vap_A_data)) self.cp_mol_vap_comp_coeff_B = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**2, doc="Vapor phase Cp parameter B", initialize=extract_data(Cp_Vap_B_data)) self.cp_mol_vap_comp_coeff_C = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**3, doc="Vapor phase Cp parameter C", initialize=extract_data(Cp_Vap_C_data)) self.cp_mol_vap_comp_coeff_D = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**4, doc="Vapor phase Cp parameter D", initialize=extract_data(Cp_Vap_D_data)) self.cp_mol_vap_comp_coeff_E = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**5, doc="Vapor phase Cp parameter E", initialize=extract_data(Cp_Vap_E_data)) # Source: NIST Webbook, 9th October 2019 dh_form = { ("Vap", "CH4"): -74600, ("Vap", "CO"): -110530, ("Vap", "CO2"): -393520, ("Vap", "H2"): 0, ("Vap", "H2O"): -241830, ("Vap", "N2"): 0, ("Vap", "NH3"): -45900, ("Vap", "O2"): 0 } self.dh_form = Param(self.phase_list, self.component_list, mutable=False, initialize=extract_data(dh_form), doc="Heats of formation (J/mol)", units=pyunits.J / pyunits.mol) # Source: NIST Webbook, 9th October 2019 ds_form = { ("Vap", "CH4"): 186.25, ("Vap", "CO"): 197.66, ("Vap", "CO2"): 213.79, ("Vap", "H2"): 130.68, ("Vap", "H2O"): 188.84, ("Vap", "N2"): 191.61, ("Vap", "NH3"): 192.77, ("Vap", "O2"): 205.15 } self.ds_form = Param(self.phase_list, self.component_list, mutable=False, initialize=extract_data(ds_form), doc="Entropies of formation (J/mol.K)", units=pyunits.J / pyunits.mol / pyunits.K)
def build(self): ''' Callable method for Block construction. ''' super(NaClParameterData, self).build() self._state_block_class = NaClStateBlock # components self.H2O = Solvent() self.NaCl = Solute() # phases self.Liq = LiquidPhase() # reference # this package is developed from Bartholomew & Mauter (2019) https://doi.org/10.1016/j.memsci.2018.11.067 # the enthalpy calculations are from Sharqawy et al. (2010) http://dx.doi.org/10.5004/dwt.2010.1079 # molecular weight mw_comp_data = {'H2O': 18.01528E-3, 'NaCl': 58.44E-3} self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight kg/mol") # mass density parameters, eq 4 in Bartholomew dens_mass_param_dict = {'0': 995, '1': 756} self.dens_mass_param = Var(dens_mass_param_dict.keys(), domain=Reals, initialize=dens_mass_param_dict, units=pyunits.kg / pyunits.m**3, doc='Mass density parameters') # dynamic viscosity parameters, eq 5 in Bartholomew visc_d_param_dict = {'0': 9.80E-4, '1': 2.15E-3} self.visc_d_param = Var(visc_d_param_dict.keys(), domain=Reals, initialize=visc_d_param_dict, units=pyunits.Pa * pyunits.s, doc='Dynamic viscosity parameters') # diffusivity parameters, eq 6 in Bartholomew diffus_param_dict = { '0': 1.51e-9, '1': -2.00e-9, '2': 3.01e-8, '3': -1.22e-7, '4': 1.53e-7 } self.diffus_param = Var(diffus_param_dict.keys(), domain=Reals, initialize=diffus_param_dict, units=pyunits.m**2 / pyunits.s, doc='Dynamic viscosity parameters') # osmotic coefficient parameters, eq. 3b in Bartholomew osm_coeff_param_dict = {'0': 0.918, '1': 8.89e-2, '2': 4.92} self.osm_coeff_param = Var(osm_coeff_param_dict.keys(), domain=Reals, initialize=osm_coeff_param_dict, units=pyunits.dimensionless, doc='Osmotic coefficient parameters') # TODO: update for NaCl solution, relationship from Sharqawy is for seawater # specific enthalpy parameters, eq. 55 and 43 in Sharqawy (2010) self.enth_mass_param_A1 = Var(within=Reals, initialize=124.790, units=pyunits.J / pyunits.kg, doc='Specific enthalpy parameter A1') self.enth_mass_param_A2 = Var(within=Reals, initialize=4203.075, units=(pyunits.J / pyunits.kg) * pyunits.K**-1, doc='Specific enthalpy parameter A2') self.enth_mass_param_A3 = Var(within=Reals, initialize=-0.552, units=(pyunits.J / pyunits.kg) * pyunits.K**-2, doc='Specific enthalpy parameter A3') self.enth_mass_param_A4 = Var(within=Reals, initialize=0.004, units=(pyunits.J / pyunits.kg) * pyunits.K**-3, doc='Specific enthalpy parameter A4') self.enth_mass_param_B1 = Var(within=Reals, initialize=27062.623, units=pyunits.dimensionless, doc='Specific enthalpy parameter B1') self.enth_mass_param_B2 = Var(within=Reals, initialize=4835.675, units=pyunits.dimensionless, doc='Specific enthalpy parameter B2') # traditional parameters are the only Vars currently on the block and should be fixed for v in self.component_objects(Var): v.fix() # ---default scaling--- self.set_default_scaling('temperature', 1e-2) self.set_default_scaling('pressure', 1e-6) self.set_default_scaling('dens_mass_phase', 1e-3, index='Liq') self.set_default_scaling('visc_d_phase', 1e3, index='Liq') self.set_default_scaling('diffus_phase', 1e9, index='Liq') self.set_default_scaling('osm_coeff', 1e0) self.set_default_scaling('enth_mass_phase', 1e-5, index='Liq')
def build(self): ''' Callable method for Block construction. ''' super(ETOHParameterData, self).build() self._state_block_class = IdealStateBlock self.ethanol = Component() self.water = Component() self.CO2 = Component() #self.hydrogen = Component() self.Liq = LiquidPhase() self.Vap = VaporPhase() # List of components in each phase (optional) self.phase_comp = { "Liq": self.component_list, "Vap": self.component_list } # List of phase equilibrium index self.phase_equilibrium_idx = Set(initialize=[1, 2, 3]) self.phase_equilibrium_list = \ {1: ["ethanol", ("Vap", "Liq")], # 2: ["water", ("Vap", "Liq")], 3: ["CO2", ("Vap", "Liq")]} #4: ["methane", ("Vap", "Liq")], #5: ["diphenyl", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_ref = Param(mutable=True, default=101325, doc='Reference pressure [Pa]') self.temperature_ref = Param(mutable=True, default=298.15, doc='Reference temperature [K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_crit_data = {'ethanol': 63e5, 'water': 220.5e5, 'CO2': 73.8e5} self.pressure_crit = Param(self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_crit_data), doc='Critical pressure [Pa]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid temperature_crit_data = { 'ethanol': 515.15, 'water': 647.15, 'CO2': 304.34 } self.temperature_crit = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_crit_data), doc='Critical temperature [K]') # Gas Constant self.gas_const = Param(within=NonNegativeReals, mutable=False, default=8.314, doc='Gas Constant [J/mol.K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid mw_comp_data = { 'ethanol': 46.07E-3, 'water': 18.02E-3, 'CO2': 44.01e-3 } self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight Kg/mol") # Constants for liquid densities # Source: Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) dens_liq_data = { ('ethanol', '1'): 1.048, #todo ('ethanol', '2'): 0.27627, ('ethanol', '3'): 513.92, ('ethanol', '4'): 0.2331, ('water', '1'): 5.459, ('water', '2'): 0.30542, ('water', '3'): 647.13, ('water', '4'): 0.081, ('CO2', '1'): 2.768, ('CO2', '2'): 0.26212, ('CO2', '3'): 304.21, ('CO2', '4'): 0.2908 } self.dens_liq_params = Param( self.component_list, ['1', '2', '3', '4'], mutable=False, initialize=extract_data(dens_liq_data), doc="Parameters to compute liquid densities") # Boiling point at standard pressure # Source: Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) bp_data = {('ethanol'): 351.52, ('water'): 373.15, ('CO2'): 194.69} self.temperature_boil = Param( self.component_list, mutable=False, initialize=extract_data(bp_data), doc="Pure component boiling points at standard pressure [K]") # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid # Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) # Unit: J/kmol-K cp_ig_data = { ('Liq', 'ethanol', '1'): 1.2064E5, #todo ('Liq', 'ethanol', '2'): -1.3963E2, ('Liq', 'ethanol', '3'): -3.0341E-2, ('Liq', 'ethanol', '4'): 2.0386E-3, ('Liq', 'ethanol', '5'): 0, ('Vap', 'ethanol', '1'): 36.548344E3, ('Vap', 'ethanol', '2'): 5.221192, ('Vap', 'ethanol', '3'): 0.46109444, ('Vap', 'ethanol', '4'): -0.000583975, ('Vap', 'ethanol', '5'): 2.20986E-07, ('Liq', 'water', '1'): 2.7637E5, #reference: toluene 1.40e5 ('Liq', 'water', '2'): -2.0901E3, ('Liq', 'water', '3'): 8.1250, ('Liq', 'water', '4'): -1.4116E-2, ('Liq', 'water', '5'): 9.3701E-6, ('Vap', 'water', '1'): 3.654E4, ('Vap', 'water', '2'): -34.802404, ('Vap', 'water', '3'): -0.1168117, ('Vap', 'water', '4'): -0.000130031, ('Vap', 'water', '5'): 5.25445E-08, ('Liq', 'CO2', '1'): -8.3043E6, # 6.6653e1, ('Liq', 'CO2', '2'): 1.0437E5, # 6.7659e3, ('Liq', 'CO2', '3'): -4.3333E2, # -1.2363e2, ('Liq', 'CO2', '4'): 6.0042E-1, # 4.7827e2, # Eqn 2 ('Liq', 'CO2', '5'): 0, ('Vap', 'CO2', '1'): 27095.326, ('Vap', 'CO2', '2'): 11.273784, ('Vap', 'CO2', '3'): 0.12487628, ('Vap', 'CO2', '4'): -0.000197374, ('Vap', 'CO2', '5'): 8.77958E-08 } self.cp_ig = Param(self.phase_list, self.component_list, ['1', '2', '3', '4', '5'], mutable=False, initialize=extract_data(cp_ig_data), doc="parameters to compute Cp_comp") # Source: NIST # fitted to Antoine form # Unit: Pvp [bar] -> unit conversion later pressure_sat_coeff_data = { ('ethanol', 'A'): 5.24677, ('ethanol', 'B'): 1598.673, ('ethanol', 'C'): -46.424, ('water', 'A'): 5.40221, ('water', 'B'): 1838.675, ('water', 'C'): -31.737, ('CO2', 'A'): 6.812, ('CO2', 'B'): 1302, ('CO2', 'C'): -3.494 } self.pressure_sat_coeff = Param( self.component_list, ['A', 'B', 'C'], mutable=False, initialize=extract_data(pressure_sat_coeff_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid dh_vap = {'ethanol': 42.4e3, 'water': 43.86e3, 'CO2': 16.5e3} self.dh_vap = Param(self.component_list, mutable=False, initialize=extract_data(dh_vap), doc="heat of vaporization")
def build(self): ''' Callable method for Block construction. ''' super(BTXParameterData, self).build() self.component_list_master = Set( initialize=['benzene', 'toluene', 'o-xylene']) # Component list - a list of component identifiers # NOTE: User needs to update this list; can be a subset or # equal to the master component list self.component_list = Set(initialize=['benzene', 'toluene']) # List of components in each phase (optional) self.phase_comp = { "Liq": self.component_list, "Vap": self.component_list } # List of phase equilibrium index self.phase_equilibrium_idx_master = Set(initialize=[1, 2, 3]) self.phase_equilibrium_idx = Set(initialize=[1, 2]) self.phase_equilibrium_list_master = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")], 3: ["o-xylene", ("Vap", "Liq")]} self.phase_equilibrium_list = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_ref = Param(mutable=True, default=101325, doc='Reference pressure [Pa]') self.temperature_ref = Param(mutable=True, default=298.15, doc='Reference temperature [K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_crit_data = { 'benzene': 48.9e5, 'toluene': 41e5, 'o-xylene': 37.3e5 } self.pressure_crit = Param(self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_crit_data), doc='Critical pressure [Pa]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid temperature_crit_data = { 'benzene': 562.2, 'toluene': 591.8, 'o-xylene': 630.3 } self.temperature_crit = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_crit_data), doc='Critical temperature [K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid mw_comp_data = { 'benzene': 78.1136E-3, 'toluene': 92.1405E-3, 'o-xylene': 106.167e-3 } self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight Kg/mol") # Constants for liquid densities # Source: Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) dens_liq_data = { ('benzene', '1'): 1.0162, ('benzene', '2'): 0.2655, ('benzene', '3'): 562.16, ('benzene', '4'): 0.28212, ('toluene', '1'): 0.8488, ('toluene', '2'): 0.26655, ('toluene', '3'): 591.8, ('toluene', '4'): 0.2878, ('o-xylene', '1'): 0.69883, ('o-xylene', '2'): 0.26113, ('o-xylene', '3'): 630.33, ('o-xylene', '4'): 0.27429 } self.dens_liq_params = Param( self.component_list, ['1', '2', '3', '4'], mutable=False, initialize=extract_data(dens_liq_data), doc="Parameters to compute liquid densities") # Boiling point at standard pressure # Source: Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) bp_data = { ('benzene'): 353.25, ('toluene'): 383.95, ('o-xylene'): 417.15 } self.temperature_boil = Param( self.component_list, mutable=False, initialize=extract_data(bp_data), doc="Pure component boiling points at standard pressure [K]") # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid # Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) cp_ig_data = { ('Liq', 'benzene', '1'): 1.29E5, ('Liq', 'benzene', '2'): -1.7E2, ('Liq', 'benzene', '3'): 6.48E-1, ('Liq', 'benzene', '4'): 0, ('Liq', 'benzene', '5'): 0, ('Vap', 'benzene', '1'): -3.392E1, ('Vap', 'benzene', '2'): 4.739E-1, ('Vap', 'benzene', '3'): -3.017E-4, ('Vap', 'benzene', '4'): 7.130E-8, ('Vap', 'benzene', '5'): 0, ('Liq', 'toluene', '1'): 1.40E5, ('Liq', 'toluene', '2'): -1.52E2, ('Liq', 'toluene', '3'): 6.95E-1, ('Liq', 'toluene', '4'): 0, ('Liq', 'toluene', '5'): 0, ('Vap', 'toluene', '1'): -2.435E1, ('Vap', 'toluene', '2'): 5.125E-1, ('Vap', 'toluene', '3'): -2.765E-4, ('Vap', 'toluene', '4'): 4.911E-8, ('Vap', 'toluene', '5'): 0, ('Liq', 'o-xylene', '1'): 3.65e4, ('Liq', 'o-xylene', '2'): 1.0175e3, ('Liq', 'o-xylene', '3'): -2.63, ('Liq', 'o-xylene', '4'): 3.02e-3, ('Liq', 'o-xylene', '5'): 0, ('Vap', 'o-xylene', '1'): -1.585e-1, ('Vap', 'o-xylene', '2'): 5.962e-1, ('Vap', 'o-xylene', '3'): -3.443e-4, ('Vap', 'o-xylene', '4'): 7.528E-8, ('Vap', 'o-xylene', '5'): 0 } self.cp_ig = Param(self.phase_list, self.component_list, ['1', '2', '3', '4', '5'], mutable=False, initialize=extract_data(cp_ig_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_sat_coeff_data = { ('benzene', 'A'): 4.202, ('benzene', 'B'): 1322, ('benzene', 'C'): -38.56, ('toluene', 'A'): 4.216, ('toluene', 'B'): 1435, ('toluene', 'C'): -43.33, ('o-xylene', 'A'): 4.233, ('o-xylene', 'B'): 1548, ('o-xylene', 'C'): -51.65 } self.pressure_sat_coeff = Param( self.component_list, ['A', 'B', 'C'], mutable=False, initialize=extract_data(pressure_sat_coeff_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid dh_vap = { 'benzene': 3.377e4, 'toluene': 3.8262e4, 'o-xylene': 4.34584e4 } self.dh_vap = Param(self.component_list, mutable=False, initialize=extract_data(dh_vap), doc="heat of vaporization")
def build(self): ''' Callable method for Block construction. ''' super(BTXParameterData, self).build() self.component_list_master = Set( initialize=['benzene', 'toluene', 'o-xylene']) # Component list - a list of component identifiers # NOTE: User needs to update this list; can be a subset or # equal to the master component list self.component_list = Set(initialize=['benzene', 'toluene']) # List of components in each phase (optional) self.phase_comp = { "Liq": self.component_list, "Vap": self.component_list } # List of phase equilibrium index self.phase_equilibrium_idx_master = Set(initialize=[1, 2, 3]) self.phase_equilibrium_idx = Set(initialize=[1, 2]) self.phase_equilibrium_list_master = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")], 3: ["o-xylene", ("Vap", "Liq")]} self.phase_equilibrium_list = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_reference = Param(mutable=True, default=101325, doc='Reference pressure [Pa]') self.temperature_reference = Param(mutable=True, default=298.15, doc='Reference temperature [K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_critical_data = { 'benzene': 48.9e5, 'toluene': 41e5, 'o-xylene': 37.3e5 } self.pressure_critical = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_critical_data), doc='Critical pressure [Pa]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid temperature_critical_data = { 'benzene': 562.2, 'toluene': 591.8, 'o-xylene': 630.3 } self.temperature_critical = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_critical_data), doc='Critical temperature [K]') # Gas Constant self.gas_const = Param(within=NonNegativeReals, mutable=False, default=8.314, doc='Gas Constant [J/mol.K]') # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid mw_comp_data = { 'benzene': 78.1136E-3, 'toluene': 92.1405E-3, 'o-xylene': 106.167e-3 } self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight Kg/mol") # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid # Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) CpIG_data = { ('Liq', 'benzene', 'A'): 1.29E5, ('Liq', 'benzene', 'B'): -1.7E2, ('Liq', 'benzene', 'C'): 6.48E-1, ('Liq', 'benzene', 'D'): 0, ('Liq', 'benzene', 'E'): 0, ('Vap', 'benzene', 'A'): -3.392E1, ('Vap', 'benzene', 'B'): 4.739E-1, ('Vap', 'benzene', 'C'): -3.017E-4, ('Vap', 'benzene', 'D'): 7.130E-8, ('Vap', 'benzene', 'E'): 0, ('Liq', 'toluene', 'A'): 1.40E5, ('Liq', 'toluene', 'B'): -1.52E2, ('Liq', 'toluene', 'C'): 6.95E-1, ('Liq', 'toluene', 'D'): 0, ('Liq', 'toluene', 'E'): 0, ('Vap', 'toluene', 'A'): -2.435E1, ('Vap', 'toluene', 'B'): 5.125E-1, ('Vap', 'toluene', 'C'): -2.765E-4, ('Vap', 'toluene', 'D'): 4.911E-8, ('Vap', 'toluene', 'E'): 0, ('Liq', 'o-xylene', 'A'): 3.65e4, ('Liq', 'o-xylene', 'B'): 1.0175e3, ('Liq', 'o-xylene', 'C'): -2.63, ('Liq', 'o-xylene', 'D'): 3.02e-3, ('Liq', 'o-xylene', 'E'): 0, ('Vap', 'o-xylene', 'A'): -1.585e-1, ('Vap', 'o-xylene', 'B'): 5.962e-1, ('Vap', 'o-xylene', 'C'): -3.443e-4, ('Vap', 'o-xylene', 'D'): 7.528E-8, ('Vap', 'o-xylene', 'E'): 0 } self.CpIG = Param(self.phase_list, self.component_list, ['A', 'B', 'C', 'D', 'E'], mutable=False, initialize=extract_data(CpIG_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_sat_coeff_data = { ('benzene', 'A'): -6.98273, ('benzene', 'B'): 1.33213, ('benzene', 'C'): -2.62863, ('benzene', 'D'): -3.33399, ('toluene', 'A'): -7.28607, ('toluene', 'B'): 1.38091, ('toluene', 'C'): -2.83433, ('toluene', 'D'): -2.79168, ('o-xylene', 'A'): -7.53357, ('o-xylene', 'B'): 1.40968, ('o-xylene', 'C'): -3.10985, ('o-xylene', 'D'): -2.85992 } self.pressure_sat_coeff = Param( self.component_list, ['A', 'B', 'C', 'D'], mutable=False, initialize=extract_data(pressure_sat_coeff_data), doc="parameters to compute Cp_comp") # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid dh_vap = { 'benzene': 3.377e4, 'toluene': 3.8262e4, 'o-xylene': 4.34584e4 } self.dh_vap = Param(self.component_list, mutable=False, initialize=extract_data(dh_vap), doc="heat of vaporization (J/mol)")
def build(self): ''' Callable method for Block construction. ''' self.component_list_master = Set( initialize=['benzene', 'toluene', 'o-xylene']) # Create component objects # NOTE: User needs to update this list; can be a subset or # equal to the master component list self.benzene = Component() self.toluene = Component() super(BTXParameterData, self).build() # List of phase equilibrium index self.phase_equilibrium_idx_master = Set(initialize=[1, 2, 3]) self.phase_equilibrium_idx = Set(initialize=[1, 2]) self.phase_equilibrium_list_master = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")], 3: ["o-xylene", ("Vap", "Liq")]} self.phase_equilibrium_list = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_reference = Param(mutable=True, default=101325, doc='Reference pressure [Pa]', units=pyunits.Pa) self.temperature_reference = Param(mutable=True, default=298.15, doc='Reference temperature [K]', units=pyunits.K) # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_critical_data = { 'benzene': 48.9e5, 'toluene': 41e5, 'o-xylene': 37.3e5 } self.pressure_critical = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_critical_data), doc='Critical pressure [Pa]', units=pyunits.Pa) # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid temperature_critical_data = { 'benzene': 562.2, 'toluene': 591.8, 'o-xylene': 630.3 } self.temperature_critical = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_critical_data), doc='Critical temperature [K]', units=pyunits.K) # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid mw_comp_data = { 'benzene': 78.1136E-3, 'toluene': 92.1405E-3, 'o-xylene': 106.167e-3 } self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight kg/mol", units=pyunits.kg / pyunits.mol) # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid # Perry's Chemical Engineers Handbook # - Robert H. Perry (Cp_liq) Cp_Liq_A_data = { ('benzene'): 1.29E5, ('toluene'): 1.40E5, ('o-xylene'): 3.65e4 } Cp_Liq_B_data = { ('benzene'): -1.7E2, ('toluene'): -1.52E2, ('o-xylene'): 1.0175e3 } Cp_Liq_C_data = { ('benzene'): 6.48E-1, ('toluene'): 6.95E-1, ('o-xylene'): -2.63 } Cp_Liq_D_data = {('benzene'): 0, ('toluene'): 0, ('o-xylene'): 3.02e-3} Cp_Liq_E_data = {('benzene'): 0, ('toluene'): 0, ('o-xylene'): 0} self.cp_mol_liq_comp_coeff_A = Param( self.component_list, units=pyunits.J / pyunits.kmol / pyunits.K, doc="Liquid phase Cp parameter A", initialize=extract_data(Cp_Liq_A_data)) self.cp_mol_liq_comp_coeff_B = Param( self.component_list, units=pyunits.J / pyunits.kmol / pyunits.K**2, doc="Liquid phase Cp parameter B", initialize=extract_data(Cp_Liq_B_data)) self.cp_mol_liq_comp_coeff_C = Param( self.component_list, units=pyunits.J / pyunits.kmol / pyunits.K**3, doc="Liquid phase Cp parameter C", initialize=extract_data(Cp_Liq_C_data)) self.cp_mol_liq_comp_coeff_D = Param( self.component_list, units=pyunits.J / pyunits.kmol / pyunits.K**4, doc="Liquid phase Cp parameter D", initialize=extract_data(Cp_Liq_D_data)) self.cp_mol_liq_comp_coeff_E = Param( self.component_list, units=pyunits.J / pyunits.kmol / pyunits.K**5, doc="Liquid phase Cp parameter E", initialize=extract_data(Cp_Liq_E_data)) Cp_Vap_A_data = { ('benzene'): -3.392E1, ('toluene'): -2.435E1, ('o-xylene'): -1.585e-1 } Cp_Vap_B_data = { ('benzene'): 4.739E-1, ('toluene'): 5.125E-1, ('o-xylene'): 5.962e-1 } Cp_Vap_C_data = { ('benzene'): -3.017E-4, ('toluene'): -2.765E-4, ('o-xylene'): -3.443e-4 } Cp_Vap_D_data = { ('benzene'): 7.130E-8, ('toluene'): 4.911E-8, ('o-xylene'): 7.528E-8 } Cp_Vap_E_data = {('benzene'): 0, ('toluene'): 0, ('o-xylene'): 0} self.cp_mol_vap_comp_coeff_A = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K, doc="Vapor phase Cp parameter A", initialize=extract_data(Cp_Vap_A_data)) self.cp_mol_vap_comp_coeff_B = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**2, doc="Vapor phase Cp parameter B", initialize=extract_data(Cp_Vap_B_data)) self.cp_mol_vap_comp_coeff_C = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**3, doc="Vapor phase Cp parameter C", initialize=extract_data(Cp_Vap_C_data)) self.cp_mol_vap_comp_coeff_D = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**4, doc="Vapor phase Cp parameter D", initialize=extract_data(Cp_Vap_D_data)) self.cp_mol_vap_comp_coeff_E = Param( self.component_list, units=pyunits.J / pyunits.mol / pyunits.K**5, doc="Vapor phase Cp parameter E", initialize=extract_data(Cp_Vap_E_data)) # Source: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid pressure_sat_coeff_data = { ('benzene', 'A'): -6.98273, ('benzene', 'B'): 1.33213, ('benzene', 'C'): -2.62863, ('benzene', 'D'): -3.33399, ('toluene', 'A'): -7.28607, ('toluene', 'B'): 1.38091, ('toluene', 'C'): -2.83433, ('toluene', 'D'): -2.79168, ('o-xylene', 'A'): -7.53357, ('o-xylene', 'B'): 1.40968, ('o-xylene', 'C'): -3.10985, ('o-xylene', 'D'): -2.85992 } self.pressure_sat_coeff = Param( self.component_list, ['A', 'B', 'C', 'D'], mutable=False, initialize=extract_data(pressure_sat_coeff_data), doc="parameters to compute P_sat") # Standard heats of formation # Source: NIST Webbook, https://webbook.nist.gov # Retrieved 25th September 2019 dh_form_data = { ('Vap', 'benzene'): 82.9e3, ('Vap', 'toluene'): 50.1e3, ('Vap', 'o-xylene'): 19.0e3, ('Liq', 'benzene'): 49.0e3, ('Liq', 'toluene'): 12.0e3, ('Liq', 'o-xylene'): -24.4e3 } self.dh_form = Param(self.phase_list, self.component_list, mutable=False, initialize=extract_data(dh_form_data), doc="Standard heats of formation [J/mol]", units=pyunits.J / pyunits.mol) # Standard entropy of formation # Source: Engineering Toolbox, https://www.engineeringtoolbox.com # o-xylene from NIST Webbook, https://webbook.nist.gov # Retrieved 9th October, 2019 ds_form_data = { ('Vap', 'benzene'): -269, ('Vap', 'toluene'): -321, ('Vap', 'o-xylene'): -353.6, ('Liq', 'benzene'): -173, ('Liq', 'toluene'): -220, ('Liq', 'o-xylene'): -246 } self.ds_form = Param(self.phase_list, self.component_list, mutable=False, initialize=extract_data(ds_form_data), doc="Standard entropy of formation [J/mol.K]", units=pyunits.J / pyunits.mol / pyunits.K)
def build(self): ''' Callable method for Block construction. ''' super(BTParameterData, self).build() self.cubic_type = CubicEoS.PR # Add Component objects self.benzene = Component( default={"elemental_composition": { "C": 6, "H": 6 }}) self.toluene = Component( default={"elemental_composition": { "C": 7, "H": 8 }}) # List of phase equilibrium index self.phase_equilibrium_idx = Set(initialize=[1, 2]) self.phase_equilibrium_list = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_ref = Param(mutable=True, default=101325, doc='Reference pressure [Pa]', units=pyunits.Pa) self.temperature_ref = Param(mutable=True, default=298.15, doc='Reference temperature [K]', units=pyunits.K) # Critical Properties pressure_crit_data = {'benzene': 48.9e5, 'toluene': 41.0e5} self.pressure_crit = Param(self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_crit_data), doc='Critical pressure [Pa]', units=pyunits.Pa) temperature_crit_data = {'benzene': 562.2, 'toluene': 591.8} self.temperature_crit = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_crit_data), doc='Critical temperature [K]', units=pyunits.K) # Pitzer acentricity factor omega_data = {'benzene': 0.212, 'toluene': 0.263} self.omega = Param(self.component_list, within=Reals, mutable=False, initialize=extract_data(omega_data), doc='Acentricity Factor') # Peng-Robinson binary interaction parameters kappa_data = { ('benzene', 'benzene'): 0.0000, ('benzene', 'toluene'): 0.0000, ('toluene', 'benzene'): 0.0000, ('toluene', 'toluene'): 0.0000 } self.kappa = Param(self.component_list, self.component_list, within=Reals, mutable=False, initialize=extract_data(kappa_data), doc='Peng-Robinson binary interaction parameters') # Molecular Weights mw_comp_data = {'benzene': 78.1136E-3, 'toluene': 92.1405E-3} self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight kg/mol", units=pyunits.kg / pyunits.mol) # Constants for specific heat capacity, enthalpy and entropy self.cp_mol_ig_comp_coeff_1 = Param( self.component_list, mutable=False, initialize={ 'benzene': -3.392E1, 'toluene': -2.435E1 }, doc="Parameter 1 to compute cp_mol_comp", units=pyunits.J / pyunits.mol / pyunits.K) self.cp_mol_ig_comp_coeff_2 = Param( self.component_list, mutable=False, initialize={ 'benzene': 4.739E-1, 'toluene': 5.125E-1 }, doc="Parameter 2 to compute cp_mol_comp", units=pyunits.J / pyunits.mol / pyunits.K**2) self.cp_mol_ig_comp_coeff_3 = Param( self.component_list, mutable=False, initialize={ 'benzene': -3.017E-4, 'toluene': -2.765E-4 }, doc="Parameter 3 to compute cp_mol_comp", units=pyunits.J / pyunits.mol / pyunits.K**3) self.cp_mol_ig_comp_coeff_4 = Param( self.component_list, mutable=False, initialize={ 'benzene': 7.130E-8, 'toluene': 4.911E-8 }, doc="Parameter 4 to compute cp_mol_comp", units=pyunits.J / pyunits.mol / pyunits.K**4) # Standard heats of formation # Source: NIST Webbook, https://webbook.nist.gov # Retrieved 25th September 2019 dh_form_data = {'benzene': 82.9e3, 'toluene': 50.1e3} self.enth_mol_form_ref = Param(self.component_list, mutable=False, initialize=extract_data(dh_form_data), doc="Standard heats of formation", units=pyunits.J / pyunits.mol) # Standard entropy of formation # Source: Engineering Toolbox, https://www.engineeringtoolbox.com # Retrieved 25th September, 2019 ds_form_data = {'benzene': -269, 'toluene': -321} self.entr_mol_form_ref = Param(self.component_list, mutable=False, initialize=extract_data(ds_form_data), doc="Standard entropy of formation", units=pyunits.J / pyunits.mol / pyunits.K) # Antoine coefficients for ideal vapour (units: bar, K) # This is needed for initial guesses of bubble and dew points self.antoine_coeff_A = Param( self.component_list, mutable=False, initialize={ 'benzene': 4.202, 'toluene': 4.216 }, doc="Antoine A Parameter to calculate pressure_sat", units=pyunits.dimensionless) self.antoine_coeff_B = Param( self.component_list, mutable=False, initialize={ 'benzene': 1322, 'toluene': 1435 }, doc="Antoine B Parameter to calculate pressure_sat", units=pyunits.K) self.antoine_coeff_C = Param( self.component_list, mutable=False, initialize={ 'benzene': -38.56, 'toluene': -43.33 }, doc="Antoine C Parameter to calculate pressure_sat", units=pyunits.K)
def build(self): ''' Callable method for Block construction. ''' super(MethaneParameterData, self).build() # Component list - a list of component identifiers self.component_list = Set(initialize=['H2', 'N2', 'O2', 'CH4', 'CO', 'CO2', 'H2O', 'NH3']) # List of components in each phase (optional) self.phase_comp = {"Vap": self.component_list} # List of all chemical elements that constitute the chemical species self.element_list = Set(initialize=['H', 'N', 'O', 'C']) # Elemental composition of all species self.element_comp = {'H2': {'H': 2, 'N': 0, 'O': 0, 'C': 0}, 'N2': {'H': 0, 'N': 2, 'O': 0, 'C': 0}, 'O2': {'H': 0, 'N': 0, 'O': 2, 'C': 0}, 'CH4': {'H': 4, 'N': 0, 'O': 0, 'C': 1}, 'CO': {'H': 0, 'N': 0, 'O': 1, 'C': 1}, 'CO2': {'H': 0, 'N': 0, 'O': 2, 'C': 1}, 'H2O': {'H': 2, 'N': 0, 'O': 1, 'C': 0}, 'NH3': {'H': 3, 'N': 1, 'O': 0, 'C': 0}} # Thermodynamic reference state self.pressure_reference = Param(mutable=True, default=101325, doc='Reference pressure [Pa]') self.temperature_reference = Param(mutable=True, default=1500, doc='Reference temperature [K]') # Constants for specific heat capacity, enthalpy # Sources: The Properties of Gases and Liquids (1987) # 4th edition, Chemical Engineering Series - Robert C. Reid CpIG_data = {('Vap', 'CH4', 'A'): 1.925e1, ('Vap', 'CH4', 'B'): 5.213e-2, ('Vap', 'CH4', 'C'): 1.197e-5, ('Vap', 'CH4', 'D'): -1.132e-8, ('Vap', 'CH4', 'E'): 0, ('Vap', 'CO', 'A'): 3.087e1, ('Vap', 'CO', 'B'): -1.285e-2, ('Vap', 'CO', 'C'): 2.789e-5, ('Vap', 'CO', 'D'): -1.272e-8, ('Vap', 'CO', 'E'): 0, ('Vap', 'CO2', 'A'): 1.980e1, ('Vap', 'CO2', 'B'): 7.344e-2, ('Vap', 'CO2', 'C'): -5.602e-5, ('Vap', 'CO2', 'D'): 1.715e-8, ('Vap', 'CO2', 'E'): 0, ('Vap', 'H2', 'A'): 2.714e1, ('Vap', 'H2', 'B'): 9.274e-3, ('Vap', 'H2', 'C'): -1.381e-5, ('Vap', 'H2', 'D'): 7.645e-9, ('Vap', 'H2', 'E'): 0, ('Vap', 'H2O', 'A'): 3.224e1, ('Vap', 'H2O', 'B'): 1.924e-3, ('Vap', 'H2O', 'C'): 1.055e-5, ('Vap', 'H2O', 'D'): -3.596e-9, ('Vap', 'H2O', 'E'): 0, ('Vap', 'N2', 'A'): 3.115e1, ('Vap', 'N2', 'B'): -1.357e-2, ('Vap', 'N2', 'C'): 2.680e-5, ('Vap', 'N2', 'D'): -1.168e-8, ('Vap', 'N2', 'E'): 0, ('Vap', 'NH3', 'A'): 2.731e1, ('Vap', 'NH3', 'B'): 2.383e-2, ('Vap', 'NH3', 'C'): 1.707e-5, ('Vap', 'NH3', 'D'): -1.185e-8, ('Vap', 'NH3', 'E'): 0, ('Vap', 'O2', 'A'): 2.811e1, ('Vap', 'O2', 'B'): -3.680e-6, ('Vap', 'O2', 'C'): 1.746e-5, ('Vap', 'O2', 'D'): -1.065e-8, ('Vap', 'O2', 'E'): 0} self.CpIG = Param(self.phase_list, self.component_list, ['A', 'B', 'C', 'D', 'E'], mutable=False, initialize=extract_data(CpIG_data), doc="parameters to compute Cp_comp") # Source: NIST Webbook, 9th October 2019 dh_form = {("Vap", "CH4"): -74600, ("Vap", "CO"): -110530, ("Vap", "CO2"): -393520, ("Vap", "H2"): 0, ("Vap", "H2O"): -241830, ("Vap", "N2"): 0, ("Vap", "NH3"): -45900, ("Vap", "O2"): 0} self.dh_form = Param(self.phase_list, self.component_list, mutable=False, initialize=extract_data(dh_form), doc="Heats of formation (J/mol)") # Source: NIST Webbook, 9th October 2019 ds_form = {("Vap", "CH4"): 186.25, ("Vap", "CO"): 197.66, ("Vap", "CO2"): 213.79, ("Vap", "H2"): 130.68, ("Vap", "H2O"): 188.84, ("Vap", "N2"): 191.61, ("Vap", "NH3"): 192.77, ("Vap", "O2"): 205.15} self.ds_form = Param(self.phase_list, self.component_list, mutable=False, initialize=extract_data(ds_form), doc="Entropies of formation (J/mol.K)")
def build(self): ''' Callable method for Block construction. ''' super(BTParameterData, self).build() self.cubic_type = CubicEoS.PR self.component_list = Set(initialize=['benzene', 'toluene']) # List of components in each phase (optional) self.phase_comp = { "Liq": self.component_list, "Vap": self.component_list } # List of phase equilibrium index self.phase_equilibrium_idx = Set(initialize=[1, 2]) self.phase_equilibrium_list = \ {1: ["benzene", ("Vap", "Liq")], 2: ["toluene", ("Vap", "Liq")]} # Thermodynamic reference state self.pressure_ref = Param(mutable=True, default=101325, doc='Reference pressure [Pa]') self.temperature_ref = Param(mutable=True, default=298.15, doc='Reference temperature [K]') # Critical Properties pressure_crit_data = {'benzene': 48.9e5, 'toluene': 41.0e5} self.pressure_crit = Param(self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(pressure_crit_data), doc='Critical pressure [Pa]') temperature_crit_data = {'benzene': 562.2, 'toluene': 591.8} self.temperature_crit = Param( self.component_list, within=NonNegativeReals, mutable=False, initialize=extract_data(temperature_crit_data), doc='Critical temperature [K]') # Pitzer acentricity factor omega_data = {'benzene': 0.212, 'toluene': 0.263} self.omega = Param(self.component_list, within=Reals, mutable=False, initialize=extract_data(omega_data), doc='Acentricity Factor') # Peng-Robinson binary interaction parameters kappa_data = { ('benzene', 'benzene'): 0.0000, ('benzene', 'toluene'): 0.0000, ('toluene', 'benzene'): 0.0000, ('toluene', 'toluene'): 0.0000 } self.kappa = Param(self.component_list, self.component_list, within=Reals, mutable=False, initialize=extract_data(kappa_data), doc='Peng-Robinson binary interaction parameters') # Molecular Weights mw_comp_data = {'benzene': 78.1136E-3, 'toluene': 92.1405E-3} self.mw_comp = Param(self.component_list, mutable=False, initialize=extract_data(mw_comp_data), doc="molecular weight kg/mol") # Constants for specific heat capacity, enthalpy and entropy cp_ig_data = { ('benzene', '1'): -3.392E1, ('benzene', '2'): 4.739E-1, ('benzene', '3'): -3.017E-4, ('benzene', '4'): 7.130E-8, ('toluene', '1'): -2.435E1, ('toluene', '2'): 5.125E-1, ('toluene', '3'): -2.765E-4, ('toluene', '4'): 4.911E-8 } self.cp_ig = Param(self.component_list, ['1', '2', '3', '4'], mutable=False, initialize=extract_data(cp_ig_data), doc="Parameters to compute cp_comp") # Standard heats of formation # Source: NIST Webbook, https://webbook.nist.gov # Retrieved 25th September 2019 dh_form_data = {'benzene': 82.9e3, 'toluene': 50.1e3} self.enth_mol_form_ref = Param(self.component_list, mutable=False, initialize=extract_data(dh_form_data), doc="Standard heats of formation") # Standard entropy of formation # Source: Engineering Toolbox, https://www.engineeringtoolbox.com # Retrieved 25th September, 2019 ds_form_data = {'benzene': -269, 'toluene': -321} self.entr_mol_form_ref = Param(self.component_list, mutable=False, initialize=extract_data(ds_form_data), doc="Standard entropy of formation") # Antoine coefficients for ideal vapour (units: bar, K) # This is needed for initial guesses of bubble and dew points antoine_data = { ('benzene', '1'): 4.202, ('benzene', '2'): 1322, ('benzene', '3'): -38.56, ('toluene', '1'): 4.216, ('toluene', '2'): 1435, ('toluene', '3'): -43.33 } self.antoine = Param(self.component_list, ['1', '2', '3'], mutable=False, initialize=extract_data(antoine_data), doc="Antoine Parameters to pressure_sat")