From da68ab80987f63e1bc229e50162a664f6858e297 Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Wed, 21 Jan 2026 17:04:39 +0100 Subject: [PATCH 1/8] adds shunt compensator bus columns to the spreadsheet data Signed-off-by: Mathieu DEHARBE --- .../shuntcompensator/ShuntCompensatorTabInfos.java | 4 ++++ .../network/map/dto/mapper/ShuntCompensatorMapper.java | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java index 85b6453b..a342cb6a 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java @@ -62,4 +62,8 @@ public class ShuntCompensatorTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private Map voltageLevelProperties; + + private String busId; + + private Double busV; } diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index e656430c..da3f493c 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -91,6 +91,14 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) .properties(getProperties(shuntCompensator)) .country(mapCountry(terminal.getVoltageLevel().getSubstation().orElse(null))); + if (terminal.getBusView().getBus() != null) { + builder.busV(terminal.getBusView().getBus().getV()); + builder.busId(terminal.getBusView().getBus().getId()); + } else if (terminal.getBusView().getConnectableBus() != null) { + // TODO : getConnectableBus provoque le chargement du réseau -> à virer ? autre moyen ?? + builder.busId(terminal.getBusView().getConnectableBus().getId()); + } + Double bPerSection = null; if (shuntCompensator.getModel() instanceof ShuntCompensatorLinearModel) { bPerSection = shuntCompensator.getModel(ShuntCompensatorLinearModel.class).getBPerSection(); From b9c4398d1438a5692de2c1ddf180b03cd94b405b Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Thu, 22 Jan 2026 10:51:40 +0100 Subject: [PATCH 2/8] extra Signed-off-by: Mathieu DEHARBE --- .../network/map/dto/mapper/ShuntCompensatorMapper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index da3f493c..0ed6a17a 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -91,11 +91,12 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) .properties(getProperties(shuntCompensator)) .country(mapCountry(terminal.getVoltageLevel().getSubstation().orElse(null))); - if (terminal.getBusView().getBus() != null) { - builder.busV(terminal.getBusView().getBus().getV()); - builder.busId(terminal.getBusView().getBus().getId()); + Bus bus = terminal.getBusView().getBus(); + if (bus != null) { + builder.busV(bus.getV()); + builder.busId(bus.getId()); } else if (terminal.getBusView().getConnectableBus() != null) { - // TODO : getConnectableBus provoque le chargement du réseau -> à virer ? autre moyen ?? + // TODO : getConnectableBus provoque le chargement du réseau -> regarder dedans par débug pour voir si à virer ? autre moyen ?? builder.busId(terminal.getBusView().getConnectableBus().getId()); } From 05927a52bc84e05840defbeb459de83726141ecd Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Mon, 26 Jan 2026 17:08:49 +0100 Subject: [PATCH 3/8] TU etc Signed-off-by: Mathieu DEHARBE --- .../shuntcompensator/ShuntCompensatorTabInfos.java | 2 ++ .../network/map/dto/mapper/ShuntCompensatorMapper.java | 10 +++++++--- src/test/resources/all-data-in-variant.json | 9 ++++++--- src/test/resources/all-data-without-optionals.json | 9 ++++++--- src/test/resources/all-data.json | 9 ++++++--- src/test/resources/partial-all-data-in-variant.json | 6 ++++-- src/test/resources/partial-all-data.json | 3 ++- .../partial-all-map-data-no-redundant-lines.json | 6 ++++-- .../shunt-compensators-tab-data-in-variant.json | 9 ++++++--- src/test/resources/shunt-compensators-tab-data.json | 9 ++++++--- 10 files changed, 49 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java index a342cb6a..412c0f20 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java @@ -63,7 +63,9 @@ public class ShuntCompensatorTabInfos extends ElementInfosWithProperties { @JsonInclude(JsonInclude.Include.NON_NULL) private Map voltageLevelProperties; + @JsonInclude(JsonInclude.Include.NON_NULL) private String busId; + @JsonInclude(JsonInclude.Include.NON_NULL) private Double busV; } diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index 0ed6a17a..3b91b91e 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -92,11 +92,15 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) .country(mapCountry(terminal.getVoltageLevel().getSubstation().orElse(null))); Bus bus = terminal.getBusView().getBus(); - if (bus != null) { - builder.busV(bus.getV()); + if (bus != null && bus.getId() != null) { + // those bus values are only applied if the bus is connected + if (!Double.isNaN(bus.getV())) { + builder.busV(bus.getV()); + } builder.busId(bus.getId()); } else if (terminal.getBusView().getConnectableBus() != null) { - // TODO : getConnectableBus provoque le chargement du réseau -> regarder dedans par débug pour voir si à virer ? autre moyen ?? + // TODO : do not merge with this + // getConnectableBus provoque le chargement du réseau -> regarder dedans par débug pour voir si à virer ? autre moyen ?? builder.busId(terminal.getBusView().getConnectableBus().getId()); } diff --git a/src/test/resources/all-data-in-variant.json b/src/test/resources/all-data-in-variant.json index 71b524cd..f6d15c40 100644 --- a/src/test/resources/all-data-in-variant.json +++ b/src/test/resources/all-data-in-variant.json @@ -2172,7 +2172,8 @@ }, "voltageLevelProperties": { "Country": "FR" - } + }, + "busId":"VLNEW2_0" }, { "id": "SHUNT2", @@ -2193,7 +2194,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT_VLNB", @@ -2249,7 +2251,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" } ], "staticVarCompensators": [ diff --git a/src/test/resources/all-data-without-optionals.json b/src/test/resources/all-data-without-optionals.json index c8f90570..920a83a9 100644 --- a/src/test/resources/all-data-without-optionals.json +++ b/src/test/resources/all-data-without-optionals.json @@ -1948,7 +1948,8 @@ }, "voltageLevelProperties": { "Country": "FR" - } + }, + "busId":"VLNEW2_0" }, { "id": "SHUNT2", @@ -1969,7 +1970,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT_VLNB", @@ -1989,7 +1991,8 @@ "measurementQ": { "value": 69.0, "validity": true - } + }, + "busId":"VLGEN4_0" }, { "id": "SHUNT_NON_LINEAR", diff --git a/src/test/resources/all-data.json b/src/test/resources/all-data.json index 5d0bfccb..11341742 100644 --- a/src/test/resources/all-data.json +++ b/src/test/resources/all-data.json @@ -2172,7 +2172,8 @@ }, "voltageLevelProperties": { "Country": "FR" - } + }, + "busId":"VLNEW2_0" }, { "id": "SHUNT2", @@ -2193,7 +2194,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT_VLNB", @@ -2213,7 +2215,8 @@ "measurementQ": { "value": 69.0, "validity": true - } + }, + "busId":"VLGEN4_0" }, { "id": "SHUNT_NON_LINEAR", diff --git a/src/test/resources/partial-all-data-in-variant.json b/src/test/resources/partial-all-data-in-variant.json index 8a87511c..ca1cc91d 100644 --- a/src/test/resources/partial-all-data-in-variant.json +++ b/src/test/resources/partial-all-data-in-variant.json @@ -352,7 +352,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT3", @@ -374,7 +375,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" } ], "staticVarCompensators": [], diff --git a/src/test/resources/partial-all-data.json b/src/test/resources/partial-all-data.json index ad6a21c3..eb642cd0 100644 --- a/src/test/resources/partial-all-data.json +++ b/src/test/resources/partial-all-data.json @@ -352,7 +352,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" } ], "staticVarCompensators": [], diff --git a/src/test/resources/partial-all-map-data-no-redundant-lines.json b/src/test/resources/partial-all-map-data-no-redundant-lines.json index 9c2c115c..235ad455 100644 --- a/src/test/resources/partial-all-map-data-no-redundant-lines.json +++ b/src/test/resources/partial-all-map-data-no-redundant-lines.json @@ -370,7 +370,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT3", @@ -392,7 +393,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" } ], "staticVarCompensators": [], diff --git a/src/test/resources/shunt-compensators-tab-data-in-variant.json b/src/test/resources/shunt-compensators-tab-data-in-variant.json index 138f5fd3..8b3d24ac 100644 --- a/src/test/resources/shunt-compensators-tab-data-in-variant.json +++ b/src/test/resources/shunt-compensators-tab-data-in-variant.json @@ -41,7 +41,8 @@ }, "voltageLevelProperties": { "Country": "FR" - } + }, + "busId":"VLNEW2_0" }, { "id": "SHUNT2", @@ -62,7 +63,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT_VLNB", @@ -118,6 +120,7 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" } ] \ No newline at end of file diff --git a/src/test/resources/shunt-compensators-tab-data.json b/src/test/resources/shunt-compensators-tab-data.json index 5e5eef93..2a2004dc 100644 --- a/src/test/resources/shunt-compensators-tab-data.json +++ b/src/test/resources/shunt-compensators-tab-data.json @@ -41,7 +41,8 @@ }, "voltageLevelProperties": { "Country": "FR" - } + }, + "busId":"VLNEW2_0" }, { "id": "SHUNT2", @@ -62,7 +63,8 @@ "targetV": 225.0, "substationProperties": { "Country": "FR" - } + }, + "busId":"VLGEN3_0" }, { "id": "SHUNT_VLNB", @@ -82,7 +84,8 @@ "measurementQ": { "value": 69.0, "validity": true - } + }, + "busId":"VLGEN4_0" }, { "id": "SHUNT_NON_LINEAR", From d992e06d23a9b3051cbf32168287fb4cd5745e01 Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Mon, 26 Jan 2026 17:25:12 +0100 Subject: [PATCH 4/8] TU etc Signed-off-by: Mathieu DEHARBE --- src/test/resources/all-data-in-variant.json | 6 ++++-- src/test/resources/all-data-without-optionals.json | 3 ++- src/test/resources/all-data.json | 3 ++- .../resources/shunt-compensators-tab-data-in-variant.json | 6 ++++-- src/test/resources/shunt-compensators-tab-data.json | 3 ++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/test/resources/all-data-in-variant.json b/src/test/resources/all-data-in-variant.json index f6d15c40..40209d39 100644 --- a/src/test/resources/all-data-in-variant.json +++ b/src/test/resources/all-data-in-variant.json @@ -2215,7 +2215,8 @@ "measurementQ": { "value": 69.0, "validity": true - } + }, + "busId":"VLGEN4_0" }, { "id": "SHUNT_NON_LINEAR", @@ -2229,7 +2230,8 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0 + "targetV": 225.0, + "busId":"VLGEN4_0" }, { "id": "SHUNT3", diff --git a/src/test/resources/all-data-without-optionals.json b/src/test/resources/all-data-without-optionals.json index 920a83a9..f790aee5 100644 --- a/src/test/resources/all-data-without-optionals.json +++ b/src/test/resources/all-data-without-optionals.json @@ -2006,7 +2006,8 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0 + "targetV": 225.0, + "busId":"VLGEN4_0" } ], "staticVarCompensators": [ diff --git a/src/test/resources/all-data.json b/src/test/resources/all-data.json index 11341742..258204f3 100644 --- a/src/test/resources/all-data.json +++ b/src/test/resources/all-data.json @@ -2230,7 +2230,8 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0 + "targetV": 225.0, + "busId":"VLGEN4_0" } ], "staticVarCompensators": [ diff --git a/src/test/resources/shunt-compensators-tab-data-in-variant.json b/src/test/resources/shunt-compensators-tab-data-in-variant.json index 8b3d24ac..93dc97f4 100644 --- a/src/test/resources/shunt-compensators-tab-data-in-variant.json +++ b/src/test/resources/shunt-compensators-tab-data-in-variant.json @@ -84,7 +84,8 @@ "measurementQ": { "value": 69.0, "validity": true - } + }, + "busId":"VLGEN4_0" }, { "id": "SHUNT_NON_LINEAR", @@ -98,7 +99,8 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0 + "targetV": 225.0, + "busId":"VLGEN4_0" }, { "id": "SHUNT3", diff --git a/src/test/resources/shunt-compensators-tab-data.json b/src/test/resources/shunt-compensators-tab-data.json index 2a2004dc..bdc378ae 100644 --- a/src/test/resources/shunt-compensators-tab-data.json +++ b/src/test/resources/shunt-compensators-tab-data.json @@ -99,6 +99,7 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0 + "targetV": 225.0, + "busId":"VLGEN4_0" } ] \ No newline at end of file From 710bd9b73cb901d832b06411a1d17fb72b922204 Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Tue, 27 Jan 2026 09:23:21 +0100 Subject: [PATCH 5/8] remove temp else Signed-off-by: Mathieu DEHARBE --- .../network/map/dto/mapper/ShuntCompensatorMapper.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index 3b91b91e..a89b0930 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -98,10 +98,6 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) builder.busV(bus.getV()); } builder.busId(bus.getId()); - } else if (terminal.getBusView().getConnectableBus() != null) { - // TODO : do not merge with this - // getConnectableBus provoque le chargement du réseau -> regarder dedans par débug pour voir si à virer ? autre moyen ?? - builder.busId(terminal.getBusView().getConnectableBus().getId()); } Double bPerSection = null; From 6c249105eb5f3eeb2a351e3bfc2fbfb2fca863db Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Tue, 27 Jan 2026 16:34:20 +0100 Subject: [PATCH 6/8] test on busV Signed-off-by: Mathieu DEHARBE --- .../network/map/dto/mapper/ShuntCompensatorMapper.java | 4 ++++ .../org/gridsuite/network/map/NetworkMapControllerTest.java | 1 + src/test/resources/shunt-compensators-tab-data.json | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index a89b0930..3b91b91e 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -98,6 +98,10 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) builder.busV(bus.getV()); } builder.busId(bus.getId()); + } else if (terminal.getBusView().getConnectableBus() != null) { + // TODO : do not merge with this + // getConnectableBus provoque le chargement du réseau -> regarder dedans par débug pour voir si à virer ? autre moyen ?? + builder.busId(terminal.getBusView().getConnectableBus().getId()); } Double bPerSection = null; diff --git a/src/test/java/org/gridsuite/network/map/NetworkMapControllerTest.java b/src/test/java/org/gridsuite/network/map/NetworkMapControllerTest.java index 1ac69ef9..785deb49 100644 --- a/src/test/java/org/gridsuite/network/map/NetworkMapControllerTest.java +++ b/src/test/java/org/gridsuite/network/map/NetworkMapControllerTest.java @@ -2732,6 +2732,7 @@ void shouldReturnBatteryTabData() throws Exception { @Test void shouldReturnShuntCompensatorTabData() throws Exception { + network.getShuntCompensator("SHUNT_VLNB").getTerminal().getBusView().getBus().setV(3.5); // to add a loadflow computed voltage succeedingTestForElementsInfos(NETWORK_UUID, null, ElementType.SHUNT_COMPENSATOR, InfoType.TAB, null, resourceToString("/shunt-compensators-tab-data.json")); succeedingTestForElementsInfos(NETWORK_UUID, VARIANT_ID, ElementType.SHUNT_COMPENSATOR, InfoType.TAB, null, resourceToString("/shunt-compensators-tab-data-in-variant.json")); } diff --git a/src/test/resources/shunt-compensators-tab-data.json b/src/test/resources/shunt-compensators-tab-data.json index bdc378ae..510fa508 100644 --- a/src/test/resources/shunt-compensators-tab-data.json +++ b/src/test/resources/shunt-compensators-tab-data.json @@ -85,7 +85,8 @@ "value": 69.0, "validity": true }, - "busId":"VLGEN4_0" + "busId":"VLGEN4_0", + "busV":3.5 }, { "id": "SHUNT_NON_LINEAR", From c9920e0e2adb192dbbf803c4a0d560777cb52ccf Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Tue, 27 Jan 2026 17:23:59 +0100 Subject: [PATCH 7/8] remove getConnectableBus Signed-off-by: Mathieu DEHARBE --- .../network/map/dto/mapper/ShuntCompensatorMapper.java | 4 ---- src/test/resources/all-data-in-variant.json | 6 ++---- src/test/resources/all-data-without-optionals.json | 3 +-- src/test/resources/all-data.json | 3 +-- .../resources/shunt-compensators-tab-data-in-variant.json | 6 ++---- src/test/resources/shunt-compensators-tab-data.json | 3 +-- 6 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index 3b91b91e..a89b0930 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -98,10 +98,6 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) builder.busV(bus.getV()); } builder.busId(bus.getId()); - } else if (terminal.getBusView().getConnectableBus() != null) { - // TODO : do not merge with this - // getConnectableBus provoque le chargement du réseau -> regarder dedans par débug pour voir si à virer ? autre moyen ?? - builder.busId(terminal.getBusView().getConnectableBus().getId()); } Double bPerSection = null; diff --git a/src/test/resources/all-data-in-variant.json b/src/test/resources/all-data-in-variant.json index 40209d39..f6d15c40 100644 --- a/src/test/resources/all-data-in-variant.json +++ b/src/test/resources/all-data-in-variant.json @@ -2215,8 +2215,7 @@ "measurementQ": { "value": 69.0, "validity": true - }, - "busId":"VLGEN4_0" + } }, { "id": "SHUNT_NON_LINEAR", @@ -2230,8 +2229,7 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0, - "busId":"VLGEN4_0" + "targetV": 225.0 }, { "id": "SHUNT3", diff --git a/src/test/resources/all-data-without-optionals.json b/src/test/resources/all-data-without-optionals.json index f790aee5..920a83a9 100644 --- a/src/test/resources/all-data-without-optionals.json +++ b/src/test/resources/all-data-without-optionals.json @@ -2006,8 +2006,7 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0, - "busId":"VLGEN4_0" + "targetV": 225.0 } ], "staticVarCompensators": [ diff --git a/src/test/resources/all-data.json b/src/test/resources/all-data.json index 258204f3..11341742 100644 --- a/src/test/resources/all-data.json +++ b/src/test/resources/all-data.json @@ -2230,8 +2230,7 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0, - "busId":"VLGEN4_0" + "targetV": 225.0 } ], "staticVarCompensators": [ diff --git a/src/test/resources/shunt-compensators-tab-data-in-variant.json b/src/test/resources/shunt-compensators-tab-data-in-variant.json index 93dc97f4..8b3d24ac 100644 --- a/src/test/resources/shunt-compensators-tab-data-in-variant.json +++ b/src/test/resources/shunt-compensators-tab-data-in-variant.json @@ -84,8 +84,7 @@ "measurementQ": { "value": 69.0, "validity": true - }, - "busId":"VLGEN4_0" + } }, { "id": "SHUNT_NON_LINEAR", @@ -99,8 +98,7 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0, - "busId":"VLGEN4_0" + "targetV": 225.0 }, { "id": "SHUNT3", diff --git a/src/test/resources/shunt-compensators-tab-data.json b/src/test/resources/shunt-compensators-tab-data.json index 510fa508..7f8f0b30 100644 --- a/src/test/resources/shunt-compensators-tab-data.json +++ b/src/test/resources/shunt-compensators-tab-data.json @@ -100,7 +100,6 @@ "connectablePosition": { "connectionDirection": null }, - "targetV": 225.0, - "busId":"VLGEN4_0" + "targetV": 225.0 } ] \ No newline at end of file From 59ddeba184924cd0979a03edc5dde600b9479b12 Mon Sep 17 00:00:00 2001 From: Mathieu DEHARBE Date: Wed, 28 Jan 2026 17:52:41 +0100 Subject: [PATCH 8/8] BusInfos substructure Signed-off-by: Mathieu DEHARBE --- .../ShuntCompensatorTabInfos.java | 6 ++--- .../map/dto/definition/topology/BusInfos.java | 27 +++++++++++++++++++ .../dto/mapper/ShuntCompensatorMapper.java | 11 +++++--- src/test/resources/all-data-in-variant.json | 12 ++++++--- .../resources/all-data-without-optionals.json | 12 ++++++--- src/test/resources/all-data.json | 12 ++++++--- .../partial-all-data-in-variant.json | 8 ++++-- src/test/resources/partial-all-data.json | 4 ++- ...rtial-all-map-data-no-redundant-lines.json | 8 ++++-- ...hunt-compensators-tab-data-in-variant.json | 12 ++++++--- .../shunt-compensators-tab-data.json | 14 +++++++--- 11 files changed, 97 insertions(+), 29 deletions(-) create mode 100644 src/main/java/org/gridsuite/network/map/dto/definition/topology/BusInfos.java diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java index 412c0f20..a9d818f0 100644 --- a/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java +++ b/src/main/java/org/gridsuite/network/map/dto/definition/shuntcompensator/ShuntCompensatorTabInfos.java @@ -11,6 +11,7 @@ import lombok.Getter; import lombok.experimental.SuperBuilder; import org.gridsuite.network.map.dto.ElementInfosWithProperties; +import org.gridsuite.network.map.dto.definition.topology.BusInfos; import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; import org.gridsuite.network.map.dto.definition.extension.InjectionObservabilityInfos; import org.gridsuite.network.map.dto.definition.extension.MeasurementsInfos; @@ -64,8 +65,5 @@ public class ShuntCompensatorTabInfos extends ElementInfosWithProperties { private Map voltageLevelProperties; @JsonInclude(JsonInclude.Include.NON_NULL) - private String busId; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double busV; + private BusInfos bus; } diff --git a/src/main/java/org/gridsuite/network/map/dto/definition/topology/BusInfos.java b/src/main/java/org/gridsuite/network/map/dto/definition/topology/BusInfos.java new file mode 100644 index 00000000..1d708d17 --- /dev/null +++ b/src/main/java/org/gridsuite/network/map/dto/definition/topology/BusInfos.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2026, 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/. + * SPDX-License-Identifier: MPL-2.0 + */ +package org.gridsuite.network.map.dto.definition.topology; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Builder; +import lombok.Getter; + +/** + * @author Mathieu Deharbe + * + * Those BusInfos are used when we want to add Bus data into another mapped data, not by itself + */ +@Getter +@Builder +public class BusInfos { + @JsonInclude(JsonInclude.Include.NON_NULL) + private String id; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Double v; +} diff --git a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java index a89b0930..b0d2b3c0 100644 --- a/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java +++ b/src/main/java/org/gridsuite/network/map/dto/mapper/ShuntCompensatorMapper.java @@ -10,6 +10,7 @@ import com.powsybl.iidm.network.extensions.Measurement.Type; import org.gridsuite.network.map.dto.ElementInfos; import org.gridsuite.network.map.dto.InfoTypeParameters; +import org.gridsuite.network.map.dto.definition.topology.BusInfos; import org.gridsuite.network.map.dto.definition.shuntcompensator.ShuntCompensatorFormInfos; import org.gridsuite.network.map.dto.definition.shuntcompensator.ShuntCompensatorTabInfos; import org.gridsuite.network.map.dto.utils.ElementUtils; @@ -94,10 +95,12 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable identifiable) Bus bus = terminal.getBusView().getBus(); if (bus != null && bus.getId() != null) { // those bus values are only applied if the bus is connected - if (!Double.isNaN(bus.getV())) { - builder.busV(bus.getV()); - } - builder.busId(bus.getId()); + builder.bus( + BusInfos.builder() + .id(bus.getId()) + .v(Double.isNaN(bus.getV()) ? null : bus.getV()) + .build() + ); } Double bPerSection = null; diff --git a/src/test/resources/all-data-in-variant.json b/src/test/resources/all-data-in-variant.json index f6d15c40..a3fccb6b 100644 --- a/src/test/resources/all-data-in-variant.json +++ b/src/test/resources/all-data-in-variant.json @@ -2173,7 +2173,9 @@ "voltageLevelProperties": { "Country": "FR" }, - "busId":"VLNEW2_0" + "bus": { + "id": "VLNEW2_0" + } }, { "id": "SHUNT2", @@ -2195,7 +2197,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT_VLNB", @@ -2252,7 +2256,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } } ], "staticVarCompensators": [ diff --git a/src/test/resources/all-data-without-optionals.json b/src/test/resources/all-data-without-optionals.json index 920a83a9..d3e0c368 100644 --- a/src/test/resources/all-data-without-optionals.json +++ b/src/test/resources/all-data-without-optionals.json @@ -1949,7 +1949,9 @@ "voltageLevelProperties": { "Country": "FR" }, - "busId":"VLNEW2_0" + "bus": { + "id": "VLNEW2_0" + } }, { "id": "SHUNT2", @@ -1971,7 +1973,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT_VLNB", @@ -1992,7 +1996,9 @@ "value": 69.0, "validity": true }, - "busId":"VLGEN4_0" + "bus": { + "id": "VLGEN4_0" + } }, { "id": "SHUNT_NON_LINEAR", diff --git a/src/test/resources/all-data.json b/src/test/resources/all-data.json index 11341742..959b6c1e 100644 --- a/src/test/resources/all-data.json +++ b/src/test/resources/all-data.json @@ -2173,7 +2173,9 @@ "voltageLevelProperties": { "Country": "FR" }, - "busId":"VLNEW2_0" + "bus": { + "id": "VLNEW2_0" + } }, { "id": "SHUNT2", @@ -2195,7 +2197,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT_VLNB", @@ -2216,7 +2220,9 @@ "value": 69.0, "validity": true }, - "busId":"VLGEN4_0" + "bus": { + "id": "VLGEN4_0" + } }, { "id": "SHUNT_NON_LINEAR", diff --git a/src/test/resources/partial-all-data-in-variant.json b/src/test/resources/partial-all-data-in-variant.json index ca1cc91d..0eb59693 100644 --- a/src/test/resources/partial-all-data-in-variant.json +++ b/src/test/resources/partial-all-data-in-variant.json @@ -353,7 +353,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT3", @@ -376,7 +378,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } } ], "staticVarCompensators": [], diff --git a/src/test/resources/partial-all-data.json b/src/test/resources/partial-all-data.json index eb642cd0..8d88b892 100644 --- a/src/test/resources/partial-all-data.json +++ b/src/test/resources/partial-all-data.json @@ -353,7 +353,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } } ], "staticVarCompensators": [], diff --git a/src/test/resources/partial-all-map-data-no-redundant-lines.json b/src/test/resources/partial-all-map-data-no-redundant-lines.json index 235ad455..73ada2c3 100644 --- a/src/test/resources/partial-all-map-data-no-redundant-lines.json +++ b/src/test/resources/partial-all-map-data-no-redundant-lines.json @@ -371,7 +371,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT3", @@ -394,7 +396,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } } ], "staticVarCompensators": [], diff --git a/src/test/resources/shunt-compensators-tab-data-in-variant.json b/src/test/resources/shunt-compensators-tab-data-in-variant.json index 8b3d24ac..bcf57197 100644 --- a/src/test/resources/shunt-compensators-tab-data-in-variant.json +++ b/src/test/resources/shunt-compensators-tab-data-in-variant.json @@ -42,7 +42,9 @@ "voltageLevelProperties": { "Country": "FR" }, - "busId":"VLNEW2_0" + "bus": { + "id": "VLNEW2_0" + } }, { "id": "SHUNT2", @@ -64,7 +66,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT_VLNB", @@ -121,6 +125,8 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } } ] \ No newline at end of file diff --git a/src/test/resources/shunt-compensators-tab-data.json b/src/test/resources/shunt-compensators-tab-data.json index 7f8f0b30..52e35146 100644 --- a/src/test/resources/shunt-compensators-tab-data.json +++ b/src/test/resources/shunt-compensators-tab-data.json @@ -42,7 +42,9 @@ "voltageLevelProperties": { "Country": "FR" }, - "busId":"VLNEW2_0" + "bus": { + "id": "VLNEW2_0" + } }, { "id": "SHUNT2", @@ -64,7 +66,9 @@ "substationProperties": { "Country": "FR" }, - "busId":"VLGEN3_0" + "bus": { + "id": "VLGEN3_0" + } }, { "id": "SHUNT_VLNB", @@ -85,8 +89,10 @@ "value": 69.0, "validity": true }, - "busId":"VLGEN4_0", - "busV":3.5 + "bus": { + "id": "VLGEN4_0", + "v": 3.5 + } }, { "id": "SHUNT_NON_LINEAR",