-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor DC Outer Loops creation #1158
Merged
+118
−85
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
61381e5
refactor dc outerloops creation + add active boolean to outerloops
vmouradian 246cd64
remove active parameter from outer loop
vmouradian 3ffc89a
clean
vmouradian 1a417ae
change DC slack distribution usage conditions
vmouradian 5a49f85
ensure keeping the previous behaviour
vmouradian 929a5b8
clean
vmouradian 3798ca8
refactor "AIC + no area" case handling
vmouradian cf9268e
Merge branch 'main' into feature/refactor-outer-loops
jeandemanged File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
src/main/java/com/powsybl/openloadflow/dc/DcAreaInterchangeControlControlOuterLoop.java
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
src/main/java/com/powsybl/openloadflow/dc/DcAreaInterchangeControlOuterLoop.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Copyright (c) 2024, Coreso SA (https://www.coreso.eu/) and TSCNET Services GmbH (https://www.tscnet.eu/) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.openloadflow.dc; | ||
|
||
import com.powsybl.commons.report.ReportNode; | ||
import com.powsybl.openloadflow.dc.equations.DcEquationType; | ||
import com.powsybl.openloadflow.dc.equations.DcVariableType; | ||
import com.powsybl.openloadflow.lf.outerloop.AbstractAreaInterchangeControlOuterLoop; | ||
import com.powsybl.openloadflow.lf.outerloop.OuterLoopResult; | ||
import com.powsybl.openloadflow.lf.outerloop.OuterLoopStatus; | ||
import com.powsybl.openloadflow.network.LfBus; | ||
import com.powsybl.openloadflow.network.util.ActivePowerDistribution; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Valentin Mouradian {@literal <valentin.mouradian at artelys.com>} | ||
*/ | ||
public class DcAreaInterchangeControlOuterLoop extends AbstractAreaInterchangeControlOuterLoop<DcVariableType, DcEquationType, DcLoadFlowParameters, DcLoadFlowContext, DcOuterLoopContext> implements DcOuterLoop { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(DcAreaInterchangeControlOuterLoop.class); | ||
|
||
public DcAreaInterchangeControlOuterLoop(ActivePowerDistribution activePowerDistribution, double slackBusPMaxMismatch, double areaInterchangePMaxMismatch) { | ||
super(activePowerDistribution, new DcNoAreaOuterLoop(), slackBusPMaxMismatch, areaInterchangePMaxMismatch, LOGGER); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "AreaInterchangeControl"; | ||
} | ||
|
||
@Override | ||
public double getSlackBusActivePowerMismatch(DcOuterLoopContext context) { | ||
List<LfBus> buses = context.getNetwork().getBuses(); | ||
return DcLoadFlowEngine.getActivePowerMismatch(buses); | ||
} | ||
|
||
/** | ||
* If the network has no area, the area interchange control is replaced by slack distribution. | ||
* In DC mode, the slack distribution is handled directly by the load flow engine, without any outer loop. | ||
* This class will be used as fallback outerloop in case the network has no area, and has no need to do anything. | ||
*/ | ||
private static class DcNoAreaOuterLoop implements DcOuterLoop { | ||
@Override | ||
public String getName() { | ||
return "DcNoAreaOuterLoop"; | ||
} | ||
|
||
@Override | ||
public OuterLoopResult check(DcOuterLoopContext context, ReportNode reportNode) { | ||
return new OuterLoopResult(this, OuterLoopStatus.STABLE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, a small remark here, maybe a little bit out of the scope of this PR : when comparing with
createAcOuterLoops
, it shows that the parameter phaseShifterControlMode is not taken into account in DC mode. Maybe it should be mentioned in the doc (or even with a log message, because default value of this param isCONTINUOUS_WITH_DISCRETISATION
and notINCREMENTAL
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SylvestreSakti if we want t improve the doc for phaseShifterControlMode I think this should be done in a different PR.
The doc of this paraeter could be improved in the following way I guess (just from code reading) - that are not all related to this outerloop.
- The parameter is only relevant for AC
- in Continuous mode, only the phase shifter in active power controller mode are computed through the Newton Raphson. The current limiters are controlled by an outerloop.
- In continuous mode, if the active target power taget is impossible to reach, the newton raphson will diverge. In incremental mode, the failure occurs in the incrementalPhaseControl outerloop that cannot reach a stable state. This makes it easier to troubleshoot the failure cause.