fix: use actual R value when switch/breaker symbol is present in v35 BRANCH entry - #51
Merged
Merged
Conversation
…BRANCH entry Port of PowerSystems.jl PR #1702, which never made it over when the parsing code moved into this package. v35 SWITCHING DEVICE records have no R field, but legacy BRANCH records parsed as switches/breakers (CKT starting with '@' or '*') do. Unconditionally zeroing R for source_version 35 discarded the latter's resistance. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmGuSdKu4g7a3uqgPXZ4NC
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
jd-lara
self-requested a review
September 5, 2026 17:12
jd-lara
approved these changes
Sep 5, 2026
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.
Ports PowerSystems.jl#1702, which never made its way over when the parsing code moved into this package.
_build_switch_breaker_sub_dataunconditionally setr = 0.0forsource_version == "35". That is right for records coming from the v35 SWITCHING DEVICE / SUBSTATION SWITCHING DEVICE sections, which have noRfield, but wrong for legacy BRANCH records parsed as switches/breakers (CKT starting with@or*) — those do carryR, and it was being discarded.pop!(dict_object, "R", 0.0)keeps the value when present and falls back to zero otherwise.Test
New fixture
test/fixtures/synthetic_v35_branch_switch_r.raw: a v35 case whose BRANCH section holds a*1switch and an@1breaker with nonzero, distinct R values. The added testset intest/test_openapi_switch.jlchecks both the parsed PowerModels dict and the resultingDiscreteControlledACBranchcomponents. It fails (4 of 6 assertions) without the source change.Full test suite passes locally.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HmGuSdKu4g7a3uqgPXZ4NC