Skip to content

Commit 74f31d5

Browse files
authored
add limits and properties to creation of line attached (#141)
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
1 parent 677c6be commit 74f31d5

17 files changed

+133
-93
lines changed

src/main/java/org/gridsuite/modification/dto/BranchCreationInfos.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public class BranchCreationInfos extends EquipmentCreationInfos {
4949
private List<OperationalLimitsGroupInfos> operationalLimitsGroups;
5050

5151
@Schema(description = "Selected operational limits group on Side 1")
52-
private String selectedOperationalLimitsGroup1;
52+
private String selectedOperationalLimitsGroupId1;
5353

5454
@Schema(description = "Selected operational limits group on Side 2")
55-
private String selectedOperationalLimitsGroup2;
55+
private String selectedOperationalLimitsGroupId2;
5656

5757
@Schema(description = "Connection Name 1")
5858
private String connectionName1;

src/main/java/org/gridsuite/modification/dto/BranchModificationInfos.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public class BranchModificationInfos extends BasicEquipmentModificationInfos {
4242
private List<OperationalLimitsGroupModificationInfos> operationalLimitsGroups;
4343

4444
@Schema(description = "Selected operational limits group on Side 1")
45-
private AttributeModification<String> selectedOperationalLimitsGroup1;
45+
private AttributeModification<String> selectedOperationalLimitsGroupId1;
4646

4747
@Schema(description = "Selected operational limits group on Side 2")
48-
private AttributeModification<String> selectedOperationalLimitsGroup2;
48+
private AttributeModification<String> selectedOperationalLimitsGroupId2;
4949

5050
@Schema(description = "Voltage level id modification 1")
5151
private AttributeModification<String> voltageLevelId1;

src/main/java/org/gridsuite/modification/dto/byfilter/equipmentfield/LineField.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public enum LineField {
2828
G2,
2929
B1,
3030
B2,
31-
SELECTED_OPERATIONAL_LIMITS_GROUP_1,
32-
SELECTED_OPERATIONAL_LIMITS_GROUP_2;
31+
SELECTED_OPERATIONAL_LIMITS_GROUP_ID1,
32+
SELECTED_OPERATIONAL_LIMITS_GROUP_ID2;
3333

3434
public static String getReferenceValue(Line line, String lineField) {
3535
LineField field = LineField.valueOf(lineField);
@@ -40,8 +40,8 @@ public static String getReferenceValue(Line line, String lineField) {
4040
case G2 -> String.valueOf(line.getG2());
4141
case B1 -> String.valueOf(line.getB1());
4242
case B2 -> String.valueOf(line.getB2());
43-
case SELECTED_OPERATIONAL_LIMITS_GROUP_1 -> String.valueOf(line.getSelectedOperationalLimitsGroupId1().orElse(null));
44-
case SELECTED_OPERATIONAL_LIMITS_GROUP_2 -> String.valueOf(line.getSelectedOperationalLimitsGroupId2().orElse(null));
43+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 -> String.valueOf(line.getSelectedOperationalLimitsGroupId1().orElse(null));
44+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 -> String.valueOf(line.getSelectedOperationalLimitsGroupId2().orElse(null));
4545
};
4646
}
4747

@@ -50,7 +50,7 @@ public static void setNewValue(Line line, String lineField, @NotNull String newV
5050
String errorMessage = String.format(ERROR_MESSAGE, line.getId());
5151
switch (field) {
5252
case R, X, G1, G2, B1, B2 -> setNewDoubleValue(line, field, newValue, errorMessage);
53-
case SELECTED_OPERATIONAL_LIMITS_GROUP_1, SELECTED_OPERATIONAL_LIMITS_GROUP_2 -> setNewStringValue(line, field, newValue, errorMessage);
53+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID1, SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 -> setNewStringValue(line, field, newValue, errorMessage);
5454
}
5555
}
5656

@@ -80,15 +80,15 @@ private static void setNewDoubleValue(Line line, LineField field, String newValu
8080
private static void setNewStringValue(Line line, LineField field, String newValue, String errorMessage) {
8181
final AttributeModification<String> attributeModification = new AttributeModification<>(newValue, OperationType.SET);
8282
switch (field) {
83-
case SELECTED_OPERATIONAL_LIMITS_GROUP_1 -> {
83+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 -> {
8484
ModificationUtils.checkLimitsGroupExist(errorMessage, newValue, MODIFY_LINE_ERROR,
8585
line.getOperationalLimitsGroups1()
8686
.stream()
8787
.map(OperationalLimitsGroup::getId)
8888
.toList(), 1);
8989
modifySelectedOperationalLimitsGroup(line, attributeModification, TwoSides.ONE, null);
9090
}
91-
case SELECTED_OPERATIONAL_LIMITS_GROUP_2 -> {
91+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 -> {
9292
ModificationUtils.checkLimitsGroupExist(errorMessage, newValue, MODIFY_LINE_ERROR,
9393
line.getOperationalLimitsGroups2()
9494
.stream()

src/main/java/org/gridsuite/modification/dto/byfilter/equipmentfield/TwoWindingsTransformerField.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public enum TwoWindingsTransformerField {
4444
PHASE_LOW_TAP_POSITION,
4545
PHASE_TAP_POSITION,
4646
PHASE_TARGET_DEADBAND,
47-
SELECTED_OPERATIONAL_LIMITS_GROUP_1,
48-
SELECTED_OPERATIONAL_LIMITS_GROUP_2;
47+
SELECTED_OPERATIONAL_LIMITS_GROUP_ID1,
48+
SELECTED_OPERATIONAL_LIMITS_GROUP_ID2;
4949

5050
public static final String VALUE_KEY_FIELD_NAME = "fieldName";
5151
public static final String VALUE_KEY_EQUIPMENT_NAME = "equipmentName";
@@ -115,9 +115,9 @@ public static String getReferenceValue(TwoWindingsTransformer transformer, Strin
115115
phaseTapChanger != null ? String.valueOf(phaseTapChanger.getTapPosition()) : null;
116116
case PHASE_TARGET_DEADBAND ->
117117
phaseTapChanger != null ? String.valueOf(phaseTapChanger.getTargetDeadband()) : null;
118-
case SELECTED_OPERATIONAL_LIMITS_GROUP_1 ->
118+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 ->
119119
String.valueOf(transformer.getSelectedOperationalLimitsGroupId1().orElse(null));
120-
case SELECTED_OPERATIONAL_LIMITS_GROUP_2 ->
120+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 ->
121121
String.valueOf(transformer.getSelectedOperationalLimitsGroupId2().orElse(null));
122122
};
123123
}
@@ -130,7 +130,7 @@ public static void setNewValue(TwoWindingsTransformer transformer, String twoWin
130130
case R, X, G, B, RATED_U1, RATED_U2, RATED_S, TARGET_V, RATIO_LOW_TAP_POSITION, RATIO_TAP_POSITION,
131131
RATIO_TARGET_DEADBAND, REGULATION_VALUE, PHASE_LOW_TAP_POSITION, PHASE_TAP_POSITION,
132132
PHASE_TARGET_DEADBAND -> setNewDoubleValue(transformer, field, newValue, errorMessage);
133-
case SELECTED_OPERATIONAL_LIMITS_GROUP_1, SELECTED_OPERATIONAL_LIMITS_GROUP_2 ->
133+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID1, SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 ->
134134
setNewStringValue(transformer, field, newValue, errorMessage);
135135
}
136136
}
@@ -188,15 +188,15 @@ private static void setNewDoubleValue(TwoWindingsTransformer transformer, TwoWin
188188
private static void setNewStringValue(TwoWindingsTransformer transformer, TwoWindingsTransformerField field, String newValue, String errorMessage) {
189189
final AttributeModification<String> attributeModification = new AttributeModification<>(newValue, OperationType.SET);
190190
switch (field) {
191-
case SELECTED_OPERATIONAL_LIMITS_GROUP_1 -> {
191+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID1 -> {
192192
ModificationUtils.checkLimitsGroupExist(errorMessage, newValue, MODIFY_LINE_ERROR,
193193
transformer.getOperationalLimitsGroups1()
194194
.stream()
195195
.map(OperationalLimitsGroup::getId)
196196
.toList(), 1);
197197
modifySelectedOperationalLimitsGroup(transformer, attributeModification, TwoSides.ONE, null);
198198
}
199-
case SELECTED_OPERATIONAL_LIMITS_GROUP_2 -> {
199+
case SELECTED_OPERATIONAL_LIMITS_GROUP_ID2 -> {
200200
ModificationUtils.checkLimitsGroupExist(errorMessage, newValue, MODIFY_LINE_ERROR,
201201
transformer.getOperationalLimitsGroups2()
202202
.stream()

src/main/java/org/gridsuite/modification/modifications/AbstractBranchModification.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ protected void modifyBranch(Branch<?> branch, BranchModificationInfos branchModi
9494
}
9595

9696
private void applySelectedOLGs(Branch<?> branch, List<ReportNode> activeOLGReports) {
97-
if (modificationInfos.getSelectedOperationalLimitsGroup1() != null) {
97+
if (modificationInfos.getSelectedOperationalLimitsGroupId1() != null) {
9898
modifySelectedOperationalLimitsGroup(
9999
branch,
100-
modificationInfos.getSelectedOperationalLimitsGroup1(),
100+
modificationInfos.getSelectedOperationalLimitsGroupId1(),
101101
TwoSides.ONE,
102102
activeOLGReports
103103
);
104104
}
105-
if (modificationInfos.getSelectedOperationalLimitsGroup2() != null) {
105+
if (modificationInfos.getSelectedOperationalLimitsGroupId2() != null) {
106106
modifySelectedOperationalLimitsGroup(
107107
branch,
108-
modificationInfos.getSelectedOperationalLimitsGroup2(),
108+
modificationInfos.getSelectedOperationalLimitsGroupId2(),
109109
TwoSides.TWO,
110110
activeOLGReports);
111111
}

src/main/java/org/gridsuite/modification/modifications/LineAttachToVoltageLevel.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.gridsuite.modification.utils.PropertiesUtils;
2222

2323
import static org.gridsuite.modification.NetworkModificationException.Type.*;
24+
import static org.gridsuite.modification.modifications.LineCreation.addLimits;
2425

2526
/**
2627
* @author David Braquart <david.braquart at rte-france.com>
@@ -97,6 +98,12 @@ public void apply(Network network, ReportNode subReportNode) {
9798
.build();
9899

99100
algo.apply(network, true, subReportNode);
101+
102+
// add extra information on attachment line
103+
Line createdAttachmentLine = network.getLine(attachmentLineInfos.getEquipmentId());
104+
addLimits(attachmentLineInfos, subReportNode, createdAttachmentLine);
105+
PropertiesUtils.applyProperties(createdAttachmentLine, subReportNode, attachmentLineInfos.getProperties(), "network.modification.LineProperties");
106+
100107
// override attachment point
101108
if (modificationInfos.getAttachmentPointDetailInformation() != null) {
102109
// override voltage level

src/main/java/org/gridsuite/modification/modifications/LineCreation.java

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ public void check(Network network) throws NetworkModificationException {
5252
checkIsNotNegativeValue(errorMessage, modificationInfos.getG2(), CREATE_LINE_ERROR, "Conductance on side 2 G2");
5353
}
5454

55-
private ReportNode addLimitSetReportNode(ReportNode limitsReporter) {
56-
return limitsReporter.newReportNode()
57-
.withSeverity(TypedValue.INFO_SEVERITY)
58-
.withMessageTemplate("network.modification.LimitSets")
59-
.add();
60-
}
61-
6255
@Override
6356
public void apply(Network network, ReportNode subReportNode) {
6457
VoltageLevel voltageLevel1 = ModificationUtils.getInstance().getVoltageLevel(network, modificationInfos.getVoltageLevelId1());
@@ -75,6 +68,13 @@ public void apply(Network network, ReportNode subReportNode) {
7568
ModificationUtils.getInstance().disconnectBranch(modificationInfos, network.getLine(modificationInfos.getEquipmentId()), characteristicsReporter);
7669
Line line = network.getLine(modificationInfos.getEquipmentId());
7770

71+
addLimits(modificationInfos, subReportNode, line);
72+
73+
// properties
74+
PropertiesUtils.applyProperties(line, characteristicsReporter, modificationInfos.getProperties(), "network.modification.LineProperties");
75+
}
76+
77+
public static void addLimits(LineCreationInfos modificationInfos, ReportNode subReportNode, Line line) {
7878
// Set permanent and temporary current limits
7979
ReportNode limitsReporter = null;
8080
List<OperationalLimitsGroupInfos> opLimitsGroupSide1 = ModificationUtils.getOperationalLimitsGroupsOnSide(modificationInfos.getOperationalLimitsGroups(), Applicability.SIDE1);
@@ -101,36 +101,36 @@ public void apply(Network network, ReportNode subReportNode) {
101101
}
102102

103103
List<ReportNode> limitSetsOnSideReportNodes = new ArrayList<>();
104-
if (modificationInfos.getSelectedOperationalLimitsGroup1() != null) {
105-
if (!ModificationUtils.hasLimitSet(opLimitsGroupSide1, modificationInfos.getSelectedOperationalLimitsGroup1())) {
104+
if (modificationInfos.getSelectedOperationalLimitsGroupId1() != null) {
105+
if (!ModificationUtils.hasLimitSet(opLimitsGroupSide1, modificationInfos.getSelectedOperationalLimitsGroupId1())) {
106106
limitSetsOnSideReportNodes.add(ReportNode.newRootReportNode()
107-
.withMessageTemplate("network.modification.limitSetAbsentOnSide1")
108-
.withUntypedValue("selectedOperationalLimitsGroup", modificationInfos.getSelectedOperationalLimitsGroup1())
109-
.withSeverity(TypedValue.WARN_SEVERITY)
110-
.build());
107+
.withMessageTemplate("network.modification.limitSetAbsentOnSide1")
108+
.withUntypedValue("selectedOperationalLimitsGroup", modificationInfos.getSelectedOperationalLimitsGroupId1())
109+
.withSeverity(TypedValue.WARN_SEVERITY)
110+
.build());
111111
} else {
112-
line.setSelectedOperationalLimitsGroup1(modificationInfos.getSelectedOperationalLimitsGroup1());
112+
line.setSelectedOperationalLimitsGroup1(modificationInfos.getSelectedOperationalLimitsGroupId1());
113113
limitSetsOnSideReportNodes.add(ReportNode.newRootReportNode()
114-
.withMessageTemplate("network.modification.limitSetSelectedOnSide1")
115-
.withUntypedValue("selectedOperationalLimitsGroup1", modificationInfos.getSelectedOperationalLimitsGroup1())
116-
.withSeverity(TypedValue.INFO_SEVERITY)
117-
.build());
114+
.withMessageTemplate("network.modification.limitSetSelectedOnSide1")
115+
.withUntypedValue("selectedOperationalLimitsGroup1", modificationInfos.getSelectedOperationalLimitsGroupId1())
116+
.withSeverity(TypedValue.INFO_SEVERITY)
117+
.build());
118118
}
119119
}
120-
if (modificationInfos.getSelectedOperationalLimitsGroup2() != null) {
121-
if (!ModificationUtils.hasLimitSet(opLimitsGroupSide2, modificationInfos.getSelectedOperationalLimitsGroup2())) {
120+
if (modificationInfos.getSelectedOperationalLimitsGroupId2() != null) {
121+
if (!ModificationUtils.hasLimitSet(opLimitsGroupSide2, modificationInfos.getSelectedOperationalLimitsGroupId2())) {
122122
limitSetsOnSideReportNodes.add(ReportNode.newRootReportNode()
123-
.withMessageTemplate("network.modification.limitSetAbsentOnSide2")
124-
.withUntypedValue("selectedOperationalLimitsGroup", modificationInfos.getSelectedOperationalLimitsGroup2())
125-
.withSeverity(TypedValue.WARN_SEVERITY)
126-
.build());
123+
.withMessageTemplate("network.modification.limitSetAbsentOnSide2")
124+
.withUntypedValue("selectedOperationalLimitsGroup", modificationInfos.getSelectedOperationalLimitsGroupId2())
125+
.withSeverity(TypedValue.WARN_SEVERITY)
126+
.build());
127127
} else {
128-
line.setSelectedOperationalLimitsGroup2(modificationInfos.getSelectedOperationalLimitsGroup2());
128+
line.setSelectedOperationalLimitsGroup2(modificationInfos.getSelectedOperationalLimitsGroupId2());
129129
limitSetsOnSideReportNodes.add(ReportNode.newRootReportNode()
130-
.withMessageTemplate("network.modification.limitSetSelectedOnSide2")
131-
.withUntypedValue("selectedOperationalLimitsGroup2", modificationInfos.getSelectedOperationalLimitsGroup2())
132-
.withSeverity(TypedValue.INFO_SEVERITY)
133-
.build());
130+
.withMessageTemplate("network.modification.limitSetSelectedOnSide2")
131+
.withUntypedValue("selectedOperationalLimitsGroup2", modificationInfos.getSelectedOperationalLimitsGroupId2())
132+
.withSeverity(TypedValue.INFO_SEVERITY)
133+
.build());
134134
}
135135
}
136136

@@ -139,11 +139,15 @@ public void apply(Network network, ReportNode subReportNode) {
139139
limitsReporter = subReportNode.newReportNode().withMessageTemplate("network.modification.limitsCreated").add();
140140
}
141141
ModificationUtils.getInstance().reportModifications(limitsReporter, limitSetsOnSideReportNodes,
142-
"network.modification.ActiveLimitSets");
142+
"network.modification.ActiveLimitSets");
143143
}
144+
}
144145

145-
// properties
146-
PropertiesUtils.applyProperties(line, characteristicsReporter, modificationInfos.getProperties(), "network.modification.LineProperties");
146+
private static ReportNode addLimitSetReportNode(ReportNode limitsReporter) {
147+
return limitsReporter.newReportNode()
148+
.withSeverity(TypedValue.INFO_SEVERITY)
149+
.withMessageTemplate("network.modification.LimitSets")
150+
.add();
147151
}
148152

149153
@Override

0 commit comments

Comments
 (0)