Skip to content

Fix TOU derivation to use MC-based seasonal rates directly #362

@sherryzuo

Description

@sherryzuo

What

The TOU derivation script (utils/pre/compute_tou.py) currently computes demand-weighted average MCs per season, then rescales them so the load-weighted mean equals a base_rate from a calibrated flat tariff (from runs 1 and 2). This discards the MC absolute level and anchors to a reference tariff, creating unnecessary upstream dependencies:

  • run-9 → needs run-1 to get nyseg_flat_calibrated.json as the base rate anchor
  • run-10 → needs run-2 to get nyseg_flat_supply_calibrated.json as the base rate anchor

Why

Since CAIRO's precalc recalibrates the absolute level anyway, rescaling to a reference tariff base rate is unnecessary. Eliminating this dependency lets TOU tariffs be generated entirely in all-pre, decouples runs 9 and 10 from runs 1 and 2, and makes the rate derivation more semantically correct (rates reflect actual MC; precalc calibrates revenue neutrality).

How

  1. utils/pre/compute_tou.py — Remove base_rate parameter from compute_seasonal_base_rates; return raw demand-weighted average MCs directly (no rescaling).
  2. utils/pre/derive_seasonal_tou.py — Remove tou_base_rate parameter from derive_seasonal_tou(); update the call to compute_seasonal_base_rates; remove --tou-base-rate CLI arg; keep --reference-tariff but use it only for fixedchargefirstmeter (not base rate); remove the tou_base_rate is None validation guard.
  3. rate_design/hp_rates/Justfile — Add create-tou-tariffs recipe that runs after create-flat-tariffs and update all-pre accordingly; simplify run-9 and run-10 to just call run-scenario.
  4. utils/Justfile — Update create-seasonal-tou recipe description to reflect the new role of --reference-tariff.
  5. tests/test_derive_seasonal_tou.py — Remove tou_base_rate=0.1 from derive_seasonal_tou() call.
  6. context/code/marginal_costs/compute_tou_from_marginal_costs.md — Update to reflect that rates are output directly from MC without rescaling.

Deliverables

  • PR merging the changes above
  • Runs 9 and 10 pass without relying on run-1/run-2 outputs
  • just check and just test pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions