Skip to content

Commit

Permalink
Fix non impedant phase shifter with active power flow control activat…
Browse files Browse the repository at this point in the history
…ed (#641)

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
  • Loading branch information
geofjamg authored Feb 23, 2023
1 parent b330dad commit f3eec19
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/powsybl/openloadflow/network/LfNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ public void fix(boolean minImpedance, double lowImpedanceThreshold) {
for (LfBranch branch : branches) {
branch.setMinZ(lowImpedanceThreshold);
}
} else {
// zero impedance controller phase shifter is not supported
branches.stream()
.filter(LfBranch::isPhaseController)
.forEach(branch -> branch.setMinZ(lowImpedanceThreshold));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,14 @@ public boolean isConnectedAtBothSides() {

@Override
public void setMinZ(double lowImpedanceThreshold) {
if (piModel.setMinZ(lowImpedanceThreshold, true)) {
LOGGER.trace("Branch {} has a low impedance in DC, set to min {}", getId(), lowImpedanceThreshold);
dcZeroImpedance = false;

}
if (piModel.setMinZ(lowImpedanceThreshold, false)) {
LOGGER.trace("Branch {} has a low impedance in AC, set to min {}", getId(), lowImpedanceThreshold);
acZeroImpedance = false;
}
if (piModel.setMinZ(lowImpedanceThreshold, true)) {
LOGGER.trace("Branch {} has a low impedance in DC, set to min {}", getId(), lowImpedanceThreshold);
dcZeroImpedance = false;
}
}

private static boolean isZeroImpedanceBranch(PiModel piModel, boolean dc, double lowImpedanceThreshold) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,4 +600,34 @@ void incrementalPhaseShifterSensiTest() {
assertEquals(-43.007011829925496, di2t12p, 0d);
}
}

@Test
void activePowerflowControlAndNonImpedantPhaseShifterTest() {
selectNetwork(PhaseControlFactory.createNetworkWithT2wt());
parameters.setPhaseShifterRegulationOn(true);
t2wt.setR(0).setX(0);
t2wt.getPhaseTapChanger().setRegulationMode(PhaseTapChanger.RegulationMode.ACTIVE_POWER_CONTROL)
.setTargetDeadband(1)
.setRegulating(true)
.setTapPosition(1)
.setRegulationTerminal(t2wt.getTerminal1())
.setRegulationValue(100);

LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
assertActivePowerEquals(112.197, line2.getTerminal1());
assertActivePowerEquals(-112.019, line2.getTerminal2());
assertEquals(2, t2wt.getPhaseTapChanger().getTapPosition());

line1.setR(0).setX(0);
t2wt.setR(2.0).setX(100.0);
t2wt.getPhaseTapChanger()
.setRegulationTerminal(line1.getTerminal1())
.setTapPosition(0);

assertTrue(result.isOk());
assertActivePowerEquals(-12.006, line1.getTerminal1());
assertActivePowerEquals(112.197, line2.getTerminal1());
assertEquals(0, t2wt.getPhaseTapChanger().getTapPosition());
}
}

0 comments on commit f3eec19

Please sign in to comment.