Skip to content
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

Fix non impedant phase shifter with active power flow control activated #641

Merged
merged 12 commits into from
Feb 23, 2023
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());
}
}