flexops.costing.monthly_scale_factor

flexops.costing.monthly_scale_factor(time_index: DatetimeIndex, dt_hours: float) → float

Fraction of its starting calendar month that a horizon covers (<= 1).

Monthly-assessed charges — the demand charge and the tariff’s fixed (customer) charge — are billed per calendar month, so a horizon shorter than a month must only pay its share of them. This is that share, computed from the real length of the month the horizon starts in (February and 30-day months differ), and clamped to 1.0 so a full-month horizon pays the full charge and nothing is ever scaled up.

Parameters:
  • time_index – The horizon’s naive datetime index.

  • dt_hours – Timestep length in hours.

Returns:

The prorating factor in (0, 1].

Raises:

FlexDataError – If time_index is tz-aware.