openpytea.equipment¶
- openpytea.equipment.inflation_adjustment(equipment_cost, cost_year, target_year=2024)[source]¶
Adjust equipment cost from one year to another using the Chemical Engineering Plant Cost Index (CEPCI).
This function uses historical CEPCI values to convert equipment costs between different years, accounting for inflation in the chemical engineering industry.
- Parameters:
- Returns:
The inflation-adjusted equipment cost in target_year (in USD).
- Return type:
- Raises:
ValueError – If cost_year is not found in CEPCI_DF.
ValueError – If target_year is not found in CEPCI_DF.
Notes
The adjustment factor is calculated as: adjusted_cost = equipment_cost * (CEPCI[target_year] / CEPCI[cost_year])
Examples
>>> # Adjust from 2015 to 2023 >>> new_cost = inflation_adjustment(50000, 2015, 2023)
- class openpytea.equipment.CostCorrelationDB(df= key ... Unnamed: 27 0 gas_permeation_seider_2013 ... NaN 1 pervaporation_seider_2013 ... NaN 2 osmosis_brackish_seider_2013 ... NaN 3 osmosis_seawater_seider_2013 ... NaN 4 ultrafiltration_high_seider_2013 ... NaN .. ... ... ... 412 wastewater_primary_secondary_seider_2013 ... NaN 413 wastewater_primary_secondary_tertiary_seider_2013 ... NaN 414 water_ion_exchange_plant_towler_2010 ... NaN 415 internal_coils_vaporizers_turton_2001 ... NaN 416 jacketed_vessels_vaporizers_turton_2001 ... NaN [417 rows x 28 columns])[source]¶
Bases:
objectDatabase interface for equipment cost correlations.
Manages cost estimation correlations for equipment based on size/capacity parameters. Supports multiple correlation forms (offset power-law, log-log quadratic, ln-ln quartic, power-sizing, 2-var power-law) and handles equipment parallelization when capacity limits are exceeded.
- df¶
Cost correlation data with columns: key, category, type, form, s_lower, s_upper, s2_lower, s2_upper, upper_parallel, a, b, n, n2, k1, k2, k3, k4, k5, s0, c0, f, cost_year.
- Type:
pd.DataFrame
- evaluate(key, s, s2=None)[source]¶
Calculate purchased equipment cost based on correlation key and size.
- Parameters:
key (
str) – Unique identifier for the cost correlation.s (
float) – Equipment size/capacity parameter.s2 (
float | None, optional) – Second size/capacity parameter, required by two-parameter correlation forms such as"2-var power-law". Validated againsts2_lower/s2_upperbut never parallelized. Default is None.
- Returns:
(total_cost, number_of_units, cost_year).
- Return type:
tuple[float,int,int]- Raises:
KeyError – If correlation key not found in database.
ValueError – If size (or
s2) is outside its valid bounds, the correlation form is unsupported, or the form requiress2and none was given.
- key_for_category_type(eq_category, type)[source]¶
Look up correlation key by equipment category and optional type.
- Parameters:
eq_category (
str) – Equipment category name.type (
str | None) – Equipment sub-type (optional).
- Returns:
Correlation key if found, None otherwise.
- Return type:
str | None
- default_material_for_key(key)[source]¶
Look up the cost basis’s default construction material for a key.
- Parameters:
key (
str) – Correlation key.- Returns:
The
default materialvalue for the row, or None if the key is not found, the column is absent, or the value is unset (e.g."n.a.").- Return type:
str | None
- class openpytea.equipment.Equipment(name, param, process_type, category, type=None, material=None, num_units=None, purchased_cost=None, cost_year=None, cost_func=None, target_year=2024, erection_factor=None, piping_factor=None, instrumentation_factor=None, electrical_factor=None, civil_factor=None, structural_factor=None, lagging_factor=None, material_factor=None)[source]¶
Bases:
objectEquipment cost estimation class for process equipment.
Manages cost calculation of process equipment based on process type, material, and equipment parameters. Supports both direct cost input and calculated costs from a cost correlation database.
- process_factors¶
Process type factors affecting cost calculation. Keys are process types (“Solids”, “Fluids”, “Mixed”, “Electrical”). Values are dicts with factors: fer, fp, fi, fel, fc, fs, fl.
- Type:
- material_factors¶
Material type multipliers mapping material names to cost factors (1.0 to 1.7).
- Type:
- Parameters:
name (
str) – Equipment identifier/name.param (
float | tuple[float,float] | list[float]) – Equipment parameter (size, capacity) for cost correlation lookup. Pass a 2-element tuple/list(s1, s2)for two-parameter correlation forms such as"2-var power-law".process_type (
str) – Type of process (“Solids”, “Fluids”, “Mixed”, or “Electrical”).category (
str) – Equipment category for database lookup.type (
str | None, optional) – Equipment sub-type for database lookup. Default is None.material (
str | None, optional) – Material of construction. Default is None, which uses the resolved cost correlation’sdefault materialcolumn, falling back to “Carbon steel” if there’s no correlation match or the value is unset (e.g. “n.a.”). Since the correlation’s cost already prices in whatever material it defaults to, a material that matches the resolved default (whether auto-filled or passed explicitly) always uses a material factor of 1.0, even if it’s recognized inmaterial_factors(e.g. “304 stainless steel”). Passing a different material instead usesmaterial_factors[material] / material_factors[default](the default’s own factor, or 1.0 if it has none) so the factor is relative to the correlation’s actual cost basis rather than double-counting it, and raises ValueError if the material isn’t found inmaterial_factors.num_units (
int | None, optional) – Number of identical units. Default is None (set to 1 when purchased_cost is provided).purchased_cost (
float | None, optional) – Direct purchased cost input. If provided, param is ignored. Default is None.cost_year (
int | None, optional) – Year of the purchased_cost quote for inflation adjustment. Default is None.cost_func (
str | None, optional) – Explicit cost correlation key from the database. Default is None (auto-resolved from category/type).target_year (
int, optional) – Target year for inflation adjustment. Default is 2024.erection_factor (
float | None, optional) – Erection factor override. Default is None (use process_type table).piping_factor (
float | None, optional) – Piping factor override. Default is None (use process_type table).instrumentation_factor (
float | None, optional) – Instrumentation & controls factor override. Default is None.electrical_factor (
float | None, optional) – Electrical factor override. Default is None (use process_type table).civil_factor (
float | None, optional) – Civil factor override. Default is None (use process_type table).structural_factor (
float | None, optional) – Structural steel factor override. Default is None (use process_type table).lagging_factor (
float | None, optional) – Lagging & painting factor override. Default is None (use process_type table).material_factor (
float | None, optional) – Material factor override. Default is None (1.0 ifmaterialmatches the resolved default material, else the ratio of the two materials’material_factorsvalues).
- Raises:
ValueError – If process_type or material is not found in the factor dictionaries.
KeyError – If the category/type combination is not found in the database and cost_func is not specified.
Examples
>>> eq = Equipment( ... name="Reactor", ... param=100, ... process_type="Fluids", ... category="Reactor", ... material="304 stainless steel" ... ) >>> print(eq.direct_cost)
- process_factors = {'Electrical': {'fc': 0.2, 'fel': 0.7, 'fer': 0.4, 'fi': 0.7, 'fl': 0.1, 'fp': 0.1, 'fs': 0.1}, 'Fluids': {'fc': 0.3, 'fel': 0.2, 'fer': 0.3, 'fi': 0.3, 'fl': 0.1, 'fp': 0.8, 'fs': 0.2}, 'Mixed': {'fc': 0.3, 'fel': 0.2, 'fer': 0.5, 'fi': 0.3, 'fl': 0.1, 'fp': 0.6, 'fs': 0.2}, 'Solids': {'fc': 0.2, 'fel': 0.15, 'fer': 0.6, 'fi': 0.2, 'fl': 0.05, 'fp': 0.2, 'fs': 0.1}}¶
- material_factors = {'304 stainless steel': 1.3, '316 stainless steel': 1.3, '321 stainless steel': 1.5, 'Aluminum': 1.07, 'Bronze': 1.07, 'Carbon steel': 1.0, 'Cast steel': 1.1, 'Hastelloy C': 1.55, 'Inconel': 1.7, 'Monel': 1.65, 'Nickel': 1.7, 'Stainless steel': 1.3}¶
Functions
- openpytea.equipment.inflation_adjustment(equipment_cost, cost_year, target_year=2024)[source]¶
Adjust equipment cost from one year to another using the Chemical Engineering Plant Cost Index (CEPCI).
This function uses historical CEPCI values to convert equipment costs between different years, accounting for inflation in the chemical engineering industry.
- Parameters:
- Returns:
The inflation-adjusted equipment cost in target_year (in USD).
- Return type:
- Raises:
ValueError – If cost_year is not found in CEPCI_DF.
ValueError – If target_year is not found in CEPCI_DF.
Notes
The adjustment factor is calculated as: adjusted_cost = equipment_cost * (CEPCI[target_year] / CEPCI[cost_year])
Examples
>>> # Adjust from 2015 to 2023 >>> new_cost = inflation_adjustment(50000, 2015, 2023)
Classes
- class openpytea.equipment.CostCorrelationDB(df= key ... Unnamed: 27 0 gas_permeation_seider_2013 ... NaN 1 pervaporation_seider_2013 ... NaN 2 osmosis_brackish_seider_2013 ... NaN 3 osmosis_seawater_seider_2013 ... NaN 4 ultrafiltration_high_seider_2013 ... NaN .. ... ... ... 412 wastewater_primary_secondary_seider_2013 ... NaN 413 wastewater_primary_secondary_tertiary_seider_2013 ... NaN 414 water_ion_exchange_plant_towler_2010 ... NaN 415 internal_coils_vaporizers_turton_2001 ... NaN 416 jacketed_vessels_vaporizers_turton_2001 ... NaN [417 rows x 28 columns])[source]¶
Bases:
objectDatabase interface for equipment cost correlations.
Manages cost estimation correlations for equipment based on size/capacity parameters. Supports multiple correlation forms (offset power-law, log-log quadratic, ln-ln quartic, power-sizing, 2-var power-law) and handles equipment parallelization when capacity limits are exceeded.
- df¶
Cost correlation data with columns: key, category, type, form, s_lower, s_upper, s2_lower, s2_upper, upper_parallel, a, b, n, n2, k1, k2, k3, k4, k5, s0, c0, f, cost_year.
- Type:
pd.DataFrame
- evaluate(key, s, s2=None)[source]¶
Calculate purchased equipment cost based on correlation key and size.
- Parameters:
key (
str) – Unique identifier for the cost correlation.s (
float) – Equipment size/capacity parameter.s2 (
float | None, optional) – Second size/capacity parameter, required by two-parameter correlation forms such as"2-var power-law". Validated againsts2_lower/s2_upperbut never parallelized. Default is None.
- Returns:
(total_cost, number_of_units, cost_year).
- Return type:
tuple[float,int,int]- Raises:
KeyError – If correlation key not found in database.
ValueError – If size (or
s2) is outside its valid bounds, the correlation form is unsupported, or the form requiress2and none was given.
- key_for_category_type(eq_category, type)[source]¶
Look up correlation key by equipment category and optional type.
- Parameters:
eq_category (
str) – Equipment category name.type (
str | None) – Equipment sub-type (optional).
- Returns:
Correlation key if found, None otherwise.
- Return type:
str | None
- default_material_for_key(key)[source]¶
Look up the cost basis’s default construction material for a key.
- Parameters:
key (
str) – Correlation key.- Returns:
The
default materialvalue for the row, or None if the key is not found, the column is absent, or the value is unset (e.g."n.a.").- Return type:
str | None
- class openpytea.equipment.Equipment(name, param, process_type, category, type=None, material=None, num_units=None, purchased_cost=None, cost_year=None, cost_func=None, target_year=2024, erection_factor=None, piping_factor=None, instrumentation_factor=None, electrical_factor=None, civil_factor=None, structural_factor=None, lagging_factor=None, material_factor=None)[source]¶
Bases:
objectEquipment cost estimation class for process equipment.
Manages cost calculation of process equipment based on process type, material, and equipment parameters. Supports both direct cost input and calculated costs from a cost correlation database.
- process_factors¶
Process type factors affecting cost calculation. Keys are process types (“Solids”, “Fluids”, “Mixed”, “Electrical”). Values are dicts with factors: fer, fp, fi, fel, fc, fs, fl.
- Type:
- material_factors¶
Material type multipliers mapping material names to cost factors (1.0 to 1.7).
- Type:
- Parameters:
name (
str) – Equipment identifier/name.param (
float | tuple[float,float] | list[float]) – Equipment parameter (size, capacity) for cost correlation lookup. Pass a 2-element tuple/list(s1, s2)for two-parameter correlation forms such as"2-var power-law".process_type (
str) – Type of process (“Solids”, “Fluids”, “Mixed”, or “Electrical”).category (
str) – Equipment category for database lookup.type (
str | None, optional) – Equipment sub-type for database lookup. Default is None.material (
str | None, optional) – Material of construction. Default is None, which uses the resolved cost correlation’sdefault materialcolumn, falling back to “Carbon steel” if there’s no correlation match or the value is unset (e.g. “n.a.”). Since the correlation’s cost already prices in whatever material it defaults to, a material that matches the resolved default (whether auto-filled or passed explicitly) always uses a material factor of 1.0, even if it’s recognized inmaterial_factors(e.g. “304 stainless steel”). Passing a different material instead usesmaterial_factors[material] / material_factors[default](the default’s own factor, or 1.0 if it has none) so the factor is relative to the correlation’s actual cost basis rather than double-counting it, and raises ValueError if the material isn’t found inmaterial_factors.num_units (
int | None, optional) – Number of identical units. Default is None (set to 1 when purchased_cost is provided).purchased_cost (
float | None, optional) – Direct purchased cost input. If provided, param is ignored. Default is None.cost_year (
int | None, optional) – Year of the purchased_cost quote for inflation adjustment. Default is None.cost_func (
str | None, optional) – Explicit cost correlation key from the database. Default is None (auto-resolved from category/type).target_year (
int, optional) – Target year for inflation adjustment. Default is 2024.erection_factor (
float | None, optional) – Erection factor override. Default is None (use process_type table).piping_factor (
float | None, optional) – Piping factor override. Default is None (use process_type table).instrumentation_factor (
float | None, optional) – Instrumentation & controls factor override. Default is None.electrical_factor (
float | None, optional) – Electrical factor override. Default is None (use process_type table).civil_factor (
float | None, optional) – Civil factor override. Default is None (use process_type table).structural_factor (
float | None, optional) – Structural steel factor override. Default is None (use process_type table).lagging_factor (
float | None, optional) – Lagging & painting factor override. Default is None (use process_type table).material_factor (
float | None, optional) – Material factor override. Default is None (1.0 ifmaterialmatches the resolved default material, else the ratio of the two materials’material_factorsvalues).
- Raises:
ValueError – If process_type or material is not found in the factor dictionaries.
KeyError – If the category/type combination is not found in the database and cost_func is not specified.
Examples
>>> eq = Equipment( ... name="Reactor", ... param=100, ... process_type="Fluids", ... category="Reactor", ... material="304 stainless steel" ... ) >>> print(eq.direct_cost)
- process_factors = {'Electrical': {'fc': 0.2, 'fel': 0.7, 'fer': 0.4, 'fi': 0.7, 'fl': 0.1, 'fp': 0.1, 'fs': 0.1}, 'Fluids': {'fc': 0.3, 'fel': 0.2, 'fer': 0.3, 'fi': 0.3, 'fl': 0.1, 'fp': 0.8, 'fs': 0.2}, 'Mixed': {'fc': 0.3, 'fel': 0.2, 'fer': 0.5, 'fi': 0.3, 'fl': 0.1, 'fp': 0.6, 'fs': 0.2}, 'Solids': {'fc': 0.2, 'fel': 0.15, 'fer': 0.6, 'fi': 0.2, 'fl': 0.05, 'fp': 0.2, 'fs': 0.1}}¶
- material_factors = {'304 stainless steel': 1.3, '316 stainless steel': 1.3, '321 stainless steel': 1.5, 'Aluminum': 1.07, 'Bronze': 1.07, 'Carbon steel': 1.0, 'Cast steel': 1.1, 'Hastelloy C': 1.55, 'Inconel': 1.7, 'Monel': 1.65, 'Nickel': 1.7, 'Stainless steel': 1.3}¶