-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(reports): add reporters and basic first reports (#55)
* feat(reports): add reporters and basic first reports * chore: duplication and formatting * fix(reports): wording * fix(reports): after rebase * Reword after bad review. --------- Signed-off-by: Joris Mancini <[email protected]> Co-authored-by: Anne Tilloy <[email protected]>
- Loading branch information
1 parent
36fe8ea
commit 3698afb
Showing
4 changed files
with
119 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.openreac; | ||
|
||
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> | ||
*/ | ||
public final class Reports { | ||
|
||
private Reports() { | ||
// Should not be instantiated | ||
} | ||
|
||
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 target is considered fixed for ${size} generators") | ||
.withSeverity(TypedValue.INFO_SEVERITY) | ||
.withValue("size", constantQGeneratorsSize) | ||
.build()); | ||
} | ||
|
||
public static void reportVariableTwoWindingsTransformersSize(Reporter reporter, int variableTwoWindingsTransformersSize) { | ||
reporter.report(Report.builder() | ||
.withKey("variableTwoWindingsTransformersSize") | ||
.withDefaultMessage("There are ${size} two-winding transformers with tap position considered as variable") | ||
.withSeverity(TypedValue.INFO_SEVERITY) | ||
.withValue("size", variableTwoWindingsTransformersSize) | ||
.build()); | ||
} | ||
|
||
public static void reportVariableShuntCompensatorsSize(Reporter reporter, int variableShuntCompensatorsSize) { | ||
reporter.report(Report.builder() | ||
.withKey("variableShuntCompensatorsSize") | ||
.withDefaultMessage("There are ${size} shunt compensators with section considered as variable") | ||
.withSeverity(TypedValue.INFO_SEVERITY) | ||
.withValue("size", variableShuntCompensatorsSize) | ||
.build()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters