watertap.core package
Subpackages
Submodules
watertap.core.membrane_channel0d module
- class watertap.core.membrane_channel0d.MembraneChannel0DBlock(*args, **kwds)
Bases:
ProcessBlock
- Parameters
rule (function) – A rule function or None. Default rule calls build().
concrete (bool) – If True, make this a toplevel model. Default - False.
ctype (class) – Pyomo ctype of the block. Default - pyomo.environ.Block
default (dict) –
Default ProcessBlockData config
- Keys
- dynamic
Indicates whether this model will be dynamic, default - useDefault. Valid values: { useDefault - get flag from parent, True - set as a dynamic model, False - set as a steady-state model}
- has_holdup
Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms}
- property_package
Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.}
- property_package_args
A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.}
- reaction_package
Reaction parameter object used to define reaction calculations, default - None. Valid values: { None - no reaction package, ReactionParameterBlock - a ReactionParameterBlock object.}
- reaction_package_args
A ConfigBlock with arguments to be passed to a reaction block(s) and used when constructing these, default - None. Valid values: { see reaction package for documentation.}
- auto_construct
If set to True, this argument will trigger the auto_construct method which will attempt to construct a set of material, energy and momentum balance equations based on the parent unit’s config block. The parent unit must have a config block which derives from CONFIG_Base, default - False. Valid values: { True - use automatic construction, False - do not use automatic construciton.}
initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
- Returns
(MembraneChannel0DBlock) New instance
- class watertap.core.membrane_channel0d.MembraneChannel0DBlockData(component)[source]
Bases:
MembraneChannelMixin
,ControlVolume0DBlockData
- add_geometry(length_var=None, width_var=None, flow_direction=FlowDirection.forward)[source]
Method to create spatial domain and volume Var in ControlVolume.
- Parameters
- (width_var) – the channel. If a variable is provided, a reference will be made to this in place of the length Var.
- – the channel. If a variable is provided, a reference will be made to this in place of the length Var.
flow (flow_direction - argument indicating direction of material) –
- relative to length domain. Valid values:
FlowDirection.forward (default), flow goes from 0 to 1.
FlowDirection.backward, flow goes from 1 to 0
- Returns
None
- add_state_blocks(has_phase_equilibrium=None)[source]
This method constructs the state blocks for the control volume.
- Parameters
has_phase_equilibrium – indicates whether equilibrium calculations will be required in state blocks
- Returns
None
- initialize(state_args=None, outlvl=0, optarg=None, solver=None, hold_state=True, initialize_guess=None)[source]
Initialization routine for the membrane channel control volume
- Keyword Arguments
state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
outlvl – sets output log level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None)
hold_state – flag indicating whether the initialization routine should unfix any state variables fixed during initialization, default - True. Valid values: True - states variables are not unfixed, and a dict of returned containing flags for which states were fixed during initialization, False - state variables are unfixed after initialization by calling the release_state method.
initialize_guess – a dict of guesses for solvent_recovery, solute_recovery, and cp_modulus. These guesses offset the initial values for the retentate, permeate, and membrane interface state blocks from the inlet feed (default = {‘deltaP’: -1e4, ‘solvent_recovery’: 0.5, ‘solute_recovery’: 0.01, ‘cp_modulus’: 1.1})
- Returns
If hold_states is True, returns a dict containing flags for which states were fixed during initialization.
watertap.core.membrane_channel1d module
- class watertap.core.membrane_channel1d.MembraneChannel1DBlock(*args, **kwds)
Bases:
ProcessBlock
- Parameters
rule (function) – A rule function or None. Default rule calls build().
concrete (bool) – If True, make this a toplevel model. Default - False.
ctype (class) – Pyomo ctype of the block. Default - pyomo.environ.Block
default (dict) –
Default ProcessBlockData config
- Keys
- dynamic
Indicates whether this model will be dynamic, default - useDefault. Valid values: { useDefault - get flag from parent, True - set as a dynamic model, False - set as a steady-state model}
- has_holdup
Indicates whether holdup terms should be constructed or not. Must be True if dynamic = True, default - False. Valid values: { True - construct holdup terms, False - do not construct holdup terms}
- property_package
Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PropertyParameterObject - a PropertyParameterBlock object.}
- property_package_args
A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: { see property package for documentation.}
- reaction_package
Reaction parameter object used to define reaction calculations, default - None. Valid values: { None - no reaction package, ReactionParameterBlock - a ReactionParameterBlock object.}
- reaction_package_args
A ConfigBlock with arguments to be passed to a reaction block(s) and used when constructing these, default - None. Valid values: { see reaction package for documentation.}
- auto_construct
If set to True, this argument will trigger the auto_construct method which will attempt to construct a set of material, energy and momentum balance equations based on the parent unit’s config block. The parent unit must have a config block which derives from CONFIG_Base, default - False. Valid values: { True - use automatic construction, False - do not use automatic construciton.}
- area_definition
Argument defining whether area variable should be spatially variant or not. default - DistributedVars.uniform. Valid values: { DistributedVars.uniform - area does not vary across spatial domian, DistributedVars.variant - area can vary over the domain and is indexed by time and space.}
- transformation_method
Method to use to transform domain. Must be a method recognised by the Pyomo TransformationFactory.
- transformation_scheme
Scheme to use when transforming domain. See Pyomo documentation for supported schemes.
- finite_elements
Number of finite elements to use in transformation (equivalent to Pyomo nfe argument).
- collocation_points
Number of collocation points to use (equivalent to Pyomo ncp argument).
initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
- Returns
(MembraneChannel1DBlock) New instance
- class watertap.core.membrane_channel1d.MembraneChannel1DBlockData(component)[source]
Bases:
MembraneChannelMixin
,ControlVolume1DBlockData
- add_geometry(length_var, width_var, flow_direction=FlowDirection.forward, **kwargs)[source]
Method to create spatial domain and volume Var in ControlVolume.
- Parameters
of (width_var - An external variable to use for the width) – the channel. If a variable is provided, a reference will be made to this in place of the length Var.
of – the channel. If a variable is provided, a reference will be made to this in place of the length Var.
flow (flow_direction - argument indicating direction of material) –
- relative to length domain. Valid values:
FlowDirection.forward (default), flow goes from 0 to 1.
FlowDirection.backward, flow goes from 1 to 0
- (length_domain_set) – domain for the ControlVolume. If not provided, a new ContinuousSet will be created (default=None). ContinuousSet should be normalized to run between 0 and 1.
- – a new ContinuousSet if length_domain is not provided (default = [0.0, 1.0]).
- Returns
None
- add_state_blocks(has_phase_equilibrium=None)[source]
This method constructs the state blocks for the control volume.
- Parameters
has_phase_equilibrium – indicates whether equilibrium calculations will be required in state blocks
- Returns
None
- add_total_enthalpy_balances(**kwrags)[source]
This method constructs a set of 1D enthalpy balances indexed by time and phase.
- Parameters
should (has_heat_of_reaction - whether terms for heat of reaction) – be included in enthalpy balance
be (has_work_transfer - whether terms for work transfer should) – included in enthalpy balances
be – included in enthalpy balances
to (has_enthalpy_transfer - whether terms for enthalpy transfer due) – mass transfer should be included in enthalpy balance. This should generally be the same as the has_mass_transfer argument in the material balance methods
representing (custom_term - a Python method which returns Pyomo expressions) – custom terms to be included in enthalpy balances. Method should accept time, length and phase list as arguments.
- Returns
Constraint object representing enthalpy balances
- apply_transformation(*args, **kwargs)[source]
Method to apply DAE transformation to the Control Volume length domain. Transformation applied will be based on the Control Volume configuration arguments.
- initialize(state_args=None, outlvl=0, optarg=None, solver=None, hold_state=True, initialize_guess=None)[source]
Initialization routine for the membrane channel control volume
- Keyword Arguments
state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
outlvl – sets output log level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None)
hold_state – flag indicating whether the initialization routine should unfix any state variables fixed during initialization, default - True. Valid values: True - states variables are not unfixed, and a dict of returned containing flags for which states were fixed during initialization, False - state variables are unfixed after initialization by calling the release_state method.
initialize_guess – a dict of guesses for solvent_recovery, solute_recovery, and cp_modulus. These guesses offset the initial values for the retentate, permeate, and membrane interface state blocks from the inlet feed (default = {‘deltaP’: -1e4, ‘solvent_recovery’: 0.5, ‘solute_recovery’: 0.01, ‘cp_modulus’: 1.1})
- Returns
If hold_states is True, returns a dict containing flags for which states were fixed during initialization.
watertap.core.membrane_channel_base module
- class watertap.core.membrane_channel_base.ConcentrationPolarizationType(value)[source]
Bases:
Enum
none: no concentration polarization fixed: concentration polarization modulus is a user specified value calculated: calculate concentration polarization (concentration at membrane interface)
- class watertap.core.membrane_channel_base.MassTransferCoefficient(value)[source]
Bases:
Enum
none: mass transfer coefficient not utilized for concentration polarization effect fixed: mass transfer coefficient is a user specified value calculated: mass transfer coefficient is calculated
- class watertap.core.membrane_channel_base.PressureChangeType(value)[source]
Bases:
Enum
fixed_per_stage: pressure drop across membrane channel is a user-specified value fixed_per_unit_length: pressure drop per unit length across membrane channel is a user-specified value calculated: pressure drop across membrane channel is calculated
watertap.core.wt_database module
This module contains the base class for interacting with WaterTAP data files with zero-order model parameter data.
- class watertap.core.wt_database.Database(dbpath=None)[source]
Bases:
object
WaterTap Database class.
Used to instantiate an instance of a database for loading parameters associated with zero-order models in WaterTap.
- Parameters
- (dbpath) –
- Returns
an instance of a Database object linked to the provided database
- get_solute_set(water_source=None)[source]
Method to retrieve solute set for a given water source.
- Parameters
- (water_source) – If None, the default water source will be used.
- Returns
list of solutes contained in the database for the given source.
- Raises
KeyError if water source could not be found in database –
- get_source_data(water_source=None)[source]
Method to retrieve water source definition from database.
- Parameters
- (water_source) – If None, the default water source will be used.
- Returns
dict of parameters defined in database for given water source
- Raises
KeyError if database has not defined water sources –
- get_unit_operation_parameters(technology, subtype=None)[source]
Method to retrieve parameters for a given technology by subtype.
- Parameters
retrieve (technology - unit operation technology to look up and) – parameters for.
- (subtype) – sub-type of technology to return parameters for. If not provided, the default parameters are used instead.
- Returns
dict of parameters for technology and subtype
- Raises
KeyError if technology or subtype could not be found in database –
TypeError if subytpe is not string or list-of-strings –
watertap.core.zero_order_base module
This module contains the base class for all zero order unit models.
- class watertap.core.zero_order_base.ZeroOrderBase(*args, **kwds)
Bases:
ProcessBlock
- Parameters
rule (function) – A rule function or None. Default rule calls build().
concrete (bool) – If True, make this a toplevel model. Default - False.
ctype (class) – Pyomo ctype of the block. Default - pyomo.environ.Block
default (dict) –
Default ProcessBlockData config
- Keys
- dynamic
All zero-order models are steady-state only
- has_holdup
Zero order models do not include holdup
- property_package
Property parameter object used to define property calculations, default - useDefault. Valid values: { useDefault - use default package from parent model or flowsheet, PhysicalParameterObject - a PhysicalParameterBlock object.}
- property_package_args
A ConfigBlock with arguments to be passed to a property block(s) and used when constructing these, default - None. Valid values: {see property package for documentation.}
- database
An instance of a WaterTAP Database to use for parameters.
- process_subtype
Process subtype to use when looking up parameters from database.
initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
- Returns
(ZeroOrderBase) New instance
- class watertap.core.zero_order_base.ZeroOrderBaseData(component)[source]
Bases:
UnitModelBlockData
Standard base class for zero order unit models.
This class contains the basic consistency checks and common methods for zero order type models.
- build()[source]
General build method for UnitModelBlockData. This method calls a number of sub-methods which automate the construction of expected attributes of unit models.
Inheriting models should call super().build.
- Parameters
None –
- Returns
None
- calculate_scaling_factors()[source]
Placeholder scaling routine, should be overloaded by derived classes
- initialize_build(state_args=None, outlvl=0, solver=None, optarg=None)[source]
Passthrough initialization routine, raises NotImplementedError if the unit model does not have an _initialize function.
- load_parameters_from_database(use_default_removal=False)[source]
Method to load parameters for from database.
- Parameters
- (use_default_removal) – default removal fraction if no specific value defined in database
- Returns
None
- set_param_from_data(parameter, data, index=None, use_default_removal=False)[source]
General method for setting parameter values from a dict of data returned from a database.
- Parameters
database (data - dict of parameter values from) –
database –
- (use_default_removal) –
- – default removal fraction if no specific value defined in database
- Returns
None
- Raises
KeyError if values cannot be found for parameter in data dict –
- set_recovery_and_removal(data, use_default_removal=False)[source]
Common utility method for setting values of recovery and removal fractions.
- Parameters
variables (data - dict of parameter values to use when fixing) –
- (use_default_removal) – default removal fraction if no specific value defined in database
- Returns
None
watertap.core.zero_order_costing module
General costing package for zero-order processes.
- class watertap.core.zero_order_costing.ZeroOrderCosting(*args, **kwds)
Bases:
ProcessBlock
- Parameters
rule (function) – A rule function or None. Default rule calls build().
concrete (bool) – If True, make this a toplevel model. Default - False.
ctype (class) – Pyomo ctype of the block. Default - pyomo.environ.Block
default (dict) –
Default ProcessBlockData config
- Keys
- case_study_definition
Path to YAML file defining global parameters for case study. If not provided, default values from the WaterTap database are used.
initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
- Returns
(ZeroOrderCosting) New instance
- class watertap.core.zero_order_costing.ZeroOrderCostingData(component)[source]
Bases:
FlowsheetCostingBlockData
General costing package for zero-order processes.
- add_LCOW(flow_rate)[source]
Add Levelized Cost of Water (LCOW) to costing block. :param flow_rate - flow rate of water: calculating LCOW :type flow_rate - flow rate of water: volumetric
- add_electricity_intensity(flow_rate)[source]
Add calculation of overall electricity intensity to costing block. :param flow_rate - flow rate of water: calculating electricity intensity :type flow_rate - flow rate of water: volumetric
- build_global_params()[source]
To minimize overhead, only create global parameters for now. Unit-specific parameters will be added as sub-Blocks on a case-by-case basis as a unit of that type is costed.
- cost_HRCS_clarifier()[source]
Method for costing a clarifier unit in a high-rate contact stabilization (HRCS) process.
- cost_anaerobic_mbr_mec()[source]
Method for costing anaerobic membrane bioreactor integrated with microbial electrolysis cell.
- cost_autothermal_hydrothermal_liquefaction()[source]
General method for costing autothermal-hydrothermal liquefaction unit. Capital cost is based on the HTL reactor, booster pump, solid filter, other equipment, and heat oil system.
- cost_brine_concentrator()[source]
General method for costing brine concentration processes. Capital cost is based on the volumetirc flowrate and TDS of the incoming stream and the water recovery. This method also registers the electricity demand as a costed flow.
- cost_chemical_addition(number_of_parallel_units=1)[source]
General method for costing chemical addition processes. Capital cost is based on the mass flow rate of chemical added. This method also registers the chemical flow and electricity demand as costed flows. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_chlorination()[source]
General method for costing chlorination units. Capital cost is based on the both inlet flow and dosage of chlorine. This method also registers the chemical flow and electricity demand as costed flows.
- cost_clarifier(number_of_parallel_units=1)[source]
General method for costing clarifiers. Costing is carried out using either the general_power_law form or the standard form which computes HRT, sizing costs, and chemical input costs. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_coag_and_floc()[source]
General method for costing coagulation/flocculation processes. Capital cost is based on the alum flowrate and the polymer flowrate of the incoming stream. This method also registers the electricity demand as a costed flow.
- cost_deep_well_injection(number_of_parallel_units=1)[source]
General method for costing deep well injection processes. Capital cost is based on the cost of pump and pipe. This method also registers the electricity demand as a costed flow. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_dmbr()[source]
General method for costing dynamic membrane bioreactor. Capital cost is based on the cost of membrane area. This method also registers the electricity demand as a costed flow.
- cost_electrochemical_nutrient_removal()[source]
General method for costing electrochemical nutrient recovery. Capital cost is based on the volumetirc flowrate and HRT of the incoming stream. Chemical dosing cost is based on MgCl2 cost. This method also registers the electricity demand as a costed flow.
- cost_evaporation_pond()[source]
General method for costing evaporation pond. Capital cost is based on the pond area and other pond construction parameters.
- cost_filter_press()[source]
General method for costing belt filter press. Capital cost is a function of flow in gal/hr.
- cost_fixed_bed(number_of_parallel_units=1)[source]
General method for costing fixed bed units. This primarily calls the cost_power_law_flow method. This method also registers demand for a number of additional material flows. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_gac()[source]
General method for costing granular activated carbon processes. Capital cost is based on the inlet flow rate of liquid and the empty bed contacting time. This method also registers electricity and activated carbon consumption as costed flows.
- cost_hydrothermal_gasification()[source]
General method for costing hydrothermal gasification unit. Capital cost is based on the CHG reactor and other wastewater treatment equipment including a feed pump, a booster pump, a feed/product exchanger, a fired heater, a hydrocyclone, and a product air fin cooler.
- cost_ion_exchange()[source]
Two methods for costing ion exchange: (1) General method for costing ion exchange units. Capital cost is based on the both inlet flow and TDS. This method also registers the NaCl demand, resin replacement and electricity demand as costed flows. (2) General method using unit capex and unit opex cost parameters, tailored for AMO wastewater resource recovery (process subtype: clinoptilolite)
- cost_iron_and_manganese_removal(number_of_parallel_units=1)[source]
General method for costing iron and manganese removal processes. Capital cost is based on the cost of air blower, backwash and dual media filter. This method also registers the electricity demand as a costed flow. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_landfill(number_of_parallel_units=1)[source]
General method for costing landfill. Capital cost is based on the total mass and capacity basis. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_mabr()[source]
General method for costing membrane aerated biofilm reactor. Capital cost is based on the cost of reactor and blower. This method also registers the electricity demand as a costed flow.
- cost_membrane()[source]
Get membrane cost based on membrane area and unit membrane costs as well as fixed operating cost for membrane replacement.
- cost_metab()[source]
General method for costing the metab reactor. Capital cost is based on the cost of reactor, mixer, METAB beads, membrane, and vacuum pump. This method also registers the electricity demand as a costed flow.
- cost_nanofiltration(number_of_parallel_units=1)[source]
General method for costing nanofiltration. Costing is carried out using either the general_power_law form or the standard form which computes membrane cost and replacement rate. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_ozonation()[source]
General method for costing ozone addition. Capital cost is based on the inlet flowrate and dosage of ozone.
- cost_ozonation_aop()[source]
General method for costing ozonation with AOP. Capital cost is based on the inlet flowrate, dosage of ozone and flow rate of H2O2.
- cost_power_law_flow(number_of_parallel_units=1)[source]
General method for costing equipment based on power law form. This is the most common costing form for zero-order models. CapCost = A*(F/Fref)**B This method also registers electricity demand as a costed flow (if present in the unit operation model). :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_pump_electricity()[source]
General method for costing low pressure pump. Capital cost is based on the cost of inlet flow rate. This method also registers the electricity demand as a costed flow.
- cost_sedimentation(number_of_parallel_units=1)[source]
General method for costing sedimentaion processes. Capital cost is based on the surface area of the basin. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_storage_tank(number_of_parallel_units=1)[source]
General method for costing storage tanks. Capital cost is based on the volume of the tank. :param number_of_parallel_units: number_of_parallel_units parallel units (default: 1) :type number_of_parallel_units: int, optional
- cost_suboxic_asm()[source]
General method for costing suboxic activated sludge process unit. Capital cost is based on the aeration basin, other equipments including mixers, blowers, MLR pumps, RAS pumps and automated valves, and instrumentation and control system including probes (dissolved oxygen, nitrate and ammonia), phosphorus analyzer and air flowmeter.
- cost_supercritical_salt_precipitation()[source]
General method for costing supercritical salt precipitation unit.
- cost_surface_discharge()[source]
General method for costing surface discharge. Capital cost is based on construction and pipe costs.
- cost_uv()[source]
General method for costing UV reactor units. Capital cost is based on the inlet flow, UV reduced equivalent dosage, and UV transmittance at the inlet.
watertap.core.zero_order_diso module
This module contains the methods for constructing the material balances for zero-order double-input/single-output (DISO) unit models (i.e. units with two inlets and single outlet where composition changes, such as a generic bioreactor).
- watertap.core.zero_order_diso.build_diso(self)[source]
Helper method for constructing material balances for zero-order type models with DISO behavior.
- Three StateBlocks are added with two corresponding Ports:
properties_in1 –> inlet1
properties_in2 –> inlet2
properties_treated —> treated
- Two additional variables are added:
recovery_frac_mass_H2O (indexed by time)
removal_frac_mass_comp (indexed by time and component)
- Two additional constraints are added to represent the material balances
water_recovery_equation (indexed by time)
solute_treated_equation (indexed by time and solute)
This method also sets private attributes on the unit model with references to the appropriate initialization and scaling methods to use and to return the inlet volumetric flow rate.
- watertap.core.zero_order_diso.initialize_diso(blk, state_args=None, outlvl=0, solver=None, optarg=None)[source]
Initialization routine for double inlet-single outlet unit models.
- Keyword Arguments
outlvl – sets output level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None, use default IDAES solver)
- Returns
None
watertap.core.zero_order_electricity module
This module contains common methods for determining the electricity intensity and demand for zero-order unit models.
- watertap.core.zero_order_electricity.constant_intensity(self)[source]
Helper method for implementing electricity demand assuming constant intensity based on the inlet volumetric flow rate.
E[t] = Q[t] * intensity
- Two variables are added to the model:
electricity (indexed by time)
energy_electric_flow_vol_inlet (unindexed)
- One constraint is added to the model:
electricity_consumption (indexed by time)
- watertap.core.zero_order_electricity.pump_electricity(self, flow_rate)[source]
Helper method for calculating electricity demand based on a pump flow equation.
E[t] = (0.746 * Q[t] * H / (3960 * eta_pump * eta_motor))
Here Q is the volumetric flowrate to be used to calculate electricity demand, H is the lift height for the pump and eta_pump and eta_motor are the efficiencies of the pump and motor respectively.
- Parameters
above. (flow_rate - term to use for Q in the equation) –
watertap.core.zero_order_properties module
This module contains the general purpose property package for zero-order unit models. Zero-order models do not track temperature and pressure, or any form of energy flow.
- class watertap.core.zero_order_properties.WaterParameterBlock(*args, **kwds)
Bases:
ProcessBlock
- Parameters
rule (function) – A rule function or None. Default rule calls build().
concrete (bool) – If True, make this a toplevel model. Default - False.
ctype (class) – Pyomo ctype of the block. Default - pyomo.environ.Block
default (dict) –
Default ProcessBlockData config
- Keys
- default_arguments
Default arguments to use with Property Package
- database
An instance of a WaterTAP Database to use for parameters.
- water_source
Water source to use when looking up parameters from database.
- solute_list
List of solute species of interest. If None, will use all species defined in the water_source provided.
initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
- Returns
(WaterParameterBlock) New instance
- class watertap.core.zero_order_properties.WaterParameterBlockData(component)[source]
Bases:
PhysicalParameterBlock
Property Parameter Block Class
Defines component and phase lists, along with base units and constant parameters.
- classmethod define_metadata(obj)[source]
Set all the metadata for properties and units.
This method should be implemented by subclasses. In the implementation, they should set information into the object provided as an argument.
- Parameters
pcm (PropertyClassMetadata) – Add metadata to this object.
- Returns
None
- class watertap.core.zero_order_properties.WaterStateBlock(*args, **kwds)
Bases:
_WaterStateBlock
- Parameters
rule (function) – A rule function or None. Default rule calls build().
concrete (bool) – If True, make this a toplevel model. Default - False.
ctype (class) – Pyomo ctype of the block. Default - pyomo.environ.Block
default (dict) –
Default ProcessBlockData config
- Keys
- parameters
A reference to an instance of the Property Parameter Block associated with this property package.
- defined_state
Flag indicating whether the state should be considered fully defined, and thus whether constraints such as sum of mass/mole fractions should be included, default - False. Valid values: { True - state variables will be fully defined, False - state variables will not be fully defined.}
- has_phase_equilibrium
Flag indicating whether phase equilibrium constraints should be constructed in this state block, default - True. Valid values: { True - StateBlock should calculate phase equilibrium, False - StateBlock should not calculate phase equilibrium.}
initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries described under the “default” argument above.
idx_map (function) – Function to take the index of a BlockData element and return the index in the initialize dict from which to read arguments. This can be provided to overide the default behavior of matching the BlockData index exactly to the index in initialize.
- Returns
(WaterStateBlock) New instance
- class watertap.core.zero_order_properties.WaterStateBlockData(*args, **kwargs)[source]
Bases:
StateBlockData
General purpose StateBlock for Zero-Order unit models.
- define_display_vars()[source]
Method used to specify components to use to generate stream tables and other outputs. Defaults to define_state_vars, and developers should overload as required.
- define_state_vars()[source]
Method that returns a dictionary of state variables used in property package. Implement a placeholder method which returns an Exception to force users to overload this.
- get_energy_density_terms(p)[source]
Method which returns a valid expression for enthalpy density to use in the energy balances.
- get_enthalpy_flow_terms(p)[source]
Method which returns a valid expression for enthalpy flow to use in the energy balances.
- get_material_density_terms(p, j)[source]
Method which returns a valid expression for material density to use in the material balances .
watertap.core.zero_order_pt module
This module contains the methods for constructing the material balances for zero-order pass-through unit models (i.e. units with a single inlet and single outlet where flow and composition do not change, such as pumps).
- watertap.core.zero_order_pt.build_pt(self)[source]
Helper method for constructing material balances for zero-order type models with pass-through behavior.
- One StateBlock is added with two corresponding Ports:
properties
No additional variables and constraints are created.
This method also sets private attributes on the unit model with references to the appropriate initialization and scaling methods to use and to return the inlet volumetric flow rate.
- watertap.core.zero_order_pt.initialize_pt(blk, state_args=None, outlvl=0, solver=None, optarg=None)[source]
Initialization routine for pass-through unit models.
- Keyword Arguments
state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
outlvl – sets output level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None, use default IDAES solver)
- Returns
None
watertap.core.zero_order_sido module
This module contains methods for constructing the material balances for zero-order single inlet-double outlet (SIDO) unit models.
- watertap.core.zero_order_sido.build_sido(self)[source]
Helper method for constructing material balances for zero-order type models with one inlet and two outlets.
- Three StateBlocks are added with corresponding Ports:
properties_inlet
properties_treated
properties_byproduct
- Two additional variables are added:
recovery_vol (indexed by time)
removal_frac_mass_comp (indexed by time and component)
- Four additional constraints are added to represent the material balances
water_recovery_equation (indexed by time)
flow_balance (indexed by time)
solute_removal_equation (indexed by time and solute)
solute_treated_equation (indexed by time and solute)
This method also sets private attributes on the unit model with references to the appropriate initialization and scaling methods to use and to return the inlet volumetric flow rate.
- watertap.core.zero_order_sido.initialize_sido(blk, state_args=None, outlvl=0, solver=None, optarg=None)[source]
Initialization routine for single inlet-double outlet unit models.
- Keyword Arguments
state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
outlvl – sets output level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None, use default IDAES solver)
- Returns
None
watertap.core.zero_order_sido_reactive module
This module contains methods for constructing the material balances for zero-order single inlet-double outlet (SIDO) unit models with chemical reactions.
- watertap.core.zero_order_sido_reactive.build_sido_reactive(self)[source]
Helper method for constructing material balances for zero-order type models with one inlet and two outlets including chemical reactions.
- Three StateBlocks are added with corresponding Ports:
properties_in
properties_treated
properties_byproduct
- Additional variables are:
recovery_vol (indexed by time)
removal_frac_mass_comp (indexed by time and component)
extent_of_reaction (indexed by time and reactions)
- Four additional constraints are added to represent the material balances
water_recovery_equation (indexed by time)
flow_balance (indexed by time)
solute_removal_equation (indexed by time and solute)
solute_treated_equation (indexed by time and solute)
This method also sets private attributes on the unit model with references to the appropriate initialization and scaling methods to use and to return the inlet volumetric flow rate.
- watertap.core.zero_order_sido_reactive.initialize_sidor(blk, state_args=None, outlvl=0, solver=None, optarg=None)[source]
Initialization routine for single inlet-double outlet unit models with reactions.
- Keyword Arguments
state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
outlvl – sets output level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None, use default IDAES solver)
- Returns
None
watertap.core.zero_order_siso module
This module contains the methods for constructing the material balances for zero-order single-input/single-output (SISO) unit models (i.e. units with a single inlet and single outlet where composition changes, such as a generic bioreactor).
- watertap.core.zero_order_siso.build_siso(self)[source]
Helper method for constructing material balances for zero-order type models with SISO behavior.
- Two StateBlocks are added with two corresponding Ports:
properties_in –> inlet
properties_treated —> treated
- Two additional variables are added:
recovery_frac_mass_H2O (indexed by time)
removal_frac_mass_comp (indexed by time and component)
- Two additional constraints are added to represent the material balances
water_recovery_equation (indexed by time)
solute_treated_equation (indexed by time and solute)
This method also sets private attributes on the unit model with references to the appropriate initialization and scaling methods to use and to return the inlet volumetric flow rate.
- watertap.core.zero_order_siso.initialize_siso(blk, state_args=None, outlvl=0, solver=None, optarg=None)[source]
Initialization routine for single inlet-single outlet unit models.
- Keyword Arguments
state_args – a dict of arguments to be passed to the property package(s) to provide an initial state for initialization (see documentation of the specific property package) (default = {}).
outlvl – sets output level of initialization routine
optarg – solver options dictionary object (default=None, use default solver options)
solver – str indicating which solver to use during initialization (default = None, use default IDAES solver)
- Returns
None