Skip to content

fix: use actual R value when switch/breaker symbol is present in v35 BRANCH entry - #51

Merged
jd-lara merged 1 commit into
psy6from
lk/psy-1702-switch-r
Sep 5, 2026
Merged

jd-lara merged 1 commit into
psy6from
lk/psy-1702-switch-r

Conversation

@luke-kiernan

Copy link
Copy Markdown
Contributor

Ports PowerSystems.jl#1702, which never made its way over when the parsing code moved into this package.

_build_switch_breaker_sub_data unconditionally set r = 0.0 for source_version == "35". That is right for records coming from the v35 SWITCHING DEVICE / SUBSTATION SWITCHING DEVICE sections, which have no R field, but wrong for legacy BRANCH records parsed as switches/breakers (CKT starting with @ or *) — those do carry R, 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 *1 switch and an @1 breaker with nonzero, distinct R values. The added testset in test/test_openapi_switch.jl checks both the parsed PowerModels dict and the resulting DiscreteControlledACBranch components. 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

…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

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jd-lara
jd-lara merged commit d2d2cdc into psy6 Sep 5, 2026
6 of 8 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.

2 participants