Skip to content

Remove BusFault + Replace with Bus::setFault - #607

Open
lukelowry wants to merge 1 commit into
developfrom
lukel/fault-improve-dev
Open

lukelowry wants to merge 1 commit into
developfrom
lukel/fault-improve-dev

Conversation

@lukelowry

@lukelowry lukelowry commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds Bus::setFault to apply or clear a fault to ground directly at a bus. This is the first of two PRs. The follow-up removes BusFault and changes solver fault events to name the bus.

@pelesh Cleaned up

Proposed changes

  • BusBase::setFault(status, R, X). The default rejects the call, so a BusInfinite cannot be faulted.
  • Bus subtracts the fault current $(G_f + jB_f)V$ from its current balance, with $G_f + jB_f = 1/(R_f + jX_f)$, and puts the fault admittance in its existing Jacobian entries. A zero fault impedance is rejected.
  • Example: TenGenGenrou applies its fault with setFault instead of a BusFault component, and its reference check passes unchanged.

Tests: BusTests::fault checks the fault current against its closed form, clearing the fault, and rejection of a zero impedance and of an infinite bus. BusTests::jacobian checks the Jacobian against DependencyTracking and that clearing the fault leaves its entries in place at zero. 68/68 pass.

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

BusFault and the solver event format are unchanged here.

@superwhiskers superwhiskers 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.

this seems fine so far but it still needs BusFault to be removed entirely before it can be merged

@lukelowry

Copy link
Copy Markdown
Collaborator Author

@pelesh Please advise the cutover is rather large.

@pelesh

pelesh commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

this seems fine so far but it still needs BusFault to be removed entirely before it can be merged

@superwhiskers, the idea for this PR is just to pilot proposed changes and show how the new implementation works. If this is approved, the follow up PR will make a wholesale transition to the new approach to bus faults and the old BusFault class will be removed at that time. This may have not come clear from the scope explanation in this PR.

@lukelowry
lukelowry force-pushed the lukel/fault-improve-dev branch from 6f2aebc to b6fe2d5 Compare October 6, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants