Skip to content

Commit

Permalink
Fix to take into account alwaysUpdateNetwork parameter
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 ff7b8bb commit 6ce973e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private void updateAcState(Network network, LoadFlowParameters parameters, OpenL
}
try {
// update network state
if ((atLeastOneComponentHasToBeUpdated || parametersExt.isAlwaysUpdateNetwork()) && result.isSuccess()) {
if (atLeastOneComponentHasToBeUpdated && result.isSuccess()
|| parametersExt.isAlwaysUpdateNetwork()) {
var updateParameters = new LfNetworkStateUpdateParameters(parameters.isUseReactiveLimits(),
parameters.isWriteSlackBus(),
parameters.isPhaseShifterRegulationOn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void testAlwaysUpdateNetwork() {
Network network = EurostagFactory.fix(EurostagTutorialExample1Factory.create());
var nload = network.getBusBreakerView().getBus("NLOAD");
LoadFlow.Runner loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory()));
loadFlowRunner.run(network, parameters);
result = loadFlowRunner.run(network, parameters);
assertTrue(Double.isNaN(nload.getV()));

// Check the network is updated if alwaysUpdateNetwork = true and final status = MAX_ITERATION_REACHED
Expand Down

0 comments on commit 6ce973e

Please sign in to comment.