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

        self._tech_type = "bioreactor"

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

        self._tech_type = "decarbonator"

        build_siso(self)
        constant_intensity(self)

        self.recovery_frac_mass_H2O.fix(1)
Exemple #3
0
    def build(self):
        super().build()

        self._tech_type = "fixed_bed"

        build_siso(self)
        self._Q = Reference(self.properties_in[:].flow_vol)
        # TODO: incorporate a*Q**b relationship for electricity consumption based on EPA data fitting;
        # apply pump electricity consumption in the meantime
        pump_electricity(self, self._Q)
        self.recovery_frac_mass_H2O.fix(1)
    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
    def build(self):
        super().build()

        self._tech_type = "ion_exchange"

        build_siso(self)
        self._Q = Reference(self.properties_in[:].flow_vol)
        pump_electricity(self, self._Q)

        # mutable parameter; default value found in WT3 for anion exchange
        self.eta_pump.set_value(0.8)
        # mutable parameter; default value of 2 bar converted to feet head
        self.lift_height.set_value(69.91052 * pyunits.feet)
        self.recovery_frac_mass_H2O.fix(1)

        # Add variables and constraints for material requirements
        self.NaCl_flowrate = Var(self.flowsheet().time,
                                 initialize=1,
                                 units=pyunits.kg / pyunits.s,
                                 bounds=(0, None),
                                 doc="Flowrate of NaCl addition")
        self.NaCl_dose = Var(units=pyunits.kg / pyunits.m**3,
                             bounds=(0, None),
                             doc="Dosage of NaCl addition")

        self._fixed_perf_vars.append(self.NaCl_dose)
        self._perf_var_dict["NaCl Addition"] = self.NaCl_flowrate

        @self.Constraint(self.flowsheet().time)
        def NaCl_constraint(blk, t):
            return (blk.NaCl_flowrate[t] == blk.NaCl_dose *
                    blk.properties_in[t].flow_vol)

        self.resin_demand = Var(self.flowsheet().time,
                                initialize=1,
                                units=pyunits.kg / pyunits.s,
                                bounds=(0, None),
                                doc="Replacement rate of ion exchange resin")
        self.resin_replacement = Var(
            units=pyunits.kg / pyunits.m**3,
            bounds=(0, None),
            doc="Resin replacement as a fuction of flow")

        self._fixed_perf_vars.append(self.resin_replacement)
        self._perf_var_dict["Resin Demand"] = self.resin_demand

        @self.Constraint(self.flowsheet().time)
        def resin_constraint(blk, t):
            return (blk.resin_demand[t] == blk.resin_replacement *
                    blk.properties_in[t].flow_vol)
Exemple #6
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
Exemple #7
0
    def build(self):
        super().build()

        self._tech_type = "ozonation"

        build_siso(self)

        if "toc" not in self.config.property_package.config.solute_list:
            raise ConfigurationError(
                "TOC must be in solute list for Ozonation or Ozone/AOP"
            )

        self.contact_time = Var(
            self.flowsheet().time, units=pyunits.minute, doc="Ozone contact time"
        )

        self.concentration_time = Var(
            self.flowsheet().time,
            units=(pyunits.mg * pyunits.minute) / pyunits.liter,
            doc="CT value for ozone contactor",
        )

        self.mass_transfer_efficiency = Var(
            self.flowsheet().time,
            units=pyunits.dimensionless,
            doc="Ozone mass transfer efficiency",
        )

        self.specific_energy_coeff = Var(
            self.flowsheet().time,
            units=pyunits.kWh / pyunits.lb,
            bounds=(0, None),
            doc="Specific energy consumption for ozone generation",
        )

        self._fixed_perf_vars.append(self.contact_time)
        self._fixed_perf_vars.append(self.concentration_time)
        self._fixed_perf_vars.append(self.mass_transfer_efficiency)
        self._fixed_perf_vars.append(self.specific_energy_coeff)

        self.ozone_flow_mass = Var(
            self.flowsheet().time,
            initialize=1,
            bounds=(0, None),
            units=pyunits.lb / pyunits.hr,
            doc="Mass flow rate of ozone",
        )

        self.ozone_consumption = Var(
            self.flowsheet().time,
            initialize=1,
            bounds=(0, None),
            units=pyunits.mg / pyunits.liter,
            doc="Ozone consumption",
        )

        self.electricity = Var(
            self.flowsheet().time,
            initialize=1,
            bounds=(0, None),
            units=pyunits.kW,
            doc="Ozone generation power demand",
        )

        @self.Constraint(self.flowsheet().time, doc="Ozone consumption constraint")
        def ozone_consumption_constraint(b, t):
            return (
                b.ozone_consumption[t]
                == (
                    (
                        pyunits.convert(
                            b.properties_in[t].conc_mass_comp["toc"],
                            to_units=pyunits.mg / pyunits.liter,
                        )
                        + self.concentration_time[t] / self.contact_time[t]
                    )
                )
                / self.mass_transfer_efficiency[t]
            )

        @self.Constraint(self.flowsheet().time, doc="Ozone mass flow constraint")
        def ozone_flow_mass_constraint(b, t):
            return b.ozone_flow_mass[t] == pyunits.convert(
                b.properties_in[t].flow_vol * b.ozone_consumption[t],
                to_units=pyunits.lb / pyunits.hr,
            )

        @self.Constraint(self.flowsheet().time, doc="Ozone power constraint")
        def electricity_constraint(b, t):
            return b.electricity[t] == (
                b.specific_energy_coeff[t] * b.ozone_flow_mass[t]
            )

        self._perf_var_dict["Ozone Contact Time (min)"] = self.contact_time
        self._perf_var_dict["Ozone CT Value ((mg*min)/L)"] = self.concentration_time
        self._perf_var_dict[
            "Ozone Mass Transfer Efficiency"
        ] = self.mass_transfer_efficiency
        self._perf_var_dict["Ozone Mass Flow (lb/hr)"] = self.ozone_flow_mass
        self._perf_var_dict["Ozone Unit Power Demand (kW)"] = self.electricity
Exemple #8
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,
            )
    def build(self):
        super().build()

        self._tech_type = "constructed_wetlands"

        build_siso(self)