|
14 | 14 | import com.powsybl.openloadflow.network.impl.Networks; |
15 | 15 | import com.powsybl.openloadflow.util.LoadFlowAssert; |
16 | 16 | import com.powsybl.openloadflow.util.PerUnit; |
| 17 | +import com.powsybl.openloadflow.util.report.PowsyblOpenLoadFlowReportResourceBundle; |
17 | 18 | import org.junit.jupiter.api.Test; |
18 | 19 |
|
19 | 20 | import java.io.IOException; |
@@ -357,4 +358,49 @@ void remoteAndLocalTestWithDisabling() { |
357 | 358 | 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); |
358 | 359 | assertEquals(150.0, lfNetwork.getBusById("vl1_0").getGenerationTargetQ() * PerUnit.SB); |
359 | 360 | } |
| 361 | + |
| 362 | + @Test |
| 363 | + void remoteAndLocalTestWithInconsistentTargetVoltage() throws IOException { |
| 364 | + Network network = createLocalInconsistentTargetVoltageNetwork(); |
| 365 | + Generator g2 = network.getGenerator("g2"); |
| 366 | + g2.setRegulatingTerminal(network.getLoad("ld2").getTerminal()).setTargetV(400.0); |
| 367 | + VoltageLevel vl1 = network.getVoltageLevel("vl1"); |
| 368 | + vl1.newGenerator() |
| 369 | + .setId("g3") |
| 370 | + .setBus("b1") |
| 371 | + .setConnectableBus("b1") |
| 372 | + .setEnergySource(EnergySource.THERMAL) |
| 373 | + .setMinP(0) |
| 374 | + .setMaxP(200) |
| 375 | + .setTargetP(100) |
| 376 | + .setTargetV(24) |
| 377 | + .setVoltageRegulatorOn(true) |
| 378 | + .add(); |
| 379 | + |
| 380 | + LfNetworkParameters parameters = new LfNetworkParameters() |
| 381 | + .setGeneratorVoltageRemoteControl(true); |
| 382 | + |
| 383 | + ReportNode reportNode = ReportNode.newRootReportNode() |
| 384 | + .withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME, PowsyblTestReportResourceBundle.TEST_BASE_NAME) |
| 385 | + .withMessageTemplate("testReport") |
| 386 | + .build(); |
| 387 | + List<LfNetwork> networkList = Networks.load(network, parameters, reportNode); |
| 388 | + LfNetwork lfNetwork = networkList.get(0); |
| 389 | + LfBus lfBus = lfNetwork.getBusById("vl1_0"); |
| 390 | + Optional<GeneratorVoltageControl> sharedVoltageControl = lfBus.getGeneratorVoltageControl(); |
| 391 | + assertTrue(sharedVoltageControl.isPresent()); |
| 392 | + LoadFlowAssert.assertTxtReportEquals(""" |
| 393 | + + Test Report |
| 394 | + + Network CC0 SC0 |
| 395 | + 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) |
| 396 | + Generators [g1, g2, g3] are connected to the same bus vl1_0 with different target voltages: 23 kV (kept) and 24 kV (rejected) |
| 397 | + + Network info |
| 398 | + Network has 2 buses and 1 branches |
| 399 | + Network balance: active generation=300 MW, active load=99.9 MW, reactive generation=0 MVar, reactive load=80 MVar |
| 400 | + Angle reference bus: vl1_0 |
| 401 | + Slack bus: vl1_0 |
| 402 | + """, |
| 403 | + reportNode); |
| 404 | + assertEquals(23.0, sharedVoltageControl.get().getTargetValue() * lfBus.getNominalV()); |
| 405 | + } |
360 | 406 | } |
0 commit comments