Repository navigation
Add MW Start column to action score tables - #62
Merged
Merged
Conversation
Display the initial MW value for each action in the score tables: - Line disconnection/PST: active power (p_or) on the line in N-1 state - Load shedding: active power (load_p) of the load in N-1 state - Open coupling: sum of active power on lines moved between buses - Line reconnection/close coupling: N/A Backend computes mw_start per action type in _compute_mw_start_for_scores(). Frontend displays the column in ActionFeed, CombinedActionsModal, and standalone_interface.html. Session save/restore preserves the data. https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
Backend (pytest, 17 tests): - _compute_mw_start_for_scores: no-context guards, line disco abs(p_or), PST p_or, load shedding load_p, open coupling summed lines, N/A for reco/close-coupling, multi-type in one call Frontend (vitest, 8 tests): - ActionFeed: MW Start header, numeric value, N/A for reco/missing, load shedding value - CombinedActionsModal: explore tab numeric value, null value N/A, missing mw_start map N/A https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
Load shedding: add fallback to extract load name from action_id pattern (load_shedding_<name>) when content.set_bus.loads_id is missing, which happens with library-enriched actions. Open coupling: replace incorrect sum of abs(p_or) with algebraic net injection at the moved bus using Kirchhoff's law: - lines_or_id: injection = -p_or (origin at sub, positive leaves) - lines_ex_id: injection = +p_or (power arriving from origin) - generators_id: injection = +gen_p - loads_id: injection = -load_p Virtual line MW = |net injection| Updated tests: 21 backend tests now cover both fixes including action_id pattern fallback, net injection algebra, and gen/load contributions. https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
Partition set_bus elements by bus number and compute KCL at bus 1 only (matching the reference get_virtual_line_flow implementation). Previously all elements were summed regardless of bus assignment, giving ~0 instead of the virtual line flow. https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
set_bus can contain elements with bus=-1 (disconnected). Previously min(all_buses) picked -1 as bus 1, computing KCL only for disconnected elements (0 flow) → result was always 0. Now filters out bus <= 0 before determining bus 1. https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
Tests use the exact set_bus from reduced_model_actions_test.json with p_or values derived from the N-1 diagrams shown in the issue screenshots. Covers: disconnected elements (bus=-1), mix of or/ex side lines, expected virtual line flows of 63 MW and 29 MW respectively. https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
The onChange handler was calling changeConfigFilePath (which makes an API call and resets state from the response), so by Apply time the displayed value was already overwritten by the mock response '/mock/config.json'. Now onChange only updates the local display state via setConfigFilePath. The API call still happens on blur and on Apply (which already had the configFilePath !== lastActiveConfigFilePath guard). https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz
marota
pushed a commit
that referenced
this pull request
Apr 30, 2026
Reconciliation of section 2 (0.5.0): - Drop misattributed PRs that were actually pre-rebrand: save/reload (#49/#52), MW Start (#62), interaction-logging (#64), SLD highlights (#63), load shedding initial integration (#61). All now properly cited in section 1.5–1.6. - Disambiguate App.tsx refactor history: PR #56 (hooks, 2100 → 800, pre-rebrand) vs PR #74 (components, 1000 → 650, 0.5.0) vs PR #75 (memoization Phase 2, same LoC). - Add accurate 0.5.0 PRs: #66 (vectorization w/ benchmark table), #69/#70/#71 (UI polish), #72 (curtailment), #73 (loads_p/gens_p format + configurable MW), #74/#75 (App.tsx decomposition), #78 (PST tap re-simulation), #84/#86/#87/#90 (detachable tabs). - Add a recap table summarizing what's truly new in 0.5.0. Diagrams added (Mermaid, GitHub-rendered): - Gantt timeline of all 4 phases (top of doc). - High-level architecture (frontend / backend / data). - Two-step analysis sequence diagram (section 1.6). - App.tsx LoC evolution flow (section 2.4). - Backend mixin decomposition before/after PR #104/#106 (section 3). - PyPSA-EUR pipeline flowchart (section 4). https://claude.ai/code/session_01Pg7fuCUG2edfm5PyHS6SbN
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
mw_startper action in_compute_mw_start_for_scores()using the N-1 observation:abs(p_or)of the disconnected lineabs(p_or)of the PST lineload_pof the shed load(s)abs(p_or)of lines moved between buses (virtual line MW)mw_startdata automatically viaaction_scoresTest plan
https://claude.ai/code/session_01AH3KFQG3oMHczWhuc2htgz