예제 #1
0
def test_build_and_scale_desalination():
    for has_desal_feed in [True]:
        for is_twostage in [True, False]:
            for has_ERD in [True, False]:
                for RO_type in ['Sep', '0D', '1D']:
                    for RO_base in ['TDS']:
                        for RO_level in ['simple', 'detailed']:
                            kwargs = {'has_desal_feed': has_desal_feed, 'is_twostage': is_twostage, 'has_ERD': has_ERD,
                                      'RO_type': RO_type, 'RO_base': RO_base, 'RO_level': RO_level}

                            if RO_type == 'Sep' and is_twostage:
                                continue  # not a supported combination
                            elif RO_type == 'Sep' and has_ERD:
                                continue  # not a supported combination
                            elif RO_type == '1D' and RO_level == 'simple':
                                continue  # not a supported combination

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

                            check_build(m, build_func=desalination.build_desalination, **kwargs)
                            assert hasattr(m.fs, 'RO')
                            check_scaling(m, scale_func=desalination.scale_desalination, **kwargs)

                            desalination.display_desalination(m, **kwargs)
예제 #2
0
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
def report(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("water recovery:", value(m.fs.system_recovery))
    costing.display_costing(m)
예제 #4
0
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
def test_build_and_scale_desalination():
    for has_desal_feed in [True]:
        for is_twostage in [True, False]:
            for has_ERD in [True, False]:
                for RO_type in ["Sep", "0D", "1D"]:
                    for RO_base in ["TDS"]:
                        for RO_level in ["simple", "detailed"]:
                            kwargs = {
                                "has_desal_feed": has_desal_feed,
                                "is_twostage": is_twostage,
                                "has_ERD": has_ERD,
                                "RO_type": RO_type,
                                "RO_base": RO_base,
                                "RO_level": RO_level,
                            }

                            if RO_type == "Sep" and is_twostage:
                                continue  # not a supported combination
                            elif RO_type == "Sep" and has_ERD:
                                continue  # not a supported combination
                            elif RO_type == "1D" and RO_level == "simple":
                                continue  # not a supported combination

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

                            check_build(
                                m,
                                build_func=desalination.build_desalination,
                                **kwargs)
                            assert hasattr(m.fs, "RO")
                            check_scaling(
                                m,
                                scale_func=desalination.scale_desalination,
                                **kwargs)

                            desalination.display_desalination(m, **kwargs)