Repository navigation
Conversation
The single line diagram followed Flows | Impacts but always read in MW. It now follows the main window's MW | Loading % toggle too: - Loading % Flows: each branch feeder reads the loading of the end it draws (pypowsybl's feeder-info side; a transformer's side without a limit reads the other end's), its cell in the NAD's loading scale, the value on a pill of that colour from 50 %. - Loading % Impacts: the branch's loading change (+12%), coloured like the deltas, as on the NAD. - The Q arrow is hidden (one figure per end); loads and generators keep their MW. The header says Loading % beside Flows / Impacts; the N sub-tab reads Flows, the Impacts' reference. Backend: the three SLD endpoints carry branch_loading (and, N-1 / action, loading_deltas), read grid-wide like the NAD's so the Impacts categories match, then narrowed to the voltage level's branches. The painting moved out of SldOverlay (1420 -> 1070 lines) into utils/svg/sldFlowVisuals.ts + hooks/useSldFlowVisuals.ts, self-gated on its inputs' identity instead of a per-render JSON signature of the grid-wide deltas. Fixes on the way: - values pypowsybl prints with their thousands grouped (-1,297) read as numbers: a 1 297 MW branch read -1 in the NAD's MW labels and hover, and a >= 1 000 MW SLD feeder kept its flow in MW Impacts; - apply_threshold greys a zero change even when nothing changed at all; a loading change rounds to 0.1 point like the loadings; - a change under one unit keeps a decimal (-0.4%) instead of reading 0 in a decrease's colour. Co-Authored-By: Claude Opus 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
Follow-up to #230 (Loading % view). The SLD overlay followed Flows | Impacts but always read in MW. It now also follows the main window's MW | Loading % toggle, on its N, N-1 and action sub-tabs.
+12%), as on the NADIn Loading %:
side(ONE/TWO), and the feeder reads that end's loading. A transformer's side without a limit reads the other end's loading. For example, in the 400 kV voltage level, a 400/225 kV transformer limited on its 225 kV side shows its loading, not a dash.Loading %besideFlows/Impacts. The N sub-tab reads Flows, since it is the Impacts' reference, as on the N tab.Backend
/api/n-sld,/api/contingency-sldand/api/action-variant-sldcarrybranch_loading; the N-1 and action ones also carryloading_deltas._safe_branch_loading,_attach_loading_vs_base,_attach_action_loading) and follow the same variant discipline: the action loading is read before the switch to the contingency variant._keep_sld_branches).Frontend
SldOverlay(1420 → 1070 lines, the ceiling is 1450) intoutils/svg/sldFlowVisuals.tsplushooks/useSldFlowVisuals.ts.VisualizationPanelpasses the main window's metric to the overlay, as it already did foractionViewMode.Fixes on the way (found while checking on the fr225_400 situation)
-1,297, andparseFloatread it as-1.-1.parsePrintedNumber/isPrintedNumbernow reads these values correctly.apply_thresholdclassified an exact zero change asnegativewhen nothing changed at all (0 < 0is false). It now reads grey, like the vectorised and scalar categorisers already did.-0.4%). Before, it read0%in a decrease's colour. Shared by the NAD labels and the SLD.Test plan
test_diagram_mixin.py: the three SLD payloads, the narrowing to the voltage level's branches, and the variant restored.test_diagram_helpers.py: equal states read grey; a zero change is grey.test_combined_actions_scenario::test_independent_actions_simulation,test_stream_pdf_integration) fail the same way without this change and depend on the local recommender install.sldFlowVisuals.test.ts: each view, the feeder's end, the transformer fallback, pills, hidden Q, loads in MW, grouped values, clearing.SldOverlay.test.tsx: follows the toggles, the header, the N sub-tab.useSldOverlay.test.ts, plus grouped values inbranchLabelsandloadingVisuals.tsc -band eslint are clean.check_code_quality.py,check_docs_tree.py, mypy 1.19, OpenAPI contract, and the four parity layers against a freshly built standalone.pypsa_eur_fr225_400(2025-07-01 11:00), contingency ATTAQL72MANDA:105%on a vivid orange pill under its overload halo, ATTAQUES (the contingency) reads0%, and the transformer without a limit reads—.open_coupler, Loading % Impacts: CAPELLE+2%in orange, LONNY-1%and AVELIN-0.4%in blue; the injections show ΔMW.🤖 Generated with Claude Code