Skip to content

Commit 0fab314

Browse files
Merge branch 'Add_Attribute_DTO_LimitSets' into send-all-limit-sets-to-branch-forms
2 parents dc09d65 + 29e6879 commit 0fab314

File tree

12 files changed

+413
-9
lines changed

12 files changed

+413
-9
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<groupId>org.gridsuite</groupId>
2121
<artifactId>gridsuite-network-map-server</artifactId>
22-
<version>2.21.0-SNAPSHOT</version>
22+
<version>2.22.0-SNAPSHOT</version>
2323

2424
<packaging>jar</packaging>
2525
<name>Network map server</name>

src/main/java/org/gridsuite/network/map/dto/common/CurrentLimitsData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.springframework.util.CollectionUtils;
1414

1515
import java.util.List;
16+
import java.util.Objects;
1617

1718
/**
1819
* @author David Braquart <david.braquart at rte-france.com>
@@ -46,9 +47,8 @@ public boolean hasLimits() {
4647
}
4748

4849
public boolean limitsEquals(CurrentLimitsData other) {
49-
return permanentLimit != null && permanentLimit.equals(other.permanentLimit)
50-
&& (temporaryLimits != null && temporaryLimits.equals(other.temporaryLimits)
51-
|| temporaryLimits == null && other.temporaryLimits == null);
50+
return Objects.equals(permanentLimit, other.permanentLimit)
51+
&& Objects.equals(temporaryLimits, other.temporaryLimits);
5252
}
5353
}
5454

src/main/java/org/gridsuite/network/map/dto/utils/ElementUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ public static Optional<HvdcOperatorActivePowerRangeInfos> toHvdcOperatorActivePo
8585
}
8686

8787
public static void buildCurrentLimits(Collection<OperationalLimitsGroup> currentLimits, Consumer<List<CurrentLimitsData>> build) {
88-
89-
ArrayList<CurrentLimitsData> currentLimitsData = new ArrayList<>(currentLimits.stream()
88+
List<CurrentLimitsData> currentLimitsData = currentLimits.stream()
9089
.map(ElementUtils::operationalLimitsGroupToMapDataCurrentLimits)
91-
.toList());
92-
90+
.toList();
9391
if (!currentLimitsData.isEmpty()) {
9492
build.accept(currentLimitsData);
9593
}
@@ -126,7 +124,8 @@ public static void mergeCurrentLimits(Collection<OperationalLimitsGroup> operati
126124
}
127125
build.accept(mergedLimitsData);
128126
return;
129-
} else if (currentLimitsData1.isEmpty() && !currentLimitsData2.isEmpty()) {
127+
}
128+
if (currentLimitsData1.isEmpty() && !currentLimitsData2.isEmpty()) {
130129
for (CurrentLimitsData currentLimitsData : currentLimitsData2) {
131130
mergedLimitsData.add(copyCurrentLimitsData(currentLimitsData, SIDE2));
132131
}

src/test/java/org/gridsuite/network/map/NetworkMapControllerTest.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,23 @@ void setUp() {
485485
.withObservable(true)
486486
.add();
487487

488+
line3.newOperationalLimitsGroup1("group1").newCurrentLimits()
489+
.setPermanentLimit(220.0)
490+
.beginTemporaryLimit()
491+
.setName("temporary1")
492+
.setAcceptableDuration(100)
493+
.setValue(50.)
494+
.setFictitious(false)
495+
.endTemporaryLimit()
496+
.beginTemporaryLimit()
497+
.setName("temporary2")
498+
.setAcceptableDuration(150)
499+
.setValue(70.)
500+
.setFictitious(false)
501+
.endTemporaryLimit()
502+
.add();
503+
line3.setSelectedOperationalLimitsGroup1("group1");
504+
488505
Substation p6 = network.newSubstation()
489506
.setId("P6")
490507
.setCountry(Country.FR)
@@ -515,6 +532,24 @@ void setUp() {
515532
.setB2(386E-6 / 2)
516533
.add();
517534

535+
Line line4 = network.getLine("LINE4");
536+
line4.newOperationalLimitsGroup2("group1").newCurrentLimits()
537+
.setPermanentLimit(220.0)
538+
.beginTemporaryLimit()
539+
.setName("temporary1")
540+
.setAcceptableDuration(100)
541+
.setValue(50.)
542+
.setFictitious(false)
543+
.endTemporaryLimit()
544+
.beginTemporaryLimit()
545+
.setName("temporary2")
546+
.setAcceptableDuration(150)
547+
.setValue(70.)
548+
.setFictitious(false)
549+
.endTemporaryLimit()
550+
.add();
551+
line4.setSelectedOperationalLimitsGroup2("group1");
552+
518553
Battery b1 = vlnew2.newBattery()
519554
.setId("BATTERY1")
520555
.setName("BATTERY1")

src/test/resources/all-data-in-variant.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,26 @@
377377
"country2": "FR",
378378
"terminal1Connected": true,
379379
"terminal2Connected": true,
380+
"operationalLimitsGroup1": {
381+
"group1": {
382+
"permanentLimit": 220.0,
383+
"temporaryLimits": [
384+
{
385+
"name": "temporary2",
386+
"value": 70.0,
387+
"acceptableDuration": 150
388+
},
389+
{
390+
"name": "temporary1",
391+
"value": 50.0,
392+
"acceptableDuration": 100
393+
}
394+
],
395+
"applicability": null
396+
}
397+
},
398+
"operationalLimitsGroup1Names": ["group1"],
399+
"selectedOperationalLimitsGroup1": "group1",
380400
"p1": 200.0,
381401
"p2": 100.0,
382402
"r": 3.0,
@@ -436,6 +456,26 @@
436456
"country2": "FR",
437457
"terminal1Connected": true,
438458
"terminal2Connected": true,
459+
"operationalLimitsGroup2": {
460+
"group1": {
461+
"permanentLimit": 220.0,
462+
"temporaryLimits": [
463+
{
464+
"name": "temporary2",
465+
"value": 70.0,
466+
"acceptableDuration": 150
467+
},
468+
{
469+
"name": "temporary1",
470+
"value": 50.0,
471+
"acceptableDuration": 100
472+
}
473+
],
474+
"applicability": null
475+
}
476+
},
477+
"operationalLimitsGroup2Names": ["group1"],
478+
"selectedOperationalLimitsGroup2": "group1",
439479
"r": 3.0,
440480
"x": 33.0,
441481
"g1": 0.0,

src/test/resources/all-data.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,26 @@
367367
"country2": "FR",
368368
"terminal1Connected": true,
369369
"terminal2Connected": true,
370+
"operationalLimitsGroup1": {
371+
"group1": {
372+
"permanentLimit": 220.0,
373+
"temporaryLimits": [
374+
{
375+
"name": "temporary2",
376+
"value": 70.0,
377+
"acceptableDuration": 150
378+
},
379+
{
380+
"name": "temporary1",
381+
"value": 50.0,
382+
"acceptableDuration": 100
383+
}
384+
],
385+
"applicability": null
386+
}
387+
},
388+
"operationalLimitsGroup1Names": ["group1"],
389+
"selectedOperationalLimitsGroup1": "group1",
370390
"p1": 200.0,
371391
"p2": 100.0,
372392
"r": 3.0,
@@ -426,6 +446,26 @@
426446
"country2": "FR",
427447
"terminal1Connected": true,
428448
"terminal2Connected": true,
449+
"operationalLimitsGroup2": {
450+
"group1": {
451+
"permanentLimit": 220.0,
452+
"temporaryLimits": [
453+
{
454+
"name": "temporary2",
455+
"value": 70.0,
456+
"acceptableDuration": 150
457+
},
458+
{
459+
"name": "temporary1",
460+
"value": 50.0,
461+
"acceptableDuration": 100
462+
}
463+
],
464+
"applicability": null
465+
}
466+
},
467+
"operationalLimitsGroup2Names": ["group1"],
468+
"selectedOperationalLimitsGroup2": "group1",
429469
"r": 3.0,
430470
"x": 33.0,
431471
"g1": 0.0,

src/test/resources/line-tooltip-data-dc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
"terminal2Connected": true,
77
"i1": 6014.065304058601,
88
"i2": 3007.0326520293006,
9+
"currentLimits1":{
10+
"permanentLimit":220.0,
11+
"temporaryLimits":[
12+
{
13+
"name":"temporary2",
14+
"value":70.0,
15+
"acceptableDuration":150
16+
},
17+
{"name":"temporary1",
18+
"value":50.0,
19+
"acceptableDuration":100
20+
}
21+
],
22+
"applicability":null},
923
"r": 3.0,
1024
"x": 33.0,
1125
"b1": 1.93E-4,

src/test/resources/lines-form-data.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,45 @@
147147
"voltageLevelId2": "VLGEN3",
148148
"terminal1Connected": true,
149149
"terminal2Connected": true,
150+
"currentLimits1": [
151+
{
152+
"id": "group1",
153+
"permanentLimit": 220.0,
154+
"temporaryLimits": [
155+
{
156+
"name": "temporary2",
157+
"value": 70.0,
158+
"acceptableDuration": 150
159+
},
160+
{
161+
"name": "temporary1",
162+
"value": 50.0,
163+
"acceptableDuration": 100
164+
}
165+
],
166+
"applicability": null
167+
}
168+
],
169+
"currentLimits": [
170+
{
171+
"id": "group1",
172+
"permanentLimit": 220.0,
173+
"temporaryLimits": [
174+
{
175+
"name": "temporary2",
176+
"value": 70.0,
177+
"acceptableDuration": 150
178+
},
179+
{
180+
"name": "temporary1",
181+
"value": 50.0,
182+
"acceptableDuration": 100
183+
}
184+
],
185+
"applicability": "SIDE1"
186+
}
187+
],
188+
"selectedOperationalLimitsGroup1": "group1",
150189
"p1": 200.0,
151190
"p2": 100.0,
152191
"operatingStatus": "PLANNED_OUTAGE",
@@ -187,6 +226,45 @@
187226
"voltageLevelId2": "VLGEN3",
188227
"terminal1Connected": true,
189228
"terminal2Connected": true,
229+
"currentLimits2": [
230+
{
231+
"id": "group1",
232+
"permanentLimit": 220.0,
233+
"temporaryLimits": [
234+
{
235+
"name": "temporary2",
236+
"value": 70.0,
237+
"acceptableDuration": 150
238+
},
239+
{
240+
"name": "temporary1",
241+
"value": 50.0,
242+
"acceptableDuration": 100
243+
}
244+
],
245+
"applicability": null
246+
}
247+
],
248+
"currentLimits": [
249+
{
250+
"id": "group1",
251+
"permanentLimit": 220.0,
252+
"temporaryLimits": [
253+
{
254+
"name": "temporary2",
255+
"value": 70.0,
256+
"acceptableDuration": 150
257+
},
258+
{
259+
"name": "temporary1",
260+
"value": 50.0,
261+
"acceptableDuration": 100
262+
}
263+
],
264+
"applicability": "SIDE2"
265+
}
266+
],
267+
"selectedOperationalLimitsGroup2": "group1",
190268
"r": 3.0,
191269
"x": 33.0,
192270
"g1": 0.0,

src/test/resources/partial-all-data-in-variant.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@
4141
"country2": "FR",
4242
"terminal1Connected": true,
4343
"terminal2Connected": true,
44+
"operationalLimitsGroup2": {
45+
"group1": {
46+
"permanentLimit": 220.0,
47+
"temporaryLimits": [
48+
{
49+
"name": "temporary2",
50+
"value": 70.0,
51+
"acceptableDuration": 150
52+
},
53+
{
54+
"name": "temporary1",
55+
"value": 50.0,
56+
"acceptableDuration": 100
57+
}
58+
],
59+
"applicability": null
60+
}
61+
},
62+
"operationalLimitsGroup2Names": ["group1"],
63+
"selectedOperationalLimitsGroup2": "group1",
4464
"r": 3.0,
4565
"x": 33.0,
4666
"g1": 0.0,
@@ -62,6 +82,26 @@
6282
"country2": "FR",
6383
"terminal1Connected": true,
6484
"terminal2Connected": true,
85+
"operationalLimitsGroup1": {
86+
"group1": {
87+
"permanentLimit": 220.0,
88+
"temporaryLimits": [
89+
{
90+
"name": "temporary2",
91+
"value": 70.0,
92+
"acceptableDuration": 150
93+
},
94+
{
95+
"name": "temporary1",
96+
"value": 50.0,
97+
"acceptableDuration": 100
98+
}
99+
],
100+
"applicability": null
101+
}
102+
},
103+
"operationalLimitsGroup1Names": ["group1"],
104+
"selectedOperationalLimitsGroup1": "group1",
65105
"p1": 200.0,
66106
"p2": 100.0,
67107
"r": 3.0,

0 commit comments

Comments
 (0)