watertap.core package

Subpackages

Submodules

watertap.core.control_volume_isothermal module

class watertap.core.control_volume_isothermal.ControlVolume0DBlock(*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

    Config args

    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 construction.}

  • initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries with config arguments as keys.

  • 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 override the default behavior of matching the BlockData index exactly to the index in initialize.

Returns:

(ControlVolume0DBlock) New instance

class watertap.core.control_volume_isothermal.ControlVolume0DBlockData(component)[source]

Bases: _IsothermalEnergyBalanceCheckerMixin, ControlVolume0DBlockData

class watertap.core.control_volume_isothermal.ControlVolume1DBlock(*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

    Config args

    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 construction.}

    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 domain, 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 with config arguments as keys.

  • 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 override the default behavior of matching the BlockData index exactly to the index in initialize.

Returns:

(ControlVolume1DBlock) New instance

class watertap.core.control_volume_isothermal.ControlVolume1DBlockData(component)[source]

Bases: _IsothermalEnergyBalanceCheckerMixin, ControlVolume1DBlockData

watertap.core.initialization_mixin module

class watertap.core.initialization_mixin.InitializationMixin[source]

Bases: object

Class for catching InitializationError in UnitModel.initialize

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

    Config args

    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 construction.}

  • initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries with config arguments as keys.

  • 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 override 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

    Config args

    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 construction.}

    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 domain, 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 with config arguments as keys.

  • 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 override 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

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.FrictionFactor(value)[source]

Bases: Enum

default_by_module_type: Will revert FrictionFactor to either the Darcy’s friction factor correlation by Guillen & Hoek (flat-plate) or by Schock & Miquel (spiral-wound)

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.ModuleType(value)[source]

Bases: Enum

flat_sheet: flat-sheet module configuration spiral_wound: spiral-wound module configuration

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

class watertap.core.membrane_channel_base.TransportModel(value)[source]

Bases: Enum

SD: Solvent and solute mass flux is calculated using the Solution-Diffusion model SKK: Solvent and solute mass flux is calculated using the Spiegler-Kedem-Katchalsky model

watertap.core.solvers module

This module contains a get_solver function which is identical to the IDAES get_solver function except that it returns IpoptWaterTAP by default.

watertap.core.solvers.get_solver(solver=None, options=None)[source]

General method for getting a solver object which defaults to IpoptWaterTAP

Parameters:
  • solver – string name for desired solver. Default=None, use default solver

  • options – dict of solver options to use, overwrites any settings in IpoptWaterTAP. Default = None, use default solver options.

Returns:

A Pyomo solver object

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

__init__(dbpath=None)[source]
flush_cache()[source]

Method to flush cached files in database object.

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

    Config args

    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.

    isothermal

    Isothermal assumption, or ignore temperature variables in unit. Default=True

    isobaric

    Isobaric assumption, or ignore pressure variables in unit. Default=True

  • initialize (dict) – ProcessBlockData config for individual elements. Keys are BlockData indexes and values are dictionaries with config arguments as keys.

  • 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 override 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

static cost_power_law_flow(blk, 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

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_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

    Config args

    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 with config arguments as keys.

  • 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 override 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.

build()[source]

Callable method for Block construction.

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

    Config args

    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 with config arguments as keys.

  • 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 override 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.

build()[source]

General build method for StateBlockDatas.

Parameters:

None

Returns:

None

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 .

get_material_flow_basis()[source]

Method which returns an Enum indicating the basis of the material flow term.

get_material_flow_terms(p, j)[source]

Method which returns a valid expression for material flow 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

Module contents