Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/com/powsybl/openloadflow/util/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.slf4j.Logger;

import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
Expand Down Expand Up @@ -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))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right way to solve this issue because you lost the value type (double -> String) in the report model just for testing purpose.
This PR will provide a better way to handle this.

.withUntypedValue("distributed", String.format(Locale.UK, "%.2f", mismatch - remaining))
.withUntypedValue("remaining", String.format(Locale.UK, "%.2f", remaining))
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/saReport.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down