diff --git a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalBusBreakerViewImpl.java b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalBusBreakerViewImpl.java index fbd68971a..0608fbeda 100644 --- a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalBusBreakerViewImpl.java +++ b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalBusBreakerViewImpl.java @@ -146,9 +146,13 @@ public void moveConnectable(String busId, boolean connected) { throw new PowsyblException("Trying to move connectable " + attributes.getResource().getId() + " to bus " + busId + " of voltage level " + bus.getVoltageLevel().getId() + ", which is a node breaker voltage level"); } - attributes.setConnectableBus(busId); - attributes.setBus(connected ? busId : null); - attributes.setVoltageLevelId(voltageLevel.getId()); + getAbstractIdentifiable().updateResource(res -> { + InjectionAttributes attr = attributesGetter.apply(res); + attr.setConnectableBus(busId); + attr.setBus(connected ? busId : null); + attr.setNode(null); + attr.setVoltageLevelId(voltageLevel.getId()); + }); voltageLevel.invalidateCalculatedBuses(); } } diff --git a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalNodeBreakerViewImpl.java b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalNodeBreakerViewImpl.java index cab643335..08cb6325e 100644 --- a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalNodeBreakerViewImpl.java +++ b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalNodeBreakerViewImpl.java @@ -70,8 +70,13 @@ public void moveConnectable(int node, String voltageLevelId) { throw new ValidationException(attributes.getResource(), "an equipment (" + terminal.getConnectable().getId() + ") is already connected to node " + node + " of voltage level " + voltageLevelId); } - attributes.setNode(node); - attributes.setVoltageLevelId(voltageLevelId); + getAbstractIdentifiable().updateResource(res -> { + InjectionAttributes attr = attributesGetter.apply(res); + attr.setConnectableBus(null); + attr.setBus(null); + attr.setNode(node); + attr.setVoltageLevelId(voltageLevelId); + }); voltageLevel.invalidateCalculatedBuses(); } }