Cost-benefit analysis#

Annual discounted cash-flow screening in one consistent currency/price basis.

Year zero is the initial investment; subsequent flows occur at year end. This is an unlevered, pre-tax calculation, not a tax, financing or electricity-bill model. Use a real discount rate with constant-price inputs, or nominal rates with nominal flows. Benefits and costs are separate nonnegative amounts, avoiding hidden credits.

class x2power.methods.cost_benefit.AnnualCashFlow(year, costs=0.0, benefits=0.0, delivered_electricity_kwh=0.0)[source]#

One year’s costs, benefits and electricity delivered outside plant loads.

All monetary amounts use the same currency. Electricity excludes plant imports and internal consumption. Include import purchases in costs. No cost allocation to heat or other co-products is implied by the electricity denominator.

Parameters:
  • year (int)

  • costs (float)

  • benefits (float)

  • delivered_electricity_kwh (float)

year: int#
costs: float = 0.0#
benefits: float = 0.0#
delivered_electricity_kwh: float = 0.0#
class x2power.methods.cost_benefit.CostBenefitResult(net_present_value, present_value_costs, present_value_benefits, discounted_delivered_electricity_kwh, benefit_cost_ratio, levelized_cost_per_kwh, simple_payback_years, discounted_payback_years, cash_flows)[source]#

Discounted metrics; undefined ratios and unreached paybacks are None.

LCOE is gross lifecycle cost divided by discounted delivered electricity, with no subtraction of gate fees, grants or other benefits. BCR includes all stated benefits and costs; describe the project perspective before interpreting it.

Parameters:
  • net_present_value (float)

  • present_value_costs (float)

  • present_value_benefits (float)

  • discounted_delivered_electricity_kwh (float)

  • benefit_cost_ratio (float | None)

  • levelized_cost_per_kwh (float | None)

  • simple_payback_years (float | None)

  • discounted_payback_years (float | None)

  • cash_flows (tuple[dict[str, float | int], ...])

net_present_value: float#
present_value_costs: float#
present_value_benefits: float#
discounted_delivered_electricity_kwh: float#
benefit_cost_ratio: float | None#
levelized_cost_per_kwh: float | None#
simple_payback_years: float | None#
discounted_payback_years: float | None#
cash_flows: tuple[dict[str, float | int], ...]#
to_dict()[source]#
Return type:

dict[str, Any]

x2power.methods.cost_benefit.net_present_value(cash_flows, discount_rate)[source]#

Discount signed, consecutive yearly net flows, starting at year zero.

Parameters:
  • cash_flows (Sequence[float])

  • discount_rate (float)

Return type:

float

x2power.methods.cost_benefit.payback_period(cash_flows, discount_rate=0.0)[source]#

First cumulative recovery, with linear within-year interpolation.

This interpolation is an approximation to the year-end ledger. A later cost can make the cumulative balance negative again; payback is not a viability test. Returns zero when no initial deficit exists, and None if recovery is not reached.

Parameters:
  • cash_flows (Sequence[float])

  • discount_rate (float)

Return type:

float | None

x2power.methods.cost_benefit.break_even_unit_value(present_value_costs, present_value_other_benefits, discounted_quantity)[source]#

Constant unit value making NPV zero; negative values are retained.

Quantity and other benefits must cover the same years and discount rate as costs. Returns None for zero quantity. This solves an arithmetic threshold, not evidence that a buyer or waste supplier will pay that value.

Parameters:
  • present_value_costs (float)

  • present_value_other_benefits (float)

  • discounted_quantity (float)

Return type:

float | None

x2power.methods.cost_benefit.value_electricity(delivered_kwh, imported_kwh, *, self_consumption_fraction, avoided_purchase_price_per_kwh, export_price_per_kwh, import_price_per_kwh)[source]#

Value separate delivered and imported energy without annual net metering.

The self-consumption fraction applies only to delivered positive energy after plant loads. Establish it from coincident external demand; it is an assumption when no interval demand exists. Demand charges, fixed bills and taxes are absent.

Parameters:
  • delivered_kwh (float)

  • imported_kwh (float)

  • self_consumption_fraction (float)

  • avoided_purchase_price_per_kwh (float)

  • export_price_per_kwh (float)

  • import_price_per_kwh (float)

Return type:

dict[str, float]

x2power.methods.cost_benefit.evaluate_cost_benefit(annual_flows, discount_rate)[source]#

Calculate NPV, BCR, gross LCOE and paybacks from an explicit yearly ledger.

Parameters:
Return type:

CostBenefitResult