flexops.costing.evaluate_cost

flexops.costing.evaluate_cost(aggregate_power_kw: ndarray, tariff: DataFrame, dt_hours: float, *, dr_config: DRConfig | None = None, time_index: DatetimeIndex | None = None, prorate: bool = True, prev_demand_dict: dict | None = None, decomposition_type: str | None = None) → float

Compute the TRUE (de-relaxed) electricity cost on a fixed realized load.

This is the user-facing bill: once the dispatch is fixed the pricing non-convexity is harmless, so it is an exact post-hoc EECO evaluation, not a relaxation. All eeco.* calls route through this module (the sole import point).

Parameters:
  • aggregate_power_kw – Realized aggregate power per timestep, kW.

  • tariff – An EECO rate_data DataFrame.

  • dt_hours – Timestep length in hours; passed to EECO once for kW→kWh.

  • dr_config – Ignored in v0 (DR is containers-only).

  • time_index – The load’s naive datetime index, aligning it to the tariff’s month/weekday/hour windows. Omit only for a calendar-independent (flat) tariff. EECO’s charge windows are calendar-dependent, so a bare array is insufficient to reproduce a real (e.g. July) bill.

  • prorate – Prorate monthly demand and fixed charges to the horizon length. Leave at the default so the reported bill matches the objective; pass False only to reproduce a full un-prorated monthly bill.

  • prev_demand_dict – Optional prior-demand carry for billing this horizon as one slice of a longer billing period; EECO then bills only the incremental demand above the carry. None (the default) bills the horizon standalone.

  • decomposition_type – EECO’s net-power decomposition, e.g. "absolute_value", which splits power into non-negative imports and exports so a tariff’s export charges apply. None (default) skips it, as before. EECO documents which types are linear.

Returns:

The horizon-total electricity cost in dollars.