Skip to content

feat(context-map): consignations and the 400/225 kV network outline, as Carte-Front - #229

Merged
marota merged 1 commit into
ainetus:mainfrom
marota:feat/context-network-layers
Nov 25, 2026
Merged

marota merged 1 commit into
ainetus:mainfrom
marota:feat/context-network-layers

Conversation

@marota

@marota marota commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two Carte-Front layers on the Context tab:

  • Consignations — the extra-high-voltage circuits (400/225 kV lines and two-winding transformers) a situation takes out, by Carte-Front's rule on a situation (maintenance.detect_consignations_via_I), ported to the parsed network:
    • no current at either end (I is NaN or < 0.5 A; a line energised from one end keeps its charging current and is not consigned), and
    • isolated at both voltage levels in the TOPO sense — alone on its node, or sharing it only with the substation's own wiring (busbar sections, fict_…) and other consigned circuits (an antenna). TOPO is read per candidate voltage level from get_node_breaker_topology (~0.35 ms each); a bus-breaker end is isolated when its circuit is disconnected.
    • A file carrying no flow at all gives none (every circuit would read "without current").
    • Drawn with a casing per voltage (400 kV red and solid, 225 kV green and dashed — a second channel for colour-blind readers), a transformer as a point, hover names the circuit. On by default when there are some.
  • Network outline (liseré) — a pastel 400/225 kV trace of the grid under the flows, built from the network's lines (parallel circuits melted). Two independent legend boxes, off by default; served by the new GET /api/context-map/network (50–80 kB), read once the first time a box is ticked.

Detection runs in capture_snapshot (inside the existing network lock) and the consignations ride in the /api/context-map payload.

Numbers

  • 26 to 71 consigned circuits on the four RTE7000 THT grids (Carte-Front measures 58–169 on real PtFige); none on the PyPSA-EUR grids, whose circuits are all in service.
  • Capture cost: +0.25 s on the 7 000-node French grid, nothing measurable elsewhere. A detection failure only leaves the layer out.
  • Checked in the real app on a THT grid: 71 consignations drawn, outline 257 (400 kV) + 1 337 (225 kV) segments, hover card correct.

Test plan

  • pytest — 39 new tests (test_context_map_consignations.py: the rule, snapshot, payload, outline, route); suite 1 441 passed
  • check_openapi_contract.py (snapshot regenerated for the new route), check_code_quality.py
  • Vitest 2 233 passed (new view + hook specs), tsc -b, ESLint (0 errors)
  • Manual: THT grid in the browser, both layers toggled

Known, unrelated: test_combined_actions_scenario::test_independent_actions_simulation and test_stream_pdf_integration::test_stream_pdf_integration fail on main too.

Docs: docs/features/context-tab.md § Network layers, CHANGELOG, CLAUDE.md guides.

🤖 Generated with Claude Code

…as Carte-Front

Two Carte-Front layers on the Context tab:

- Consignations: the extra-high-voltage circuits (400/225 kV lines and
  two-winding transformers) a situation takes out, by Carte-Front's rule on a
  situation (maintenance.detect_consignations_via_I) ported to the parsed
  network: no current at either end (I NaN or < 0.5 A) AND isolated at both
  voltage levels (alone on its node, or only with the substation's wiring and
  other consigned circuits), the TOPO read per candidate voltage level from
  get_node_breaker_topology; a bus-breaker end is isolated when its circuit is
  disconnected; a file without any flow gives none. Detected in
  capture_snapshot (+0.25 s on the 7 000-node French grid), carried in the
  /api/context-map payload, drawn with a casing per voltage (400 kV red and
  solid, 225 kV green and dashed), on by default.
- Network outline (liseré): a pastel 400/225 kV trace built from the
  network's lines, parallel circuits melted, off by default, served by the
  new GET /api/context-map/network the first time a legend box is ticked.

Backend: services/context_map/consignations.py, network_layers.py; snapshot,
builder, service and the route; OpenAPI snapshot regenerated. Frontend:
ContextMapLayers / ContextMapView (legend toggles, hover card),
useContextMap.requestNetwork, tokens, types, api. Docs: context-tab.md
§ Network layers, CHANGELOG, CLAUDE.md guides.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Antoine Marot <amarot91@gmail.com>
@marota
marota merged commit 6c1702c into ainetus:main Nov 25, 2026
6 checks passed
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