コード例 #1
0
def test_build_and_scale_pretreatment_NF():
    for has_bypass in [True, False]:
        for NF_type in ["Sep", "ZO"]:
            for NF_base in ["ion", "salt"]:
                kwargs = {
                    "has_bypass": has_bypass,
                    "NF_type": NF_type,
                    "NF_base": NF_base,
                }
                print("\n\n***kwargs****\n", kwargs)

                if NF_type == "ZO" and NF_base == "salt":
                    continue  # not a valid combination

                m = ConcreteModel()
                m.fs = FlowsheetBlock(default={"dynamic": False})
                property_models.build_prop(m, base=kwargs["NF_base"])

                check_build(m,
                            build_func=pretreatment_NF.build_pretreatment_NF,
                            **kwargs)
                assert hasattr(m.fs, "NF")
                check_scaling(m,
                              scale_func=pretreatment_NF.scale_pretreatment_NF,
                              **kwargs)

                pretreatment_NF.display_pretreatment_NF(m, **kwargs)
コード例 #2
0
ファイル: full_example.py プロジェクト: ksbeattie/proteuslib
def solve_optimization(system_recovery=0.75, **kwargs_flowsheet):

    m = solve_flowsheet_mvp_NF(**kwargs_flowsheet)

    print("\n****** Optimization *****\n")
    set_up_optimization(m, system_recovery=system_recovery, **kwargs_flowsheet)
    optimize(m)

    pretreatment_NF.display_pretreatment_NF(m, **kwargs_flowsheet)
    m.fs.tb_pretrt_to_desal.report()
    desalination.display_desalination(m, **kwargs_flowsheet)
    costing.display_costing(m)
    print(
        "desalination saturation index:", value(m.fs.desal_saturation.saturation_index)
    )
    print(
        "pretreatment saturation index:", value(m.fs.pretrt_saturation.saturation_index)
    )
    print(
        "pretreatment Ca concentration factor:",
        value(
            m.fs.NF.feed_side.properties_out[0].mass_frac_phase_comp["Liq", "Ca"]
            / m.fs.feed.properties[0].mass_frac_phase_comp["Liq", "Ca"]
        ),
    )
    print("water recovery:", value(m.fs.system_recovery))
    print("CP modulus:", value(m.fs.desal_saturation.cp_modulus))
    return m
コード例 #3
0
def test_build_and_scale_pretreatment_NF():
    for has_bypass in [True, False]:
        for NF_type in ['Sep', 'ZO']:
            for NF_base in ['ion', 'salt']:
                kwargs = {
                    'has_bypass': has_bypass,
                    'NF_type': NF_type,
                    'NF_base': NF_base
                }
                print('\n\n***kwargs****\n', kwargs)

                if NF_type == 'ZO' and NF_base == 'salt':
                    continue  # not a valid combination

                m = ConcreteModel()
                m.fs = FlowsheetBlock(default={"dynamic": False})
                property_models.build_prop(m, base=kwargs['NF_base'])

                check_build(m,
                            build_func=pretreatment_NF.build_pretreatment_NF,
                            **kwargs)
                assert hasattr(m.fs, 'NF')
                check_scaling(m,
                              scale_func=pretreatment_NF.scale_pretreatment_NF,
                              **kwargs)

                pretreatment_NF.display_pretreatment_NF(m, **kwargs)
コード例 #4
0
ファイル: full_example.py プロジェクト: ksbeattie/proteuslib
def solve_flowsheet_mvp_NF(**kwargs):
    m = ConcreteModel()
    m.fs = FlowsheetBlock(default={"dynamic": False})
    build_flowsheet_mvp_NF(m, **kwargs)
    TransformationFactory("network.expand_arcs").apply_to(m)

    # scale
    pretreatment_NF.scale_pretreatment_NF(m, **kwargs)
    calculate_scaling_factors(m.fs.tb_pretrt_to_desal)
    desalination.scale_desalination(m, **kwargs)
    calculate_scaling_factors(m)

    # initialize
    optarg = {"nlp_scaling_method": "user-scaling"}
    pretreatment_NF.initialize_pretreatment_NF(m, **kwargs)
    m.fs.pretrt_saturation.properties.initialize(optarg=optarg)
    propagate_state(m.fs.s_pretrt_tb)
    m.fs.tb_pretrt_to_desal.initialize(optarg=optarg)
    propagate_state(m.fs.s_tb_desal)
    desalination.initialize_desalination(m, **kwargs)
    m.fs.desal_saturation.properties.initialize()

    m.fs.costing.initialize()

    # check_build(m)
    # check_scaling(m)

    check_dof(m)
    solve_block(m, tee=False, fail_flag=True)

    pretreatment_NF.display_pretreatment_NF(m, **kwargs)
    m.fs.tb_pretrt_to_desal.report()
    desalination.display_desalination(m, **kwargs)
    print(
        "desalination solubility index:", value(m.fs.desal_saturation.saturation_index)
    )
    print(
        "pretreatment solubility index:", value(m.fs.pretrt_saturation.saturation_index)
    )
    print("water recovery:", value(m.fs.system_recovery))
    print("LCOW:", value(m.fs.costing.LCOW))
    print("CP modulus:", value(m.fs.desal_saturation.cp_modulus))

    return m
コード例 #5
0
ファイル: flowsheet_NF.py プロジェクト: ksbeattie/proteuslib
def report(m, has_bypass=True):
    pretreatment_NF.display_pretreatment_NF(m,
                                            NF_type="ZO",
                                            NF_base="ion",
                                            has_bypass=has_bypass)
    m.fs.tb_pretrt_to_desal.report()