Skip to content

Add state_file solver option for PhasorDynamics - #652

Merged
nkoukpaizan merged 2 commits into
developfrom
lukel/state-1
Nov 11, 2026
Merged

nkoukpaizan merged 2 commits into
developfrom
lukel/state-1

Conversation

@lukelowry

Copy link
Copy Markdown
Collaborator

Description

Adds a state_file solver option that sets initial bus voltages from a .state.json file, following #514 and #643.

Proposed changes

  • applyState sets bus Vr/Vi from the state file by case bus number.
  • Optional state_file in the solver file, used by the Hawaii validation.
  • Test: CaseFormatTests::stateParse.

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • The CHANGELOG.md has been updated to reflect the changes.

Further comments

Device entries and removal of the case init follow in later PRs.

@lukelowry lukelowry added the enhancement New feature or request label Nov 10, 2026
@lukelowry

Copy link
Copy Markdown
Collaborator Author

@nkoukpaizan @pelesh This is the highest value next migration step

@nkoukpaizan nkoukpaizan left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

I'll merge once rebased and CHANGELOG conflict is resolved and CI passes. Expect CI to fail for some time because of a GitHub actions issue.

for (auto& bus : sm.bus)
{
const auto number = std::to_string(bus.bus_id);
if (buses.contains(number))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Minor, thoughts for future PRs] Is there an acceptable situation where this condition will not be met? Perhaps we need some validation between the state and case files. A mismatch would be silent here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree, I adjust it so it requires every bus voltage to be specified.

Should be ready to merge

@nkoukpaizan
nkoukpaizan merged commit 0fb771c into develop Nov 11, 2026
9 checks passed
@lukelowry
lukelowry deleted the lukel/state-1 branch November 11, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants