Skip to content

Commit

Permalink
Update unit test to check no update on NO_CALCULATION island
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Aug 7, 2024
1 parent a455e09 commit 08b53b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void updateAcState(Network network, LoadFlowParameters parameters, OpenL
}
try {
// update network state
if (atLeastOneComponentHasToBeUpdated || parametersExt.isAlwaysUpdateNetwork()) {
if ((atLeastOneComponentHasToBeUpdated || parametersExt.isAlwaysUpdateNetwork()) && result.isSuccess()) {
var updateParameters = new LfNetworkStateUpdateParameters(parameters.isUseReactiveLimits(),
parameters.isWriteSlackBus(),
parameters.isPhaseShifterRegulationOn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void testMultipleComponents() throws IOException {
assertEquals(LfNetwork.Validity.INVALID_NO_GENERATOR_VOLTAGE_CONTROL.toString(), result.getComponentResults().get(1).getStatusText());
assertEquals(LoadFlowResult.ComponentResult.Status.NO_CALCULATION, result.getComponentResults().get(2).getStatus());
assertEquals(LfNetwork.Validity.INVALID_NO_GENERATOR.toString(), result.getComponentResults().get(2).getStatusText());
assertEquals(Double.NaN, network.getLoad("d9").getTerminal().getP()); // load on the NO_CALCULATION island connected component
LoadFlowAssert.assertReportEquals("/multipleConnectedComponentsAcReport.txt", reportNode);

// test in DC
Expand All @@ -151,6 +152,7 @@ void testMultipleComponents() throws IOException {
assertEquals("Converged", result.getComponentResults().get(1).getStatusText());
assertEquals(LoadFlowResult.ComponentResult.Status.NO_CALCULATION, result.getComponentResults().get(2).getStatus());
assertEquals(LfNetwork.Validity.INVALID_NO_GENERATOR.toString(), result.getComponentResults().get(2).getStatusText());
assertEquals(Double.NaN, network.getLoad("d9").getTerminal().getP()); // load on the NO_CALCULATION island connected component
LoadFlowAssert.assertReportEquals("/multipleConnectedComponentsDcReport.txt", reportNode);
}

Expand Down

0 comments on commit 08b53b6

Please sign in to comment.