def test_initialize():
    m = ConcreteModel()
    m.fs = FlowsheetBlock(default={"dynamic": False})

    m.fs.properties = SaponificationParameterBlock()

    m.fs.sj = StateJunction(default={"property_package": m.fs.properties})

    m.fs.sj.inlet.flow_vol.fix(1.0e-03)
    m.fs.sj.inlet.conc_mol_comp[0, "H2O"].fix(55388.0)
    m.fs.sj.inlet.conc_mol_comp[0, "NaOH"].fix(100.0)
    m.fs.sj.inlet.conc_mol_comp[0, "EthylAcetate"].fix(100.0)
    m.fs.sj.inlet.conc_mol_comp[0, "SodiumAcetate"].fix(0.0)
    m.fs.sj.inlet.conc_mol_comp[0, "Ethanol"].fix(0.0)

    m.fs.sj.inlet.temperature.fix(303.15)
    m.fs.sj.inlet.pressure.fix(101325.0)

    m.fs.sj.initialize(outlvl=5, optarg={'tol': 1e-6})

    assert (pytest.approx(101325.0,
                          abs=1e-2) == m.fs.sj.outlet.pressure[0].value)
    assert (pytest.approx(303.15,
                          abs=1e-2) == m.fs.sj.outlet.temperature[0].value)
    assert (pytest.approx(
        100, abs=1e-2) == m.fs.sj.outlet.conc_mol_comp[0,
                                                       "EthylAcetate"].value)
Beispiel #2
0
def test_report():
    m = ConcreteModel()
    m.fs = FlowsheetBlock(default={"dynamic": False})

    m.fs.properties = SaponificationParameterBlock()

    m.fs.sj = StateJunction(default={"property_package": m.fs.properties})

    m.fs.sj.report()
    def sapon(self):
        m = ConcreteModel()
        m.fs = FlowsheetBlock(default={"dynamic": False})

        m.fs.properties = SaponificationParameterBlock()

        m.fs.unit = StateJunction(
            default={"property_package": m.fs.properties})

        return m
    def iapws(self):
        m = ConcreteModel()
        m.fs = FlowsheetBlock(default={"dynamic": False})

        m.fs.properties = iapws95.Iapws95ParameterBlock()

        m.fs.unit = StateJunction(
            default={"property_package": m.fs.properties})

        return m
    def btx(self):
        m = ConcreteModel()
        m.fs = FlowsheetBlock(default={"dynamic": False})

        m.fs.properties = BTXParameterBlock(default={"valid_phase": 'Liq'})

        m.fs.unit = StateJunction(
            default={"property_package": m.fs.properties})

        return m
def test_config():
    m = ConcreteModel()
    m.fs = FlowsheetBlock(default={"dynamic": False})

    m.fs.properties = PhysicalParameterTestBlock()

    m.fs.unit = StateJunction(default={"property_package": m.fs.properties})

    # Check unit config arguments
    assert len(m.fs.unit.config) == 4

    assert not m.fs.unit.config.dynamic
    assert not m.fs.unit.config.has_holdup
    assert m.fs.unit.config.property_package is m.fs.properties
def test_build():
    m = ConcreteModel()
    m.fs = FlowsheetBlock(default={"dynamic": False})

    m.fs.properties = SaponificationParameterBlock()

    m.fs.sj = StateJunction(default={"property_package": m.fs.properties})

    assert hasattr(m.fs.sj, "inlet")
    assert len(m.fs.sj.inlet.vars) == 4
    assert hasattr(m.fs.sj.inlet, "flow_vol")
    assert hasattr(m.fs.sj.inlet, "conc_mol_comp")
    assert hasattr(m.fs.sj.inlet, "temperature")
    assert hasattr(m.fs.sj.inlet, "pressure")

    assert hasattr(m.fs.sj, "outlet")
    assert len(m.fs.sj.outlet.vars) == 4
    assert hasattr(m.fs.sj.outlet, "flow_vol")
    assert hasattr(m.fs.sj.outlet, "conc_mol_comp")
    assert hasattr(m.fs.sj.outlet, "temperature")
    assert hasattr(m.fs.sj.outlet, "pressure")

    assert degrees_of_freedom(m) == 0