Skip to content

Support disconnection of DC elements in the load flow - #1471

Draft
bperr wants to merge 12 commits into
mainfrom
dc-disconnection
Draft

Support disconnection of DC elements in the load flow#1471
bperr wants to merge 12 commits into
mainfrom
dc-disconnection

Conversation

@bperr

@bperr bperr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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?

Feature

What is the current behavior?

The AC-DC load flow did not consider wheher DC terminals of elements were connected or disconnected.

What is the new behavior (if this is a feature change)?
Disconnnected elements are properly taken into account during load flow

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

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

Other information:

bperr added 5 commits June 24, 2026 16:42
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
@bperr
bperr requested a review from SGI-Landry July 24, 2026 07:26
bperr added 2 commits July 24, 2026 09:28
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>

@SGI-Landry SGI-Landry 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.

Thanks for this activity @bperr !
There are a few minor comments here and there. I think however that we should discuss tests in AcDcLoadFlowWithDisconnectionTest.

Comment thread docs/loadflow/loadflow.md
DC buses at the other side.<br>
Please note that converters with a second optional AC terminal are not supported by Open Load Flow.

If a terminal of the converter is disconnected, the converter is not included in the load flow, and none of the equations below is added.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This will probably require a bit more details, e.g. whether an equation imposing I=0 is added, or what happens with losses and on the AC side.

}

@Test
void testDcBusWithDisconnectedDcGroundIsNotGrounded() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am a bit puzzled by these tests. What behavior are we testing here? Are you testing the interface or the implementation details? This is not clear to me, can we please discuss it?

}

/**
* Verify the DC node voltage is coherent with the nominal voltage

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
* Verify the DC node voltage is coherent with the nominal voltage
* Verify the DC node voltage is consistent with the nominal voltage

But is this really needed? I would expect that you should know what values to expect precisely from your test cases, rather than test that the value is finite and "small enough".

import static org.junit.jupiter.api.Assertions.*;

/**
* @author Baptiste Perreyon {@literal <bapstiste.perreyon at supergrid-institute.com>}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
* @author Baptiste Perreyon {@literal <bapstiste.perreyon at supergrid-institute.com>}
* @author Baptiste Perreyon {@literal <baptiste.perreyon at supergrid-institute.com>}

* @author Baptiste Perreyon {@literal <bapstiste.perreyon at supergrid-institute.com>}
*/
@ExtendWith(ServiceParameterResolver.class)
class AcDcLoadFlowWithDisconnectionTest {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This can be simplified and made more robust. Can we please write down what behaviors to expect in a if condition then expectation way, and create just these tests, over observable behaviors? This should rely on analytical cases when this is numerical, with comparisons to expected values.

* @param acDcConverters A list of AC-DC converters to check.
* @throws PowsyblException If at least one AC-DC converter is not indirectly connected to a DC ground
*/
public static void checkAllConvertersAreIndirectlyConnectedToADcGround(List<AcDcConverter<?>> acDcConverters) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would it make sense to leave it package-private? I think these static methods are only used in LfNetworkLoaderImpl anyway.

// lcc converter not implemented yet
} else {
// Remove previous load flow results (we don't want the user to believe this are results from the new load flow)
acDcConverter.unsetSolvedValues();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very good point. However, a converter whose DC terminals are both disconnected belongs to no DcBus so it is never added to the acDcConverterSet in the first place.

Same issue with DcLines disconnected at both ends.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done after the load flow in Networks.resetState as all other equipments

*
* @author Baptiste Perreyon {@literal <baptiste.perreyon at supergrid-institute.com>}
*/
final class DcNetworkValidationHelpers {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good call to factor out these static functions. I am wondering if it is possible to simplify this code a bit. Maybe extract the topology visitor, and replace the predicate on converters by a boolean stating whether the test is needed or not?

bperr added 5 commits July 28, 2026 11:36
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
Signed-off-by: b.perreyon <baptiste.perreyon@supergrid-institute.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
86.6% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube Cloud

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