Skip to content

feat(demand): SERVM region load-allocation weights for California (CPUC stack 1/5) - #796

Closed
ktehranchi wants to merge 1 commit into
developfrom
feat/servm-load-weights
Closed

ktehranchi wants to merge 1 commit into
developfrom
feat/servm-load-weights

Conversation

@ktehranchi

Copy link
Copy Markdown
Collaborator

First of a five-PR stack adding a California-only configuration driven by CPUC SERVM 2026 demand data (stack: #1 → this; #2 feat/servm-demand; #3 feat/caiso-interface-limits; #4 feat/servm-california; #5 feat/cpuc-benchmark).

Changes proposed in this Pull Request

Adds a fractional load-allocation-weights artifact mapping the six CPUC SERVM California load regions (IID, LADWP, NCNC, PGE, SCE, SDGE) onto clustered network buses:

  • workflow/repo_data/CPUC/servm_region_map.csvbalancing_area → servm_region (CISO-VEA kept as an explicit known-but-excluded null row; per the CPUC data dictionary, SERVM's SCE column already includes VEA load).
  • workflow/scripts/build_servm_load_weights.py — composes busmap_b (base bus → sub_id) with busmap_s{simpl} (sub_id → cluster bus), groups population load_weight by (servm_region, cluster bus), and normalizes to per-region allocation factors.
  • rule build_servm_load_weightsresources/demand/{interconnect}/servm_load_weights_s{simpl}.csv.

Why busmap composition instead of preserving a bus column: balancing_area (and, under topological_boundaries: reeds_zone, county) is dropped in aggregate_to_substations, and preserving a label through clustering trips PyPSA's make_consense assert on clusters that straddle regions (real in CA — LA County contains both LADWP and CISO-SCE buses). The weights table represents straddling clusters exactly, touches no clustering code, and is agnostic to simpl/topological_boundaries (county resolution works unchanged).

Testing

  • Tier A pytest -m fast: 195 passed, 1 pre-existing skip (run on the combined 5-PR stack).
  • New unit tests: test_build_servm_load_weights.py11 passed (includes a straddling-cluster regression: one cluster containing LDWP + CISO-SCE base buses splits fractionally across both regions).
  • Tier B (pytest -m integration) not run for this PR. No equivalence run for this branch (additive: new rule + new artifact only; no existing outputs change).

Checklist

  • I tested my contribution locally and it seems to work fine.
  • pre-commit and pytest -m fast pass locally.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to workflow/envs/environment.yaml (no dependency changes).
  • Changes in configuration options are added in workflow/repo_data/config/config.default.yaml (no config options in this PR — they arrive in stack Remove shunt impedandes #2/Development #4).
  • Changes in configuration options are also documented in docs/source/configtables/*.csv (same).

🤖 Generated with Claude Code

Builds a fractional per-(SERVM region, cluster bus) allocation table so CPUC
SERVM demand for the six California load regions can be disaggregated onto the
simplified network.

The shares are derived by composing the two busmaps (base bus -> substation ->
{simpl} cluster bus) against elec_base_network.nc rather than reading a bus
column of the clustered network: aggregate_to_substations drops
`balancing_area` from the buses, and a cluster can straddle two SERVM regions
anyway (LA County holds both LDWP and CISO-SCE buses). The base network is the
last stage that still carries both `balancing_area` and the population-based
`load_weight`, so the composition recovers where each base bus's weight lands.
A straddling cluster therefore appears once per region it overlaps, each row
carrying only that region's share, and the factors sum to 1.0 within a region.

Balancing areas that are deliberately out of scope (CISO-VEA, Nevada
footprint) keep a row with an empty region in servm_region_map.csv, so an
unknown balancing area introduced by upstream relabeling still hard-fails
while the excluded one is dropped with a logged load share.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ktehranchi

Copy link
Copy Markdown
Collaborator Author

CI note: the fast-tests failures here are environmental, not from this diff — every failure is AssertionError: Solver glpk not installed (plus one downstream Optimization failed), hitting pre-existing test_policy/test_reserves cases that this PR does not touch (#796's diff is purely additive and fails identically). The CI workflow was re-enabled today after a long disabled period, and the runner environment for Tier A lacks the GLPK binary; there is no green develop baseline yet. Tier A passes locally with GLPK: 195 passed, 1 pre-existing skip. The e2e-tests failure is likewise infra ("Setup micromamba" step). Leaving the CI environment fix to the maintainers / the #794 CI work rather than folding it into this stack.

🤖 Generated with Claude Code

@ktehranchi

Copy link
Copy Markdown
Collaborator Author

Superseded by #801 — the five-PR stack was collapsed into a single PR at the author's request. All commits (plus Tier B fixes) are on feat/cpuc-servm-california.

@ktehranchi ktehranchi closed this Aug 30, 2026
@ktehranchi
ktehranchi deleted the feat/servm-load-weights branch August 30, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant