Skip to content

Support DC switch resistance in load flow - #1423

Draft
SGI-Landry wants to merge 14 commits into
mainfrom
LH-DcSwitch-resistance
Draft

Support DC switch resistance in load flow#1423
SGI-Landry wants to merge 14 commits into
mainfrom
LH-DcSwitch-resistance

Conversation

@SGI-Landry

@SGI-Landry SGI-Landry commented Jun 4, 2026

Copy link
Copy Markdown

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?

Fixes #1371

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

  • Yes
  • No

Signed-off-by: Sylvestre Prabakaran <sylvestre.prabakaran@rte-france.com>
Signed-off-by: Sylvestre Prabakaran <sylvestre.prabakaran@rte-france.com>
Signed-off-by: Sylvestre Prabakaran <sylvestre.prabakaran@rte-france.com>
@SGI-Landry

Copy link
Copy Markdown
Author

@bperr can you please review this activity? CI fails but this is normal, as long as tests run locally.

Comment thread docs/loadflow/loadflow.md
/**
* @author Landry Huet {@literal <landry.huet at supergrid-institute.com>}
*/
public class LfDcSwitchImpl extends AbstractLfDcLine {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should AbstractLfDcLine be renamed to AbstractLfDcBranch ? It may now represent something else than a DC line

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It is a good idea. It has consequences in many files, however. In many places we then need to rename 'DcLine' to 'DcBranch'.


@Override
public void updateFlows(double i1, double i2, double p1, double p2) {
// TODO: DcSwitch has no DcTerminal yet in the IIDM model - revisit when terminals are added.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This mean that the result of the load flow cannot be propagated to the iidm Network object. Is there no workaround for this ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You can still see the voltages at each node where the DcSwitches are connected. You do lose the data on the current. Fixing this requires however another activity in PowSyBl Core and it raises more questions. I will create a GitHub issue for this.

@@ -611,11 +613,25 @@ private static void createBranches(List<LfBus> lfBuses, LfNetwork lfNetwork, LfT

private static void createDcLines(LfNetwork lfNetwork, LoadingContext loadingContext, LfNetworkParameters parameters) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similarly, this may be renamed to createDcBranches

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Like many other methods and variables.


List<LfDcBus> lfDcBuses = new ArrayList<>();
createDcBuses(dcBuses, parameters, lfNetwork, lfDcBuses, loadingContext);
network.getDcSwitches().forEach(loadingContext.dcSwitchSet::add);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand that the DcTopologyVisitor interface does not allow to fill dcSwitchSet as for DC lines and ground so this is a workaround.
However I think your current implementation is incorrect as it adds all DC switches of the network, rather than the ones of the DC component. If your network has two DC components, the switches will be added twice.

You can either add a filter here using numDcc, or group DC Switches by (numCC, numDCC) (as done for AC switches)

@@ -0,0 +1,66 @@
/**
* Copyright (c) 2025, SuperGrid Institute (http://www.supergrid-institute.com)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2026

@@ -0,0 +1,102 @@
/**
* Copyright (c) 2025, SuperGrid Institute (http://www.supergrid-institute.com)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2026

.setOpen(false)
.setR(rSwitch)
.add();
addStandardConverters(network);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since #1406 you have helper functions in AbstractLoadFlowNetworkFactory.java to create elements faster.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Let's discuss this. I don't see how this is less verbose.

SylvestreSakti and others added 8 commits June 8, 2026 18:42
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
@SGI-Landry SGI-Landry changed the title Lh dc switch resistance Support DC switch resistance in load flow Jun 9, 2026
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
… switches.

Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Signed-off-by: Landry Huet <landry.huet@supergrid-institute.com>
Base automatically changed from ci/core-7.3.0-SNAPSHOT to main June 23, 2026 07:10
@jeandemanged

Copy link
Copy Markdown
Member

Hi@SGI-Landry , cc @SylvestreSakti
Could you please update your branch ? (for inclusion in next release)
we do have powsybl-core RC now, and final powsybl-core should be ready soon

@SGI-Landry
SGI-Landry force-pushed the LH-DcSwitch-resistance branch from fe5033c to aa9ff93 Compare June 30, 2026 06:39
@SGI-Landry

Copy link
Copy Markdown
Author

Hi@SGI-Landry , cc @SylvestreSakti Could you please update your branch ? (for inclusion in next release) we do have powsybl-core RC now, and final powsybl-core should be ready soon

Hello @jeandemanged I have just updated the branch. I have discovered a bug in the Core part of this activity, with a consequence in the load flow computation (see powsybl/powsybl-core#3953).

Please let's not merge the activity in the release train, but rather wait until the issue in Core is fixed.

@jeandemanged

Copy link
Copy Markdown
Member

Hello @SGI-Landry ,
DC switches were made in IIDM without Terminals just like AC switches.
Not sure powsybl/powsybl-core#3953 is really a bug, rather a feature.
The needed feature is the ability to store DC flow results on DC switches. Modifying DC Switches to be DC Connectable and having DC Terminals could be one solution - but involves more work.
Some alternatives by decreasing complexity:

  • an IIDM Extension of DC Switch to store these results. I think the DcTerminals in DcSwitches powsybl-core#3953 proposal has an issue: DC Switches without resistance will never have results, and yet the DC Terminals are there. With extension you would put an extension only where results are relevant solving that problem.
  • putting results as simple IIDM properties on the DC Switches with non zero resistance. This mechanism is already used e.g. in LfBoundaryLineBus to store solved voltage magnitude and angle as properties.
  • not exporting the results for DC Switches in IIDM

My call would be for one of the above options (not writing, or writing as properties). If this cannot be done for this release train, I think it would make sense to do a small PR to have OLF throwing an exception on networks with DC Switch with non-zero resistance.

Let us know

@SGI-Landry

Copy link
Copy Markdown
Author

Hello @SGI-Landry , DC switches were made in IIDM without Terminals just like AC switches. Not sure powsybl/powsybl-core#3953 is really a bug, rather a feature. The needed feature is the ability to store DC flow results on DC switches. Modifying DC Switches to be DC Connectable and having DC Terminals could be one solution - but involves more work. Some alternatives by decreasing complexity:

* an IIDM Extension of DC Switch to store these results. I think the [DcTerminals in DcSwitches powsybl-core#3953](https://github.com/powsybl/powsybl-core/issues/3953) proposal has an issue: DC Switches without resistance will never have results, and yet the DC Terminals are there. With extension you would put an extension only where results are relevant solving that problem.

* putting results as simple IIDM properties on the DC Switches with non zero resistance. This mechanism is already used e.g. in LfBoundaryLineBus to store solved voltage magnitude and angle as properties.

* not exporting the results for DC Switches in IIDM

My call would be for one of the above options (not writing, or writing as properties). If this cannot be done for this release train, I think it would make sense to do a small PR to have OLF throwing an exception on networks with DC Switch with non-zero resistance.

Let us know

Thanks for your answer, and thanks @SylvestreSakti for putting the exception.

The issue is more than just recording the results. Continuing the discussion on powsybl/powsybl-core#3953

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Enhanced DC circuit breaker

4 participants