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

Fixed PST Flow Regulation on non impedant branch causing exception #816

Merged
merged 10 commits into from
Jul 18, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,9 @@ public void fix(boolean minImpedance, double lowImpedanceThreshold) {
}
} else {
// zero impedance controller phase shifter is not supported
// zero impedance controlled branch is not supported
jeandemanged marked this conversation as resolved.
Show resolved Hide resolved
branches.stream()
.filter(LfBranch::isPhaseController)
.filter(b -> b.isPhaseController() || b.isPhaseControlled())
.forEach(branch -> branch.setMinZ(lowImpedanceThreshold));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ public void setMinZ(double lowImpedanceThreshold) {
if (piModel.setMinZ(lowImpedanceThreshold, loadFlowModel)) {
LOGGER.trace("Branch {} has a low impedance in {}, set to min {}", getId(), loadFlowModel, lowImpedanceThreshold);
zeroImpedanceContextByModel.get(loadFlowModel).zeroImpedance = false;
} else if (isZeroImpedance(loadFlowModel)) {
annetill marked this conversation as resolved.
Show resolved Hide resolved
// For DC load flow model, the min impedance has already been set by AC load flow model but
// the zero impedance field was not updated.
zeroImpedanceContextByModel.get(loadFlowModel).zeroImpedance = false;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,24 @@ void remoteFlowControlT2wtTest() {
assertEquals(0, t2wt.getPhaseTapChanger().getTapPosition());
}

@Test
void remoteFlowControlOnZeroImpedanceBranch() {
jeandemanged marked this conversation as resolved.
Show resolved Hide resolved
selectNetwork(PhaseControlFactory.createNetworkWithT2wt());
parameters.setPhaseShifterRegulationOn(true);
t2wt.getPhaseTapChanger().setRegulationMode(PhaseTapChanger.RegulationMode.ACTIVE_POWER_CONTROL)
.setTargetDeadband(1)
.setRegulating(true)
.setTapPosition(2)
.setRegulationTerminal(line1.getTerminal1())
.setRegulationValue(83);
line1.setR(0).setX(0).setG1(0).setG2(0).setB1(0).setB2(0);
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertTrue(result.isOk());
assertActivePowerEquals(100.0, line1.getTerminal1());
assertActivePowerEquals(0.0, line2.getTerminal1());
assertEquals(1, t2wt.getPhaseTapChanger().getTapPosition());
}

@Test
void currentLimiterT2wtTest() {
selectNetwork(PhaseControlFactory.createNetworkWithT2wt());
Expand Down Expand Up @@ -621,15 +639,16 @@ void activePowerflowControlAndNonImpedantPhaseShifterTest() {
assertActivePowerEquals(-112.019, line2.getTerminal2());
assertEquals(2, t2wt.getPhaseTapChanger().getTapPosition());

line1.setR(0).setX(0);
line1.setR(0.0).setX(0.0);
t2wt.setR(2.0).setX(100.0);
t2wt.getPhaseTapChanger()
.setRegulationTerminal(line1.getTerminal1())
.setTapPosition(0);
LoadFlowResult result2 = loadFlowRunner.run(network, parameters);

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