From a1b733ca2547918f84e20a3c2318cea1af60770e Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Tue, 11 Jan 2022 17:17:38 +0100 Subject: [PATCH 1/7] Remove disconnection info from BranchEdges Signed-off-by: Florian Dupuy --- .../com/powsybl/nad/NetworkAreaDiagram.java | 5 ++-- .../nad/build/iidm/NetworkGraphBuilder.java | 4 +-- .../powsybl/nad/model/AbstractBranchEdge.java | 19 +------------ .../java/com/powsybl/nad/model/LineEdge.java | 4 +-- .../java/com/powsybl/nad/model/TwoWtEdge.java | 5 ++-- .../nad/svg/AbstractStyleProvider.java | 4 ++- .../java/com/powsybl/nad/svg/EdgeInfo.java | 4 +-- .../svg/{ => iidm}/DefaultStyleProvider.java | 27 ++++++++++++++++--- .../java/com/powsybl/nad/AbstractTest.java | 4 +-- .../java/com/powsybl/nad/SvgWriterTest.java | 5 ++-- 10 files changed, 43 insertions(+), 38 deletions(-) rename src/main/java/com/powsybl/nad/svg/{ => iidm}/DefaultStyleProvider.java (55%) diff --git a/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java b/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java index 0dd93134..ff3f7b74 100644 --- a/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java +++ b/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java @@ -17,6 +17,7 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.model.Graph; import com.powsybl.nad.svg.*; +import com.powsybl.nad.svg.iidm.DefaultStyleProvider; import java.io.IOException; import java.io.StringWriter; @@ -56,7 +57,7 @@ public void draw(Path svgFile, SvgParameters svgParameters) { } public void draw(Path svgFile, SvgParameters svgParameters, LayoutParameters layoutParameters) { - draw(svgFile, svgParameters, layoutParameters, new DefaultStyleProvider()); + draw(svgFile, svgParameters, layoutParameters, new DefaultStyleProvider(network)); } public void draw(Path svgFile, SvgParameters svgParameters, LayoutParameters layoutParameters, @@ -98,7 +99,7 @@ public void draw(Writer writer, SvgParameters svgParameters) { } public void draw(Writer writer, SvgParameters svgParameters, LayoutParameters layoutParameters) { - draw(writer, svgParameters, layoutParameters, new DefaultStyleProvider()); + draw(writer, svgParameters, layoutParameters, new DefaultStyleProvider(network)); } public void draw(Writer writer, SvgParameters svgParameters, LayoutParameters layoutParameters, diff --git a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java index c3e39e1f..430fb517 100644 --- a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java +++ b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java @@ -86,8 +86,7 @@ public void visitLine(Line line, Branch.Side side) { VoltageLevelNode vlOtherNode = getOrCreateVoltageLevelNode(line.getTerminal(otherSide)); double nominalV = vlNode.getNominalV(); - LineEdge edge = new LineEdge(idProvider.createId(line), line.getId(), line.getNameOrId(), - line.getTerminal1().isConnected(), line.getTerminal2().isConnected(), nominalV); + LineEdge edge = new LineEdge(idProvider.createId(line), line.getId(), line.getNameOrId(), nominalV); graph.addEdge(vlNode, vlOtherNode, edge); } @@ -104,7 +103,6 @@ public void visitTwoWindingsTransformer(TwoWindingsTransformer twt, Branch.Side VoltageLevelNode vlOtherNode = getOrCreateVoltageLevelNode(twt.getTerminal(otherSide)); AbstractBranchEdge edge = new TwoWtEdge(idProvider.createId(twt), twt.getId(), twt.getNameOrId(), - twt.getTerminal(side).isConnected(), twt.getTerminal(otherSide).isConnected(), twt.getTerminal(side).getVoltageLevel().getNominalV(), twt.getTerminal(otherSide).getVoltageLevel().getNominalV()); graph.addEdge(vlNode, vlOtherNode, edge); } diff --git a/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java b/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java index 5919470a..154a1ac1 100644 --- a/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java +++ b/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java @@ -15,16 +15,12 @@ * @author Florian Dupuy */ public abstract class AbstractBranchEdge extends AbstractEdge implements BranchEdge { - private final boolean side1Connected; - private final boolean side2Connected; private List line1 = Collections.emptyList(); private List line2 = Collections.emptyList(); private final boolean[] visible = new boolean[] {true, true}; - protected AbstractBranchEdge(String diagramId, String equipmentId, String nameOrId, boolean side1Connected, boolean side2Connected) { + protected AbstractBranchEdge(String diagramId, String equipmentId, String nameOrId) { super(diagramId, equipmentId, nameOrId); - this.side1Connected = side1Connected; - this.side2Connected = side2Connected; } public List getLine(Side side) { @@ -65,17 +61,4 @@ public void setVisible(Side side, boolean visible) { Objects.requireNonNull(side); this.visible[side.ordinal()] = visible; } - - public boolean isConnected(Side side) { - Objects.requireNonNull(side); - return side == Side.ONE ? isSide1Connected() : isSide2Connected(); - } - - public boolean isSide1Connected() { - return side1Connected; - } - - public boolean isSide2Connected() { - return side2Connected; - } } diff --git a/src/main/java/com/powsybl/nad/model/LineEdge.java b/src/main/java/com/powsybl/nad/model/LineEdge.java index dab64637..86c3081c 100644 --- a/src/main/java/com/powsybl/nad/model/LineEdge.java +++ b/src/main/java/com/powsybl/nad/model/LineEdge.java @@ -4,8 +4,8 @@ public class LineEdge extends AbstractBranchEdge { private final double nominalV; - public LineEdge(String diagramId, String equipmentId, String nameOrId, boolean side1Connected, boolean side2Connected, double nominalV) { - super(diagramId, equipmentId, nameOrId, side1Connected, side2Connected); + public LineEdge(String diagramId, String equipmentId, String nameOrId, double nominalV) { + super(diagramId, equipmentId, nameOrId); this.nominalV = nominalV; } diff --git a/src/main/java/com/powsybl/nad/model/TwoWtEdge.java b/src/main/java/com/powsybl/nad/model/TwoWtEdge.java index b79bafb1..9b0ba5f8 100644 --- a/src/main/java/com/powsybl/nad/model/TwoWtEdge.java +++ b/src/main/java/com/powsybl/nad/model/TwoWtEdge.java @@ -5,9 +5,8 @@ public class TwoWtEdge extends AbstractBranchEdge { private final double nominalV1; private final double nominalV2; - public TwoWtEdge(String diagramId, String equipmentId, String nameOrId, boolean side1Connected, boolean side2Connected, - double nominalV1, double nominalV2) { - super(diagramId, equipmentId, nameOrId, side1Connected, side2Connected); + public TwoWtEdge(String diagramId, String equipmentId, String nameOrId, double nominalV1, double nominalV2) { + super(diagramId, equipmentId, nameOrId); this.nominalV1 = nominalV1; this.nominalV2 = nominalV2; } diff --git a/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java b/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java index 2fe255aa..2403938f 100644 --- a/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java +++ b/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java @@ -76,7 +76,7 @@ public List getEdgeStyleClasses(Edge edge) { public List getSideEdgeStyleClasses(BranchEdge edge, BranchEdge.Side side) { Objects.requireNonNull(side); List result = new ArrayList<>(); - if (edge instanceof AbstractBranchEdge && !((AbstractBranchEdge) edge).isConnected(side)) { + if (isDisconnectedBranch(edge, side)) { result.add(DISCONNECTED_SIDE_EDGE_CLASS); } if (edge instanceof TwoWtEdge) { @@ -85,6 +85,8 @@ public List getSideEdgeStyleClasses(BranchEdge edge, BranchEdge.Side sid return result; } + protected abstract boolean isDisconnectedBranch(BranchEdge edge, BranchEdge.Side side); + private Optional getBaseVoltageStyle(double nominalV) { return baseVoltagesConfig.getBaseVoltageName(nominalV, baseVoltagesConfig.getDefaultProfile()) .map(bvName -> CLASSES_PREFIX + bvName); diff --git a/src/main/java/com/powsybl/nad/svg/EdgeInfo.java b/src/main/java/com/powsybl/nad/svg/EdgeInfo.java index 2cc2f6c7..fa204216 100644 --- a/src/main/java/com/powsybl/nad/svg/EdgeInfo.java +++ b/src/main/java/com/powsybl/nad/svg/EdgeInfo.java @@ -12,8 +12,8 @@ * @author Florian Dupuy */ public class EdgeInfo { - static final String ACTIVE_POWER = "ActivePower"; - static final String REACTIVE_POWER = "ReactivePower"; + public static final String ACTIVE_POWER = "ActivePower"; + public static final String REACTIVE_POWER = "ReactivePower"; private final String infoType; private final Direction arrowDirection; diff --git a/src/main/java/com/powsybl/nad/svg/DefaultStyleProvider.java b/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java similarity index 55% rename from src/main/java/com/powsybl/nad/svg/DefaultStyleProvider.java rename to src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java index fdf4f1dd..55bc5ffe 100644 --- a/src/main/java/com/powsybl/nad/svg/DefaultStyleProvider.java +++ b/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java @@ -4,25 +4,36 @@ * 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/. */ -package com.powsybl.nad.svg; +package com.powsybl.nad.svg.iidm; import com.powsybl.commons.config.BaseVoltagesConfig; +import com.powsybl.iidm.network.Branch; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.Terminal; +import com.powsybl.nad.model.BranchEdge; +import com.powsybl.nad.svg.AbstractStyleProvider; +import com.powsybl.nad.svg.EdgeInfo; import java.util.Collections; import java.util.LinkedList; import java.util.List; +import java.util.Objects; /** * @author Florian Dupuy */ public class DefaultStyleProvider extends AbstractStyleProvider { - public DefaultStyleProvider() { + private final Network network; + + public DefaultStyleProvider(Network network) { super(); + this.network = network; } - public DefaultStyleProvider(BaseVoltagesConfig baseVoltageStyle) { + public DefaultStyleProvider(Network network, BaseVoltagesConfig baseVoltageStyle) { super(baseVoltageStyle); + this.network = network; } @Override @@ -43,4 +54,14 @@ public List getEdgeInfoStyles(EdgeInfo info) { return styles; } + @Override + protected boolean isDisconnectedBranch(BranchEdge edge, BranchEdge.Side side) { + Branch b = network.getBranch(edge.getEquipmentId()); + Terminal terminal = b.getTerminal(edgeSideToIidmSide(side)); + return terminal == null || !terminal.isConnected(); + } + + private Branch.Side edgeSideToIidmSide(BranchEdge.Side side) { + return Objects.requireNonNull(side) == BranchEdge.Side.ONE ? Branch.Side.ONE : Branch.Side.TWO; + } } diff --git a/src/test/java/com/powsybl/nad/AbstractTest.java b/src/test/java/com/powsybl/nad/AbstractTest.java index 9ca9814b..adf61565 100644 --- a/src/test/java/com/powsybl/nad/AbstractTest.java +++ b/src/test/java/com/powsybl/nad/AbstractTest.java @@ -36,7 +36,7 @@ public abstract class AbstractTest { protected abstract SvgParameters getSvgParameters(); - protected abstract StyleProvider getStyleProvider(); + protected abstract StyleProvider getStyleProvider(Network network); protected abstract LabelProvider getLabelProvider(Network network); @@ -48,7 +48,7 @@ protected String generateSvgString(Network network, Predicate volt Graph graph = new NetworkGraphBuilder(network, voltageLevelFilter).buildGraph(); new BasicForceLayout().run(graph, getLayoutParameters()); StringWriter writer = new StringWriter(); - new SvgWriter(getSvgParameters(), getStyleProvider(), getLabelProvider(network)).writeSvg(graph, writer); + new SvgWriter(getSvgParameters(), getStyleProvider(network), getLabelProvider(network)).writeSvg(graph, writer); String svgString = writer.toString(); if (debugSvg) { writeToHomeDir(refFilename, svgString); diff --git a/src/test/java/com/powsybl/nad/SvgWriterTest.java b/src/test/java/com/powsybl/nad/SvgWriterTest.java index 35775794..a16ff774 100644 --- a/src/test/java/com/powsybl/nad/SvgWriterTest.java +++ b/src/test/java/com/powsybl/nad/SvgWriterTest.java @@ -14,6 +14,7 @@ import com.powsybl.nad.build.iidm.VoltageLevelFilter; import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.*; +import com.powsybl.nad.svg.iidm.DefaultStyleProvider; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -45,8 +46,8 @@ protected SvgParameters getSvgParameters() { } @Override - protected StyleProvider getStyleProvider() { - return new DefaultStyleProvider(); + protected StyleProvider getStyleProvider(Network network) { + return new DefaultStyleProvider(network); } @Override From a59dc5cedcd83c33c6c9fa7c2d78540f592e1041 Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Tue, 11 Jan 2022 17:53:43 +0100 Subject: [PATCH 2/7] Remove nominal voltage info from BranchEdge Signed-off-by: Florian Dupuy --- .../nad/build/iidm/NetworkGraphBuilder.java | 12 ++++--- .../java/com/powsybl/nad/model/LineEdge.java | 9 +----- .../java/com/powsybl/nad/model/TwoWtEdge.java | 19 +----------- .../nad/svg/AbstractStyleProvider.java | 15 ++++++--- .../nad/svg/iidm/DefaultStyleProvider.java | 31 ++++++++++++++----- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java index 430fb517..cdb0fc0d 100644 --- a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java +++ b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java @@ -85,8 +85,7 @@ public void visitLine(Line line, Branch.Side side) { .orElseThrow(() -> new PowsyblException("Cannot add line, its voltage level is unknown")); VoltageLevelNode vlOtherNode = getOrCreateVoltageLevelNode(line.getTerminal(otherSide)); - double nominalV = vlNode.getNominalV(); - LineEdge edge = new LineEdge(idProvider.createId(line), line.getId(), line.getNameOrId(), nominalV); + LineEdge edge = new LineEdge(idProvider.createId(line), line.getId(), line.getNameOrId()); graph.addEdge(vlNode, vlOtherNode, edge); } @@ -102,9 +101,12 @@ public void visitTwoWindingsTransformer(TwoWindingsTransformer twt, Branch.Side .orElseThrow(() -> new PowsyblException("Cannot add two-windings transformer, its voltage level is unknown")); VoltageLevelNode vlOtherNode = getOrCreateVoltageLevelNode(twt.getTerminal(otherSide)); - AbstractBranchEdge edge = new TwoWtEdge(idProvider.createId(twt), twt.getId(), twt.getNameOrId(), - twt.getTerminal(side).getVoltageLevel().getNominalV(), twt.getTerminal(otherSide).getVoltageLevel().getNominalV()); - graph.addEdge(vlNode, vlOtherNode, edge); + AbstractBranchEdge edge = new TwoWtEdge(idProvider.createId(twt), twt.getId(), twt.getNameOrId()); + if (side == Branch.Side.ONE) { + graph.addEdge(vlNode, vlOtherNode, edge); + } else { + graph.addEdge(vlOtherNode, vlNode, edge); + } } @Override diff --git a/src/main/java/com/powsybl/nad/model/LineEdge.java b/src/main/java/com/powsybl/nad/model/LineEdge.java index 86c3081c..02444609 100644 --- a/src/main/java/com/powsybl/nad/model/LineEdge.java +++ b/src/main/java/com/powsybl/nad/model/LineEdge.java @@ -2,14 +2,7 @@ public class LineEdge extends AbstractBranchEdge { - private final double nominalV; - - public LineEdge(String diagramId, String equipmentId, String nameOrId, double nominalV) { + public LineEdge(String diagramId, String equipmentId, String nameOrId) { super(diagramId, equipmentId, nameOrId); - this.nominalV = nominalV; - } - - public double getNominalV() { - return nominalV; } } diff --git a/src/main/java/com/powsybl/nad/model/TwoWtEdge.java b/src/main/java/com/powsybl/nad/model/TwoWtEdge.java index 9b0ba5f8..0d395437 100644 --- a/src/main/java/com/powsybl/nad/model/TwoWtEdge.java +++ b/src/main/java/com/powsybl/nad/model/TwoWtEdge.java @@ -2,24 +2,7 @@ public class TwoWtEdge extends AbstractBranchEdge { - private final double nominalV1; - private final double nominalV2; - - public TwoWtEdge(String diagramId, String equipmentId, String nameOrId, double nominalV1, double nominalV2) { + public TwoWtEdge(String diagramId, String equipmentId, String nameOrId) { super(diagramId, equipmentId, nameOrId); - this.nominalV1 = nominalV1; - this.nominalV2 = nominalV2; - } - - public double getNominalV1() { - return nominalV1; - } - - public double getNominalV2() { - return nominalV2; - } - - public double getNominalV(Side side) { - return side == Side.ONE ? nominalV1 : nominalV2; } } diff --git a/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java b/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java index 2403938f..879f29ac 100644 --- a/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java +++ b/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java @@ -66,8 +66,9 @@ public List getNodeStyleClasses(Node node) { @Override public List getEdgeStyleClasses(Edge edge) { if (edge instanceof LineEdge) { - return getBaseVoltageStyle(((LineEdge) edge).getNominalV()) - .map(Collections::singletonList).orElse(Collections.emptyList()); + return getBaseVoltageStyle((LineEdge) edge) + .map(Collections::singletonList) + .orElse(Collections.emptyList()); } return Collections.emptyList(); } @@ -80,16 +81,20 @@ public List getSideEdgeStyleClasses(BranchEdge edge, BranchEdge.Side sid result.add(DISCONNECTED_SIDE_EDGE_CLASS); } if (edge instanceof TwoWtEdge) { - getBaseVoltageStyle(((TwoWtEdge) edge).getNominalV(side)).ifPresent(result::add); + getBaseVoltageStyle((TwoWtEdge) edge, side).ifPresent(result::add); } return result; } protected abstract boolean isDisconnectedBranch(BranchEdge edge, BranchEdge.Side side); - private Optional getBaseVoltageStyle(double nominalV) { + protected abstract Optional getBaseVoltageStyle(LineEdge edge); + + protected abstract Optional getBaseVoltageStyle(TwoWtEdge edge, BranchEdge.Side side); + + protected Optional getBaseVoltageStyle(double nominalV) { return baseVoltagesConfig.getBaseVoltageName(nominalV, baseVoltagesConfig.getDefaultProfile()) - .map(bvName -> CLASSES_PREFIX + bvName); + .map(bvName -> CLASSES_PREFIX + bvName); } } diff --git a/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java b/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java index 55bc5ffe..d20d67f0 100644 --- a/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java +++ b/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java @@ -7,17 +7,14 @@ package com.powsybl.nad.svg.iidm; import com.powsybl.commons.config.BaseVoltagesConfig; -import com.powsybl.iidm.network.Branch; -import com.powsybl.iidm.network.Network; -import com.powsybl.iidm.network.Terminal; +import com.powsybl.iidm.network.*; import com.powsybl.nad.model.BranchEdge; +import com.powsybl.nad.model.LineEdge; +import com.powsybl.nad.model.TwoWtEdge; import com.powsybl.nad.svg.AbstractStyleProvider; import com.powsybl.nad.svg.EdgeInfo; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * @author Florian Dupuy @@ -61,6 +58,26 @@ protected boolean isDisconnectedBranch(BranchEdge edge, BranchEdge.Side side) { return terminal == null || !terminal.isConnected(); } + @Override + protected Optional getBaseVoltageStyle(LineEdge edge) { + Line line = network.getLine(edge.getEquipmentId()); + double nominalVoltage = 0; + if (line.getTerminal1() != null) { + nominalVoltage = line.getTerminal1().getVoltageLevel().getNominalV(); + } else if (line.getTerminal2() != null) { + nominalVoltage = line.getTerminal2().getVoltageLevel().getNominalV(); + } + return getBaseVoltageStyle(nominalVoltage); + } + + @Override + protected Optional getBaseVoltageStyle(TwoWtEdge edge, BranchEdge.Side side) { + TwoWindingsTransformer transfo = network.getTwoWindingsTransformer(edge.getEquipmentId()); + Terminal terminal = transfo.getTerminal(edgeSideToIidmSide(side)); + double nominalVoltage = terminal == null ? 0 : terminal.getVoltageLevel().getNominalV(); + return getBaseVoltageStyle(nominalVoltage); + } + private Branch.Side edgeSideToIidmSide(BranchEdge.Side side) { return Objects.requireNonNull(side) == BranchEdge.Side.ONE ? Branch.Side.ONE : Branch.Side.TWO; } From 7c3312295418ebde64b18da19d5c8eb632ed2a88 Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Wed, 12 Jan 2022 10:47:04 +0100 Subject: [PATCH 3/7] Correct edge direction Signed-off-by: Florian Dupuy --- .../java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java | 5 +++++ src/main/java/com/powsybl/nad/layout/AbstractLayout.java | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java index cdb0fc0d..5d301a3f 100644 --- a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java +++ b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java @@ -87,6 +87,11 @@ public void visitLine(Line line, Branch.Side side) { LineEdge edge = new LineEdge(idProvider.createId(line), line.getId(), line.getNameOrId()); graph.addEdge(vlNode, vlOtherNode, edge); + if (side == Branch.Side.ONE) { + graph.addEdge(vlNode, vlOtherNode, edge); + } else { + graph.addEdge(vlOtherNode, vlNode, edge); + } } @Override diff --git a/src/main/java/com/powsybl/nad/layout/AbstractLayout.java b/src/main/java/com/powsybl/nad/layout/AbstractLayout.java index d1029cf3..d4ff85bc 100644 --- a/src/main/java/com/powsybl/nad/layout/AbstractLayout.java +++ b/src/main/java/com/powsybl/nad/layout/AbstractLayout.java @@ -27,6 +27,9 @@ private void singleEdgeLayout(Node node1, Node node2, BranchEdge edge) { Point middle = Point.createMiddlePoint(point1, point2); edge.setSide1(point1, middle); edge.setSide2(point2, middle); + if (node1 instanceof VoltageLevelNode && !((VoltageLevelNode) node1).isVisible()) { + edge.setVisible(BranchEdge.Side.ONE, false); + } if (node2 instanceof VoltageLevelNode && !((VoltageLevelNode) node2).isVisible()) { edge.setVisible(BranchEdge.Side.TWO, false); } From 490d93a0f2889545aa019a22ec77e8e91005282b Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Wed, 12 Jan 2022 11:19:10 +0100 Subject: [PATCH 4/7] Merge LineEdge and TwoWtEdge into BranchEdge Signed-off-by: Florian Dupuy --- .../nad/build/iidm/NetworkGraphBuilder.java | 5 +- .../powsybl/nad/model/AbstractBranchEdge.java | 64 ------------------- .../com/powsybl/nad/model/BranchEdge.java | 58 ++++++++++++++--- .../java/com/powsybl/nad/model/LineEdge.java | 8 --- .../java/com/powsybl/nad/model/TwoWtEdge.java | 8 --- .../nad/svg/AbstractStyleProvider.java | 12 ++-- .../java/com/powsybl/nad/svg/SvgWriter.java | 4 +- .../nad/svg/iidm/DefaultStyleProvider.java | 34 +++++----- 8 files changed, 77 insertions(+), 116 deletions(-) delete mode 100644 src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java delete mode 100644 src/main/java/com/powsybl/nad/model/LineEdge.java delete mode 100644 src/main/java/com/powsybl/nad/model/TwoWtEdge.java diff --git a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java index 5d301a3f..9e14288b 100644 --- a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java +++ b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java @@ -85,8 +85,7 @@ public void visitLine(Line line, Branch.Side side) { .orElseThrow(() -> new PowsyblException("Cannot add line, its voltage level is unknown")); VoltageLevelNode vlOtherNode = getOrCreateVoltageLevelNode(line.getTerminal(otherSide)); - LineEdge edge = new LineEdge(idProvider.createId(line), line.getId(), line.getNameOrId()); - graph.addEdge(vlNode, vlOtherNode, edge); + BranchEdge edge = new BranchEdge(idProvider.createId(line), line.getId(), line.getNameOrId(), BranchEdge.LINE_EDGE); if (side == Branch.Side.ONE) { graph.addEdge(vlNode, vlOtherNode, edge); } else { @@ -106,7 +105,7 @@ public void visitTwoWindingsTransformer(TwoWindingsTransformer twt, Branch.Side .orElseThrow(() -> new PowsyblException("Cannot add two-windings transformer, its voltage level is unknown")); VoltageLevelNode vlOtherNode = getOrCreateVoltageLevelNode(twt.getTerminal(otherSide)); - AbstractBranchEdge edge = new TwoWtEdge(idProvider.createId(twt), twt.getId(), twt.getNameOrId()); + BranchEdge edge = new BranchEdge(idProvider.createId(twt), twt.getId(), twt.getNameOrId(), BranchEdge.TWO_WT_EDGE); if (side == Branch.Side.ONE) { graph.addEdge(vlNode, vlOtherNode, edge); } else { diff --git a/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java b/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java deleted file mode 100644 index 154a1ac1..00000000 --- a/src/main/java/com/powsybl/nad/model/AbstractBranchEdge.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2021, 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/. - */ -package com.powsybl.nad.model; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -/** - * @author Florian Dupuy - */ -public abstract class AbstractBranchEdge extends AbstractEdge implements BranchEdge { - private List line1 = Collections.emptyList(); - private List line2 = Collections.emptyList(); - private final boolean[] visible = new boolean[] {true, true}; - - protected AbstractBranchEdge(String diagramId, String equipmentId, String nameOrId) { - super(diagramId, equipmentId, nameOrId); - } - - public List getLine(Side side) { - Objects.requireNonNull(side); - return side == Side.ONE ? getSide1() : getSide2(); - } - - @Override - public List getSide1() { - return Collections.unmodifiableList(line1); - } - - @Override - public List getSide2() { - return Collections.unmodifiableList(line2); - } - - @Override - public void setSide1(Point... points) { - Arrays.stream(points).forEach(Objects::requireNonNull); - this.line1 = Arrays.asList(points); - } - - @Override - public void setSide2(Point... points) { - Arrays.stream(points).forEach(Objects::requireNonNull); - this.line2 = Arrays.asList(points); - } - - @Override - public boolean isVisible(Side side) { - Objects.requireNonNull(side); - return visible[side.ordinal()]; - } - - @Override - public void setVisible(Side side, boolean visible) { - Objects.requireNonNull(side); - this.visible[side.ordinal()] = visible; - } -} diff --git a/src/main/java/com/powsybl/nad/model/BranchEdge.java b/src/main/java/com/powsybl/nad/model/BranchEdge.java index 83b327a4..67fb97cf 100644 --- a/src/main/java/com/powsybl/nad/model/BranchEdge.java +++ b/src/main/java/com/powsybl/nad/model/BranchEdge.java @@ -6,27 +6,67 @@ */ package com.powsybl.nad.model; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Objects; /** * @author Florian Dupuy */ -public interface BranchEdge extends Edge { - enum Side { +public class BranchEdge extends AbstractEdge { + + public enum Side { ONE, TWO } - List getLine(Side side); + public static final String TWO_WT_EDGE = "TwoWtEdge"; + public static final String LINE_EDGE = "LineEdge"; + + private List line1 = Collections.emptyList(); + private List line2 = Collections.emptyList(); + private final boolean[] visible = new boolean[] {true, true}; + private final String type; + + public BranchEdge(String diagramId, String equipmentId, String nameOrId, String type) { + super(diagramId, equipmentId, nameOrId); + this.type = type; + } + + public String getType() { + return type; + } + + public List getLine(Side side) { + Objects.requireNonNull(side); + return side == Side.ONE ? getSide1() : getSide2(); + } - List getSide1(); + public List getSide1() { + return Collections.unmodifiableList(line1); + } - List getSide2(); + public List getSide2() { + return Collections.unmodifiableList(line2); + } - void setSide1(Point... points); + public void setSide1(Point... points) { + Arrays.stream(points).forEach(Objects::requireNonNull); + this.line1 = Arrays.asList(points); + } - void setSide2(Point... points); + public void setSide2(Point... points) { + Arrays.stream(points).forEach(Objects::requireNonNull); + this.line2 = Arrays.asList(points); + } - boolean isVisible(Side side); + public boolean isVisible(Side side) { + Objects.requireNonNull(side); + return visible[side.ordinal()]; + } - void setVisible(Side side, boolean visible); + public void setVisible(Side side, boolean visible) { + Objects.requireNonNull(side); + this.visible[side.ordinal()] = visible; + } } diff --git a/src/main/java/com/powsybl/nad/model/LineEdge.java b/src/main/java/com/powsybl/nad/model/LineEdge.java deleted file mode 100644 index 02444609..00000000 --- a/src/main/java/com/powsybl/nad/model/LineEdge.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.powsybl.nad.model; - -public class LineEdge extends AbstractBranchEdge { - - public LineEdge(String diagramId, String equipmentId, String nameOrId) { - super(diagramId, equipmentId, nameOrId); - } -} diff --git a/src/main/java/com/powsybl/nad/model/TwoWtEdge.java b/src/main/java/com/powsybl/nad/model/TwoWtEdge.java deleted file mode 100644 index 0d395437..00000000 --- a/src/main/java/com/powsybl/nad/model/TwoWtEdge.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.powsybl.nad.model; - -public class TwoWtEdge extends AbstractBranchEdge { - - public TwoWtEdge(String diagramId, String equipmentId, String nameOrId) { - super(diagramId, equipmentId, nameOrId); - } -} diff --git a/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java b/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java index 879f29ac..f2ce0007 100644 --- a/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java +++ b/src/main/java/com/powsybl/nad/svg/AbstractStyleProvider.java @@ -65,8 +65,8 @@ public List getNodeStyleClasses(Node node) { @Override public List getEdgeStyleClasses(Edge edge) { - if (edge instanceof LineEdge) { - return getBaseVoltageStyle((LineEdge) edge) + if (edge instanceof BranchEdge) { + return getBaseVoltageStyle((BranchEdge) edge) .map(Collections::singletonList) .orElse(Collections.emptyList()); } @@ -80,17 +80,15 @@ public List getSideEdgeStyleClasses(BranchEdge edge, BranchEdge.Side sid if (isDisconnectedBranch(edge, side)) { result.add(DISCONNECTED_SIDE_EDGE_CLASS); } - if (edge instanceof TwoWtEdge) { - getBaseVoltageStyle((TwoWtEdge) edge, side).ifPresent(result::add); - } + getBaseVoltageStyle(edge, side).ifPresent(result::add); return result; } protected abstract boolean isDisconnectedBranch(BranchEdge edge, BranchEdge.Side side); - protected abstract Optional getBaseVoltageStyle(LineEdge edge); + protected abstract Optional getBaseVoltageStyle(BranchEdge edge); - protected abstract Optional getBaseVoltageStyle(TwoWtEdge edge, BranchEdge.Side side); + protected abstract Optional getBaseVoltageStyle(BranchEdge edge, BranchEdge.Side side); protected Optional getBaseVoltageStyle(double nominalV) { return baseVoltagesConfig.getBaseVoltageName(nominalV, baseVoltagesConfig.getDefaultProfile()) diff --git a/src/main/java/com/powsybl/nad/svg/SvgWriter.java b/src/main/java/com/powsybl/nad/svg/SvgWriter.java index fa417afd..5a245b1b 100644 --- a/src/main/java/com/powsybl/nad/svg/SvgWriter.java +++ b/src/main/java/com/powsybl/nad/svg/SvgWriter.java @@ -122,7 +122,7 @@ private void drawBranchEdges(Graph graph, XMLStreamWriter writer) throws XMLStre private void drawHalfEdge(Graph graph, XMLStreamWriter writer, BranchEdge edge, BranchEdge.Side side) throws XMLStreamException { // the half edge is only drawn if visible, but if the edge is a TwoWtEdge, the transformer is still drawn - if (!edge.isVisible(side) && !(edge instanceof TwoWtEdge)) { + if (!edge.isVisible(side) && !(edge.getType().equals(BranchEdge.TWO_WT_EDGE))) { return; } writer.writeStartElement(GROUP_ELEMENT_NAME); @@ -136,7 +136,7 @@ private void drawHalfEdge(Graph graph, XMLStreamWriter writer, BranchEdge edge, writer.writeAttribute("points", lineFormatted); drawEdgeInfo(writer, edge, side, labelProvider.getEdgeInfos(graph, edge, side)); } - if (edge instanceof TwoWtEdge) { + if (edge.getType().equals(BranchEdge.TWO_WT_EDGE)) { drawTransformer(writer, half); } writer.writeEndElement(); diff --git a/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java b/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java index d20d67f0..2b4eb501 100644 --- a/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java +++ b/src/main/java/com/powsybl/nad/svg/iidm/DefaultStyleProvider.java @@ -9,8 +9,6 @@ import com.powsybl.commons.config.BaseVoltagesConfig; import com.powsybl.iidm.network.*; import com.powsybl.nad.model.BranchEdge; -import com.powsybl.nad.model.LineEdge; -import com.powsybl.nad.model.TwoWtEdge; import com.powsybl.nad.svg.AbstractStyleProvider; import com.powsybl.nad.svg.EdgeInfo; @@ -59,23 +57,29 @@ protected boolean isDisconnectedBranch(BranchEdge edge, BranchEdge.Side side) { } @Override - protected Optional getBaseVoltageStyle(LineEdge edge) { - Line line = network.getLine(edge.getEquipmentId()); - double nominalVoltage = 0; - if (line.getTerminal1() != null) { - nominalVoltage = line.getTerminal1().getVoltageLevel().getNominalV(); - } else if (line.getTerminal2() != null) { - nominalVoltage = line.getTerminal2().getVoltageLevel().getNominalV(); + protected Optional getBaseVoltageStyle(BranchEdge edge) { + if (edge.getType().equals(BranchEdge.LINE_EDGE)) { + Branch branch = network.getBranch(edge.getEquipmentId()); + double nominalVoltage = 0; + if (branch.getTerminal1() != null) { + nominalVoltage = branch.getTerminal1().getVoltageLevel().getNominalV(); + } else if (branch.getTerminal2() != null) { + nominalVoltage = branch.getTerminal2().getVoltageLevel().getNominalV(); + } + return getBaseVoltageStyle(nominalVoltage); } - return getBaseVoltageStyle(nominalVoltage); + return Optional.empty(); } @Override - protected Optional getBaseVoltageStyle(TwoWtEdge edge, BranchEdge.Side side) { - TwoWindingsTransformer transfo = network.getTwoWindingsTransformer(edge.getEquipmentId()); - Terminal terminal = transfo.getTerminal(edgeSideToIidmSide(side)); - double nominalVoltage = terminal == null ? 0 : terminal.getVoltageLevel().getNominalV(); - return getBaseVoltageStyle(nominalVoltage); + protected Optional getBaseVoltageStyle(BranchEdge edge, BranchEdge.Side side) { + if (edge.getType().equals(BranchEdge.TWO_WT_EDGE)) { + Branch branch = network.getBranch(edge.getEquipmentId()); + Terminal terminal = branch.getTerminal(edgeSideToIidmSide(side)); + double nominalVoltage = terminal == null ? 0 : terminal.getVoltageLevel().getNominalV(); + return getBaseVoltageStyle(nominalVoltage); + } + return Optional.empty(); } private Branch.Side edgeSideToIidmSide(BranchEdge.Side side) { From ae38a3cdd2f55279602aafd96ea330be09e0f990 Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Wed, 12 Jan 2022 11:30:41 +0100 Subject: [PATCH 5/7] Move DefaultLabelProvider to iidm package Signed-off-by: Florian Dupuy --- src/main/java/com/powsybl/nad/NetworkAreaDiagram.java | 1 + .../com/powsybl/nad/svg/{ => iidm}/DefaultLabelProvider.java | 4 +++- src/test/java/com/powsybl/nad/SvgWriterTest.java | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) rename src/main/java/com/powsybl/nad/svg/{ => iidm}/DefaultLabelProvider.java (93%) diff --git a/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java b/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java index ff3f7b74..2f4430f4 100644 --- a/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java +++ b/src/main/java/com/powsybl/nad/NetworkAreaDiagram.java @@ -17,6 +17,7 @@ import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.model.Graph; import com.powsybl.nad.svg.*; +import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.DefaultStyleProvider; import java.io.IOException; diff --git a/src/main/java/com/powsybl/nad/svg/DefaultLabelProvider.java b/src/main/java/com/powsybl/nad/svg/iidm/DefaultLabelProvider.java similarity index 93% rename from src/main/java/com/powsybl/nad/svg/DefaultLabelProvider.java rename to src/main/java/com/powsybl/nad/svg/iidm/DefaultLabelProvider.java index c9f42f3e..50feffd2 100644 --- a/src/main/java/com/powsybl/nad/svg/DefaultLabelProvider.java +++ b/src/main/java/com/powsybl/nad/svg/iidm/DefaultLabelProvider.java @@ -4,11 +4,13 @@ * 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/. */ -package com.powsybl.nad.svg; +package com.powsybl.nad.svg.iidm; import com.powsybl.commons.PowsyblException; import com.powsybl.iidm.network.*; import com.powsybl.nad.model.*; +import com.powsybl.nad.svg.EdgeInfo; +import com.powsybl.nad.svg.LabelProvider; import java.util.Arrays; import java.util.List; diff --git a/src/test/java/com/powsybl/nad/SvgWriterTest.java b/src/test/java/com/powsybl/nad/SvgWriterTest.java index a16ff774..07bddae4 100644 --- a/src/test/java/com/powsybl/nad/SvgWriterTest.java +++ b/src/test/java/com/powsybl/nad/SvgWriterTest.java @@ -14,6 +14,7 @@ import com.powsybl.nad.build.iidm.VoltageLevelFilter; import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.*; +import com.powsybl.nad.svg.iidm.DefaultLabelProvider; import com.powsybl.nad.svg.iidm.DefaultStyleProvider; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; From 3ce3cacd860d702d4d1583b8b691db68469ac34e Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Fri, 14 Jan 2022 14:32:30 +0100 Subject: [PATCH 6/7] Remove connected info from ThreeWtEdge Signed-off-by: Florian Dupuy --- .../com/powsybl/nad/build/iidm/NetworkGraphBuilder.java | 6 +++--- src/main/java/com/powsybl/nad/model/ThreeWtEdge.java | 8 +------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java index 9e14288b..2741c79a 100644 --- a/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java +++ b/src/main/java/com/powsybl/nad/build/iidm/NetworkGraphBuilder.java @@ -140,9 +140,9 @@ public void visitThreeWindingsTransformer(ThreeWindingsTransformer twt, ThreeWin String twtId = twt.getId(); String twtName = twt.getNameOrId(); TransformerNode tn = new TransformerNode(idProvider.createId(twt), twtId, twtName); - graph.addEdge(tn, vlNode, new ThreeWtEdge(idProvider.createId(get3wtLeg(twt, side)), get3wtEquipmentId(twtId, side), twtName, twt.getTerminal(side).isConnected())); - graph.addEdge(tn, vlOtherNode1, new ThreeWtEdge(idProvider.createId(get3wtLeg(twt, otherSide1)), get3wtEquipmentId(twtId, otherSide1), twtName, twt.getTerminal(otherSide1).isConnected())); - graph.addEdge(tn, vlOtherNode2, new ThreeWtEdge(idProvider.createId(get3wtLeg(twt, otherSide2)), get3wtEquipmentId(twtId, otherSide2), twtName, twt.getTerminal(otherSide2).isConnected())); + graph.addEdge(tn, vlNode, new ThreeWtEdge(idProvider.createId(get3wtLeg(twt, side)), get3wtEquipmentId(twtId, side), twtName)); + graph.addEdge(tn, vlOtherNode1, new ThreeWtEdge(idProvider.createId(get3wtLeg(twt, otherSide1)), get3wtEquipmentId(twtId, otherSide1), twtName)); + graph.addEdge(tn, vlOtherNode2, new ThreeWtEdge(idProvider.createId(get3wtLeg(twt, otherSide2)), get3wtEquipmentId(twtId, otherSide2), twtName)); } private ThreeWindingsTransformer.Leg get3wtLeg(ThreeWindingsTransformer twt, ThreeWindingsTransformer.Side side) { diff --git a/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java b/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java index 78aadf0e..b348d40a 100644 --- a/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java +++ b/src/main/java/com/powsybl/nad/model/ThreeWtEdge.java @@ -10,14 +10,8 @@ * @author Florian Dupuy */ public class ThreeWtEdge extends AbstractEdge { - private final boolean connected; - public ThreeWtEdge(String diagramId, String equipmentId, String transformerName, boolean connected) { + public ThreeWtEdge(String diagramId, String equipmentId, String transformerName) { super(diagramId, equipmentId, transformerName); - this.connected = connected; - } - - public boolean isConnected() { - return connected; } } From 980fdb93ccb4de053fab95192f71748f2f8e2d72 Mon Sep 17 00:00:00 2001 From: Florian Dupuy Date: Fri, 14 Jan 2022 17:40:26 +0100 Subject: [PATCH 7/7] Update unit tests Signed-off-by: Florian Dupuy --- src/test/resources/IEEE_118_bus.svg | 140 +++++++------- src/test/resources/IEEE_118_bus_partial.svg | 44 ++--- src/test/resources/IEEE_24_bus.svg | 196 ++++++++++---------- src/test/resources/IEEE_30_bus.svg | 24 +-- src/test/resources/IEEE_57_bus.svg | 88 ++++----- src/test/resources/simple-eu.svg | 32 ++-- 6 files changed, 262 insertions(+), 262 deletions(-) diff --git a/src/test/resources/IEEE_118_bus.svg b/src/test/resources/IEEE_118_bus.svg index 411754d4..d3b35f22 100644 --- a/src/test/resources/IEEE_118_bus.svg +++ b/src/test/resources/IEEE_118_bus.svg @@ -349,44 +349,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -1111,44 +1111,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -1673,44 +1673,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -2395,44 +2395,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -4077,44 +4077,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -4239,44 +4239,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -5445,44 +5445,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + diff --git a/src/test/resources/IEEE_118_bus_partial.svg b/src/test/resources/IEEE_118_bus_partial.svg index 47a0f503..509ef05d 100644 --- a/src/test/resources/IEEE_118_bus_partial.svg +++ b/src/test/resources/IEEE_118_bus_partial.svg @@ -1315,44 +1315,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -1438,6 +1438,10 @@ + + + + @@ -1458,10 +1462,6 @@ - - - - @@ -1506,6 +1506,10 @@ + + + + @@ -1526,10 +1530,6 @@ - - - - @@ -1553,6 +1553,10 @@ + + + + @@ -1573,10 +1577,6 @@ - - - - diff --git a/src/test/resources/IEEE_24_bus.svg b/src/test/resources/IEEE_24_bus.svg index 32b471d0..ea94fe24 100644 --- a/src/test/resources/IEEE_24_bus.svg +++ b/src/test/resources/IEEE_24_bus.svg @@ -69,17 +69,17 @@ - - + + - + 0 - + @@ -88,17 +88,17 @@ - - + + - + 0 - + @@ -228,45 +228,45 @@ - - - + + + - + 0 - + 0 - + - - - + + + - + 0 - + 0 - + @@ -311,17 +311,17 @@ - - + + - + 0 - + @@ -330,17 +330,17 @@ - - + + - + 0 - + @@ -432,45 +432,45 @@ - - - + + + - + 0 - + 0 - + - - - + + + - + 0 - + 0 - + @@ -515,19 +515,19 @@ - + - - + + - + 0 - + @@ -536,17 +536,17 @@ - - + + - + 0 - + @@ -556,87 +556,87 @@ - - - + + + - + 0 - + 0 - + - - - + + + - + 0 - + 0 - + - - - + + + - + 0 - + 0 - + - - - + + + - + 0 - + 0 - + @@ -679,19 +679,19 @@ - + - - + + - + 0 - + @@ -700,17 +700,17 @@ - - + + - + 0 - + @@ -921,17 +921,17 @@ - - + + - + 0 - + @@ -940,17 +940,17 @@ - - + + - + 0 - + @@ -1001,17 +1001,17 @@ - - + + - + 0 - + @@ -1020,17 +1020,17 @@ - - + + - + 0 - + diff --git a/src/test/resources/IEEE_30_bus.svg b/src/test/resources/IEEE_30_bus.svg index ab3d1d58..3e56bfe0 100644 --- a/src/test/resources/IEEE_30_bus.svg +++ b/src/test/resources/IEEE_30_bus.svg @@ -1514,45 +1514,45 @@ - - - + + + - + 0 - + 0 - + - - - + + + - + 0 - + 0 - + diff --git a/src/test/resources/IEEE_57_bus.svg b/src/test/resources/IEEE_57_bus.svg index 3d86ceb0..6bb054ba 100644 --- a/src/test/resources/IEEE_57_bus.svg +++ b/src/test/resources/IEEE_57_bus.svg @@ -1569,44 +1569,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -2217,44 +2217,44 @@ - - + + - + 0 - + 0 - + - - + + - + 0 - + 0 - + @@ -2783,17 +2783,17 @@ - - + + - + 0 - + @@ -2802,17 +2802,17 @@ - - + + - + 0 - + @@ -2823,17 +2823,17 @@ - - + + - + 0 - + @@ -2842,17 +2842,17 @@ - - + + - + 0 - + @@ -3223,17 +3223,17 @@ - - + + - + 0 - + @@ -3242,17 +3242,17 @@ - - + + - + 0 - + diff --git a/src/test/resources/simple-eu.svg b/src/test/resources/simple-eu.svg index 78b3a340..30314e93 100644 --- a/src/test/resources/simple-eu.svg +++ b/src/test/resources/simple-eu.svg @@ -191,17 +191,17 @@ - - + + - + 0 - + @@ -210,17 +210,17 @@ - - + + - + 0 - + @@ -431,17 +431,17 @@ - - + + - + 0 - + @@ -450,17 +450,17 @@ - - + + - + 0 - +