Skip to content

Commit 6c7787c

Browse files
Expose additional fields in branch spreadsheet (#278)
Signed-off-by: Franck LECUYER <[email protected]>
1 parent 3472797 commit 6c7787c

12 files changed

+579
-435
lines changed

src/main/java/org/gridsuite/network/map/dto/definition/branch/BranchTabInfos.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import com.fasterxml.jackson.annotation.JsonInclude;
1010
import com.fasterxml.jackson.annotation.JsonInclude.Include;
11+
import com.powsybl.iidm.network.Country;
1112
import lombok.Getter;
1213
import lombok.experimental.SuperBuilder;
1314
import org.gridsuite.network.map.dto.ElementInfosWithProperties;
@@ -22,6 +23,8 @@
2223
@SuperBuilder
2324
@Getter
2425
public class BranchTabInfos extends ElementInfosWithProperties {
26+
private String type;
27+
2528
private String voltageLevelId1;
2629
private String voltageLevelId2;
2730

@@ -34,6 +37,18 @@ public class BranchTabInfos extends ElementInfosWithProperties {
3437
private Double nominalVoltage1;
3538
private Double nominalVoltage2;
3639

40+
@JsonInclude(Include.NON_NULL)
41+
private String substationId1;
42+
43+
@JsonInclude(Include.NON_NULL)
44+
private String substationId2;
45+
46+
@JsonInclude(Include.NON_NULL)
47+
private Country country1;
48+
49+
@JsonInclude(Include.NON_NULL)
50+
private Country country2;
51+
3752
private Boolean terminal1Connected;
3853
private Boolean terminal2Connected;
3954

@@ -94,6 +109,9 @@ public class BranchTabInfos extends ElementInfosWithProperties {
94109
@JsonInclude(Include.NON_NULL)
95110
private Map<String, String> voltageLevelProperties2;
96111

112+
@JsonInclude(JsonInclude.Include.NON_NULL)
113+
private String operatingStatus;
114+
97115
/* * * Extensions * * */
98116

99117
@JsonInclude(JsonInclude.Include.NON_ABSENT)

src/main/java/org/gridsuite/network/map/dto/definition/branch/line/LineTabInfos.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package org.gridsuite.network.map.dto.definition.branch.line;
88

99
import com.fasterxml.jackson.annotation.JsonInclude;
10-
import com.powsybl.iidm.network.Country;
1110
import lombok.Getter;
1211
import lombok.experimental.SuperBuilder;
1312
import org.gridsuite.network.map.dto.definition.branch.BranchTabInfos;
@@ -18,12 +17,6 @@
1817
@SuperBuilder
1918
@Getter
2019
public class LineTabInfos extends BranchTabInfos {
21-
@JsonInclude(JsonInclude.Include.NON_NULL)
22-
private Country country1;
23-
24-
@JsonInclude(JsonInclude.Include.NON_NULL)
25-
private Country country2;
26-
2720
@JsonInclude(JsonInclude.Include.NON_NULL)
2821
private Double g1;
2922

src/main/java/org/gridsuite/network/map/dto/definition/branch/twowindingstransformer/TwoWindingsTransformerTabInfos.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ public class TwoWindingsTransformerTabInfos extends BranchTabInfos {
4747
private ConnectablePositionInfos connectablePosition1;
4848
private ConnectablePositionInfos connectablePosition2;
4949

50-
@JsonInclude(JsonInclude.Include.NON_NULL)
51-
private String operatingStatus;
52-
5350
@JsonInclude(JsonInclude.Include.NON_ABSENT)
5451
private Optional<TapChangerDiscreteMeasurementsInfos> measurementRatioTap;
5552

src/main/java/org/gridsuite/network/map/dto/mapper/BranchInfosMapper.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import static org.gridsuite.network.map.dto.InfoTypeParameters.QUERY_PARAM_DC_POWERFACTOR;
2929
import static org.gridsuite.network.map.dto.common.CurrentLimitsData.Applicability.SIDE1;
3030
import static org.gridsuite.network.map.dto.common.CurrentLimitsData.Applicability.SIDE2;
31+
import static org.gridsuite.network.map.dto.utils.ElementUtils.mapCountry;
3132
import static org.gridsuite.network.map.dto.utils.ExtensionUtils.buildQualityInfos;
3233

3334
public sealed class BranchInfosMapper permits LineInfosMapper, TieLineInfosMapper, TwoWindingsTransformerInfosMapper {
@@ -75,8 +76,13 @@ public static ElementInfos toData(@NonNull final Identifiable<?> identifiable,
7576
.selectedOperationalLimitsGroup2(branch.getSelectedOperationalLimitsGroupId2().orElse(null));
7677
//noinspection unchecked
7778
return (B) builder
79+
.type(branch.getType().name())
7880
.name(branch.getOptionalName().orElse(null))
7981
.id(branch.getId())
82+
.substationId1(terminal1.getVoltageLevel().getSubstation().map(Substation::getId).orElse(null))
83+
.substationId2(terminal2.getVoltageLevel().getSubstation().map(Substation::getId).orElse(null))
84+
.country1(mapCountry(terminal1.getVoltageLevel().getSubstation().orElse(null)))
85+
.country2(mapCountry(terminal2.getVoltageLevel().getSubstation().orElse(null)))
8086
.terminal1Connected(terminal1.isConnected())
8187
.terminal2Connected(terminal2.isConnected())
8288
.voltageLevelId1(terminal1.getVoltageLevel().getId())
@@ -96,7 +102,8 @@ public static ElementInfos toData(@NonNull final Identifiable<?> identifiable,
96102
.voltageLevelProperties2(ElementUtils.getProperties(terminal2.getVoltageLevel()))
97103
.substationProperties1(terminal1.getVoltageLevel().getSubstation().map(ElementUtils::getProperties).orElse(null))
98104
.substationProperties2(terminal2.getVoltageLevel().getSubstation().map(ElementUtils::getProperties).orElse(null))
99-
.branchObservability(toBranchObservability(branch));
105+
.branchObservability(toBranchObservability(branch))
106+
.operatingStatus(ExtensionUtils.toOperatingStatus(branch));
100107
}
101108

102109
private static BranchTabInfos toTabInfos(@NonNull final Branch<?> branch, @Nullable final Double dcPowerFactor) {

src/main/java/org/gridsuite/network/map/dto/mapper/LineInfosMapper.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ private static LineMapInfos toMapInfos(Identifiable<?> identifiable, Double dcPo
134134
private static LineTabInfos toTabInfos(Identifiable<?> identifiable, Double dcPowerFactor) {
135135
final Line line = (Line) identifiable;
136136
return toTabBuilder((LineTabInfosBuilder<LineTabInfos, ?>) LineTabInfos.builder(), line, dcPowerFactor)
137-
.country1(mapCountry(line.getTerminal1().getVoltageLevel().getSubstation().orElse(null)))
138-
.country2(mapCountry(line.getTerminal2().getVoltageLevel().getSubstation().orElse(null)))
139137
.g1(line.getG1())
140138
.b1(line.getB1())
141139
.g2(line.getG2())

src/main/java/org/gridsuite/network/map/dto/mapper/TwoWindingsTransformerInfosMapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ private static TwoWindingsTransformerTabInfos toTabInfos(Identifiable<?> identif
116116
.ratedU1(twoWT.getRatedU1())
117117
.ratedU2(twoWT.getRatedU2())
118118
.ratedS(nullIfNan(twoWT.getRatedS()))
119-
.operatingStatus(ExtensionUtils.toOperatingStatus(twoWT))
120119
.connectablePosition1(ExtensionUtils.toMapConnectablePosition(twoWT, 1))
121120
.connectablePosition2(ExtensionUtils.toMapConnectablePosition(twoWT, 2))
122121
.measurementRatioTap(ExtensionUtils.toMeasurementTapChanger(twoWT, DiscreteMeasurement.Type.TAP_POSITION, TapChanger.RATIO_TAP_CHANGER))

src/test/resources/2-windings-transformers-tab-data.json

Lines changed: 78 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
[
22
{
33
"id": "NGEN_NHV1",
4+
"type": "TWO_WINDINGS_TRANSFORMER",
45
"voltageLevelId1": "VLGEN",
6+
"voltageLevelId2": "VLHV1",
57
"voltageLevelName1": "VLGEN_Name",
68
"nominalVoltage1": 24.0,
7-
"voltageLevelId2": "VLHV1",
89
"nominalVoltage2": 380.0,
9-
"country": "FR",
10+
"substationId1": "P1",
11+
"substationId2": "P1",
12+
"country1": "FR",
13+
"country2": "FR",
1014
"terminal1Connected": true,
1115
"terminal2Connected": true,
1216
"p1": 11.1,
1317
"q1": 12.2,
1418
"p2": 13.33,
1519
"q2": 14.44,
20+
"r": 0.26658461538461536,
21+
"x": 11.104492831516762,
1622
"operationalLimitsGroup1": {
1723
"limit set 1": {
1824
"permanentLimit": 750.4,
@@ -52,6 +58,17 @@
5258
"limit set 1"
5359
],
5460
"selectedOperationalLimitsGroup2": "limit set 1",
61+
"substationProperties1": {
62+
"Country": "FR"
63+
},
64+
"voltageLevelProperties1": {
65+
"Country": "FR"
66+
},
67+
"substationProperties2": {
68+
"Country": "FR"
69+
},
70+
"operatingStatus": "PLANNED_OUTAGE",
71+
"country": "FR",
5572
"phaseTapChanger": {
5673
"lowTapPosition": 0,
5774
"tapPosition": 1,
@@ -86,8 +103,6 @@
86103
},
87104
"g": 0.0,
88105
"b": 0.0,
89-
"r": 0.26658461538461536,
90-
"x": 11.104492831516762,
91106
"ratedU1": 24.0,
92107
"ratedU2": 400.0,
93108
"connectablePosition1": {
@@ -99,30 +114,26 @@
99114
"connectionDirection": "BOTTOM",
100115
"connectionPosition": 0,
101116
"connectionName": "feederName2"
102-
},
103-
"operatingStatus": "PLANNED_OUTAGE",
104-
"substationProperties1": {
105-
"Country": "FR"
106-
},
107-
"substationProperties2": {
108-
"Country": "FR"
109-
},
110-
"voltageLevelProperties1": {
111-
"Country": "FR"
112117
}
113118
},
114119
{
115120
"id": "NHV2_NLOAD",
121+
"type": "TWO_WINDINGS_TRANSFORMER",
116122
"voltageLevelId1": "VLHV2",
117-
"nominalVoltage1": 380.0,
118123
"voltageLevelId2": "VLLOAD",
124+
"nominalVoltage1": 380.0,
119125
"nominalVoltage2": 150.0,
126+
"substationId1": "P2",
127+
"substationId2": "P2",
120128
"terminal1Connected": true,
121129
"terminal2Connected": true,
122130
"p1": 5.5,
123131
"q1": 6.6,
124132
"p2": 7.77,
125133
"q2": 8.88,
134+
"r": 0.04724999999999999,
135+
"x": 4.049724365620455,
136+
"operatingStatus": "PLANNED_OUTAGE",
126137
"ratioTapChanger": {
127138
"lowTapPosition": 0,
128139
"tapPosition": 2,
@@ -163,8 +174,6 @@
163174
},
164175
"g": 0.0,
165176
"b": 0.0,
166-
"r": 0.04724999999999999,
167-
"x": 4.049724365620455,
168177
"ratedU1": 400.0,
169178
"ratedU2": 158.0,
170179
"connectablePosition1": {
@@ -176,19 +185,24 @@
176185
"connectionDirection": "BOTTOM",
177186
"connectionPosition": 0,
178187
"connectionName": "feederName2"
179-
},
180-
"operatingStatus": "PLANNED_OUTAGE"
188+
}
181189
},
182190
{
183191
"id": "NGEN_NHV2",
192+
"type": "TWO_WINDINGS_TRANSFORMER",
184193
"voltageLevelId1": "VLGEN",
194+
"voltageLevelId2": "VLHV1",
185195
"voltageLevelName1": "VLGEN_Name",
186196
"nominalVoltage1": 24.0,
187-
"voltageLevelId2": "VLHV1",
188197
"nominalVoltage2": 380.0,
189-
"country": "FR",
198+
"substationId1": "P1",
199+
"substationId2": "P1",
200+
"country1": "FR",
201+
"country2": "FR",
190202
"terminal1Connected": true,
191203
"terminal2Connected": true,
204+
"r": 47.0,
205+
"x": 23.0,
192206
"operationalLimitsGroup1": {
193207
"DEFAULT": {
194208
"permanentLimit": 300.4,
@@ -202,7 +216,9 @@
202216
"applicability": null
203217
}
204218
},
205-
"operationalLimitsGroup1Names": ["DEFAULT"],
219+
"operationalLimitsGroup1Names": [
220+
"DEFAULT"
221+
],
206222
"selectedOperationalLimitsGroup1": "DEFAULT",
207223
"operationalLimitsGroup2": {
208224
"DEFAULT": {
@@ -217,19 +233,37 @@
217233
"applicability": null
218234
}
219235
},
220-
"operationalLimitsGroup2Names": ["DEFAULT"],
236+
"operationalLimitsGroup2Names": [
237+
"DEFAULT"
238+
],
221239
"selectedOperationalLimitsGroup2": "DEFAULT",
222-
"g": 27.0,
223-
"b": 17.0,
224-
"r": 47.0,
225-
"x": 23.0,
226-
"ratedU1": 400.0,
227-
"ratedU2": 158.0,
228-
"connectablePosition1": {
229-
"connectionDirection": null
240+
"branchObservability": {
241+
"qualityP1": {
242+
"standardDeviation": 23.31,
243+
"isRedundant": true
244+
},
245+
"qualityQ1": {
246+
"standardDeviation": 23.25,
247+
"isRedundant": true
248+
},
249+
"qualityP2": {
250+
"standardDeviation": 23.31,
251+
"isRedundant": true
252+
},
253+
"qualityQ2": {
254+
"standardDeviation": 23.25,
255+
"isRedundant": true
256+
},
257+
"observable": true
230258
},
231-
"connectablePosition2": {
232-
"connectionDirection": null
259+
"substationProperties1": {
260+
"Country": "FR"
261+
},
262+
"voltageLevelProperties1": {
263+
"Country": "FR"
264+
},
265+
"substationProperties2": {
266+
"Country": "FR"
233267
},
234268
"measurementP1": {
235269
"value": 27.0,
@@ -247,6 +281,17 @@
247281
"value": 53.0,
248282
"validity": false
249283
},
284+
"country": "FR",
285+
"g": 27.0,
286+
"b": 17.0,
287+
"ratedU1": 400.0,
288+
"ratedU2": 158.0,
289+
"connectablePosition1": {
290+
"connectionDirection": null
291+
},
292+
"connectablePosition2": {
293+
"connectionDirection": null
294+
},
250295
"measurementRatioTap": {
251296
"value": 11,
252297
"validity": true
@@ -255,37 +300,9 @@
255300
"value": 7,
256301
"validity": false
257302
},
258-
"branchObservability": {
259-
"qualityP1": {
260-
"standardDeviation": 23.31,
261-
"isRedundant": true
262-
},
263-
"qualityQ1": {
264-
"standardDeviation": 23.25,
265-
"isRedundant": true
266-
},
267-
"qualityP2": {
268-
"standardDeviation": 23.31,
269-
"isRedundant": true
270-
},
271-
"qualityQ2": {
272-
"standardDeviation": 23.25,
273-
"isRedundant": true
274-
},
275-
"observable": true
276-
},
277303
"toBeEstimated": {
278304
"ratioTapChangerStatus": false,
279305
"phaseTapChangerStatus": true
280-
},
281-
"substationProperties1": {
282-
"Country": "FR"
283-
},
284-
"substationProperties2": {
285-
"Country": "FR"
286-
},
287-
"voltageLevelProperties1": {
288-
"Country": "FR"
289306
}
290307
}
291308
]

0 commit comments

Comments
 (0)