Skip to content

Commit

Permalink
Increase slack active power distribution threshold (#232)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
  • Loading branch information
geofjamg authored Mar 1, 2021
1 parent 4fd56be commit 3256305
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package com.powsybl.openloadflow.ac;

import com.powsybl.commons.PowsyblException;
import com.powsybl.openloadflow.ac.nr.DefaultNewtonRaphsonStoppingCriteria;
import com.powsybl.openloadflow.ac.outerloop.OuterLoop;
import com.powsybl.openloadflow.ac.outerloop.OuterLoopContext;
import com.powsybl.openloadflow.ac.outerloop.OuterLoopStatus;
Expand All @@ -25,6 +24,11 @@ public class DistributedSlackOuterLoop implements OuterLoop {

private static final Logger LOGGER = LoggerFactory.getLogger(DistributedSlackOuterLoop.class);

/**
* Slack bus maximum active power mismatch: 10^-2 in p.u => 1 Mw
*/
private static final double SLACK_BUS_P_MAX_MISMATCH = Math.pow(10, -2);

private final ActivePowerDistribution activePowerDistribution;

private final boolean throwsExceptionInCaseOfFailure;
Expand All @@ -42,7 +46,7 @@ public String getType() {
@Override
public OuterLoopStatus check(OuterLoopContext context) {
double slackBusActivePowerMismatch = context.getLastNewtonRaphsonResult().getSlackBusActivePowerMismatch();
if (Math.abs(slackBusActivePowerMismatch) > DefaultNewtonRaphsonStoppingCriteria.CONV_EPS_PER_EQ) {
if (Math.abs(slackBusActivePowerMismatch) > SLACK_BUS_P_MAX_MISMATCH) {

ActivePowerDistribution.Result result = activePowerDistribution.run(context.getNetwork(), slackBusActivePowerMismatch);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void threeBusesTest() {
assertVoltageEquals(1, b1);
assertVoltageEquals(0.856, b2);
assertVoltageEquals(0.856, b3);
assertAngleEquals(13.444857, b1);
assertAngleEquals(13.520904, b1);
assertAngleEquals(0, b2);
assertAngleEquals(0, b3);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void testWithVoltageRegulationOn() {
assertTrue(result2.isOk());

assertVoltageEquals(390.440, bus1);
assertAngleEquals(0.114259, bus1);
assertAngleEquals(0.114371, bus1);
assertVoltageEquals(390.181, bus2);
assertAngleEquals(0, bus2);
assertActivePowerEquals(101.2, dl1.getTerminal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void generatorWithNegativeTargetP() {
network.getLoad("LOAD").setQ0(-200);
LoadFlowResult result = LoadFlow.find("OpenLoadFlow").run(network, parameters);
assertTrue(result.isOk());
assertActivePowerEquals(595.350, network.getGenerator("GEN").getTerminal());
assertActivePowerEquals(595.328, network.getGenerator("GEN").getTerminal());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void testPowerFactorConstant() {

assertPowerFactor(network1);
LoadFlowResult loadFlowResultExpected1 = new LoadFlowResultBuilder(true)
.addMetrics("5", "CONVERGED")
.addComponentResult(0, LoadFlowResult.ComponentResult.Status.CONVERGED, 5, "VLHV1_0", -3.06844963660069E-5)
.addMetrics("4", "CONVERGED")
.addComponentResult(0, LoadFlowResult.ComponentResult.Status.CONVERGED, 4, "VLHV1_0", 0.026900149770181514)
.build();
assertLoadFlowResultsEquals(loadFlowResultExpected1, loadFlowResult1);

Expand All @@ -147,8 +147,8 @@ void testPowerFactorConstant() {

// then
assertPowerFactor(network2);
LoadFlowResult loadFlowResultExpected2 = new LoadFlowResultBuilder(true).addMetrics("5", "CONVERGED")
.addComponentResult(0, LoadFlowResult.ComponentResult.Status.CONVERGED, 5, "VLHV1_0", 1.340823176931849E-5)
LoadFlowResult loadFlowResultExpected2 = new LoadFlowResultBuilder(true).addMetrics("4", "CONVERGED")
.addComponentResult(0, LoadFlowResult.ComponentResult.Status.CONVERGED, 4, "VLHV1_0", 0.026900149770181514)
.build();
assertLoadFlowResultsEquals(loadFlowResultExpected2, loadFlowResult2);
}
Expand Down

0 comments on commit 3256305

Please sign in to comment.