Skip to content

Commit

Permalink
fix(reports): wording
Browse files Browse the repository at this point in the history
Signed-off-by: Joris Mancini <[email protected]>
  • Loading branch information
TheMaskedTurtle committed Feb 7, 2024
1 parent c559efa commit 7bc0cb9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static OpenReacResult run(Network network, String variantId, OpenReacPara
public static OpenReacResult run(Network network, String variantId, OpenReacParameters parameters, OpenReacConfig config, ComputationManager manager, Reporter reporter) {
checkParameters(network, variantId, parameters, config, manager, reporter);
AmplModel reactiveOpf = OpenReacModel.buildModel();
OpenReacAmplIOFiles amplIoInterface = new OpenReacAmplIOFiles(parameters, network, config.isDebug(), Reports.createVoltageInitReporter(reporter, network.getId()));
OpenReacAmplIOFiles amplIoInterface = new OpenReacAmplIOFiles(parameters, network, config.isDebug(), Reports.createOpenReacReporter(reporter, network.getId(), parameters.getObjective()));
AmplResults run = AmplModelRunner.run(network, variantId, reactiveOpf, manager, amplIoInterface);
return new OpenReacResult(run.isSuccess() && amplIoInterface.checkErrors() ? OpenReacStatus.OK : OpenReacStatus.NOT_OK,
amplIoInterface, run.getIndicators());
Expand Down Expand Up @@ -94,7 +94,7 @@ public static CompletableFuture<OpenReacResult> runAsync(Network network, String
public static CompletableFuture<OpenReacResult> runAsync(Network network, String variantId, OpenReacParameters parameters, OpenReacConfig config, ComputationManager manager, Reporter reporter) {
checkParameters(network, variantId, parameters, config, manager, reporter);
AmplModel reactiveOpf = OpenReacModel.buildModel();
OpenReacAmplIOFiles amplIoInterface = new OpenReacAmplIOFiles(parameters, network, config.isDebug(), Reports.createVoltageInitReporter(reporter, network.getId()));
OpenReacAmplIOFiles amplIoInterface = new OpenReacAmplIOFiles(parameters, network, config.isDebug(), Reports.createOpenReacReporter(reporter, network.getId(), parameters.getObjective()));
CompletableFuture<AmplResults> runAsync = AmplModelRunner.runAsync(network, variantId, reactiveOpf, manager, amplIoInterface);
return runAsync.thenApply(run -> new OpenReacResult(run.isSuccess() && amplIoInterface.checkErrors() ? OpenReacStatus.OK : OpenReacStatus.NOT_OK,
amplIoInterface, run.getIndicators()));
Expand Down
20 changes: 15 additions & 5 deletions open-reac/src/main/java/com/powsybl/openreac/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import com.powsybl.commons.reporter.Report;
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.commons.reporter.TypedValue;
import com.powsybl.openreac.parameters.input.algo.OpenReacOptimisationObjective;

import java.util.Map;

/**
* @author Joris Mancini <joris.mancini_externe at rte-france.com>
Expand All @@ -19,14 +22,21 @@ private Reports() {
// Should not be instantiated
}

public static Reporter createVoltageInitReporter(Reporter reporter, String networkId) {
return reporter.createSubReporter("voltageInit", "Voltage init on network '${networkId}'", "networkId", networkId);
public static Reporter createOpenReacReporter(Reporter reporter, String networkId, OpenReacOptimisationObjective objective) {
return reporter.createSubReporter(
"openReac",
"Open Reac on network '${networkId}' with ${objective} objective",
Map.of(
"networkId", new TypedValue(networkId, TypedValue.UNTYPED),
"objective", new TypedValue(objective.toString(), TypedValue.UNTYPED)
)
);
}

public static void reportConstantQGeneratorsSize(Reporter reporter, int constantQGeneratorsSize) {
reporter.report(Report.builder()
.withKey("constantQGeneratorsSize")
.withDefaultMessage("Reactive power set point is considered fixed for ${size} generators")
.withDefaultMessage("Reactive power target is considered fixed for ${size} generators")
.withSeverity(TypedValue.INFO_SEVERITY)
.withValue("size", constantQGeneratorsSize)
.build());
Expand All @@ -35,7 +45,7 @@ public static void reportConstantQGeneratorsSize(Reporter reporter, int constant
public static void reportVariableTwoWindingsTransformersSize(Reporter reporter, int variableTwoWindingsTransformersSize) {
reporter.report(Report.builder()
.withKey("variableTwoWindingsTransformersSize")
.withDefaultMessage("${size} two-windings transformers are considered as variable")
.withDefaultMessage("There are ${size} tap positions considered as variable on two-winding transformers")
.withSeverity(TypedValue.INFO_SEVERITY)
.withValue("size", variableTwoWindingsTransformersSize)
.build());
Expand All @@ -44,7 +54,7 @@ public static void reportVariableTwoWindingsTransformersSize(Reporter reporter,
public static void reportVariableShuntCompensatorsSize(Reporter reporter, int variableShuntCompensatorsSize) {
reporter.report(Report.builder()
.withKey("variableShuntCompensatorsSize")
.withDefaultMessage("${size} shunt compensators are considered as variable")
.withDefaultMessage("There are ${size} shunt sections considered as variable on shunt compensators")
.withSeverity(TypedValue.INFO_SEVERITY)
.withValue("size", variableShuntCompensatorsSize)
.build());
Expand Down

0 comments on commit 7bc0cb9

Please sign in to comment.