Skip to content

Commit

Permalink
add missing units in reports
Browse files Browse the repository at this point in the history
Signed-off-by: Caio Luke <caioluke97@gmail.com>
  • Loading branch information
cluke authored and caioluke committed Apr 29, 2024
1 parent f9d26b2 commit ea8403a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private static boolean checkUniqueControlledSide(GeneratorReactivePowerControl g
if (!side.equals(generatorReactivePowerControl.getControlledSide())) {
LOGGER.error("Controlled branch '{}' is controlled at both sides. Controlled side {} (kept) {} (rejected).",
generatorReactivePowerControl.getControlledBranch().getId(), generatorReactivePowerControl.getControlledSide(), side);
Reports.reportBranchControlledAtBothSides(reportNode, generatorReactivePowerControl.getControlledBranch().getId(), generatorReactivePowerControl.getControlledSide(), side);
Reports.reportBranchControlledAtBothSides(reportNode, generatorReactivePowerControl.getControlledBranch().getId(), String.valueOf(generatorReactivePowerControl.getControlledSide()), String.valueOf(side));
return false;
}
return true;
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/powsybl/openloadflow/util/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import com.powsybl.commons.report.ReportNode;
import com.powsybl.commons.report.TypedValue;
import com.powsybl.iidm.network.TwoSides;
import com.powsybl.openloadflow.OpenLoadFlowReportConstants;

import java.util.Map;
Expand Down Expand Up @@ -53,7 +52,7 @@ public static void reportNetworkBalance(ReportNode reportNode, double activeGene

public static void reportNotUniqueTargetVControllerBus(ReportNode reportNode, String generatorIds, String controllerBusId, Double keptTargetV, Double rejectedTargetV) {
reportNode.newReportNode()
.withMessageTemplate("notUniqueTargetVControllerBus", "Generators [${generatorIds}] are connected to the same bus ${controllerBusId} with different target voltages: ${keptTargetV} (kept) and ${rejectedTargetV} (rejected)")
.withMessageTemplate("notUniqueTargetVControllerBus", "Generators [${generatorIds}] are connected to the same bus ${controllerBusId} with different target voltages: ${keptTargetV} kV (kept) and ${rejectedTargetV} kV (rejected)")
.withTypedValue("generatorIds", generatorIds, "Generator ids")
.withTypedValue("controllerBusId", controllerBusId, "Controller bus id")
.withTypedValue("keptTargetV", keptTargetV, "Kept target V")
Expand All @@ -73,7 +72,7 @@ public static void reportControllerShuntAlreadyInVoltageControl(ReportNode repor

public static void reportBusAlreadyControlledWithDifferentTargetV(ReportNode reportNode, String controllerBusId, String controlledBusId, String busesId, Double keptTargetV, Double ignoredTargetV) {
reportNode.newReportNode()
.withMessageTemplate("busAlreadyControlledWithDifferentTargetV", "Bus ${controllerBusId} controls voltage of bus ${controlledBusId} which is already controlled by buses [${busesId}] with a different target voltage: ${keptTargetV} (kept) and ${ignoredTargetV} (ignored)")
.withMessageTemplate("busAlreadyControlledWithDifferentTargetV", "Bus ${controllerBusId} controls voltage of bus ${controlledBusId} which is already controlled by buses [${busesId}] with a different target voltage: ${keptTargetV} kV (kept) and ${ignoredTargetV} kV (ignored)")
.withTypedValue("controllerBusId", controllerBusId, "Controller bus id")
.withTypedValue("controlledBusId", controlledBusId, "Controlled bus id")
.withTypedValue("busesId", busesId, "Buses id")
Expand All @@ -83,12 +82,12 @@ public static void reportBusAlreadyControlledWithDifferentTargetV(ReportNode rep
.add();
}

public static void reportBranchControlledAtBothSides(ReportNode reportNode, String controlledBranchId, TwoSides keptSide, TwoSides rejectedSide) {
public static void reportBranchControlledAtBothSides(ReportNode reportNode, String controlledBranchId, String keptSide, String rejectedSide) {
reportNode.newReportNode()
.withMessageTemplate("branchControlledAtBothSides", "Controlled branch ${controlledBranchId} is controlled at both sides. Controlled side ${keptSide} (kept) ${rejectedSide} (rejected).")
.withMessageTemplate("branchControlledAtBothSides", "Controlled branch ${controlledBranchId} is controlled at both sides. Controlled side ${keptSide} (kept) side ${rejectedSide} (rejected).")
.withTypedValue("controlledBranchId", controlledBranchId, "Controlled branch id")
.withTypedValue("keptSide", String.valueOf(keptSide), "Kept side")
.withTypedValue("rejectedSide", String.valueOf(rejectedSide), "Rejected side")
.withTypedValue("keptSide", keptSide, "Kept side")
.withTypedValue("rejectedSide", rejectedSide, "Rejected side")
.withSeverity(TypedValue.ERROR_SEVERITY)
.add();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+ Test Report
+ Network CC0 SC0
Bus vl1_0 controls voltage of bus vl2_0 which is already controlled by buses [vl2_0, vl1_0] with a different target voltage: 412.0 (kept) and 413.0 (ignored)
Bus vl1_0 controls voltage of bus vl2_0 which is already controlled by buses [vl2_0, vl1_0] with a different target voltage: 412.0 kV (kept) and 413.0 kV (ignored)
+ Network info
Network has 3 buses and 2 branches
Network balance: active generation=200.0 MW, active load=99.9 MW, reactive generation=0.0 MVar, reactive load=80.0 MVar
2 changes: 1 addition & 1 deletion src/test/resources/notUniqueTargetVControllerBusReport.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+ Test Report
+ Network CC0 SC0
Generators [g1, g2] are connected to the same bus vl1_0 with different target voltages: 23.0 (kept) and 22.0 (rejected)
Generators [g1, g2] are connected to the same bus vl1_0 with different target voltages: 23.0 kV (kept) and 22.0 kV (rejected)
+ Network info
Network has 2 buses and 1 branches
Network balance: active generation=200.0 MW, active load=99.9 MW, reactive generation=0.0 MVar, reactive load=80.0 MVar
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+ Test Report
+ Load flow on network 'test'
+ Network CC0 SC0
Controlled branch l34 is controlled at both sides. Controlled side TWO (kept) ONE (rejected).
Controlled branch l34 is controlled at both sides. Controlled side TWO (kept) side ONE (rejected).
+ Network info
Network has 4 buses and 5 branches
Network balance: active generation=3.0 MW, active load=5.0 MW, reactive generation=0.0 MVar, reactive load=0.0 MVar
Expand Down

0 comments on commit ea8403a

Please sign in to comment.