Skip to content

Commit

Permalink
fix limit/setpoint
Browse files Browse the repository at this point in the history
Signed-off-by: David BRAQUART <[email protected]>
  • Loading branch information
dbraquart committed Sep 4, 2024
1 parent 6988996 commit 0938e7e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import static org.gridsuite.modification.server.NetworkModificationException.Type.BRANCH_MODIFICATION_ERROR;
Expand All @@ -43,7 +44,7 @@ protected void modifyBranch(Branch<?> branch, BranchModificationInfos branchModi
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
if (branchModificationInfos.getEquipmentName() != null) {
insertReportNode(subReportNode, ModificationUtils.getInstance().buildModificationReportWithIndentation(branch.getOptionalName().isEmpty() ? null : branch.getOptionalName().get(), branchModificationInfos.getEquipmentName().getValue(), "Name", 0));
insertReportNode(subReportNode, ModificationUtils.getInstance().buildModificationReportWithIndentation(Optional.of(branch.getOptionalName()).orElse(null), branchModificationInfos.getEquipmentName().getValue(), "Name", 0));
branch.setName(branchModificationInfos.getEquipmentName().getValue());
}

Expand All @@ -65,10 +66,6 @@ protected void modifyBranch(Branch<?> branch, BranchModificationInfos branchModi
}
if (!side1LimitsReports.isEmpty() || !side2LimitsReports.isEmpty()) {
ReportNode limitsReportNode = subReportNode.newReportNode().withMessageTemplate("limits", "Limits").add();
limitsReportNode.newReportNode()
.withMessageTemplate("limitsModification", "Limits")
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
ModificationUtils.getInstance().reportModifications(limitsReportNode, side1LimitsReports, "side1LimitsModification",
" Side 1");
ModificationUtils.getInstance().reportModifications(limitsReportNode, side2LimitsReports, "side2LimitsModification",
Expand Down Expand Up @@ -205,7 +202,7 @@ protected void modifyTemporaryLimits(CurrentLimitsModificationInfos currentLimit
}
}
if (!temporaryLimitsReports.isEmpty()) {
temporaryLimitsReports.add(ReportNode.newRootReportNode()
temporaryLimitsReports.add(0, ReportNode.newRootReportNode()
.withMessageTemplate("temporaryLimitsModification", " Temporary current limits :")
.withSeverity(TypedValue.INFO_SEVERITY)
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,12 @@ private void reportBatteryConnectivity(BatteryCreationInfos batteryCreationInfos
}

private ReportNode reportBatteryActiveLimits(BatteryCreationInfos batteryCreationInfos, ReportNode subReportNode) {
List<ReportNode> limitsReports = new ArrayList<>();
ReportNode subReportNodeLimits = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReportNodeLimits.newReportNode()
.withMessageTemplate(LIMITS, LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
List<ReportNode> limitsReports = new ArrayList<>();
limitsReports.add(ModificationUtils.getInstance().buildCreationReport(
batteryCreationInfos.getMinP(), "Min active power"));

limitsReports.add(ModificationUtils.getInstance().buildCreationReport(
batteryCreationInfos.getMaxP(), "Max active power"));

ModificationUtils.getInstance().reportModifications(subReportNodeLimits, limitsReports, "ActiveLimitsCreated", ACTIVE_LIMITS);
return subReportNodeLimits;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ private void modifyBatterySetpointsAttributes(BatteryModificationInfos modificat
ReportNode subReporterSetpoints = null;
if (reportActivePower != null || reportReactivePower != null) {
subReporterSetpoints = subReportNode.newReportNode().withMessageTemplate(SETPOINTS, SETPOINTS).add();
subReporterSetpoints.newReportNode()
.withMessageTemplate(SETPOINTS, SETPOINTS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
if (reportActivePower != null) {
insertReportNode(subReporterSetpoints, reportActivePower);
}
Expand Down Expand Up @@ -134,16 +130,7 @@ private ReportNode modifyBatteryActiveLimitsAttributes(BatteryModificationInfos
ReportNode reportMinActivePower = ModificationUtils.getInstance().applyElementaryModificationsAndReturnReport(battery::setMinP, battery::getMinP, modificationInfos.getMinP(), "Min active power");
if (reportMaxActivePower != null || reportMinActivePower != null) {
subReportNodeLimits = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReportNodeLimits.newReportNode()
.withMessageTemplate(LIMITS, LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();

ReportNode subReporterActiveLimits = subReportNodeLimits.newReportNode().withMessageTemplate(ACTIVE_LIMITS, ACTIVE_LIMITS).add();
subReporterActiveLimits.newReportNode()
.withMessageTemplate(ACTIVE_LIMITS, ACTIVE_LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
if (reportMaxActivePower != null) {
insertReportNode(subReporterActiveLimits, reportMaxActivePower);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,12 @@ private void reportGeneratorConnectivity(GeneratorCreationInfos generatorCreatio
}

private ReportNode reportGeneratorActiveLimits(GeneratorCreationInfos generatorCreationInfos, ReportNode subReportNode) {
List<ReportNode> limitsReports = new ArrayList<>();
ReportNode subReportNodeLimits = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReportNodeLimits.newReportNode()
.withMessageTemplate(LIMITS, LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();

List<ReportNode> limitsReports = new ArrayList<>();
limitsReports.add(ModificationUtils.getInstance().buildCreationReport(
generatorCreationInfos.getMinP(), "Min active power"));

limitsReports.add(ModificationUtils.getInstance().buildCreationReport(
generatorCreationInfos.getMaxP(), "Max active power"));

if (generatorCreationInfos.getRatedS() != null) {
limitsReports.add(ModificationUtils.getInstance().buildCreationReport(
generatorCreationInfos.getRatedS(), "Rated nominal power"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,7 @@ private ReportNode modifyGeneratorActiveLimitsAttributes(GeneratorModificationIn
ReportNode reportRatedNominalPower = ModificationUtils.getInstance().applyElementaryModificationsAndReturnReport(generator::setRatedS, generator::getRatedS, modificationInfos.getRatedS(), "Rated nominal power");
if (reportMaxActivePower != null || reportMinActivePower != null || reportRatedNominalPower != null) {
subReporterLimits = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReporterLimits.newReportNode()
.withMessageTemplate(LIMITS, LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();

ReportNode subReporterActiveLimits = subReporterLimits.newReportNode().withMessageTemplate(ACTIVE_LIMITS, ACTIVE_LIMITS).add();
subReporterActiveLimits.newReportNode()
.withMessageTemplate(ACTIVE_LIMITS, ACTIVE_LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
if (reportMaxActivePower != null) {
insertReportNode(subReporterActiveLimits, reportMaxActivePower);
}
Expand Down Expand Up @@ -394,10 +385,6 @@ private ReportNode modifyGeneratorVoltageRegulatorAttributes(GeneratorModificati
subReportNodeSetpoints2 = subReportNode.newReportNode()
.withMessageTemplate(SETPOINTS, SETPOINTS)
.add();
subReportNodeSetpoints2.newReportNode()
.withMessageTemplate(SETPOINTS, SETPOINTS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
}
ModificationUtils.getInstance().reportModifications(subReportNodeSetpoints2, voltageRegulationReports, "voltageRegulationModified", "Voltage regulation");
return subReportNodeSetpoints2;
Expand All @@ -418,10 +405,6 @@ private void modifyGeneratorSetpointsAttributes(GeneratorModificationInfos modif
ReportNode subReporterSetpoints = null;
if (reportActivePower != null || reportReactivePower != null) {
subReporterSetpoints = subReportNode.newReportNode().withMessageTemplate(SETPOINTS, SETPOINTS).add();
subReporterSetpoints.newReportNode()
.withMessageTemplate(SETPOINTS, SETPOINTS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
if (reportActivePower != null) {
insertReportNode(subReporterSetpoints, reportActivePower);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,20 +853,13 @@ public void modifyReactiveCapabilityCurvePoints(Collection<ReactiveCapabilityCur
adder.add();
ReportNode subReportNodeReactiveLimits = null;
ReportNode subReporterLimits2 = subReportNodeLimits;
if (subReportNodeLimits == null && !reports.isEmpty()) {
subReporterLimits2 = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReporterLimits2.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReporterLimits2.newReportNode()
.withMessageTemplate(LIMITS, LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
}
if (subReporterLimits2 != null && !reports.isEmpty()) {
subReportNodeReactiveLimits = subReporterLimits2.newReportNode().withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS).add();
subReportNodeReactiveLimits.newReportNode()
.withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
if (!reports.isEmpty()) {
if (subReportNodeLimits == null) {
subReporterLimits2 = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
}
if (subReporterLimits2 != null) {
subReportNodeReactiveLimits = subReporterLimits2.newReportNode().withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS).add();
}
}
reportModifications(subReportNodeReactiveLimits, reports, "curveReactiveLimitsModified", "By diagram");
}
Expand Down Expand Up @@ -966,17 +959,9 @@ public void modifyMinMaxReactiveLimits(MinMaxReactiveLimits minMaxReactiveLimits
ReportNode subReportNodeLimits2 = subReportNodeLimits;
if (subReportNodeLimits == null && !reports.isEmpty()) {
subReportNodeLimits2 = subReportNode.newReportNode().withMessageTemplate(LIMITS, LIMITS).add();
subReportNodeLimits2.newReportNode()
.withMessageTemplate(LIMITS, LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
}
if (subReportNodeLimits2 != null && !reports.isEmpty()) {
subReportNodeReactiveLimits = subReportNodeLimits2.newReportNode().withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS).add();
subReportNodeReactiveLimits.newReportNode()
.withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
}
reportModifications(subReportNodeReactiveLimits, reports, "minMaxReactiveLimitsModified", "By range");
}
Expand Down Expand Up @@ -1032,10 +1017,6 @@ public ReportNode modifyActivePowerControlAttributes(ActivePowerControl<?> activ
ReportNode subReportNodeSetpoints2 = subReporterSetpoints;
if (subReporterSetpoints == null && !reports.isEmpty()) {
subReportNodeSetpoints2 = subReportNode.newReportNode().withMessageTemplate(SETPOINTS, SETPOINTS).add();
subReportNodeSetpoints2.newReportNode()
.withMessageTemplate(SETPOINTS, SETPOINTS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
}
reportModifications(subReportNodeSetpoints2, reports, "activePowerRegulationModified", "Active power regulation");
return subReportNodeSetpoints2;
Expand Down Expand Up @@ -1180,10 +1161,6 @@ public void createMinMaxReactiveLimits(ReactiveLimitsHolderInfos batteryCreation
MAX_REACTIVE_POWER_FIELDNAME));

ReportNode subReporterReactiveLimits = subReportNode.newReportNode().withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS).add();
subReporterReactiveLimits.newReportNode()
.withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();

ModificationUtils.getInstance().reportModifications(subReporterReactiveLimits, minMaxReactiveLimitsReports, "minMaxReactiveLimitsCreated", "By range");
}
Expand All @@ -1210,10 +1187,6 @@ public void createReactiveCapabilityCurve(ReactiveLimitsHolderInfos creationInfo
});
adder.add();
ReportNode subReporterReactiveLimits = subReportNode.newReportNode().withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS).add();
subReporterReactiveLimits.newReportNode()
.withMessageTemplate(REACTIVE_LIMITS, REACTIVE_LIMITS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();
ModificationUtils.getInstance().reportModifications(subReporterReactiveLimits, pointsReports, "curveReactiveLimitsCreated", "By diagram");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,6 @@ private void addExtensionsAndReports(VscConverterStation vscConverterStation,

private void reportConverterStationSetPoints(ConverterStationCreationInfos converterStationCreationInfos, ReportNode subReportNode) {
ReportNode setPointReporter = subReportNode.newReportNode().withMessageTemplate("converterStationSetPoint", SETPOINTS).add();
setPointReporter.newReportNode()
.withMessageTemplate(SETPOINTS, SETPOINTS)
.withSeverity(TypedValue.INFO_SEVERITY)
.add();

if (converterStationCreationInfos.getReactivePowerSetpoint() != null) {
ModificationUtils.getInstance().reportElementaryCreation(setPointReporter,
Expand Down

0 comments on commit 0938e7e

Please sign in to comment.