Esempio n. 1
0
    def build(self):
        super().build()

        self._tech_type = "sedimentation"

        build_sido(self)
        constant_intensity(self)

        # TODO: Does it really make sense for this to be indexed by time?
        self.basin_surface_area = Var(self.flowsheet().config.time,
                                      units=pyunits.ft**2,
                                      doc="Surface area of sedimentation tank")

        self.settling_velocity = Var(self.flowsheet().config.time,
                                     units=pyunits.m/pyunits.s)

        self._fixed_perf_vars.append(self.settling_velocity)

        self._perf_var_dict["Basin Surface Area (ft^2)"] = self.basin_surface_area
        self._perf_var_dict["Settling Velocity (m/s)"] = self.settling_velocity

        def rule_basin_surface_area(b, t):
            return (b.basin_surface_area[t] ==
                    pyunits.convert(
                        b.properties_in[t].flow_vol
                        / b.settling_velocity[t],
                        to_units=pyunits.ft**2))
        self.basin_surface_area_constraint = Constraint(
            self.flowsheet().time, rule=rule_basin_surface_area)
Esempio n. 2
0
    def build(self):
        super().build()

        self._tech_type = "bioreactor"

        build_siso(self)
        constant_intensity(self)
Esempio n. 3
0
    def build(self):
        super().build()

        self._tech_type = "microfiltration"

        build_sido(self)
        constant_intensity(self)
Esempio n. 4
0
    def build(self):
        super().build()

        self._tech_type = "landfill_zld"

        build_pt(self)
        constant_intensity(self)

        self.capacity_basis = Var(self.flowsheet().time,
                                units=pyunits.kg/pyunits.hr,
                                doc="capacity basis for capital cost")

        self.total_mass = Var(self.flowsheet().time,
                                units=pyunits.kg/pyunits.hr,
                                doc="total mass flow rate")

        self._fixed_perf_vars.append(self.capacity_basis)

        @self.Constraint(self.flowsheet().time,
                    doc='Total mass constraint')
        def total_mass_constraint(b, t):
            return b.total_mass[t] == sum(pyunits.convert(b.inlet.flow_mass_comp[t, m], to_units=pyunits.kg/pyunits.hr)
                                          for m in b.config.property_package.component_list)

        self._perf_var_dict["Capacity Basis (kg/hr)"] = self.capacity_basis
        self._perf_var_dict["Total Mass (kg/hr)"] = self.total_mass
Esempio n. 5
0
    def build(self):
        super().build()

        self._tech_type = "bio_active_filtration"

        build_sido(self)
        constant_intensity(self)
    def build(self):
        super().build()

        self._tech_type = "dissolved_air_flotation"

        build_sido(self)
        constant_intensity(self)
    def build(self):
        super().build()

        self._tech_type = "intrusion_mitigation"

        build_pt(self)
        constant_intensity(self)
Esempio n. 8
0
    def build(self):
        super().build()

        self._tech_type = "co2_addition"

        build_pt(self)
        constant_intensity(self)
Esempio n. 9
0
    def build(self):
        super().build()

        self._tech_type = "primary_separator"

        build_sido(self)
        constant_intensity(self)
Esempio n. 10
0
    def build(self):
        super().build()

        self._tech_type = "anaerobic_digestion_oxidation"

        build_sido(self)
        constant_intensity(self)
Esempio n. 11
0
    def build(self):
        super().build()

        self._tech_type = "feed_water_tank"

        build_pt(self)
        constant_intensity(self)
Esempio n. 12
0
    def build(self):
        super().build()

        self._tech_type = "aeration_basin"

        build_sido(self)
        constant_intensity(self)
Esempio n. 13
0
    def build(self):
        super().build()

        self._tech_type = "energy_recovery"

        build_pt(self)
        constant_intensity(self)
        self.electricity.setlb(None)
        self.electricity.setub(0)
Esempio n. 14
0
    def build(self):
        super().build()

        self._tech_type = "decarbonator"

        build_siso(self)
        constant_intensity(self)

        self.recovery_frac_mass_H2O.fix(1)
Esempio n. 15
0
    def build(self):
        super().build()

        self._tech_type = "anaerobic_mbr_mec"

        if "nonbiodegradable_cod" not in self.config.property_package.solute_set:
            raise ValueError(
                "nonbiodegradable_cod must be included in the solute list since"
                " this unit model converts cod to nonbiodegradable_cod.")

        build_sido_reactive(self)
        constant_intensity(self)
Esempio n. 16
0
    def build(self):
        super().build()

        self._tech_type = "chlorination"

        build_siso(self)
        constant_intensity(self)

        self.initial_chlorine_demand = Var(
            self.flowsheet().time,
            units=pyunits.mg / pyunits.liter,
            doc="Initial chlorine demand",
        )

        self.contact_time = Var(self.flowsheet().time,
                                units=pyunits.hour,
                                doc="Chlorine contact time")
        self.concentration_time = Var(
            self.flowsheet().time,
            units=(pyunits.mg * pyunits.minute) / pyunits.liter,
            doc="CT value for chlorination",
        )
        self.chlorine_decay_rate = Var(
            self.flowsheet().time,
            units=pyunits.mg / (pyunits.L * pyunits.hour),
            doc="Chlorine decay rate",
        )

        self.recovery_frac_mass_H2O.fix(1)
        self._fixed_perf_vars.append(self.initial_chlorine_demand)
        self._fixed_perf_vars.append(self.contact_time)
        self._fixed_perf_vars.append(self.concentration_time)
        self._fixed_perf_vars.append(self.chlorine_decay_rate)

        self.chlorine_dose = Var(self.flowsheet().time,
                                 units=pyunits.mg / pyunits.L,
                                 doc="Chlorine dose")

        @self.Constraint(self.flowsheet().time, doc="Chlorine dose constraint")
        def chlorine_dose_constraint(b, t):
            return b.chlorine_dose[t] == self.initial_chlorine_demand[
                t] + self.chlorine_decay_rate[t] * self.contact_time[t] + (
                    self.concentration_time[t] / pyunits.convert(
                        self.contact_time[t], to_units=pyunits.minute))

        self._perf_var_dict["Chlorine Dose (mg/L)"] = self.chlorine_dose
        self._perf_var_dict[
            "Initial Chlorine Demand (mg/L)"] = self.initial_chlorine_demand
        self._perf_var_dict["Contact Time (hr)"] = self.contact_time
        self._perf_var_dict["CT Value ((mg*min)/L)"] = self.concentration_time
        self._perf_var_dict[
            "Chlorine Decay Rate (mg/(L*hr))"] = self.chlorine_decay_rate
Esempio n. 17
0
    def model(self):
        m = ConcreteModel()

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

        m.fs.water_props = WaterParameterBlock(default={"solute_list": ["A", "B", "C"]})

        m.fs.unit = DerivedZO(default={"property_package": m.fs.water_props})

        constant_intensity(m.fs.unit)

        m.fs.unit.energy_electric_flow_vol_inlet.fix(10)

        return m
Esempio n. 18
0
    def build(self):
        super().build()

        self._tech_type = "cofermentation"

        # TODO: consider making a diso_reactive build function and adding conditional for
        # cod/nonbiodegradable cod to be in solute set. For now, unit assumes any solutes provided are
        # cod with a removal fraction to get the final ffCOD (i.e., (1-removal_frac)*mass_cod_in = mass_ffCOD

        if "cod" not in self.config.property_package.solute_set:
            raise ValueError(
                "cod must be included in the solute list since"
                " this unit model converts cod to nonbiodegradable_cod.")
        build_diso(self)
        constant_intensity(self)
Esempio n. 19
0
    def build(self):
        super().build()

        self._tech_type = "mabr"

        build_sido_reactive(self)
        constant_intensity(self)

        self.blower_size = Var(
            units=pyunits.m**2,
            bounds=(0, None),
            doc="Sizing variable for blower size",
        )

        self._fixed_perf_vars.append(self.blower_size)

        self._perf_var_dict["Blower Size (m^2)"] = self.blower_size
Esempio n. 20
0
    def build(self):
        super().build()

        self._tech_type = "uv"

        build_siso(self)
        constant_intensity(self)

        self.uv_reduced_equivalent_dose = Var(self.flowsheet().time,
                                              units=pyunits.mJ/pyunits.cm**2,
                                              doc="Reduced equivalent dosage")
        self.uv_transmittance_in = Var(self.flowsheet().time,
                                       units=pyunits.dimensionless,
                                       doc="UV transmittance of solution at UV reactor inlet")

        self.recovery_frac_mass_H2O.fix(1)
        self._fixed_perf_vars.append(self.uv_reduced_equivalent_dose)
        self._fixed_perf_vars.append(self.uv_transmittance_in)


        self._perf_var_dict["UV Reduced Equivalent Dosage (mJ/cm^2)"] = self.uv_reduced_equivalent_dose
        self._perf_var_dict["UV Transmittance of Feed"] = self.uv_transmittance_in
Esempio n. 21
0
 def build(self):
     super().build()
     self._tech_type = "static_mixer"
     build_pt(self)
     constant_intensity(self)
Esempio n. 22
0
    def build(self):
        super().build()

        self._tech_type = "sedimentation"

        build_sido(self)
        constant_intensity(self)

        # TODO: Does it really make sense for this to be indexed by time?
        self.basin_surface_area = Var(
            self.flowsheet().config.time,
            units=pyunits.ft**2,
            doc="Surface area of sedimentation tank",
        )

        self.settling_velocity = Var(
            self.flowsheet().config.time,
            units=pyunits.m / pyunits.s,
            doc="Particle settling velocity",
        )

        self._fixed_perf_vars.append(self.settling_velocity)

        self._perf_var_dict[
            "Basin Surface Area (ft^2)"] = self.basin_surface_area
        self._perf_var_dict["Settling Velocity (m/s)"] = self.settling_velocity

        def rule_basin_surface_area(b, t):
            return b.basin_surface_area[t] == pyunits.convert(
                b.properties_in[t].flow_vol / b.settling_velocity[t],
                to_units=pyunits.ft**2,
            )

        self.basin_surface_area_constraint = Constraint(
            self.flowsheet().time, rule=rule_basin_surface_area)

        if self.config.process_subtype == "phosphorus_capture":
            self.phosphorus_solids_ratio = Var(
                self.flowsheet().config.time,
                units=pyunits.dimensionless,
                doc="Mass fraction of phosphorus in settleable solids",
            )

            self._fixed_perf_vars.append(self.phosphorus_solids_ratio)
            self._perf_var_dict[
                "Phosphorus-Solids Ratio (kg/kg)"] = self.phosphorus_solids_ratio

            # This subtype is intended to be used explicitly for phosphorous capture.
            # If the user provides TSS, the amount of settled phosphate would be determined based on
            # an assumed fraction of phosphate in TSS. Alternatively, the user could provide phosphates
            # as the species, and the amount of solids + phosphate settled would be reported.
            # However, the user cannot provide both TSS and phosphates.
            if ("phosphates" in self.config.property_package.solute_set
                    and "tss" in self.config.property_package.solute_set):
                raise KeyError(
                    "tss and phosphates cannot both be defined in the solute_list. "
                    "Please choose one.")
            elif "phosphates" in self.config.property_package.solute_set:
                self.final_solids_mass = Var(
                    self.flowsheet().config.time,
                    units=pyunits.kg / pyunits.s,
                    doc="Solids mass flow in byproduct stream",
                )

                @self.Constraint(
                    self.flowsheet().time,
                    doc="Solids mass flow in byproduct stream constraint",
                )
                def solids_mass_flow_constraint(b, t):
                    return (b.final_solids_mass[t] == b.properties_byproduct[t]
                            .flow_mass_comp["phosphates"] /
                            b.phosphorus_solids_ratio[t])

                self._perf_var_dict[
                    "Final mass flow of settled solids (kg/s)"] = self.final_solids_mass

            elif "tss" in self.config.property_package.solute_set:
                self.final_phosphate_mass = Var(
                    self.flowsheet().config.time,
                    units=pyunits.kg / pyunits.s,
                    doc="Phosphate mass flow in byproduct stream",
                )

                @self.Constraint(
                    self.flowsheet().time,
                    doc="Phosphate mass flow in byproduct stream constraint",
                )
                def phosphate_mass_flow_constraint(b, t):
                    return (b.final_phosphate_mass[t] ==
                            b.properties_byproduct[t].flow_mass_comp["tss"] *
                            b.phosphorus_solids_ratio[t])

                self._perf_var_dict[
                    "Final mass flow of settled phosphate (kg/s)"] = self.final_phosphate_mass

            else:
                # Raise this error in case the user is intended to make use of the subtype but entered
                # the wrong component names.
                raise KeyError(
                    "One of the following should be specified in the solute_list: "
                    "tss or phosphates")
Esempio n. 23
0
    def build(self):
        super().build()

        self._tech_type = "fixed_bed"

        build_siso(self)
        constant_intensity(self)
        self.recovery_frac_mass_H2O.fix(1)

        # Chemical demands
        self.acetic_acid_dose = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Dosing rate of acetic acid",
        )
        self.phosphoric_acid_dose = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Dosing rate of phosphoric acid",
        )
        self.ferric_chloride_dose = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Dosing rate of ferric chloride",
        )
        self._fixed_perf_vars.append(self.acetic_acid_dose)
        self._fixed_perf_vars.append(self.phosphoric_acid_dose)
        self._fixed_perf_vars.append(self.ferric_chloride_dose)

        self.acetic_acid_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Consumption rate of acetic acid",
        )
        self.phosphoric_acid_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Consumption rate of phosphoric acid",
        )
        self.ferric_chloride_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Consumption rate of ferric chloride",
        )

        self._perf_var_dict["Acetic Acid Demand"] = self.acetic_acid_demand
        self._perf_var_dict["Phosphoric Acid Demand"] = self.phosphoric_acid_demand
        self._perf_var_dict["Ferric Chlorided Demand"] = self.ferric_chloride_demand

        @self.Constraint(self.flowsheet().time, doc="Acetic acid demand constraint")
        def acetic_acid_demand_equation(b, t):
            return b.acetic_acid_demand[t] == pyunits.convert(
                b.acetic_acid_dose * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )

        @self.Constraint(self.flowsheet().time, doc="Phosphoric acid demand constraint")
        def phosphoric_acid_demand_equation(b, t):
            return b.phosphoric_acid_demand[t] == pyunits.convert(
                b.phosphoric_acid_dose * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )

        @self.Constraint(self.flowsheet().time, doc="Acetic acid demand constraint")
        def ferric_chloride_demand_equation(b, t):
            return b.ferric_chloride_demand[t] == pyunits.convert(
                b.ferric_chloride_dose * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )

        # Activated Carbon demand
        self.activated_carbon_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Replacement rate for activated carbon",
        )
        self.activated_carbon_parameter_a = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Pre-exponential factor for activated carbon demand",
        )
        self.activated_carbon_parameter_b = Var(
            units=pyunits.dimensionless,
            bounds=(None, None),
            doc="Exponential factor for activated carbon demand",
        )
        self._fixed_perf_vars.append(self.activated_carbon_parameter_a)
        self._fixed_perf_vars.append(self.activated_carbon_parameter_b)
        self._perf_var_dict["Activated Carbon Demand"] = self.activated_carbon_demand

        @self.Constraint(
            self.flowsheet().time, doc="Activated carbon demand constraint"
        )
        def activated_carbon_demand_equation(b, t):
            return b.activated_carbon_demand[t] == pyunits.convert(
                b.activated_carbon_parameter_a
                * pyunits.convert(
                    b.properties_in[t].flow_vol / (pyunits.m**3 / pyunits.hour),
                    to_units=pyunits.dimensionless,
                )
                ** b.activated_carbon_parameter_b
                * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )

        # Sand demand
        self.sand_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Replacement rate for sand",
        )
        self.sand_parameter_a = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Pre-exponential factor for sand demand",
        )
        self.sand_parameter_b = Var(
            units=pyunits.dimensionless,
            bounds=(None, None),
            doc="Exponential factor for sand demand",
        )
        self._fixed_perf_vars.append(self.sand_parameter_a)
        self._fixed_perf_vars.append(self.sand_parameter_b)
        self._perf_var_dict["Sand Demand"] = self.sand_demand

        @self.Constraint(self.flowsheet().time, doc="Sand demand constraint")
        def sand_demand_equation(b, t):
            return b.sand_demand[t] == pyunits.convert(
                b.sand_parameter_a
                * pyunits.convert(
                    b.properties_in[t].flow_vol / (pyunits.m**3 / pyunits.hour),
                    to_units=pyunits.dimensionless,
                )
                ** b.sand_parameter_b
                * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )

        # Anthracite demand
        self.anthracite_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Replacement rate for anthracite",
        )
        self.anthracite_parameter_a = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Pre-exponential factor for anthracite demand",
        )
        self.anthracite_parameter_b = Var(
            units=pyunits.dimensionless,
            bounds=(None, None),
            doc="Exponential factor for anthracite demand",
        )
        self._fixed_perf_vars.append(self.anthracite_parameter_a)
        self._fixed_perf_vars.append(self.anthracite_parameter_b)
        self._perf_var_dict["Anthracite Demand"] = self.anthracite_demand

        @self.Constraint(self.flowsheet().time, doc="Anthracite demand constraint")
        def anthracite_demand_equation(b, t):
            return b.anthracite_demand[t] == pyunits.convert(
                b.anthracite_parameter_a
                * pyunits.convert(
                    b.properties_in[t].flow_vol / (pyunits.m**3 / pyunits.hour),
                    to_units=pyunits.dimensionless,
                )
                ** b.anthracite_parameter_b
                * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )

        # Cationic polymer demand
        self.cationic_polymer_demand = Var(
            self.flowsheet().time,
            units=pyunits.kg / pyunits.hr,
            bounds=(0, None),
            doc="Replacement rate for cationic polymer",
        )
        self.cationic_polymer_parameter_a = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Pre-exponential factor for cationic polymer demand",
        )
        self.cationic_polymer_parameter_b = Var(
            units=pyunits.dimensionless,
            bounds=(None, None),
            doc="Exponential factor for cationic polymer demand",
        )
        self._fixed_perf_vars.append(self.cationic_polymer_parameter_a)
        self._fixed_perf_vars.append(self.cationic_polymer_parameter_b)
        self._perf_var_dict["Cationic Polymer Demand"] = self.cationic_polymer_demand

        @self.Constraint(
            self.flowsheet().time, doc="Cationic Polymer demand constraint"
        )
        def cationic_polymer_demand_equation(b, t):
            return b.cationic_polymer_demand[t] == pyunits.convert(
                b.cationic_polymer_parameter_a
                * pyunits.convert(
                    b.properties_in[t].flow_vol / (pyunits.m**3 / pyunits.hour),
                    to_units=pyunits.dimensionless,
                )
                ** b.cationic_polymer_parameter_b
                * b.properties_in[t].flow_vol,
                to_units=pyunits.kg / pyunits.hr,
            )