carbatpy.utils.cost_calculation
Calculating costs for equipment
SI units input is only implemented for the Towler method and the limits are checked now for Towler! (BA 2025-08-14/15)
Created on Wed Jul 31 13:59:25 2024
@author: Mina Anton, Majid Zarif
Attributes
Classes
Functions
|
Return module-level CAP_methods singleton (lazy init). |
Module Contents
- class carbatpy.utils.cost_calculation.CAP_methods[source]
-
- Towler_Method(Comp_dict, verbose=False, Desired_year=None)[source]
Cost estimation according to Towler and Gavin (2012).
Calculates costs based on “Chemical engineering design: principles, practice and economics of plant and process design”.
The estimation follows the power-law relation:
\[C_e = a + b \cdot S^n\]- Parameters:
Comp_dict (dict) –
Dictionary containing variables for the cost estimate. Example:
{ "Category": "Compressor", "Component Name": "hydrogen compressor", "Component Attribute": 1000 }
CI (float) – Capital investment of the investigated component.
S (float) – Capacity of the investigated component.
n (float) – Cost exponent (typically \(n < 1\) to account for economies of scale).
a (float) – Constant base value for known device costs.
b (float) – Proportionality constant for device costs.
verbose (bool, optional) – If True, prints values and explanations. The default is False.
Desired_year (float, optional) – Target year for the cost index relative to the current year. If None, the current year index is used.
- Raises:
ValueError – If the component name is not found in the Towler method database.
- Returns:
The installed cost of the component, adjusted for inflation, operational pressure, and material of construction.
- Return type:
float
Notes
SI-unit input is implemented and limits are checked. (Updated: 2025-08-15)
- get_values_by_name(name_value, columns=None, df=None)[source]
Retrieve the values of specific columns for the row matching a given ‘name’ value.
- Parameters:
name_value (str) – The value to search for in the ‘name’ column.
columns (list of str, optional) – List of column names whose values should be returned. Defaults to [“S_lower”, “S_upper”] if not provided.
df (pandas.DataFrame, optional) – DataFrame in which to search. Defaults to self.Towler_df if not provided.
- Returns:
A dictionary mapping each requested column name to its value for the matching row, or None if no matching row is found.
- Return type:
dict or None
Notes
If multiple rows have the same ‘name’, only the first match is returned.
This method is flexible and can be used with any DataFrame and column list.
- check_value_within_limits(name_value, value, verbose, lower_col='S_lower', upper_col='S_upper', df=None, error=False)[source]
Check if a given value lies within predefined limits from a DataFrame entry.
- Parameters:
name_value (str) – The value to search for in the ‘name’ column of the DataFrame.
value (float) – The numeric value to be checked.
lower_col (str, optional) – Column name for the lower limit. Default is “S_lower”.
upper_col (str, optional) – Column name for the upper limit. Default is “S_upper”.
df (pandas.DataFrame, optional) – DataFrame to search in. Defaults to self.Towler_df.
error (bool, optional) – If True, raises a ValueError when the value is out of range. If False, issues a UserWarning instead.
- Returns:
True if the value is within limits or if no limits are defined. False if the value is out of range.
- Return type:
bool
Notes
If the limits are missing or NaN, the check passes automatically.
If multiple rows match name_value, only the first is used.
- carbatpy.utils.cost_calculation.get_cost_inst() CAP_methods[source]
Return module-level CAP_methods singleton (lazy init).