Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,4 +63,7 @@ public class ShuntCompensatorTabInfos extends ElementInfosWithProperties {

@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, String> voltageLevelProperties;

@JsonInclude(JsonInclude.Include.NON_NULL)
private BusInfos bus;
}
Original file line number Diff line number Diff line change
@@ -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 <mathieu.deharbe at rte-france.com>
*
* 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,6 +92,17 @@ private static ShuntCompensatorTabInfos toTabInfos(Identifiable<?> identifiable)
.properties(getProperties(shuntCompensator))
.country(mapCountry(terminal.getVoltageLevel().getSubstation().orElse(null)));

Bus bus = terminal.getBusView().getBus();
if (bus != null && bus.getId() != null) {
// those bus values are only applied if the bus is connected
builder.bus(
BusInfos.builder()
.id(bus.getId())
.v(Double.isNaN(bus.getV()) ? null : bus.getV())
.build()
);
}

Double bPerSection = null;
if (shuntCompensator.getModel() instanceof ShuntCompensatorLinearModel) {
bPerSection = shuntCompensator.getModel(ShuntCompensatorLinearModel.class).getBPerSection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/resources/all-data-in-variant.json
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,9 @@
},
"voltageLevelProperties": {
"Country": "FR"
},
"bus": {
"id": "VLNEW2_0"
}
},
{
Expand All @@ -2193,6 +2196,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand Down Expand Up @@ -2249,6 +2255,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
}
],
Expand Down
9 changes: 9 additions & 0 deletions src/test/resources/all-data-without-optionals.json
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,9 @@
},
"voltageLevelProperties": {
"Country": "FR"
},
"bus": {
"id": "VLNEW2_0"
}
},
{
Expand All @@ -1969,6 +1972,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand All @@ -1989,6 +1995,9 @@
"measurementQ": {
"value": 69.0,
"validity": true
},
"bus": {
"id": "VLGEN4_0"
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions src/test/resources/all-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,9 @@
},
"voltageLevelProperties": {
"Country": "FR"
},
"bus": {
"id": "VLNEW2_0"
}
},
{
Expand All @@ -2193,6 +2196,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand All @@ -2213,6 +2219,9 @@
"measurementQ": {
"value": 69.0,
"validity": true
},
"bus": {
"id": "VLGEN4_0"
}
},
{
Expand Down
6 changes: 6 additions & 0 deletions src/test/resources/partial-all-data-in-variant.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand All @@ -374,6 +377,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
}
],
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/partial-all-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand All @@ -392,6 +395,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
},
"voltageLevelProperties": {
"Country": "FR"
},
"bus": {
"id": "VLNEW2_0"
}
},
{
Expand All @@ -62,6 +65,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand Down Expand Up @@ -118,6 +124,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
}
]
10 changes: 10 additions & 0 deletions src/test/resources/shunt-compensators-tab-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
},
"voltageLevelProperties": {
"Country": "FR"
},
"bus": {
"id": "VLNEW2_0"
}
},
{
Expand All @@ -62,6 +65,9 @@
"targetV": 225.0,
"substationProperties": {
"Country": "FR"
},
"bus": {
"id": "VLGEN3_0"
}
},
{
Expand All @@ -82,6 +88,10 @@
"measurementQ": {
"value": 69.0,
"validity": true
},
"bus": {
"id": "VLGEN4_0",
"v": 3.5
}
},
{
Expand Down