Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Jeandemange <damien.jeandemange@artelys.com>
  • Loading branch information
jeandemanged committed Dec 17, 2024
1 parent dfac80d commit b96672c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ public Result run(LfGenerator referenceGenerator, Collection<LfBus> buses, doubl
iteration++;
}

final boolean movedBuses = Math.abs(initialP.entrySet().stream()
.mapToDouble(e -> e.getKey().getTargetP() - e.getValue()).sum()) > P_RESIDUE_EPS;
// Identify if injections moved significantly, used e.g. to establish stable/unstable outer loop status.
// The 0.9 magic factor is to handle potential rounding issues.
final boolean movedBuses = initialP.entrySet().stream()
.mapToDouble(e -> Math.abs(e.getKey().getTargetP() - e.getValue())).sum() > P_RESIDUE_EPS * 0.9;

return new Result(iteration, remainingMismatch, movedBuses);
}
Expand Down

0 comments on commit b96672c

Please sign in to comment.