energy_methods.operations#
Daily operational loss accounting and explicitly conditional repair economics.
Pure Python, no data access or agent dependencies. Inputs must share an asset, currency, timezone and meter boundary. Event labels are associations, not causes.
- class energy_methods.operations.DailyEnergyRecord(day, expected_mwh, actual_mwh, price_per_mwh, event='none')[source]#
Bases:
objectOne local-calendar day; expected/actual are energy (MWh), never power.
A missing actual is None and excluded from both sides of the comparison. Exactly one event is allowed; reconcile overlapping events before ingestion. Prices are signed currency/MWh. Expected energy must represent the same meter boundary and daily window as actual, before the supplied event’s losses.
- Parameters:
day (str)
expected_mwh (float)
actual_mwh (float | None)
price_per_mwh (float)
event (Literal['none', 'equipment_fault', 'curtailment'])
- day: str#
- expected_mwh: float#
- actual_mwh: float | None#
- price_per_mwh: float#
- event: Literal['none', 'equipment_fault', 'curtailment'] = 'none'#
- class energy_methods.operations.OperationsLedger(observed_days, supplied_days, excluded_dates, missing_calendar_dates, coverage_fraction, expected_energy_coverage_fraction, expected_mwh, actual_mwh, deficit_mwh, surplus_mwh, signed_energy_gap_mwh, deficit_by_event_mwh, historical_deficit_value, signed_revenue_gap, fault_associated_value, conditional_recovery_mwh, conditional_gross_value, intervention_cost, conditional_net_value)[source]#
Bases:
objectComparable-day totals; signed values preserve negative energy prices.
- Parameters:
observed_days (int)
supplied_days (int)
excluded_dates (tuple[str, ...])
missing_calendar_dates (tuple[str, ...])
coverage_fraction (float)
expected_energy_coverage_fraction (float | None)
expected_mwh (float)
actual_mwh (float)
deficit_mwh (float)
surplus_mwh (float)
signed_energy_gap_mwh (float)
deficit_by_event_mwh (dict[str, float])
historical_deficit_value (float)
signed_revenue_gap (float)
fault_associated_value (float)
conditional_recovery_mwh (float)
conditional_gross_value (float)
intervention_cost (float)
conditional_net_value (float)
- observed_days: int#
- supplied_days: int#
- excluded_dates: tuple[str, ...]#
- missing_calendar_dates: tuple[str, ...]#
- coverage_fraction: float#
- expected_energy_coverage_fraction: float | None#
- expected_mwh: float#
- actual_mwh: float#
- deficit_mwh: float#
- surplus_mwh: float#
- signed_energy_gap_mwh: float#
- deficit_by_event_mwh: dict[str, float]#
- historical_deficit_value: float#
- signed_revenue_gap: float#
- fault_associated_value: float#
- conditional_recovery_mwh: float#
- conditional_gross_value: float#
- intervention_cost: float#
- conditional_net_value: float#
- energy_methods.operations.analyze_daily_operations(records, *, recovery_fraction, intervention_cost)[source]#
Account daily deficits without netting surplus or repairing curtailment.
Conditional gross value = sum(fault-associated deficit * daily price) * recovery_fraction. Net subtracts one intervention cost. This assumes recurrence over an equivalent period, at identical prices, with the stated recoverability. It is neither a forecast nor causal attribution, settlement or annual revenue.
Coverage includes missing calendar dates between the first and last supplied dates. Unknown dates outside that window cannot be detected. Energy coverage uses supplied expected energy only; omitted dates have unknown energy weight.
- Parameters:
records (tuple[DailyEnergyRecord, ...])
recovery_fraction (float)
intervention_cost (float)
- Return type: