Skip to content

Conversation

@jeandemanged
Copy link
Member

@jeandemanged jeandemanged commented Jan 30, 2026

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A PR or issue has been opened in all impacted repositories (if any)

Does this PR already have an issue describing the problem?

No

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

With lowImpedanceBranchMode set to REPLACE_BY_ZERO_IMPEDANCE_LINE, contingencies on non-impedant branches that are connected only at one side cause an exception, in both AC and DC.

Caused by: java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.orElseThrow(Optional.java:377)
	at com.powsybl.openloadflow.ac.equations.AcEquationSystemUpdater.updateNonImpedantBranchEquations(AcEquationSystemUpdater.java:77)
	at com.powsybl.openloadflow.lf.AbstractEquationSystemUpdater.updateElementEquations(AbstractEquationSystemUpdater.java:49)
	at com.powsybl.openloadflow.ac.equations.AcEquationSystemUpdater.onDisableChange(AcEquationSystemUpdater.java:93)
	at com.powsybl.openloadflow.network.LfNetworkListenerTracer.onDisableChange(LfNetworkListenerTracer.java:118)
	at com.powsybl.openloadflow.network.AbstractElement.notifyDisable(AbstractElement.java:61)
	at com.powsybl.openloadflow.network.impl.AbstractLfBranch.setDisabled(AbstractLfBranch.java:439)
	at com.powsybl.openloadflow.network.LfContingency.apply(LfContingency.java:134)

What is the new behavior (if this is a feature change)?

The fix consists in adding a check that both buses of the branch are non-null when updating non-impedant branches equations. (Because non-impedant branches equations are created only if both buses of the branch are non-null).

Does this PR introduce a breaking change or deprecate an API?

  • No

Other information:

The issue was first observed on a three-windings transformer with one side disconnected (if this matters), but can be reproduced on a simple line.

Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
@jeandemanged jeandemanged added the bug Something isn't working label Jan 30, 2026
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@jeandemanged jeandemanged changed the title [WIP] Fix Security Analysis exception half-connected zero impedance branch contingency Fix Security Analysis exception contingency on half-connected non-impedance branch Feb 3, 2026
@jeandemanged jeandemanged marked this pull request as ready for review February 3, 2026 07:42
@jeandemanged jeandemanged moved this from TODO to Waiting for review in Release 03/2026 Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Release 03/2026

Projects

Status: Waiting for review

Development

Successfully merging this pull request may close these issues.

1 participant