diff --git a/diagram-test/pom.xml b/diagram-test/pom.xml index 5198fa462..c4468a545 100644 --- a/diagram-test/pom.xml +++ b/diagram-test/pom.xml @@ -15,7 +15,7 @@ com.powsybl powsybl-diagram - 4.6.1 + 4.6.2 powsybl-diagram-test diff --git a/diagram-util/pom.xml b/diagram-util/pom.xml index 8c6862e00..99accf451 100644 --- a/diagram-util/pom.xml +++ b/diagram-util/pom.xml @@ -14,7 +14,7 @@ com.powsybl powsybl-diagram - 4.6.1 + 4.6.2 powsybl-diagram-util diff --git a/distribution-diagram/pom.xml b/distribution-diagram/pom.xml index d5a73d972..e80b22862 100644 --- a/distribution-diagram/pom.xml +++ b/distribution-diagram/pom.xml @@ -15,7 +15,7 @@ powsybl-diagram com.powsybl - 4.6.1 + 4.6.2 pom diff --git a/network-area-diagram/pom.xml b/network-area-diagram/pom.xml index 26bfd661e..cbf02f7dc 100644 --- a/network-area-diagram/pom.xml +++ b/network-area-diagram/pom.xml @@ -16,7 +16,7 @@ com.powsybl powsybl-diagram - 4.6.1 + 4.6.2 powsybl-network-area-diagram diff --git a/pom.xml b/pom.xml index 4b581ccc1..932bac91b 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ powsybl-diagram - 4.6.1 + 4.6.2 pom PowSyBl Diagram diff --git a/single-line-diagram/pom.xml b/single-line-diagram/pom.xml index 7d1bfd748..433fcf869 100644 --- a/single-line-diagram/pom.xml +++ b/single-line-diagram/pom.xml @@ -15,7 +15,7 @@ com.powsybl powsybl-diagram - 4.6.1 + 4.6.2 pom diff --git a/single-line-diagram/single-line-diagram-cgmes/pom.xml b/single-line-diagram/single-line-diagram-cgmes/pom.xml index d747e896f..6c9b5b801 100644 --- a/single-line-diagram/single-line-diagram-cgmes/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/pom.xml @@ -15,7 +15,7 @@ powsybl-single-line-diagram com.powsybl - 4.6.1 + 4.6.2 powsybl-single-line-diagram-cgmes diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml index 7763eb806..281395e12 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml @@ -12,7 +12,7 @@ com.powsybl powsybl-single-line-diagram-cgmes - 4.6.1 + 4.6.2 powsybl-single-line-diagram-cgmes-dl-conversion diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml index bea0952af..26858f0a5 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml @@ -12,7 +12,7 @@ com.powsybl powsybl-single-line-diagram-cgmes - 4.6.1 + 4.6.2 powsybl-single-line-diagram-cgmes-iidm-extensions diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml index 02826d858..5636f856e 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml @@ -15,7 +15,7 @@ com.powsybl powsybl-single-line-diagram-cgmes - 4.6.1 + 4.6.2 powsybl-single-line-diagram-cgmes-layout diff --git a/single-line-diagram/single-line-diagram-core/pom.xml b/single-line-diagram/single-line-diagram-core/pom.xml index b359fa51d..a9f01531c 100644 --- a/single-line-diagram/single-line-diagram-core/pom.xml +++ b/single-line-diagram/single-line-diagram-core/pom.xml @@ -15,7 +15,7 @@ com.powsybl powsybl-single-line-diagram - 4.6.1 + 4.6.2 powsybl-single-line-diagram-core diff --git a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java index b4f1af68f..0c8cdc489 100644 --- a/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java +++ b/single-line-diagram/single-line-diagram-core/src/main/java/com/powsybl/sld/svg/styles/iidm/HighlightLineStateStyleProvider.java @@ -57,7 +57,7 @@ private boolean isBusOrBbsConnected(BusNode busNode) { } else { Bus bus = network.getBusBreakerView().getBus(equipmentId); if (bus != null) { - return bus.getConnectedTerminalStream().anyMatch(Terminal::isConnected); + return bus.getVoltageLevel().getBusView().getMergedBus(bus.getId()) != null; } return true; // should not happen } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseBusDisconnected.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseBusDisconnected.java new file mode 100644 index 000000000..0e490e11c --- /dev/null +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseBusDisconnected.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2024, 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 com.powsybl.sld.iidm; + +import com.powsybl.diagram.test.Networks; +import com.powsybl.iidm.network.*; +import com.powsybl.sld.builders.NetworkGraphBuilder; +import com.powsybl.sld.model.graphs.VoltageLevelGraph; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.IOException; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author Florian Dupuy {@literal } + */ +class TestCaseBusDisconnected extends AbstractTestCaseIidm { + + @BeforeEach + @Override + public void setUp() throws IOException { + network = Network.create("testCaseBusNodeDisconnected", "testCaseBusNodeDisconnected"); + graphBuilder = new NetworkGraphBuilder(network); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + + // bus breaker topology + VoltageLevel vlBb = Networks.createVoltageLevel(substation, "vlBb", "vlBb", TopologyKind.BUS_BREAKER, 225); + Bus b1 = vlBb.getBusBreakerView().newBus().setId("b1").add(); + Bus b2 = vlBb.getBusBreakerView().newBus().setId("b2").add(); + Bus b3 = vlBb.getBusBreakerView().newBus().setId("b3").add(); + vlBb.getBusBreakerView().newSwitch().setId("s12").setBus1(b1.getId()).setBus2(b2.getId()).add(); + vlBb.getBusBreakerView().newSwitch().setId("s23").setOpen(true).setBus1(b2.getId()).setBus2(b3.getId()).add(); + + // node breaker topology + VoltageLevel vlNb = Networks.createVoltageLevel(substation, "vlNb", "vlNb", TopologyKind.NODE_BREAKER, 225); + vlNb.getNodeBreakerView().newBusbarSection().setId("bbs1").setNode(0).add(); + vlNb.getNodeBreakerView().newBusbarSection().setId("bbs2").setNode(1).add(); + vlNb.getNodeBreakerView().newSwitch().setId("sLine").setKind(SwitchKind.DISCONNECTOR).setNode1(0).setNode2(2).add(); + vlNb.getNodeBreakerView().newSwitch().setId("sLoad").setOpen(true).setKind(SwitchKind.DISCONNECTOR).setNode1(1).setNode2(3).add(); + vlNb.newLoad().setNode(3).setId("load").setP0(10).setQ0(10).add(); + + network.newLine().setId("line") + .setG1(0).setB1(0).setVoltageLevel1(vlBb.getId()).setBus1(b2.getId()) + .setG2(0).setB2(0).setVoltageLevel2(vlNb.getId()).setNode2(2) + .setR(1).setX(1) + .add(); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("provideTestData") + void test(String testName, String vlId, String svgResourceName) { + VoltageLevelGraph g = graphBuilder.buildVoltageLevelGraph(vlId); + voltageLevelGraphLayout(g); + assertEquals(toString(svgResourceName), toSVG(g, svgResourceName)); + } + + private static List provideTestData() { + return List.of( + Arguments.of("Test bus connected/disconnected", "vlBb", "/TestCaseBusBreakerBusConnected.svg"), + Arguments.of("Test busbarSection connected/disconnected", "vlNb", "/TestCaseNodeBreakerBbsConnected.svg") + ); + } +} diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/TestCaseBusBreakerBusConnected.svg b/single-line-diagram/single-line-diagram-core/src/test/resources/TestCaseBusBreakerBusConnected.svg new file mode 100644 index 000000000..d6abdaa57 --- /dev/null +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/TestCaseBusBreakerBusConnected.svg @@ -0,0 +1,262 @@ + + + + + + + + b1 + + + + b2 + + + + b3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + line + + + + diff --git a/single-line-diagram/single-line-diagram-core/src/test/resources/TestCaseNodeBreakerBbsConnected.svg b/single-line-diagram/single-line-diagram-core/src/test/resources/TestCaseNodeBreakerBbsConnected.svg new file mode 100644 index 000000000..6450d7108 --- /dev/null +++ b/single-line-diagram/single-line-diagram-core/src/test/resources/TestCaseNodeBreakerBbsConnected.svg @@ -0,0 +1,236 @@ + + + + + + + + bbs1 + + + + bbs2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + load + + + +