Skip to content

Commit c8b3a56

Browse files
Modify Report
Signed-off-by: PRABAKARAN Sylvestre <[email protected]>
1 parent 14e1757 commit c8b3a56

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/main/java/com/powsybl/openloadflow/ac/outerloop/DistributedSlackOuterLoop.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ public OuterLoopResult check(AcOuterLoopContext context, ReportNode reportNode)
7777
);
7878
double remainingMismatch = resultWbh.remainingMismatch();
7979
double distributedActivePower = slackBusActivePowerMismatch - remainingMismatch;
80-
if (Math.abs(remainingMismatch) > ActivePowerDistribution.P_RESIDUE_EPS) {
80+
if (Math.abs(remainingMismatch) > slackBusPMaxMismatch / PerUnit.SB) {
8181
Reports.reportMismatchDistributionFailure(iterationReportNode, remainingMismatch * PerUnit.SB);
8282
} else {
83+
if (Math.abs(remainingMismatch) > ActivePowerDistribution.P_RESIDUE_EPS) {
84+
Reports.reportResidualDistributionMismatch(reportNode, remainingMismatch * PerUnit.SB);
85+
}
8386
ActivePowerDistribution.reportAndLogSuccess(iterationReportNode, slackBusActivePowerMismatch, resultWbh);
8487
}
8588
DistributedSlackContextData contextData = (DistributedSlackContextData) context.getData();

src/main/java/com/powsybl/openloadflow/dc/DcLoadFlowEngine.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,12 @@ public DcLoadFlowResult run() {
228228
);
229229
double remainingMismatch = resultWbh.remainingMismatch();
230230
distributedActivePower = initialSlackBusActivePowerMismatch - remainingMismatch;
231-
if (Math.abs(remainingMismatch) > ActivePowerDistribution.P_RESIDUE_EPS) {
231+
if (Math.abs(remainingMismatch) > context.getParameters().getSlackBusPMaxMismatch()) {
232232
Reports.reportMismatchDistributionFailure(reportNode, remainingMismatch * PerUnit.SB);
233233
} else {
234+
if (Math.abs(remainingMismatch) > ActivePowerDistribution.P_RESIDUE_EPS) {
235+
Reports.reportResidualDistributionMismatch(reportNode, remainingMismatch * PerUnit.SB);
236+
}
234237
ActivePowerDistribution.reportAndLogSuccess(reportNode, initialSlackBusActivePowerMismatch, resultWbh);
235238
}
236239
if (resultWbh.failed()) {

src/main/java/com/powsybl/openloadflow/util/Reports.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,15 @@ public static void reportMismatchDistributionFailure(ReportNode reportNode, doub
162162
reportNode.newReportNode()
163163
.withMessageTemplate("mismatchDistributionFailure", "Failed to distribute slack bus active power mismatch, ${mismatch} MW remains")
164164
.withTypedValue(MISMATCH, remainingMismatch, OpenLoadFlowReportConstants.MISMATCH_TYPED_VALUE)
165-
.withSeverity(TypedValue.ERROR_SEVERITY)
165+
.withSeverity(TypedValue.WARN_SEVERITY)
166+
.add();
167+
}
168+
169+
public static void reportResidualDistributionMismatch(ReportNode reportNode, double remainingMismatch) {
170+
reportNode.newReportNode()
171+
.withMessageTemplate("residualDistributionMismatch", "Remaining residual slack bus active power mismatch after active power distribution, ${mismatch} MW remains")
172+
.withTypedValue(MISMATCH, remainingMismatch, OpenLoadFlowReportConstants.MISMATCH_TYPED_VALUE)
173+
.withSeverity(TypedValue.DEBUG_SEVERITY)
166174
.add();
167175
}
168176

0 commit comments

Comments
 (0)