Skip to content

Commit

Permalink
Remove starting generators from voltage control (#587)
Browse files Browse the repository at this point in the history
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
  • Loading branch information
annetill authored Aug 17, 2022
1 parent 5f8ebc2 commit 8b5b581
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public abstract class AbstractLfGenerator extends AbstractPropertyBag implements

private static final double POWER_EPSILON_SI = 1e-4;

private static final double TARGET_P_EPSILON = 1e-2;

protected static final double DEFAULT_DROOP = 4; // why not

protected double targetP;
Expand Down Expand Up @@ -206,11 +204,16 @@ protected boolean checkVoltageControlConsistency(boolean reactiveLimits, LfNetwo
consistency = false;
}
}
if (Math.abs(getTargetP()) < POWER_EPSILON_SI && getMinP() > POWER_EPSILON_SI) {
if (Math.abs(getTargetP()) < POWER_EPSILON_SI && getMinP() > 0) {
LOGGER.trace("Discard generator '{}' from voltage control because not started (targetP={} MW, minP={} MW)", getId(), getTargetP(), getMinP());
report.generatorsDiscardedFromVoltageControlBecauseNotStarted++;
consistency = false;
}
if (getTargetP() < getMinP() && getMinP() > 0) {
LOGGER.trace("Discard starting generator '{}' from voltage control (targetP={} MW, minP={} MW)", getId(), getTargetP(), getMinP());
report.generatorsDiscardedFromVoltageControlBecauseStarting++;
consistency = false;
}
return consistency;
}

Expand Down Expand Up @@ -276,7 +279,7 @@ public void setParticipating(boolean participating) {
protected boolean checkActivePowerControl(double targetP, double minP, double maxP, double plausibleActivePowerLimit,
LfNetworkLoadingReport report) {
boolean participating = true;
if (Math.abs(targetP) < TARGET_P_EPSILON) {
if (Math.abs(targetP) < POWER_EPSILON_SI) {
LOGGER.trace("Discard generator '{}' from active power control because targetP ({}) equals 0",
getId(), targetP);
report.generatorsDiscardedFromActivePowerControlBecauseTargetEqualsToZero++;
Expand All @@ -288,7 +291,7 @@ protected boolean checkActivePowerControl(double targetP, double minP, double ma
report.generatorsDiscardedFromActivePowerControlBecauseTargetPGreaterThanMaxP++;
participating = false;
}
if (targetP < minP) {
if (targetP < minP && minP > 0) {
LOGGER.trace("Discard generator '{}' from active power control because targetP ({}) < minP ({})",
getId(), targetP, minP);
report.generatorsDiscardedFromActivePowerControlBecauseTargetPLowerThanMinP++;
Expand All @@ -300,7 +303,7 @@ protected boolean checkActivePowerControl(double targetP, double minP, double ma
report.generatorsDiscardedFromActivePowerControlBecauseMaxPNotPlausible++;
participating = false;
}
if ((maxP - minP) < TARGET_P_EPSILON) {
if ((maxP - minP) < POWER_EPSILON_SI) {
LOGGER.trace("Discard generator '{}' from active power control because maxP ({} MW) equals minP ({} MW)",
getId(), maxP, minP);
report.generatorsDiscardedFromActivePowerControlBecauseMaxPEqualsMinP++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ private static LfNetwork create(int numCC, int numSC, List<Bus> buses, List<Swit
LOGGER.warn("Network {}: {} generators have been discarded from voltage control because not started",
lfNetwork, report.generatorsDiscardedFromVoltageControlBecauseNotStarted);
}
if (report.generatorsDiscardedFromVoltageControlBecauseStarting > 0) {
Reports.reportGeneratorsDiscardedFromVoltageControlBecauseStarting(reporter, report.generatorsDiscardedFromVoltageControlBecauseStarting);
LOGGER.warn("Network {}: {} starting generators have been discarded from voltage control",
lfNetwork, report.generatorsDiscardedFromVoltageControlBecauseStarting);
}
if (report.generatorsDiscardedFromVoltageControlBecauseMaxReactiveRangeIsTooSmall > 0) {
Reports.reportGeneratorsDiscardedFromVoltageControlBecauseMaxReactiveRangeIsTooSmall(reporter, report.generatorsDiscardedFromVoltageControlBecauseMaxReactiveRangeIsTooSmall);
LOGGER.warn("Network {}: {} generators have been discarded from voltage control because of a too small max reactive range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class LfNetworkLoadingReport {

int generatorsDiscardedFromVoltageControlBecauseNotStarted = 0;

int generatorsDiscardedFromVoltageControlBecauseStarting = 0;

int generatorsDiscardedFromVoltageControlBecauseMaxReactiveRangeIsTooSmall = 0;

int generatorsDiscardedFromActivePowerControlBecauseTargetEqualsToZero = 0;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/powsybl/openloadflow/util/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ public static void reportGeneratorsDiscardedFromVoltageControlBecauseNotStarted(
.build());
}

public static void reportGeneratorsDiscardedFromVoltageControlBecauseStarting(Reporter reporter, int impactedGeneratorCount) {
reporter.report(Report.builder()
.withKey("generatorsDiscardedFromVoltageControlBecauseStarting")
.withDefaultMessage("${impactedGeneratorCount} starting generators have been discarded from voltage control")
.withValue("impactedGeneratorCount", impactedGeneratorCount)
.build());
}

public static void reportGeneratorsDiscardedFromVoltageControlBecauseMaxReactiveRangeIsTooSmall(Reporter reporter, int impactedGeneratorCount) {
reporter.report(Report.builder()
.withKey("generatorsDiscardedFromVoltageControlBecauseMaxReactiveRangeIsTooSmall")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ void testWithDisconnectedGenerator() {
.setBus(loadBus.getId())
.setConnectableBus(loadBus.getId())
.setEnergySource(EnergySource.THERMAL)
.setMinP(10)
.setMinP(1)
.setMaxP(200)
.setTargetP(1)
.setTargetV(150)
Expand Down Expand Up @@ -454,4 +454,23 @@ void testGeneratorsConnectedToSameBusNotControllingSameBus() {
assertVoltageEquals(24.5, network.getBusBreakerView().getBus("NGEN"));
assertVoltageEquals(147.57, network.getBusBreakerView().getBus("NLOAD"));
}

@Test
void testWithStartingGenerator() {
loadFlowRunner.run(network, parameters);
gen.getTerminal().disconnect();
loadBus.getVoltageLevel().newGenerator()
.setId("g1")
.setBus(loadBus.getId())
.setConnectableBus(loadBus.getId())
.setEnergySource(EnergySource.THERMAL)
.setMinP(10)
.setMaxP(200)
.setTargetP(1)
.setTargetV(150)
.setVoltageRegulatorOn(true)
.add();
LoadFlowResult result = loadFlowRunner.run(network, parameters);
assertFalse(result.isOk()); // no voltage controlled bus
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ void generatorWithMaxPEqualsToMinP() {
Network network = EurostagTutorialExample1Factory.create();
network.getGenerator("GEN").setMaxP(1000);
network.getGenerator("GEN").setMinP(1000);
network.getGenerator("GEN").setTargetP(1000);
assertThrows(CompletionException.class, () -> loadFlowRunner.run(network, parameters),
"Failed to distribute slack bus active power mismatch, -1.4404045651214226 MW remains");
"Failed to distribute slack bus active power mismatch, -393.367476483181 MW remains");
}

@Test
Expand Down Expand Up @@ -182,6 +183,17 @@ void generatorWithTargetPLowerThanMinP() {
network.getGenerator("GEN").setMaxP(1000);
network.getGenerator("GEN").setMinP(200);
network.getGenerator("GEN").setTargetP(100);
network.getVoltageLevel("VLGEN").newGenerator()
.setId("g1")
.setBus("NGEN")
.setConnectableBus("NGEN")
.setEnergySource(EnergySource.THERMAL)
.setMinP(0)
.setMaxP(0)
.setTargetP(0)
.setTargetV(24.5)
.setVoltageRegulatorOn(true)
.add();
assertThrows(CompletionException.class, () -> loadFlowRunner.run(network, parameters),
"Failed to distribute slack bus active power mismatch, 504.9476825313616 MW remains");
}
Expand Down

0 comments on commit 8b5b581

Please sign in to comment.