flexops.costing.add_electricity_cost¶
- flexops.costing.add_electricity_cost(*, block: Block, electrical_power, time_index: DatetimeIndex, dt_hours: float, tariff: DataFrame, dr_config: DRConfig | None = None, prorate: bool = True, decomposition_type: str | None = None, consumption_estimate: dict[str, float] | None = None) OperatingCostHandles¶
Build EECO’s convex-relaxed in-objective electricity cost on
block.The single-utility electric builder.
add_operating_cost()is the facility-level umbrella that wraps this andadd_fuel_cost()onto one opex block; call this directly only when you want the electric leg alone.Hands EECO the kW magnitudes, tariff, and timestep; EECO owns the math (energy cost, demand-charge epigraphs, kWh conversion). The returned
total_operating_costis a RELAXED proxy for the objective, not the reported bill — useevaluate_cost()post-solve for that. DR is containers-only in v0:dr_configis accepted and stored but builds NO DR constraints.- Parameters:
block – The Pyomo block to build cost expressions on.
electrical_power – Time-indexed aggregate-load Var/Expression carrying no units — a bare kW magnitude — indexed
0..N-1to align withtime_indexorder.time_index – Naive
pd.DatetimeIndexaligning toelectrical_power.dt_hours – Timestep length in hours; passed to EECO once for kW→kWh.
tariff – An EECO rate_data DataFrame (electric utility).
dr_config – Optional DR container (v0: no constraints built).
prorate – Prorate monthly demand and fixed charges to the horizon length (see
monthly_scale_factor()).decomposition_type – EECO’s net-power decomposition, e.g.
"absolute_value", which splits power into non-negative imports and exports so a tariff’sexportcharges apply.None(default) skips it, as before. EECO documents which types are linear.consumption_estimate – See
add_operating_cost(); only the"electric"entry, if any, applies here.
- Returns:
The
OperatingCostHandlesfor the electric utility.- Raises:
FlexConfigError – If EECO produced a nonlinear demand term.
FlexDataError – If
time_indexis timezone-aware.