watertap.costing package

Subpackages

Submodules

watertap.costing.multiple_choice_costing_block module

class watertap.costing.multiple_choice_costing_block.MultiUnitModelCostingBlock(*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

    flowsheet_costing_block

    Reference to associated FlowsheetCostingBlock to use.

    costing_blocks

    Costing blocks to use for unit. Should be a dictionary whose keys are the names of the block and whose values are either the costing method used to construct the block, or another dictionary whose keys are costing_method, which has the value of the costing method, and optionally costing_method_arguments, which has the keyword arguments for the costing method specified.

    initial_costing_block

    Costing block to be initially active

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

(MultiUnitModelCostingBlock) New instance

class watertap.costing.multiple_choice_costing_block.MultiUnitModelCostingBlockData(*args, **kwds)[source]

Bases: UnitModelCostingBlockData, UnitModelCostingBlock

Class for constructing several costing blocks on the same unit model and then allowing for choice between them

build()[source]

The build method is called by the default ProcessBlock rule. If a rule is specified other than the default it is important to call ProcessBlockData’s build method to put information from the “default” and “initialize” arguments to a ProcessBlock derived class into the BlockData object’s ConfigBlock.

The build method should usually be overloaded in a subclass derived from ProcessBlockData. This method would generally add Pyomo components such as variables, expressions, and constraints to the object. It is important for build() methods implemented in derived classes to call build() from the super class.

Parameters:

None

Returns:

None

initialize(*args, **kwargs)[source]

Initialize all costing blocks for easy switching between

select_costing_block(costing_block_name)[source]

Set the active costing block

watertap.costing.util module

watertap.costing.util.cost_by_flow_volume(blk, flow_cost, flow_to_cost)[source]

Generic function for costing by flow volume.

Parameters:
  • flow_cost – The cost of the device in [currency]/([volume]/[time])

  • flow_to_cost – The flow costed in [volume]/[time]

watertap.costing.util.cost_membrane(blk, membrane_cost, factor_membrane_replacement)[source]

Generic function for costing a membrane. Assumes the unit_model has an area variable or parameter.

Parameters:
  • membrane_cost – The cost of the membrane in currency per area

  • factor_membrane_replacement – Membrane replacement factor (fraction of membrane replaced/year)

watertap.costing.util.cost_rectifier(blk, power=<pyomo.core.expr.numeric_expr.NPV_ProductExpression object>, ac_dc_conversion_efficiency=0.9)[source]

Method to cost rectifiers for electrified process units that require direct current which must be converted from an alternating current source. Note that this should be used solely for units that require the conversion, and should not be used universally for electricity requirements. Assumes the unit_model has a power variable or parameter.

Parameters:

ac_dc_conversion_efficiency – Efficiency of the conversion from AC to DC current

watertap.costing.util.make_capital_cost_var(blk)[source]

Generic function for adding a Var named capital_cost to the unit model costing block.

Creates a pyomo Var named capital_cost with units blk.costing_package.base_currency.

watertap.costing.util.make_fixed_operating_cost_var(blk)[source]

Generic function for adding a Var named fixed_operating_cost to the unit model costing block.

Creates a pyomo Var named fixed_operating_cost with units blk.costing_package.base_currency / blk.costing_package.base_period.

watertap.costing.util.register_costing_parameter_block(build_rule, parameter_block_name)[source]

Decorator to create a global-level parameter block on the costing package.

This decorator is meant to be utilized on a costing method or function in order to register parameters (including flows specific to a unit model) which should have global-scope within a costing package. In this way, all instances of a unit model can share the same global parameters, such as baseline capital costs.

The decorator takes a build_rule, which is a rule for constructing a Pyomo Block, and a parameter_block_name, which determines the name of the constructed block. The decorator then puts the new Block onto the costing package. For a unit model costing block named blk, this is symmatically equivalent to:

blk.costing_package.parameter_block_name = Block(rule=build_rule)

However, this decorator contains a few additional safeguards.

  1. If the wrapped unit model costing function is called more than once, the associated parameter block will only be added one time.

  2. Similarly, if a component named parameter_block_name already exists on the costing_package, this decorator will raise an error if the parameter block was built with a different build_rule. This prevents inadvertent name clashes between different parameter blocks.

  3. The decorator fixes any Pyomo Vars it finds on the constructed parameter block.

Use of this decorator allows for defining unit-level costing parameters in the same module as the unit-level costing method. It also ensures that unit-level costing parameters are only added to the costing package if and only if that particular unit model is costed.

Parameters:
  • build_rule (callable) – A function defining a “build rule” for a Pyomo Block.

  • parameter_block_name (str) – The name for the built Block on the costing package.

watertap.costing.watertap_costing_package module

class watertap.costing.watertap_costing_package.WaterTAPCosting(*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

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

(WaterTAPCosting) New instance

class watertap.costing.watertap_costing_package.WaterTAPCostingBlockData(component)[source]

Bases: FlowsheetCostingBlockData

Base class for creating WaterTAP costing packages. Allows unit models to “self-register” their default costing methods, and for anonymous expressions in flow costs.

add_LCOW(flow_rate, name='LCOW')[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 :param name: LCOW) :type name: optional

add_annual_water_production(flow_rate, name='annual_water_production')[source]

Add annual water production to costing block. :param flow_rate - flow rate of water: calculating annual water production :type flow_rate - flow rate of water: volumetric :param name: Expression (default: annual_water_production) :type name: optional

static add_cost_factor(blk, factor)[source]

For a unit model costing block blk, adds blk.cost_factor, an expression pointing to the appropriate indirect capital cost multiplier, and blk.direct_capital_cost, which is a expression defined to be blk.capital_cost / blk.cost_factor. Valid strings for factor are “TIC” and “TPEC”; all others will result in an indirect capital cost factor of 1.

Parameters:
  • blk – an ideas.core.UnitModelCosting block

  • factor – a string representing the cost factor to use

add_electricity_intensity(flow_rate, name='electricity_intensity')[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 :param name: electrical intensity (default: specific_electrical_carbon_intensity) :type name: optional

add_specific_electrical_carbon_intensity(flow_rate, name='specific_electrical_carbon_intensity')[source]

Add specific electrical carbon intensity (kg_CO2eq/m**3) to costing block. :param flow_rate - flow rate of water: calculating specific electrical carbon intensity :type flow_rate - flow rate of water: volumetric :param name: carbon intensity (default: specific_electrical_carbon_intensity) :type name: optional

add_specific_energy_consumption(flow_rate, name='specific_energy_consumption')[source]

Add specific energy consumption (kWh/m**3) to costing block. :param flow_rate - flow rate of water: calculating specific energy consumption :type flow_rate - flow rate of water: volumetric :param name: energy consumption (default: specific_energy_consumption) :type name: optional

aggregate_costs()[source]

This method aggregates costs from all the unit models and flows registered with this FlowsheetCostingBlock and creates aggregate variables for these on the FlowsheetCostingBlock that can be used for further process-wide costing calculations.

The following costing variables are aggregated from all the registered UnitModelCostingBlocks (if they exist):

  • capital_cost,

  • direct_capital_cost,

  • fixed_operating_cost, and

  • variable_operating_cost

Additionally, aggregate flow variables are created for all registered flow types along with aggregate costs associated with each of these.

Parameters:

None

build_global_params()[source]

Build the global parameters common to WaterTAP Costing Packages. The currency units should already be registered.

build_process_costs()[source]

Build the common process costs to WaterTAP Costing Packages. The currency units should already be registered.

The derived class should add constraints for total_capital_cost and total_operating_cost

initialize_build()[source]

Basic initialization for flowsheet level quantities

register_flow_type(flow_type, cost)[source]

This method allows users to register new material and utility flows with the FlowsheetCostingBlock for use when costing flows. If cost is a constant (up to units), then this method creates a new Var on the FlowsheetCostingBlock named f`{flow_type}_cost`. Otherwise cost is a non-constant expression and this method will create a new Expression on the FlowsheetCostingBlock named f`{flow_type}_cost` whose value is fixed to cost.

If a component named f`{flow_type}_cost` already exists on the FlowsheetCostingBlock, then an error is raised unless f`{flow_type}_cost` is cost. If f`{flow_type}_cost` is cost, no error is raised and the existing component f`{flow_type}_cost` is used to cost the flow.

Parameters:
  • flow_type – string name to represent flow type

  • cost – a Pyomo expression with units representing the flow cost

class watertap.costing.watertap_costing_package.WaterTAPCostingData(component)[source]

Bases: WaterTAPCostingBlockData

build_global_params()[source]

Build the global parameters common to WaterTAP Costing Packages. The currency units should already be registered.

class watertap.costing.watertap_costing_package.WaterTAPCostingDetailed(*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

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

(WaterTAPCostingDetailed) New instance

class watertap.costing.watertap_costing_package.WaterTAPCostingDetailedData(component)[source]

Bases: WaterTAPCostingBlockData

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.

build_process_costs()[source]

Calculating process wide costs.

watertap.costing.zero_order_costing module

General costing package for zero-order processes.

class watertap.costing.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

    Config args

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

(ZeroOrderCosting) New instance

class watertap.costing.zero_order_costing.ZeroOrderCostingData(component)[source]

Bases: WaterTAPCostingDetailedData

General costing package for zero-order processes.

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.

Module contents