From 3a95c4122289e659be8fcdb8eca5c137c691fa0e Mon Sep 17 00:00:00 2001 From: vmouradian Date: Mon, 24 Feb 2025 12:02:34 +0100 Subject: [PATCH] Round reports for SA power distribution to 2 digits Signed-off-by: vmouradian --- src/main/java/com/powsybl/openloadflow/util/Reports.java | 7 ++++--- src/test/resources/saReport.txt | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/powsybl/openloadflow/util/Reports.java b/src/main/java/com/powsybl/openloadflow/util/Reports.java index 5a8beae6b2..f32a75f81d 100644 --- a/src/main/java/com/powsybl/openloadflow/util/Reports.java +++ b/src/main/java/com/powsybl/openloadflow/util/Reports.java @@ -13,6 +13,7 @@ import org.slf4j.Logger; import java.util.List; +import java.util.Locale; import java.util.Map; /** @@ -697,9 +698,9 @@ public static void reportAcEmulationDisabledInWoodburyDcSecurityAnalysis(ReportN public static void reportContingencyActivePowerLossDistribution(ReportNode reportNode, double mismatch, double remaining) { reportNode.newReportNode() .withMessageTemplate("contingencyActivePowerLossDistribution", "Contingency caused the loss of ${mismatch} MW injection: ${distributed} MW distributed, ${remaining} MW remaining.") - .withUntypedValue(MISMATCH, mismatch) - .withUntypedValue("distributed", mismatch - remaining) - .withUntypedValue("remaining", remaining) + .withUntypedValue(MISMATCH, String.format(Locale.UK, "%.2f", mismatch)) + .withUntypedValue("distributed", String.format(Locale.UK, "%.2f", mismatch - remaining)) + .withUntypedValue("remaining", String.format(Locale.UK, "%.2f", remaining)) .withSeverity(TypedValue.INFO_SEVERITY) .add(); } diff --git a/src/test/resources/saReport.txt b/src/test/resources/saReport.txt index f4a934e80b..49b9ef8fda 100644 --- a/src/test/resources/saReport.txt +++ b/src/test/resources/saReport.txt @@ -37,11 +37,11 @@ Outer loop ReactiveLimits AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + Post-contingency simulation 'NGEN_NHV1' - Contingency caused the loss of 605.559595434878 MW injection: 0.0 MW distributed, 605.559595434878 MW remaining. + Contingency caused the loss of 605.56 MW injection: 0.00 MW distributed, 605.56 MW remaining. Network must have at least one bus with generator voltage control enabled AC load flow completed with error (solverStatus=SOLVER_FAILED, outerloopStatus=STABLE) + Post-contingency simulation 'NHV2_NLOAD' - Contingency caused the loss of -600.0 MW injection: -600.0 MW distributed, 0.0 MW remaining. + Contingency caused the loss of -600.00 MW injection: -600.00 MW distributed, 0.00 MW remaining. + Outer loop DistributedSlack + Outer loop iteration 1 Slack bus active power (-5.4942194604343655 MW) distributed in 1 distribution iteration(s)