Skip to content

Remove useless ReportNode locale report and set tests locale default to stabilize report node tests #1225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2025
Merged
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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Duser.language=en -Duser.region=US</argLine>
<classpathDependencyExcludes>
<classpathDependencyExclude>com.powsybl:powsybl-config-classic</classpathDependencyExclude>
</classpathDependencyExcludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,23 @@ private static boolean switchPqPv(List<PqToPvBus> pqToPvBuses, ContextData conte

int pvPqSwitchCount = contextData.getPvPqSwitchCount(controllerBus.getId());
if (pvPqSwitchCount >= maxPqPvSwitch) {
pqPvNodes.add(Reports.reportPvPqSwitchLimit(reportNode, controllerBus, pvPqSwitchCount, log, LOGGER));
pqPvNodes.add(Reports.createRootReportPvPqSwitchLimit(reportNode, controllerBus, pvPqSwitchCount, log, LOGGER));
} else {
controllerBus.setGeneratorVoltageControlEnabled(true);
controllerBus.setGenerationTargetQ(0);
controllerBus.setQLimitType(null);
pqPvSwitchCount++;

if (pqToPvBus.limitType.isMaxLimit()) {
pqPvNodes.add(Reports.reportPqToPvBusMaxLimit(
pqPvNodes.add(Reports.createRootReportPqToPvBusMaxLimit(
reportNode,
controllerBus,
controllerBus.getGeneratorVoltageControl().map(VoltageControl::getControlledBus).orElseThrow(),
getBusTargetV(controllerBus),
log,
LOGGER));
} else {
pqPvNodes.add(Reports.reportPqToPvBusMinLimit(
pqPvNodes.add(Reports.createRootReportPqToPvBusMinLimit(
reportNode,
controllerBus,
controllerBus.getGeneratorVoltageControl().map(VoltageControl::getControlledBus).orElseThrow(),
Expand Down Expand Up @@ -345,10 +345,10 @@ private boolean switchReactiveControllerBusPq(List<ControllerBusToPqBus> reactiv

switch (bus.limitType) {
case MAX_Q:
switchedNodes.add(Reports.reportReactiveControllerBusesToPqMaxQ(reportNode, controllerBus, bus.q, bus.qLimit, log, LOGGER));
switchedNodes.add(Reports.createRootReportReactiveControllerBusesToPqMaxQ(reportNode, controllerBus, bus.q, bus.qLimit, log, LOGGER));
break;
case MIN_Q:
switchedNodes.add(Reports.reportReactiveControllerBusesToPqMinQ(reportNode, controllerBus, bus.q, bus.qLimit, log, LOGGER));
switchedNodes.add(Reports.createRootReportReactiveControllerBusesToPqMinQ(reportNode, controllerBus, bus.q, bus.qLimit, log, LOGGER));
break;
case MIN_REALISTIC_V, MAX_REALISTIC_V:
// Note: never happens for now. Robust mode applies only to remote voltage control generators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ SecurityAnalysisReport runSync(SecurityAnalysisParameters securityAnalysisParame

parameters = createParameters(lfParameters, lfParametersExt, partitionTopoConfig.isBreaker(), isAreaInterchangeControl(lfParametersExt, contingencies));

ReportNode threadRootNode = partitionNum == 0 ? saReportNode : Reports.createThreadRootReport(saReportNode);
ReportNode threadRootNode = partitionNum == 0 ? saReportNode : Reports.createRootThreadReport(saReportNode);
reportNodes.set(partitionNum, threadRootNode);

// create networks including all necessary switches
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/com/powsybl/openloadflow/util/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static ReportNode reportPqToPvBuses(ReportNode reportNode, int pqToPvBusC
.add();
}

public static ReportNode reportPvPqSwitchLimit(ReportNode firstRootReportNode, LfBus controllerBus, int limit, boolean log, Logger logger) {
public static ReportNode createRootReportPvPqSwitchLimit(ReportNode firstRootReportNode, LfBus controllerBus, int limit, boolean log, Logger logger) {
ReportNode result = ReportNode.newRootReportNode()
.withLocale(firstRootReportNode.getTreeContext().getLocale())
.withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME)
Expand All @@ -324,7 +324,7 @@ public static ReportNode reportPvPqSwitchLimit(ReportNode firstRootReportNode, L
return result;
}

public static ReportNode reportPqToPvBusMaxLimit(ReportNode firstRootReportNode, LfBus controllerBus, LfBus controlledBus, double targetV, boolean log, Logger logger) {
public static ReportNode createRootReportPqToPvBusMaxLimit(ReportNode firstRootReportNode, LfBus controllerBus, LfBus controlledBus, double targetV, boolean log, Logger logger) {
ReportNode result = ReportNode.newRootReportNode()
.withLocale(firstRootReportNode.getTreeContext().getLocale())
.withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME)
Expand All @@ -342,7 +342,7 @@ public static ReportNode reportPqToPvBusMaxLimit(ReportNode firstRootReportNode,
return result;
}

public static ReportNode reportPqToPvBusMinLimit(ReportNode firstRootReportNode, LfBus controllerBus, LfBus controlledBus, double targetV, boolean log, Logger logger) {
public static ReportNode createRootReportPqToPvBusMinLimit(ReportNode firstRootReportNode, LfBus controllerBus, LfBus controlledBus, double targetV, boolean log, Logger logger) {
ReportNode result = ReportNode.newRootReportNode()
.withLocale(firstRootReportNode.getTreeContext().getLocale())
.withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME)
Expand Down Expand Up @@ -384,12 +384,12 @@ public static ReportNode reportReactiveControllerBusesToPqBuses(ReportNode repor
.add();
}

public static ReportNode reportReactiveControllerBusesToPqMaxQ(ReportNode firstRootReportNode,
LfBus controllerBus,
double busQ,
double maxQ,
boolean log,
Logger logger) {
public static ReportNode createRootReportReactiveControllerBusesToPqMaxQ(ReportNode firstRootReportNode,
LfBus controllerBus,
double busQ,
double maxQ,
boolean log,
Logger logger) {
ReportNode result = ReportNode.newRootReportNode()
.withLocale(firstRootReportNode.getTreeContext().getLocale())
.withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME)
Expand All @@ -405,12 +405,12 @@ public static ReportNode reportReactiveControllerBusesToPqMaxQ(ReportNode firstR
return result;
}

public static ReportNode reportReactiveControllerBusesToPqMinQ(ReportNode firstRootReportNode,
LfBus controllerBus,
double busQ,
double minQ,
boolean log,
Logger logger) {
public static ReportNode createRootReportReactiveControllerBusesToPqMinQ(ReportNode firstRootReportNode,
LfBus controllerBus,
double busQ,
double minQ,
boolean log,
Logger logger) {
ReportNode result = ReportNode.newRootReportNode()
.withLocale(firstRootReportNode.getTreeContext().getLocale())
.withResourceBundles(PowsyblOpenLoadFlowReportResourceBundle.BASE_NAME)
Expand Down Expand Up @@ -895,7 +895,7 @@ public static void reportActionApplicationFailure(String actionId, String contin
.add();
}

public static ReportNode createThreadRootReport(ReportNode firstRootReport) {
public static ReportNode createRootThreadReport(ReportNode firstRootReport) {
return ReportNode.newRootReportNode()
.withLocale(firstRootReport.getTreeContext().getLocale())
.withAllResourceBundlesFromClasspath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.EnumSet;
import java.util.List;
import java.util.OptionalDouble;
import java.util.Set;
import java.util.*;
import java.util.concurrent.CompletionException;

import static com.powsybl.openloadflow.util.LoadFlowAssert.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.concurrent.CompletionException;
import java.util.stream.Stream;

Expand Down
1 change: 0 additions & 1 deletion src/test/resources/i18n/reports_en.properties

This file was deleted.