Repository navigation
feat(action-card): SLD chips for line openings, the PST card shows its start tap - #228
Merged
marota merged 2 commits intoNov 25, 2026
Merged
Conversation
…s start tap Two gaps on the unfolded action card: - a line opening offered no SLD chip (only couplings, transformers, phase shifters, loads and productions did). It now offers the voltage levels at both ends of every branch the title names — line, transformer or PST — a voltage level two branches share being offered once. They come from the NAD metadata, so they appear once the diagram is loaded - the PST editor showed the tap the action sets but not the one it starts from (the Manual Selection table has it as "Tap Start"). The backend now sends it as pst_details[].tap_start — the N-state tap snapshotted at network load (_initial_pst_taps), per PST — so it follows the action through manual simulation, combined actions and session save / reload. The card reads "tap: [29] [0..32] start 24"; the key is left out when the start tap is unknown and on sessions saved before it existed compute_pst_details takes the initial taps as an optional argument, so existing callers are unchanged. Specs for the branch chips (single line, combined, no metadata yet), the start tap (shown, 0, absent) and the backend (per-PST start tap, unknown start); docs/features/action-card.md, save-results.md, interaction-logging.md and the changelog follow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Antoine Marot <amarot91@gmail.com>
_capture_initial_pst_taps read tap_position / low_tap_position / high_tap_position, columns get_phase_tap_changers() does not have (they are tap / low_tap / high_tap, as NetworkManager.get_pst_tap_info reads them), so every PST was snapshotted at tap 0 with no bounds. The PST card's new "start" showed that 0 (.ARKA TD 661: 0 instead of 27); the snapshot is also the fallback of the Manual Selection table's tap_start and of the un-simulated pin tooltip, where it hid behind the recommender's "previous tap". - read_pst_taps (analysis/mw_start_scoring.py, next to get_pst_tap_start) does the read, with the right columns; a PST without a tap is left out rather than given a made-up 0, so the readers fall back on the live network. _capture_initial_pst_taps delegates to it (also keeps recommender_service.py under its module-size ceiling) - specs with pypowsybl's column names: tap and bounds read, a real tap of 0 kept, a PST with no tap left out; they fail on the previous code - checked on the France 2024-08-28 grid: .ARKA TD 661 -> 27 [0..32], PRAGNY661 -> 19, as the Manual Selection table; pst_details carries tap_start 27 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Antoine Marot <amarot91@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two gaps on the unfolded action card, reported on the deployed Space after #227:
tap: [29] [0..32]), while the Manual Selection table has the Tap Start column.Changes
Line openings get their SLD chips (
utils/actionLabels.ts): the unfolded card offers the voltage levels at both ends of every branch the title names — line, transformer or PST — resolved through the NAD metadata (so once the diagram is loaded). A voltage level two branches share is offered once: the combinedBERG9L61CANTE + CANTEL61MARSIopening showsBERG9 225kV · CANTE 225kV · MARSI 225kV.The PST card shows its start tap (
ActionCard.tsx, backend):compute_pst_detailstakes the taps snapshotted at network load (_initial_pst_taps) as an optional argument and setspst_details[].tap_startper PST — the N-state tap before the action. The key is left out when unknown.tap: [29] [0..32] start 24(tooltip: the phase shifter's tap before the action (N state)).pst_details, it follows the action through manual simulation, combined actions and session save / reload with no extra plumbing (sessionUtils/useSessioncopy the array as is). A session saved before this change simply shows no start tap.Fix found while trying it on the real grid (
317b2af): the card first showedstart 0for.ARKA TD 661where the Manual Selection table shows 27. Cause:_capture_initial_pst_tapsreadtap_position/low_tap_position/high_tap_position, columns pypowsybl'sget_phase_tap_changers()does not have (they aretap/low_tap/high_tap, asNetworkManager.get_pst_tap_inforeads them), so every PST was snapshotted at tap 0 with no bounds. That bug predates this PR; the table hid it by reading the recommender'sprevious tapfirst, but the snapshot is also the fallback of the table'stap_startand of the un-simulated pin tooltip.read_pst_taps(analysis/mw_start_scoring.py) now reads the right columns and leaves a PST with no tap out of the snapshot instead of inventing a 0. Checked on the France 2024-08-28 grid:.ARKA TD 661→ 27 [0..32],PRAGNY661→ 19, the table's values.Docs:
action-card.md,save-results.md,interaction-logging.md,curtailment-loadshedding-pst-actions.md, changelog.Test plan
compute_pst_details(per-PST start tap incl. 0, unknown start), the mixin wiring and the tap snapshot (pypowsybl's column names, a real tap of 0 kept, a PST without a tap left out — they fail on the previous code); full pytest 1403 passed, 5 skipped.ARKA TD 661→ 27,pst_detailscarriestap_start: 27scripts/check_openapi_contract.py— contract unchanged (pst_detailsis not in the snapshot)tsc -b,eslinton the touched filesscripts/check_code_quality.py— gate OKtap_startexpert_backend/tests/test_stream_pdf_integration.py::test_stream_pdf_integrationfails with a 422 onrun-analysis-step1; it fails the same way on untouchedmain(244e45a), so it is excluded from the run above and unrelated to this PR.Choices worth a look
_initial_pst_taps(snapshot at network load), not theprevious tapthe score table prefers. With the snapshot fixed both give the N-state tap (27 and 19 on the two PSTs checked); the card does not depend on the recommender's score params, so it also works for a manually simulated PST.🤖 Generated with Claude Code