Skip to content

Expect DC current fields in kA - #73

Open
luke-kiernan wants to merge 2 commits into
psy6from
lk/current-fields-ka
Open

luke-kiernan wants to merge 2 commits into
psy6from
lk/current-fields-ka

Conversation

@luke-kiernan

@luke-kiernan luke-kiernan commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

These tests fail until PowerOpenAPIModels is regenerated against Sienna-Platform/SiennaSchemas#94 and released. The conversion is driven by the models' declared units (IC.has_declared_unit). Merge together with the rest of the A→kA set (Sienna-Platform/PowerSystems.jl#1836).

Summary

No source changes, just tests. The parser keeps reading PSS/E's currents in A (set_value!(component, :dc_current, d["if"], "A")), and its unit-aware set_value! converts to whatever unit the schema declares. Once the schema declares kA, the parser stores kA, and the PSS/E-native dict stays in A. So we need an extra factor of 1000 in a few places.

The A→kA set

Sienna-Platform/SiennaSchemas#94 → PowerOpenAPIModels regeneration → Sienna-Platform/PowerSystems.jl#1836, this PR, and consumer updates in PowerFlows.jl, PowerOperationsModels.jl and PowerSystemCaseBuilder.jl.

🤖 Generated with Claude Code

Follows Sienna-Platform/SiennaSchemas#94, which declares the DC current fields
in kA. The parser keeps reading PSS/E's A and its unit-aware `set_value!`
converts to the declared unit, so only the expectations change. These pass
once PowerOpenAPIModels is regenerated against #94.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@luke-kiernan

Copy link
Copy Markdown
Contributor Author

Open question for review: what value means "no DC current limit"?

The stack currently uses two different "infinities" for these currents, and moving the fields from A to kA makes them diverge further:

Where Value Unit after this set
SiennaSchemas / PSY defaults for max_dc_current, max_dc_current_from/_to (and PSY's OpenAPI import fallbacks) 1e8 kA (was A)
PowerFlowFileParser: RAW IMAX = 0 → PTI_INF = 9999.0 (src/pm_io/psse.jl:2328) 9999.0 A, then 9.999 kA once stored
PowerFlows PSS/E export: PSSE_INFINITY = 9999.0 → IMAX = 0 (src/psse_export.jl:2) 9999.0 A

So:

  1. Defaults. Should they stay 1e8 (now kA, effectively unbounded either way), or become 1e5 so they still equal 1e8 A? 1e8 A was suggested as PSS/E's conventional infinity, but nobody has confirmed that.
  2. The 9999.0 sentinel. A RAW "no limit" (IMAX = 0) is parsed to 9999 A, which becomes 9.999 kA once stored. That's a finite and fairly tight limit, not "unbounded". Should the parser and exporter use the same sentinel as the defaults? And is IMAX = 0 really "no limit" in PSS/E?

Nothing in this set changes these values. Whatever is decided, it's about a one-line change each in the schema, PSY, PFFP and PF.

@luke-kiernan luke-kiernan self-assigned this Oct 14, 2026
@rodrigomha
rodrigomha marked this pull request as ready for review October 19, 2026 22:01
@rodrigomha

Copy link
Copy Markdown

The tests-only approach checks out: every current field goes through set_value!(…, "A"), which converts to the declared kA. Two requests:

1. RAW IMAX = 0 should store 9999 kA, not 9.999 kA.
src/pm_io/psse.jl:2336-2337 puts PTI_INF = 9999.0 into the dict, which holds PSS/E currents in A. set_value! then divides by 1000, so "no limit" becomes a finite 9.999 kA limit.

  • Use 1000.0 * PTI_INF for the two max_dc_current_* lines.
  • Keep PTI_INF as it is, because SMAX uses it in system p.u. and PowerFlows reverts it on export.
  • PFFP doesn't depend on PSY, so this value has to be kept in sync by hand with PSY's INFINITE_CURRENT (Store DC current fields in kA, not A PowerSystems.jl#1836).
  • Please add a test that a RAW with IMAX = 0 stores 9999 kA. Nothing covers this path today.

2. Stale docstring.
src/openapi/dc_branch.jl:225-226 says dc_current and max_dc_current_* "are already natural (Amperes …) and pass through unscaled". They are now converted from A to kA.

@rodrigomha
rodrigomha self-requested a review October 19, 2026 23:16

@rodrigomha rodrigomha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@rodrigomha rodrigomha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All addressed, thanks. Approving. The remaining failures, including the new IMAX = 0 test (9.999e6), clear once PowerOpenAPIModels is regenerated with kA.

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