Skip to content
Open
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 @@ -157,7 +157,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 @@ -229,10 +230,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 @@ -357,4 +357,42 @@ 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() {
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()
.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.assertReportContains(
".*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\\).*",
reportNode);
LoadFlowAssert.assertReportContains(
".*Generators \\[g1\\, g2\\, g3\\] are connected to the same bus vl1\\_0 with different target voltages: 23\\.0 kV \\(kept\\) and 24\\.0 kV \\(rejected\\).*",
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