-
Notifications
You must be signed in to change notification settings - Fork 7
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
[WIP] Area Interchange Control as OuterLoop #1055
base: main
Are you sure you want to change the base?
Conversation
91829f9
to
7bbd807
Compare
Signed-off-by: mguibert <[email protected]>
7bbd807
to
08e2260
Compare
…e Control Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
@@ -618,6 +630,24 @@ public boolean isVoltagePerReactivePowerControl() { | |||
return voltagePerReactivePowerControl; | |||
} | |||
|
|||
public boolean isAreaInterchangeControl() { |
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.
Move all these new methods above isVoltagePerReactivePowerControl, as isVoltagePerReactivePowerControl and setVoltagePerReactivePowerControl should remain next to each other
@@ -1639,6 +1677,7 @@ static LfNetworkParameters getNetworkParameters(LoadFlowParameters parameters, O | |||
.setUseLoadModel(parametersExt.isUseLoadModel()) | |||
.setSimulateAutomationSystems(parametersExt.isSimulateAutomationSystems()) | |||
.setReferenceBusSelector(ReferenceBusSelector.fromMode(parametersExt.getReferenceBusSelectionMode())) | |||
.setAreaInterchangeControlAreaType(parametersExt.getAreaInterchangeControlAreaType()) |
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.
Add the line below above this one:
.setAreaInterchangeControl(parametersExt.isAreaInterchangeControl())
Also, both new lines should probably be mmoved just above the setTransformerVoltageControl call? (Everywhere else, the AIC new parameters/getter/setters are added next to it)
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.
current practice is to put new parameters at the bottom
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.
changed in 743827b
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.
Good to know, thanks!
src/main/java/com/powsybl/openloadflow/network/LfControlArea.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/network/impl/LfControlAreaImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImpl.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
private static void updateControlAreaBoundaryP(Terminal terminal, LoadingContext loadingContext, Supplier<Evaluable> getP) { | ||
LfControlArea controlArea = loadingContext.controlAreaBoundaries.get(terminal); |
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.
Check if the map contains the key first
import com.powsybl.openloadflow.network.BoundaryFactory; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class AICTests { |
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.
Rename to AreaInterchangeControlTest
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.
change in 63eb397
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.
Almost: you wrote TestS instead of Test
Signed-off-by: vmouradian <[email protected]>
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.
rename to LfArea
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.
renamed in 743827b
@@ -92,6 +92,9 @@ public enum SlackDistributionFailureBehavior { | |||
|
|||
public static final double MAX_SUSCEPTANCE_MISMATCH_DEFAULT_VALUE = 1e-4; | |||
|
|||
public static final boolean AREA_INTERCHANGE_CONTROL_DEFAULT_VALUE = false; | |||
|
|||
public static final String AREA_INTERCHANGE_CONTROL_AREA_TYPE_DEFAULT_VALUE = "ControlArea"; |
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.
this default should be defined in LfNetworkParameters
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.
changed in 743827b
updateControlAreaBoundaryP(branch.getTerminal1(), loadingContext, lfBranch::getP1); | ||
updateControlAreaBoundaryP(branch.getTerminal2(), loadingContext, lfBranch::getP2); |
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.
update
is not the right term, add
instead ?
Network network = BoundaryFactory.createWithLoad(); | ||
network.newArea() | ||
.setId("a1") | ||
.setName("Area 1") | ||
.setAreaType("ControlArea") | ||
.setInterchangeTarget(20) | ||
.addVoltageLevel(network.getVoltageLevel("vl1")) | ||
.addVoltageLevel(network.getVoltageLevel("vl2")) | ||
.addAreaBoundary(network.getDanglingLine("dl1").getBoundary(), true) | ||
.addAreaBoundary(network.getLine("l13").getTerminal2(), true) | ||
.add(); |
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.
suggestion: we will need many test networks dedicated to AIC. Create a new MultiAreaNetworkFactory
in com.powsybl.openloadflow.network
test code ?
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
Signed-off-by: vmouradian <[email protected]>
return this; | ||
} | ||
|
||
public OpenLoadFlowParameters setVoltagePerReactivePowerControl(boolean voltagePerReactivePowerControl) { |
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.
@vmouradian it looks like you moved this function by error
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.
😅 oups. Changed in 5a29ee9
@@ -299,6 +301,11 @@ public void addBus(LfBus bus) { | |||
bus.getLoads().forEach(load -> load.getOriginalIds().forEach(id -> loadsById.put(id, load))); | |||
} | |||
|
|||
public void addControlArea(LfArea controlArea) { |
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.
@vmouradian Rename it to addArea + change the argument name
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.
Forgot to push it previously, my bad. Done in 5a29ee9
@@ -366,6 +373,11 @@ public LfLoad getLoadById(String id) { | |||
return loadsById.get(id); | |||
} | |||
|
|||
public LfArea getControlAreaById(String id) { |
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.
@vmouradian Rename it to getAreaById + change the map controlAreasById to areasById
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.
same, updated in 5a29ee9
@@ -55,6 +56,8 @@ private static class LoadingContext { | |||
private final Set<ShuntCompensator> shuntSet = new LinkedHashSet<>(); | |||
|
|||
private final Set<HvdcLine> hvdcLineSet = new LinkedHashSet<>(); | |||
|
|||
private final Map<Terminal, LfArea> areaBoundaries = new HashMap<>(); |
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.
Naming is still confusing beacause not all those terminals are boundaries of the area (because of dangling lines).
Name it areaTerminalMap instead?
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.
Yes I agree, I renamed it in 5a29ee9
@@ -428,6 +433,7 @@ private static void createBranches(List<LfBus> lfBuses, LfNetwork lfNetwork, LfT | |||
LfBus lfBus2 = getLfBus(branch.getTerminal2(), lfNetwork, parameters.isBreakers()); | |||
LfBranchImpl lfBranch = LfBranchImpl.create(branch, lfNetwork, lfBus1, lfBus2, topoConfig, parameters); | |||
addBranch(lfNetwork, lfBranch, report); | |||
addLineAreaBoundaries(branch, lfBranch, loadingContext); |
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.
Rename method to addBranchAreaBoundaries
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.
changed in 5a29ee9
@@ -503,6 +511,65 @@ private static void createBranches(List<LfBus> lfBuses, LfNetwork lfNetwork, LfT | |||
} | |||
} | |||
|
|||
private static void updateControlArea(Bus bus, LfBus lfBus, LfNetwork network, LfNetworkParameters parameters, LoadingContext loadingContext, LfNetworkLoadingReport report) { | |||
Optional<Area> areaOpt = bus.getVoltageLevel().getArea(parameters.getAreaInterchangeControlAreaType()); |
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.
You should explain here that only areas necessary to the AIC are created in the LfNetwork
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.
changed in 5a29ee9
c4db184
to
26da6ec
Compare
Signed-off-by: vmouradian <[email protected]>
26da6ec
to
5a29ee9
Compare
|
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
Fixes #978
Does this PR introduce a breaking change or deprecate an API?