Skip to content

Commit

Permalink
Fix allowed direction in incremental outer loops (#1052)
Browse files Browse the repository at this point in the history
Signed-off-by: Anne Tilloy <[email protected]>
Co-authored-by: Hadrien <[email protected]>
  • Loading branch information
annetill and Hadrien-Godard authored Jun 24, 2024
1 parent 6e2d28a commit 4845b1b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class IncrementalShuntVoltageControlOuterLoop extends AbstractShuntVoltag
public static final String NAME = "IncrementalShuntVoltageControl";

// Maximum number of directional inversions for each controller during incremental outer loop
private static final int MAX_DIRECTION_CHANGE = 2;
private static final int MAX_DIRECTION_CHANGE = 3;

private static final double MIN_TARGET_DEADBAND_KV = 0.1; // kV

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class IncrementalTransformerReactivePowerControlOuterLoop extends Abstrac

public static final String NAME = "IncrementalTransformerReactivePowerControl";

private static final int MAX_DIRECTION_CHANGE = 2;
private static final int MAX_DIRECTION_CHANGE = 3;

private final int maxTapShift;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class IncrementalTransformerVoltageControlOuterLoop extends AbstractTrans

public static final String NAME = "IncrementalTransformerVoltageControl";

private static final int MAX_DIRECTION_CHANGE = 2;
private static final int MAX_DIRECTION_CHANGE = 3;

private final int maxTapShift;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public abstract class AbstractIncrementalPhaseControlOuterLoop<V extends Enum<V>
O extends OuterLoopContext<V, E, P, C>>
extends AbstractPhaseControlOuterLoop<V, E, P, C, O> {

public static final int MAX_DIRECTION_CHANGE = 2;
public static final int MAX_DIRECTION_CHANGE = 3;
public static final int MAX_TAP_SHIFT = Integer.MAX_VALUE;
public static final double MIN_TARGET_DEADBAND = 1 / PerUnit.SB; // 1 MW
public static final double SENSI_EPS = 1e-6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ public ControllerContext(int maxDirectionChange) {

private AllowedDirection allowedDirection = AllowedDirection.BOTH;

private Direction currentDirection;

public AllowedDirection getAllowedDirection() {
return allowedDirection;
}

public void updateAllowedDirection(Direction direction) {
if (directionChangeCount.getValue() <= maxDirectionChange) {
if (allowedDirection != direction.getAllowedDirection()) {
// both vs increase or decrease
// increase vs decrease
// decrease vs increase
if (directionChangeCount.getValue() < maxDirectionChange) {
if (currentDirection != null && currentDirection != direction) {
directionChangeCount.increment();
}
currentDirection = direction;
} else {
allowedDirection = direction.getAllowedDirection();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ void transformerReactivePowerControl2T2wtTest2() {

LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isFullyConverged());
assertReactivePowerEquals(7.436, network.getLine("LINE_12").getTerminal1());
assertReactivePowerEquals(-6.891, network.getLine("LINE_12").getTerminal2());
assertReactivePowerEquals(-3.070, t2wt.getTerminal1());
assertReactivePowerEquals(2.665, t2wt.getTerminal2());
assertReactivePowerEquals(2.462, t2wt2.getTerminal1());
assertReactivePowerEquals(-2.665, t2wt2.getTerminal2());
assertReactivePowerEquals(7.419, network.getLine("LINE_12").getTerminal1());
assertReactivePowerEquals(-6.876, network.getLine("LINE_12").getTerminal2());
assertReactivePowerEquals(-3.077, t2wt.getTerminal1());
assertReactivePowerEquals(2.672, t2wt.getTerminal2());
assertReactivePowerEquals(2.455, t2wt2.getTerminal1());
assertReactivePowerEquals(-2.660, t2wt2.getTerminal2());
assertEquals(0, t2wt.getRatioTapChanger().getTapPosition());
assertEquals(3, t2wt2.getRatioTapChanger().getTapPosition());
}
Expand Down

0 comments on commit 4845b1b

Please sign in to comment.