def test_build(): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = SaponificationParameterBlock() m.fs.reactions = SaponificationReactionParameterBlock( default={"property_package": m.fs.properties}) m.fs.rstoic = StoichiometricReactor( default={ "property_package": m.fs.properties, "reaction_package": m.fs.reactions, "has_heat_transfer": True, "has_pressure_change": True }) assert hasattr(m.fs.rstoic, "inlet") assert len(m.fs.rstoic.inlet.vars) == 4 assert hasattr(m.fs.rstoic.inlet, "flow_vol") assert hasattr(m.fs.rstoic.inlet, "conc_mol_comp") assert hasattr(m.fs.rstoic.inlet, "temperature") assert hasattr(m.fs.rstoic.inlet, "pressure") assert hasattr(m.fs.rstoic, "outlet") assert len(m.fs.rstoic.outlet.vars) == 4 assert hasattr(m.fs.rstoic.outlet, "flow_vol") assert hasattr(m.fs.rstoic.outlet, "conc_mol_comp") assert hasattr(m.fs.rstoic.outlet, "temperature") assert hasattr(m.fs.rstoic.outlet, "pressure") assert hasattr(m.fs.rstoic.control_volume, "heat") assert hasattr(m.fs.rstoic, "heat_duty") assert hasattr(m.fs.rstoic, "deltaP")
def test_build(): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = SaponificationParameterBlock() m.fs.reactions = SaponificationReactionParameterBlock( default={"property_package": m.fs.properties}) m.fs.cstr = CSTR( default={ "property_package": m.fs.properties, "reaction_package": m.fs.reactions, "has_equilibrium_reactions": False, "has_heat_transfer": True, "has_pressure_change": False }) assert hasattr(m.fs.cstr, "inlet") assert len(m.fs.cstr.inlet.vars) == 4 assert hasattr(m.fs.cstr.inlet, "flow_vol") assert hasattr(m.fs.cstr.inlet, "conc_mol_comp") assert hasattr(m.fs.cstr.inlet, "temperature") assert hasattr(m.fs.cstr.inlet, "pressure") assert hasattr(m.fs.cstr, "outlet") assert len(m.fs.cstr.outlet.vars) == 4 assert hasattr(m.fs.cstr.outlet, "flow_vol") assert hasattr(m.fs.cstr.outlet, "conc_mol_comp") assert hasattr(m.fs.cstr.outlet, "temperature") assert hasattr(m.fs.cstr.outlet, "pressure") assert hasattr(m.fs.cstr, "cstr_performance_eqn") assert hasattr(m.fs.cstr.control_volume, "heat") assert hasattr(m.fs.cstr, "heat_duty")
def sapon(self): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = SaponificationParameterBlock() m.fs.reactions = SaponificationReactionParameterBlock(default={ "property_package": m.fs.properties}) m.fs.unit = CSTR(default={"property_package": m.fs.properties, "reaction_package": m.fs.reactions, "has_equilibrium_reactions": False, "has_heat_transfer": True, "has_heat_of_reaction": True, "has_pressure_change": True}) return m
def test_report(): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = SaponificationParameterBlock() m.fs.reactions = SaponificationReactionParameterBlock( default={"property_package": m.fs.properties}) m.fs.pfr = PFR( default={ "property_package": m.fs.properties, "reaction_package": m.fs.reactions, "has_equilibrium_reactions": False, "has_heat_transfer": False, "has_pressure_change": False }) m.fs.pfr.report()
def test_initialize(): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = SaponificationParameterBlock() m.fs.reactions = SaponificationReactionParameterBlock( default={"property_package": m.fs.properties}) m.fs.cstr = CSTR( default={ "property_package": m.fs.properties, "reaction_package": m.fs.reactions, "has_equilibrium_reactions": False, "has_heat_transfer": False, "has_pressure_change": False }) m.fs.cstr.inlet.flow_vol.fix(1.0e-03) m.fs.cstr.inlet.conc_mol_comp[0, "H2O"].fix(55388.0) m.fs.cstr.inlet.conc_mol_comp[0, "NaOH"].fix(100.0) m.fs.cstr.inlet.conc_mol_comp[0, "EthylAcetate"].fix(100.0) m.fs.cstr.inlet.conc_mol_comp[0, "SodiumAcetate"].fix(0.0) m.fs.cstr.inlet.conc_mol_comp[0, "Ethanol"].fix(0.0) m.fs.cstr.inlet.temperature.fix(303.15) m.fs.cstr.inlet.pressure.fix(101325.0) m.fs.cstr.control_volume.volume.fix(1.5e-03) assert degrees_of_freedom(m) == 0 m.fs.cstr.initialize(outlvl=5, optarg={'tol': 1e-6}) assert (pytest.approx(101325.0, abs=1e-2) == m.fs.cstr.outlet.pressure[0].value) assert (pytest.approx(303.15, abs=1e-2) == m.fs.cstr.outlet.temperature[0].value) assert (pytest.approx( 20.80, abs=1e-2) == m.fs.cstr.outlet.conc_mol_comp[0, "EthylAcetate"].value)
def test_initialize(): m = ConcreteModel() m.fs = FlowsheetBlock(default={"dynamic": False}) m.fs.properties = SaponificationParameterBlock() m.fs.reactions = SaponificationReactionParameterBlock( default={"property_package": m.fs.properties}) m.fs.rstoic = StoichiometricReactor( default={ "property_package": m.fs.properties, "reaction_package": m.fs.reactions, "has_heat_transfer": False, "has_pressure_change": False }) m.fs.rstoic.inlet.flow_vol.fix(1.0) m.fs.rstoic.inlet.conc_mol_comp[0, "H2O"].fix(55388.0) m.fs.rstoic.inlet.conc_mol_comp[0, "NaOH"].fix(100.0) m.fs.rstoic.inlet.conc_mol_comp[0, "EthylAcetate"].fix(100.0) m.fs.rstoic.inlet.conc_mol_comp[0, "SodiumAcetate"].fix(0.0) m.fs.rstoic.inlet.conc_mol_comp[0, "Ethanol"].fix(0.0) m.fs.rstoic.inlet.temperature.fix(303.15) m.fs.rstoic.inlet.pressure.fix(101325.0) m.fs.rstoic.rate_reaction_extent[:, 'R1'].fix( 0.9 * m.fs.rstoic.inlet.conc_mol_comp[0, "NaOH"].value) assert degrees_of_freedom(m) == 0 m.fs.rstoic.initialize(outlvl=5, optarg={'tol': 1e-6}) assert (pytest.approx(101325.0, abs=1e-2) == m.fs.rstoic.outlet.pressure[0].value) assert (pytest.approx(303.15, abs=1e-2) == m.fs.rstoic.outlet.temperature[0].value) assert (pytest.approx( 90, abs=1e-2) == m.fs.rstoic.outlet.conc_mol_comp[0, "Ethanol"].value)