Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ private static void checkAndCreateVoltageControl(LfBus controllerBus,
.anyMatch(lfGenerator -> !checkUniqueControlledBus(controlledBus, lfGenerator.getControlledBus(), controllerBus, parameters.isDisableInconsistentVoltageControls()));

// Check if target voltage is the same for the generators of current controller bus which have voltage control on
boolean inconsistentTargetVoltages = !inconsistentControlledBus && voltageControlGenerators.stream().skip(1)
boolean inconsistentTargetVoltages = voltageControlGenerators.stream().skip(1)
.filter(lfGenerator -> Objects.equals(lfGenerator.getControlledBus(), controlledBus))
.anyMatch(lfGenerator -> !checkUniqueTargetVControllerBus(lfGenerator, controllerTargetV, controllerBus, lfGenerator.getControlledBus(), parameters.isDisableInconsistentVoltageControls()));

if (parameters.isDisableInconsistentVoltageControls() && (inconsistentControlledBus || inconsistentTargetVoltages)) {
Expand Down Expand Up @@ -248,10 +249,10 @@ private static void checkUniqueTargetVControlledBus(double controllerTargetV, Lf
if (deltaTargetV * controlledBus.getNominalV() > TARGET_V_EPSILON) {
String busesId = vc.getControllerElements().stream().map(LfBus::getId).collect(Collectors.joining(", "));
LOGGER.error("Bus '{}' control voltage of bus '{}' which is already controlled by buses '{}' with a different target voltage: {} (kept) and {} (ignored)",
controllerBus.getId(), controlledBus.getId(), busesId, controllerTargetV * controlledBus.getNominalV(),
voltageControlTargetV * controlledBus.getNominalV());
Reports.reportBusAlreadyControlledWithDifferentTargetV(controllerBus.getNetwork().getReportNode(), controllerBus.getId(), controlledBus.getId(), busesId, controllerTargetV * controlledBus.getNominalV(),
voltageControlTargetV * controlledBus.getNominalV());
controllerBus.getId(), controlledBus.getId(), busesId, voltageControlTargetV * controlledBus.getNominalV(),
controllerTargetV * controlledBus.getNominalV());
Reports.reportBusAlreadyControlledWithDifferentTargetV(controllerBus.getNetwork().getReportNode(), controllerBus.getId(), controlledBus.getId(), busesId, voltageControlTargetV * controlledBus.getNominalV(),
controllerTargetV * controlledBus.getNominalV());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.powsybl.openloadflow.network.impl.Networks;
import com.powsybl.openloadflow.util.LoadFlowAssert;
import com.powsybl.openloadflow.util.PerUnit;
import com.powsybl.openloadflow.util.report.PowsyblOpenLoadFlowReportResourceBundle;
import org.junit.jupiter.api.Test;

import java.io.IOException;
Expand Down Expand Up @@ -357,4 +358,49 @@ void remoteAndLocalTestWithDisabling() {
LoadFlowAssert.assertReportContains(".*Generators \\[g1\\, g2\\] are connected to the same bus vl1\\_0 but control the voltage of different buses \\(vl1\\_0 and vl2\\_0\\)\\: disabling voltage control", reportNode);
assertEquals(150.0, lfNetwork.getBusById("vl1_0").getGenerationTargetQ() * PerUnit.SB);
}

@Test
void remoteAndLocalTestWithInconsistentTargetVoltage() throws IOException {
Network network = createLocalInconsistentTargetVoltageNetwork();
Generator g2 = network.getGenerator("g2");
g2.setRegulatingTerminal(network.getLoad("ld2").getTerminal()).setTargetV(400.0);
VoltageLevel vl1 = network.getVoltageLevel("vl1");
vl1.newGenerator()
.setId("g3")
.setBus("b1")
.setConnectableBus("b1")
.setEnergySource(EnergySource.THERMAL)
.setMinP(0)
.setMaxP(200)
.setTargetP(100)
.setTargetV(24)
.setVoltageRegulatorOn(true)
.add();

LfNetworkParameters parameters = new LfNetworkParameters()
.setGeneratorVoltageRemoteControl(true);

ReportNode reportNode = ReportNode.newRootReportNode()
.withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME, PowsyblTestReportResourceBundle.TEST_BASE_NAME)
.withMessageTemplate("testReport")
.build();
List<LfNetwork> networkList = Networks.load(network, parameters, reportNode);
LfNetwork lfNetwork = networkList.get(0);
LfBus lfBus = lfNetwork.getBusById("vl1_0");
Optional<GeneratorVoltageControl> sharedVoltageControl = lfBus.getGeneratorVoltageControl();
assertTrue(sharedVoltageControl.isPresent());
LoadFlowAssert.assertTxtReportEquals("""
+ Test Report
+ Network CC0 SC0
Generators [g1, g2, g3] are connected to the same bus vl1_0 but control the voltage of different buses: vl1_0 (kept) and vl2_0 (rejected)
Generators [g1, g2, g3] are connected to the same bus vl1_0 with different target voltages: 23 kV (kept) and 24 kV (rejected)
+ Network info
Network has 2 buses and 1 branches
Network balance: active generation=300 MW, active load=99.9 MW, reactive generation=0 MVar, reactive load=80 MVar
Angle reference bus: vl1_0
Slack bus: vl1_0
""",
reportNode);
assertEquals(23.0, sharedVoltageControl.get().getTargetValue() * lfBus.getNominalV());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+ Test Report
+ Network CC0 SC0
Bus vl1_0 controls voltage of bus vl2_0 which is already controlled by buses [vl2_0, vl1_0] with a different target voltage: 412 kV (kept) and 413 kV (ignored)
Bus vl1_0 controls voltage of bus vl2_0 which is already controlled by buses [vl2_0, vl1_0] with a different target voltage: 413 kV (kept) and 412 kV (ignored)
+ Network info
Network has 3 buses and 2 branches
Network balance: active generation=200 MW, active load=99.9 MW, reactive generation=0 MVar, reactive load=80 MVar
Expand Down
Loading