openpytea.plant¶
- class openpytea.plant.Plant(configuration)[source]¶
Bases:
objectPlant class for techno-economic analysis of industrial processing plants. This class models capital costs, operating expenses, revenue, and financial metrics for chemical/process plants. It supports multiple process types (Solids, Fluids, Mixed), geographic locations with regional cost factors, and comprehensive cash flow analysis. Attributes:
- processTypes (dict): Cost multipliers for different process categories
(OS, DE, X).
- locFactors (dict): Geographic location factors for capital cost
adjustments.
- Configuration Parameters:
name (str): Plant name identifier. process_type (str): Type of process
(“Solids”, “Fluids”, or “Mixed”).
- country (str): Country location for cost factor lookup.
Default: “United States”.
region (str): Regional area within country. Default: “Gulf Coast”. currency (str): Currency code (e.g., “USD”). Default: “USD”. exchange_rate (float): Conversion factor to base currency.
Default: 1.0.
- interest_rate (float): Discount rate for NPV calculations.
Default: 0.09.
- project_lifetime (int or array): Plant operating life in years.
Default: 20.
- plant_utilization (float): Capacity utilization factor (0-1).
Default: 1.
tax_rate (float): Corporate tax rate for cash flow. Default: 0. working_capital (float or None): Working capital requirement.
Auto-calculated if None.
depreciation (dict or None): Depreciation method configuration.
- Cash Flow Profiles:
- capex_ramp (list or None): Fraction of fixed capital spent in each
construction year. Must be a 1-D list of non-negative numbers that sum to 1.0. Length must be less than project_lifetime. Working capital is drawn in the final construction year and released at the end of the project. Default: [0.3, 0.6, 0.1] (3-year build).
- production_ramp (list or None): Nameplate capacity utilisation
fraction for each project year (0–1). Values must be between 0 and 1. If shorter than project_lifetime the remaining years are set to 1.0 (full capacity). Length must not exceed project_lifetime. Default: [0, 0, 0.4, 0.8] (full capacity from year 4 on).
- Capital Cost Factors:
- loc_factor (float or None): Location factor applied to ISBL.
Overrides country/region lookup when set. Default: None.
- fixed_capital_factors (dict): Override the multipliers used to
calculate individual fixed capital components. Any subset of keys may be supplied; omitted keys fall back to processTypes defaults. Keys and defaults (process-type dependent):
“osbl” – fraction of ISBL (e.g. 0.3 for Fluids) “de” – fraction of ISBL+OSBL (e.g. 0.3 for Fluids) “contingency” – fraction of ISBL+OSBL (e.g. 0.1 for all types)
- fixed_capital_components (dict): Override the computed cost value
of individual fixed capital components directly. Takes precedence over fixed_capital_factors for the same component. Keys match attribute names:
“osbl”, “dne”, “contingency”
- Labor & Operations:
operators_per_shift (int or None): Manual input or auto-calculated. operators_hired (int or None): Total operators needed;
auto-calculated if None.
operator_hourly_rate (dict or float): Wage rate for operators. working_weeks_per_year (int): Annual working weeks. Default: 49. working_shifts_per_week (int): Shifts per week. Default: 5. operating_shifts_per_day (int): Daily operating shifts. Default: 3.
- Equipment & Economics:
equipment_list (list): Equipment objects with cost data. variable_opex_inputs (dict): Variable operating cost inputs
(consumption, price).
- plant_products (dict): Product specifications
(production rate, price).
fc (float): Fixed capital cost multiplier for installed costs. fp (float): Fixed OPEX cost multiplier.
- Fixed OPEX Customisation:
- fixed_opex_factors (dict): Override the multipliers used to
calculate individual fixed OPEX components. Any subset of keys may be supplied; omitted keys fall back to defaults. Keys and defaults:
“supervision” – 0.25 × operating_labor_costs “direct_salary_overhead”– 0.50 × (labor + supervision) “laboratory_charges” – 0.10 × operating_labor_costs “maintenance” – 0.05 × ISBL “taxes_insurance” – 0.015 × ISBL “rent_of_land” – 0.015 × (ISBL + OSBL) “environmental_charges” – 0.01 × (ISBL + OSBL) “operating_supplies” – 0.009 × ISBL “general_plant_overhead”– 0.65 × (labor + supervision
direct_salary_overhead)
“working_capital” – 0.15 × fixed_capital “patents_royalties” – 0.02 × cash cost of production “distribution_selling” – 0.02 × cash cost of production “rnd” – 0.03 × cash cost of production
- fixed_opex_components (dict): Override the computed cost value of
individual fixed OPEX components directly. Takes precedence over fixed_opex_factors for the same component. Downstream components that depend on an overridden value use the overridden value in their own calculation. Keys match attribute names:
“supervision_costs”, “direct_salary_overhead”, “laboratory_charges”, “maintenance_costs”, “taxes_insurance_costs”, “rent_of_land_costs”, “environmental_charges”, “operating_supplies”, “general_plant_overhead”, “patents_royalties”, “distribution_selling_costs”, “RnD_costs”
- Additional Capex:
additional_capex_years (array): Years when additional capex occurs. additional_capex_cost (array): Corresponding capex amounts.
- Monte Carlo:
- project_uncertainties (dict): Per-parameter uncertainty settings
for Monte Carlo simulation. Each key maps to a sub-dict with optional fields
std,min, andmax. Omitting a key uses the built-in default distribution. Settingstd=0disables sampling for that parameter (default for plant_utilization and tax_rate). Supported keys:“fixed_capital_factor” – std=0.3, min=0.25, max=1.75 “fixed_opex_factor” – std=0.3, min=0.25, max=1.75 “project_lifetime” – std=5, min/max auto (±2σ, ≥5) “interest_rate” – std=0.03, min/max auto (±2σ, ≥0.02) “plant_utilization” – std=0 (fixed unless overridden) “tax_rate” – std=0 (fixed unless overridden)
- monte_carlo_inputs (dict or None): Stochastic input distributions
populated after running monte_carlo().
- monte_carlo_metrics (dict or None): Distribution results populated
after running monte_carlo().
- Example:
>>> config = { ... "plant_name": "Example Plant", ... "process_type": "Fluids", ... "country": "United States", ... "region": "Gulf Coast", ... "equipment": [equipment_obj], ... "plant_products": {"product_A": {"production": 100, "price": 50}}, ... } >>> plant = Plant(config) >>> plant.calculate_all(print_results=True) >>> npv = plant.calculate_npv()
- Parameters:
configuration (dict)
- processTypes = {'Fluids': {'DE': 0.3, 'OS': 0.3, 'X': 0.1}, 'Mixed': {'DE': 0.25, 'OS': 0.4, 'X': 0.1}, 'Solids': {'DE': 0.2, 'OS': 0.4, 'X': 0.1}}¶
- locFactors = {'Australia': 1.21, 'Brazil': 1.14, 'Canada': {'Fort McMurray': 1.6, 'Ontario': 1.0}, 'China': {'imported': 1.12, 'indigenous': 0.61}, 'France': 1.13, 'Germany': 1.11, 'India': 1.02, 'Italy': 1.14, 'Japan': 1.26, 'Mexico': 1.03, 'Middle East': 1.07, 'Netherlands': 1.19, 'Russia': 1.53, 'Southeast Asia': 1.12, 'United Kingdom': 1.02, 'United States': {'East Coast': 1.04, 'Gulf Coast': 1.0, 'Midwest': 1.02, 'West Coast': 1.07}}¶
- update_configuration(configuration)[source]¶
Update plant parameters while preserving nested structures.
Top-level scalar keys overwrite existing values. Nested dicts (
variable_opex_inputs,plant_products,operator_hourly_rate,project_uncertainties,fixed_opex_factors,fixed_capital_factors) are deep-merged rather than replaced.- Parameters:
configuration (
dict) – Partial or full plant configuration. Only supplied keys are updated.
- calculate_purchased_cost(print_results=False)[source]¶
Sum equipment purchased costs with exchange rate conversion.
- calculate_isbl(fc=1.0, print_results=False)[source]¶
Calculate Inside Battery Limits (ISBL) cost.
Sums direct equipment costs and applies the location factor and the installed cost multiplier
fc.- Parameters:
- Returns:
ISBL cost in plant currency.
- Return type:
- Raises:
ValueError – If the plant’s country or region is not found in
locFactorsand no explicitloc_factoris set.
- calculate_fixed_capital(fc=None, additional_capex=False, print_results=False)[source]¶
Calculate total fixed capital investment.
Includes ISBL, OSBL, design & engineering, and contingency. Factors can be overridden via
fixed_capital_factors/fixed_capital_componentsset on the plant.- Parameters:
- Returns:
Total fixed capital cost in plant currency.
- Return type:
- Raises:
ValueError – If
process_typeis not one of the supported process types.
- calculate_variable_opex(print_results=False)[source]¶
Calculate annual variable operating costs.
Iterates over
variable_opex_inputsand computes cost as consumption × price × 365 × plant_utilization for each item.
- calculate_revenue(print_results=False)[source]¶
Calculate annual revenue from plant products.
Iterates over
plant_productsand computes revenue as production × price × 365 × plant_utilization for each product.
- count_process_steps(equipments, target_process_types, excluded_cats=None)[source]¶
Count equipment units matching a set of process types.
- Parameters:
- Returns:
Number of matching equipment units.
- Return type:
- calculate_operators_per_shift(no_fluid_process=None, no_solid_process=None)[source]¶
Calculate the number of operators required per shift.
Uses the empirical correlation from Turton et al. based on fluid and solid process step counts. Returns
operators_per_shiftdirectly if it was set manually on the plant.- Parameters:
- Returns:
Estimated operators per shift.
- Return type:
- Raises:
ValueError – If
no_solid_processexceeds 2.
- calculate_operators_hired(no_fluid_process=None, no_solid_process=None)[source]¶
Calculate the total number of operators to hire.
Accounts for the ratio of operating shifts per year to working shifts per year. Returns
operators_hireddirectly if set manually.- Parameters:
- Returns:
Total operators to hire.
- Return type:
- calculate_operating_labor(no_fluid_process=None, no_solid_process=None)[source]¶
Calculate total annual operating labor costs.
- calculate_fixed_opex(fp=None, print_results=False)[source]¶
Calculate fixed operating expenses (OPEX).
Computes supervision, salary overhead, laboratory charges, maintenance, taxes & insurance, rent, environmental charges, operating supplies, general plant overhead, working capital interest, patents & royalties, distribution & selling, and R&D costs. Factors and individual component values can be overridden via
fixed_opex_factorsandfixed_opex_componentsset on the plant.
- calculate_cash_flow(print_results=False)[source]¶
Build a year-by-year cash flow table.
Applies the CAPEX ramp, production ramp, depreciation schedule, and tax lag to produce annual capital cost, revenue, cash cost, gross profit, depreciation, taxable income, tax paid, and net cash flow arrays. Supports vectorised (Monte Carlo) inputs when
project_lifetime,interest_rate, etc. are arrays.- Parameters:
print_results (
bool, optional) – Return a formattedpd.DataFrame.stylefor scalar scenarios. Default is False.- Returns:
Styled cash flow table when
print_results=Trueand inputs are scalar; None otherwise (results stored as instance arrays).- Return type:
pd.DataFrame.styleorNone- Raises:
ValueError – If
project_lifetime < 3,capex_ramporproduction_rampare invalid, or no plant products are defined.
- calculate_npv(print_results=False)[source]¶
Calculate Net Present Value (NPV) of the project cash flows.
Discounts each year’s cash flow at
interest_rateand returns the cumulative NPV at the end of the project lifetime. Supports vectorised inputs for Monte Carlo scenarios.- Parameters:
print_results (
bool, optional) – Print a year-by-year present value and cumulative NPV table. Default is False.- Returns:
Final NPV (scalar) or array of NPVs across scenarios.
- Return type:
floatornp.ndarray- Raises:
ValueError – If
interest_rateis an array whose length does not match the number of cash flow scenarios.
- calculate_levelized_cost(print_results=False)[source]¶
Calculate the levelized cost of production (LCOP).
Discounts capital costs, operating costs, and production over the project lifetime at
interest_rate. Side-product revenues are subtracted before dividing by discounted production.
- calculate_payback_time(additional_capex=False, print_results=False)[source]¶
Calculate simple payback time.
Divides total fixed capital (optionally including additional CAPEX) by the mean annual cash flow across revenue-generating years.
- calculate_roi(additional_capex=False, print_results=False)[source]¶
Calculate Return on Investment (ROI).
Computes total net profit over the project lifetime as a percentage of total investment (fixed capital + working capital, optionally including additional CAPEX), annualised by project lifetime.
- calculate_irr(print_results=False)[source]¶
Calculate the Internal Rate of Return (IRR).
Finds the discount rate at which NPV equals zero using Brent’s method. Returns
nanif no sign change is found (no valid IRR exists).
- calculate_all(additional_capex=False, print_results=False)[source]¶
Run all financial calculations sequentially.
Calls
calculate_fixed_capital,calculate_variable_opex,calculate_fixed_opex,calculate_revenue,calculate_cash_flow,calculate_npv,calculate_levelized_cost,calculate_payback_time,calculate_roi, andcalculate_irr.
- class openpytea.plant.DepreciationConfig[source]¶
Bases:
objectConfiguration for asset depreciation calculations.
This class defines the parameters needed to compute depreciation using various methods.
- Attributes:
method (DepMethod): The depreciation method to use. Defaults to “straight_line”. Options: “straight_line”, “declining_balance”, “macrs”. life (Optional[int]): The useful life of the asset in years.
Used by straight_line and declining_balance methods. Defaults to None.
- db_factor (float): The declining balance factor (multiplier).
Only used by the declining_balance method. Defaults to 2.0.
- salvage_fraction (float): The salvage value as a fraction
of the initial cost. Used by straight_line and declining_balance methods. Defaults to 0.0.
- macrs_class (int): The MACRS property class (1-20).
Only used by the macrs method. Defaults to 7.
- convention (str): The depreciation convention for MACRS.
Only used by the macrs method. Defaults to “half_year”.
- service_start_year (int): The year index (starting from 0)
when the asset is placed in service. Defaults to 2.
- openpytea.plant.build_depreciation_array(project_life, capex_by_year, dep_cfg=None)[source]¶
Build a depreciation schedule array over the project lifecycle. Calculates annual depreciation amounts for capital expenditures using the specified depreciation method. Supports multiple depreciation methods including straight-line, declining balance, and MACRS. :param project_life: The total duration of the project in years. :type project_life:
int:param capex_by_year: Dictionary mapping year to capital expenditure amount for that year. :type capex_by_year:Dict[int,float]:param dep_cfg: Depreciation configuration dictionary containing method, life,salvage fraction, and method-specific parameters. If None, uses normalized default configuration. Default is None.
- Returns:
1D array of shape (project_life,) containing annual depreciation amounts. Values are floats representing depreciation in each year.
- Return type:
np.ndarray- Raises:
ValueError – If the depreciation method specified in dep_cfg is not one of the supported methods: ‘straight_line’, ‘declining_balance’, or ‘macrs’.
- Parameters:
Notes
- Capital expenditures are placed in service starting at the configured
service start year.
- Depreciation schedules respect the project horizon after placement
in service.
Zero amounts and expired horizons are skipped without error.
Classes
- class openpytea.plant.Plant(configuration)[source]¶
Bases:
objectPlant class for techno-economic analysis of industrial processing plants. This class models capital costs, operating expenses, revenue, and financial metrics for chemical/process plants. It supports multiple process types (Solids, Fluids, Mixed), geographic locations with regional cost factors, and comprehensive cash flow analysis. Attributes:
- processTypes (dict): Cost multipliers for different process categories
(OS, DE, X).
- locFactors (dict): Geographic location factors for capital cost
adjustments.
- Configuration Parameters:
name (str): Plant name identifier. process_type (str): Type of process
(“Solids”, “Fluids”, or “Mixed”).
- country (str): Country location for cost factor lookup.
Default: “United States”.
region (str): Regional area within country. Default: “Gulf Coast”. currency (str): Currency code (e.g., “USD”). Default: “USD”. exchange_rate (float): Conversion factor to base currency.
Default: 1.0.
- interest_rate (float): Discount rate for NPV calculations.
Default: 0.09.
- project_lifetime (int or array): Plant operating life in years.
Default: 20.
- plant_utilization (float): Capacity utilization factor (0-1).
Default: 1.
tax_rate (float): Corporate tax rate for cash flow. Default: 0. working_capital (float or None): Working capital requirement.
Auto-calculated if None.
depreciation (dict or None): Depreciation method configuration.
- Cash Flow Profiles:
- capex_ramp (list or None): Fraction of fixed capital spent in each
construction year. Must be a 1-D list of non-negative numbers that sum to 1.0. Length must be less than project_lifetime. Working capital is drawn in the final construction year and released at the end of the project. Default: [0.3, 0.6, 0.1] (3-year build).
- production_ramp (list or None): Nameplate capacity utilisation
fraction for each project year (0–1). Values must be between 0 and 1. If shorter than project_lifetime the remaining years are set to 1.0 (full capacity). Length must not exceed project_lifetime. Default: [0, 0, 0.4, 0.8] (full capacity from year 4 on).
- Capital Cost Factors:
- loc_factor (float or None): Location factor applied to ISBL.
Overrides country/region lookup when set. Default: None.
- fixed_capital_factors (dict): Override the multipliers used to
calculate individual fixed capital components. Any subset of keys may be supplied; omitted keys fall back to processTypes defaults. Keys and defaults (process-type dependent):
“osbl” – fraction of ISBL (e.g. 0.3 for Fluids) “de” – fraction of ISBL+OSBL (e.g. 0.3 for Fluids) “contingency” – fraction of ISBL+OSBL (e.g. 0.1 for all types)
- fixed_capital_components (dict): Override the computed cost value
of individual fixed capital components directly. Takes precedence over fixed_capital_factors for the same component. Keys match attribute names:
“osbl”, “dne”, “contingency”
- Labor & Operations:
operators_per_shift (int or None): Manual input or auto-calculated. operators_hired (int or None): Total operators needed;
auto-calculated if None.
operator_hourly_rate (dict or float): Wage rate for operators. working_weeks_per_year (int): Annual working weeks. Default: 49. working_shifts_per_week (int): Shifts per week. Default: 5. operating_shifts_per_day (int): Daily operating shifts. Default: 3.
- Equipment & Economics:
equipment_list (list): Equipment objects with cost data. variable_opex_inputs (dict): Variable operating cost inputs
(consumption, price).
- plant_products (dict): Product specifications
(production rate, price).
fc (float): Fixed capital cost multiplier for installed costs. fp (float): Fixed OPEX cost multiplier.
- Fixed OPEX Customisation:
- fixed_opex_factors (dict): Override the multipliers used to
calculate individual fixed OPEX components. Any subset of keys may be supplied; omitted keys fall back to defaults. Keys and defaults:
“supervision” – 0.25 × operating_labor_costs “direct_salary_overhead”– 0.50 × (labor + supervision) “laboratory_charges” – 0.10 × operating_labor_costs “maintenance” – 0.05 × ISBL “taxes_insurance” – 0.015 × ISBL “rent_of_land” – 0.015 × (ISBL + OSBL) “environmental_charges” – 0.01 × (ISBL + OSBL) “operating_supplies” – 0.009 × ISBL “general_plant_overhead”– 0.65 × (labor + supervision
direct_salary_overhead)
“working_capital” – 0.15 × fixed_capital “patents_royalties” – 0.02 × cash cost of production “distribution_selling” – 0.02 × cash cost of production “rnd” – 0.03 × cash cost of production
- fixed_opex_components (dict): Override the computed cost value of
individual fixed OPEX components directly. Takes precedence over fixed_opex_factors for the same component. Downstream components that depend on an overridden value use the overridden value in their own calculation. Keys match attribute names:
“supervision_costs”, “direct_salary_overhead”, “laboratory_charges”, “maintenance_costs”, “taxes_insurance_costs”, “rent_of_land_costs”, “environmental_charges”, “operating_supplies”, “general_plant_overhead”, “patents_royalties”, “distribution_selling_costs”, “RnD_costs”
- Additional Capex:
additional_capex_years (array): Years when additional capex occurs. additional_capex_cost (array): Corresponding capex amounts.
- Monte Carlo:
- project_uncertainties (dict): Per-parameter uncertainty settings
for Monte Carlo simulation. Each key maps to a sub-dict with optional fields
std,min, andmax. Omitting a key uses the built-in default distribution. Settingstd=0disables sampling for that parameter (default for plant_utilization and tax_rate). Supported keys:“fixed_capital_factor” – std=0.3, min=0.25, max=1.75 “fixed_opex_factor” – std=0.3, min=0.25, max=1.75 “project_lifetime” – std=5, min/max auto (±2σ, ≥5) “interest_rate” – std=0.03, min/max auto (±2σ, ≥0.02) “plant_utilization” – std=0 (fixed unless overridden) “tax_rate” – std=0 (fixed unless overridden)
- monte_carlo_inputs (dict or None): Stochastic input distributions
populated after running monte_carlo().
- monte_carlo_metrics (dict or None): Distribution results populated
after running monte_carlo().
- Example:
>>> config = { ... "plant_name": "Example Plant", ... "process_type": "Fluids", ... "country": "United States", ... "region": "Gulf Coast", ... "equipment": [equipment_obj], ... "plant_products": {"product_A": {"production": 100, "price": 50}}, ... } >>> plant = Plant(config) >>> plant.calculate_all(print_results=True) >>> npv = plant.calculate_npv()
- Parameters:
configuration (dict)
- processTypes = {'Fluids': {'DE': 0.3, 'OS': 0.3, 'X': 0.1}, 'Mixed': {'DE': 0.25, 'OS': 0.4, 'X': 0.1}, 'Solids': {'DE': 0.2, 'OS': 0.4, 'X': 0.1}}¶
- locFactors = {'Australia': 1.21, 'Brazil': 1.14, 'Canada': {'Fort McMurray': 1.6, 'Ontario': 1.0}, 'China': {'imported': 1.12, 'indigenous': 0.61}, 'France': 1.13, 'Germany': 1.11, 'India': 1.02, 'Italy': 1.14, 'Japan': 1.26, 'Mexico': 1.03, 'Middle East': 1.07, 'Netherlands': 1.19, 'Russia': 1.53, 'Southeast Asia': 1.12, 'United Kingdom': 1.02, 'United States': {'East Coast': 1.04, 'Gulf Coast': 1.0, 'Midwest': 1.02, 'West Coast': 1.07}}¶
- update_configuration(configuration)[source]¶
Update plant parameters while preserving nested structures.
Top-level scalar keys overwrite existing values. Nested dicts (
variable_opex_inputs,plant_products,operator_hourly_rate,project_uncertainties,fixed_opex_factors,fixed_capital_factors) are deep-merged rather than replaced.- Parameters:
configuration (
dict) – Partial or full plant configuration. Only supplied keys are updated.
- calculate_purchased_cost(print_results=False)[source]¶
Sum equipment purchased costs with exchange rate conversion.
- calculate_isbl(fc=1.0, print_results=False)[source]¶
Calculate Inside Battery Limits (ISBL) cost.
Sums direct equipment costs and applies the location factor and the installed cost multiplier
fc.- Parameters:
- Returns:
ISBL cost in plant currency.
- Return type:
- Raises:
ValueError – If the plant’s country or region is not found in
locFactorsand no explicitloc_factoris set.
- calculate_fixed_capital(fc=None, additional_capex=False, print_results=False)[source]¶
Calculate total fixed capital investment.
Includes ISBL, OSBL, design & engineering, and contingency. Factors can be overridden via
fixed_capital_factors/fixed_capital_componentsset on the plant.- Parameters:
- Returns:
Total fixed capital cost in plant currency.
- Return type:
- Raises:
ValueError – If
process_typeis not one of the supported process types.
- calculate_variable_opex(print_results=False)[source]¶
Calculate annual variable operating costs.
Iterates over
variable_opex_inputsand computes cost as consumption × price × 365 × plant_utilization for each item.
- calculate_revenue(print_results=False)[source]¶
Calculate annual revenue from plant products.
Iterates over
plant_productsand computes revenue as production × price × 365 × plant_utilization for each product.
- count_process_steps(equipments, target_process_types, excluded_cats=None)[source]¶
Count equipment units matching a set of process types.
- Parameters:
- Returns:
Number of matching equipment units.
- Return type:
- calculate_operators_per_shift(no_fluid_process=None, no_solid_process=None)[source]¶
Calculate the number of operators required per shift.
Uses the empirical correlation from Turton et al. based on fluid and solid process step counts. Returns
operators_per_shiftdirectly if it was set manually on the plant.- Parameters:
- Returns:
Estimated operators per shift.
- Return type:
- Raises:
ValueError – If
no_solid_processexceeds 2.
- calculate_operators_hired(no_fluid_process=None, no_solid_process=None)[source]¶
Calculate the total number of operators to hire.
Accounts for the ratio of operating shifts per year to working shifts per year. Returns
operators_hireddirectly if set manually.- Parameters:
- Returns:
Total operators to hire.
- Return type:
- calculate_operating_labor(no_fluid_process=None, no_solid_process=None)[source]¶
Calculate total annual operating labor costs.
- calculate_fixed_opex(fp=None, print_results=False)[source]¶
Calculate fixed operating expenses (OPEX).
Computes supervision, salary overhead, laboratory charges, maintenance, taxes & insurance, rent, environmental charges, operating supplies, general plant overhead, working capital interest, patents & royalties, distribution & selling, and R&D costs. Factors and individual component values can be overridden via
fixed_opex_factorsandfixed_opex_componentsset on the plant.
- calculate_cash_flow(print_results=False)[source]¶
Build a year-by-year cash flow table.
Applies the CAPEX ramp, production ramp, depreciation schedule, and tax lag to produce annual capital cost, revenue, cash cost, gross profit, depreciation, taxable income, tax paid, and net cash flow arrays. Supports vectorised (Monte Carlo) inputs when
project_lifetime,interest_rate, etc. are arrays.- Parameters:
print_results (
bool, optional) – Return a formattedpd.DataFrame.stylefor scalar scenarios. Default is False.- Returns:
Styled cash flow table when
print_results=Trueand inputs are scalar; None otherwise (results stored as instance arrays).- Return type:
pd.DataFrame.styleorNone- Raises:
ValueError – If
project_lifetime < 3,capex_ramporproduction_rampare invalid, or no plant products are defined.
- calculate_npv(print_results=False)[source]¶
Calculate Net Present Value (NPV) of the project cash flows.
Discounts each year’s cash flow at
interest_rateand returns the cumulative NPV at the end of the project lifetime. Supports vectorised inputs for Monte Carlo scenarios.- Parameters:
print_results (
bool, optional) – Print a year-by-year present value and cumulative NPV table. Default is False.- Returns:
Final NPV (scalar) or array of NPVs across scenarios.
- Return type:
floatornp.ndarray- Raises:
ValueError – If
interest_rateis an array whose length does not match the number of cash flow scenarios.
- calculate_levelized_cost(print_results=False)[source]¶
Calculate the levelized cost of production (LCOP).
Discounts capital costs, operating costs, and production over the project lifetime at
interest_rate. Side-product revenues are subtracted before dividing by discounted production.
- calculate_payback_time(additional_capex=False, print_results=False)[source]¶
Calculate simple payback time.
Divides total fixed capital (optionally including additional CAPEX) by the mean annual cash flow across revenue-generating years.
- calculate_roi(additional_capex=False, print_results=False)[source]¶
Calculate Return on Investment (ROI).
Computes total net profit over the project lifetime as a percentage of total investment (fixed capital + working capital, optionally including additional CAPEX), annualised by project lifetime.
- calculate_irr(print_results=False)[source]¶
Calculate the Internal Rate of Return (IRR).
Finds the discount rate at which NPV equals zero using Brent’s method. Returns
nanif no sign change is found (no valid IRR exists).
- calculate_all(additional_capex=False, print_results=False)[source]¶
Run all financial calculations sequentially.
Calls
calculate_fixed_capital,calculate_variable_opex,calculate_fixed_opex,calculate_revenue,calculate_cash_flow,calculate_npv,calculate_levelized_cost,calculate_payback_time,calculate_roi, andcalculate_irr.
- class openpytea.plant.DepreciationConfig[source]¶
Bases:
objectConfiguration for asset depreciation calculations.
This class defines the parameters needed to compute depreciation using various methods.
- Attributes:
method (DepMethod): The depreciation method to use. Defaults to “straight_line”. Options: “straight_line”, “declining_balance”, “macrs”. life (Optional[int]): The useful life of the asset in years.
Used by straight_line and declining_balance methods. Defaults to None.
- db_factor (float): The declining balance factor (multiplier).
Only used by the declining_balance method. Defaults to 2.0.
- salvage_fraction (float): The salvage value as a fraction
of the initial cost. Used by straight_line and declining_balance methods. Defaults to 0.0.
- macrs_class (int): The MACRS property class (1-20).
Only used by the macrs method. Defaults to 7.
- convention (str): The depreciation convention for MACRS.
Only used by the macrs method. Defaults to “half_year”.
- service_start_year (int): The year index (starting from 0)
when the asset is placed in service. Defaults to 2.