Source code for energy_methods.tandem_pv_screen

"""Area-constrained PV energy and discounted-cash sensitivity screening.

A first-order effective-irradiation/efficiency balance inspired by PVWatts,
not a PVWatts implementation or a bankable perovskite production forecast.
Real-world weather, thermal effects, spectral response and AC clipping must
be modelled separately for site-specific assessments.
"""

from __future__ import annotations

import math
from dataclasses import dataclass


[docs] @dataclass(frozen=True) class PVAreaScreen: """Scenario output for a fixed *module* area, using real 2026 USD. ``annual_ac_kwh`` contains annual net energy in project years 1..N. ``pv_operating_usd`` excludes initial installation capital expenditure. """ annual_ac_kwh: tuple[float, ...] pv_energy_kwh: float pv_operating_usd: float first_year_ac_kwh: float
[docs] @dataclass(frozen=True) class TandemPremiumScreen: """Incremental tandem-over-silicon value on the same module area.""" first_year_energy_gain_fraction: float incremental_pv_energy_kwh: float break_even_incremental_capex_usd_per_m2: float incremental_npv_usd: float
[docs] def screen_fixed_area_pv( *, module_area_m2: float, stc_module_efficiency: float, annual_effective_poa_kwh_per_m2: float, ac_delivery_factor: float, annual_degradation_fraction: float, operating_years: int, power_price_usd_per_kwh: float, real_discount_rate: float, annual_opex_usd_per_m2: float = 0.0, ) -> PVAreaScreen: """Project annual delivered energy and discounted operating margin. Energy[year] = module area * annual effective POA * STC efficiency * common AC delivery factor * (1 - degradation) ** (year - 1). End-of-year real USD receipts and O&M are discounted at ``(1+r)**year``. The annual input is effective plane-of-array irradiation, *not* global horizontal irradiance. The shared delivery factor is an illustrative lumped conversion/availability loss, not a measured performance ratio. """ inputs = ( module_area_m2, stc_module_efficiency, annual_effective_poa_kwh_per_m2, ac_delivery_factor, annual_degradation_fraction, power_price_usd_per_kwh, real_discount_rate, annual_opex_usd_per_m2, ) if not all(math.isfinite(value) for value in inputs): raise ValueError("All PV screening inputs must be finite") if ( module_area_m2 <= 0 or not 0 < stc_module_efficiency <= 1 or annual_effective_poa_kwh_per_m2 <= 0 or not 0 < ac_delivery_factor <= 1 or not 0 <= annual_degradation_fraction < 1 or power_price_usd_per_kwh < 0 or real_discount_rate < 0 or annual_opex_usd_per_m2 < 0 or type(operating_years) is not int or operating_years < 1 ): raise ValueError("Invalid area, efficiency, irradiation, years, losses or economics") first_year_kwh = ( module_area_m2 * stc_module_efficiency * annual_effective_poa_kwh_per_m2 * ac_delivery_factor ) annual_kwh = tuple( first_year_kwh * (1 - annual_degradation_fraction) ** year for year in range(operating_years) ) discounted_energy = sum( energy / (1 + real_discount_rate) ** (year + 1) for year, energy in enumerate(annual_kwh) ) annual_opex_usd = module_area_m2 * annual_opex_usd_per_m2 pv_operating = sum( (energy * power_price_usd_per_kwh - annual_opex_usd) / (1 + real_discount_rate) ** (year + 1) for year, energy in enumerate(annual_kwh) ) return PVAreaScreen( annual_ac_kwh=annual_kwh, pv_energy_kwh=discounted_energy, pv_operating_usd=pv_operating, first_year_ac_kwh=first_year_kwh, )
[docs] def compare_module_options( silicon: PVAreaScreen, tandem: PVAreaScreen, *, module_area_m2: float, assumed_incremental_capex_usd_per_m2: float = 0.0, ) -> TandemPremiumScreen: """Return tandem's energy gain and *ceiling* on an incremental upfront premium. Comparison assumes both module options cover identical module area and sell output at the same real tariff. Both screens must share the same project years, irradiance, discount rate and valuation basis; the caller is responsible for ensuring this comparability. """ if ( not all(math.isfinite(x) for x in (module_area_m2, assumed_incremental_capex_usd_per_m2)) or module_area_m2 <= 0 or assumed_incremental_capex_usd_per_m2 < 0 ): raise ValueError("Area must be positive and incremental cost nonnegative") if len(silicon.annual_ac_kwh) != len(tandem.annual_ac_kwh): raise ValueError("Both module options require the same operating horizon") incremental_pv_usd = tandem.pv_operating_usd - silicon.pv_operating_usd return TandemPremiumScreen( first_year_energy_gain_fraction=(tandem.first_year_ac_kwh / silicon.first_year_ac_kwh - 1), incremental_pv_energy_kwh=tandem.pv_energy_kwh - silicon.pv_energy_kwh, break_even_incremental_capex_usd_per_m2=incremental_pv_usd / module_area_m2, incremental_npv_usd=( incremental_pv_usd - assumed_incremental_capex_usd_per_m2 * module_area_m2 ), )