Skip to content

Commit

Permalink
Bump powsybl-core to 5.3.0 (#523)
Browse files Browse the repository at this point in the history
* integration of new powsybl-core version 5.3.0-alpha-2
* deal with tie lines in network-area diagrams
* update test references for NAD
* manage tie lines in single-line diagrams

Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
  • Loading branch information
So-Fras authored and flo-dup committed Jun 7, 2023
1 parent a9ef6b6 commit 1a28286
Show file tree
Hide file tree
Showing 58 changed files with 1,706 additions and 69 deletions.
31 changes: 31 additions & 0 deletions diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java
Original file line number Diff line number Diff line change
Expand Up @@ -1942,4 +1942,35 @@ private static void addThreeFeedersPosition(Extendable<?> extendable,
feederAdder3.withName(feederName3).withDirection(direction3).add();
extensionAdder.add();
}

public static Network createNetworkWithTieLineInVoltageLevel() {
Network network = createBusBreakerNetworkWithInternalBranches("tieLineWithinVoltageLevel", "test");
network.getLine("L11").remove();
String tieLineId = "B11_B12_1";
String xnodeId = "XNODE1";
DanglingLine b11xnode1 = network.getVoltageLevel("VL1").newDanglingLine().setId("B11_XNODE1").setR(1.5).setX(20.0).setG(0.0).setB(1.93E-4).setBus("B11").setUcteXnodeCode(xnodeId).add();
DanglingLine xnode1b12 = network.getVoltageLevel("VL1").newDanglingLine().setId("XNODE1_B12").setR(1.5).setX(13.0).setG(0.0).setB(1.93E-4).setBus("B12").setUcteXnodeCode(xnodeId).add();
network.newTieLine().setId(tieLineId).setDanglingLine1(b11xnode1.getId()).setDanglingLine2(xnode1b12.getId()).add();
network.getTieLine(tieLineId).getDanglingLine1().getTerminal().setP(302.4440612792969).setQ(98.74027252197266);
network.getTieLine(tieLineId).getDanglingLine2().getTerminal().setP(-300.43389892578125).setQ(-137.18849182128906);

return network;

}

public static Network createNetworkWithTieLineInSubstation() {
Network network = createBusBreakerNetworkWithInternalBranches("tieLineWithinSubstation", "test");
network.getLine("L12").remove();
String tieLineId = "B11_B21_1";
String xnodeId = "XNODE1";
DanglingLine b11xnode1 = network.getVoltageLevel("VL1").newDanglingLine().setId("B11_XNODE1").setR(1.5).setX(20.0).setG(0.0).setB(1.93E-4).setBus("B11").setUcteXnodeCode(xnodeId).add();
DanglingLine xnode1b21 = network.getVoltageLevel("VL2").newDanglingLine().setId("XNODE1_B21").setR(1.5).setX(13.0).setG(0.0).setB(1.93E-4).setBus("B21").setUcteXnodeCode(xnodeId).add();
network.newTieLine().setId(tieLineId).setDanglingLine1(b11xnode1.getId()).setDanglingLine2(xnode1b21.getId()).add();
network.getTieLine(tieLineId).getDanglingLine1().getTerminal().setP(302.4440612792969).setQ(98.74027252197266);
network.getTieLine(tieLineId).getDanglingLine2().getTerminal().setP(-300.43389892578125).setQ(-137.18849182128906);

return network;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,19 @@ private void visitThreeWindingsTransformer(VoltageLevel vl, ThreeWindingsTransfo
}

private void visitDanglingLine(DanglingLine dl, Graph graph) {
BoundaryNode boundaryNode = new BoundaryNode(idProvider.createId(dl), dl.getId(), dl.getNameOrId());
BusNode boundaryBusNode = new BoundaryBusNode(idProvider.createId(dl), dl.getId());
boundaryNode.addBusNode(boundaryBusNode);
graph.addNode(boundaryNode);
addEdge(graph, dl, boundaryNode, boundaryBusNode);
if (!dl.isPaired()) {
BoundaryNode boundaryNode = new BoundaryNode(idProvider.createId(dl), dl.getId(), dl.getNameOrId());
BusNode boundaryBusNode = new BoundaryBusNode(idProvider.createId(dl), dl.getId());
boundaryNode.addBusNode(boundaryBusNode);
graph.addNode(boundaryNode);
addEdge(graph, dl, boundaryNode, boundaryBusNode);
} else {
dl.getTieLine().ifPresent(tieLine -> visitTieLine(tieLine, dl, graph));
}
}

private void visitTieLine(TieLine tieLine, DanglingLine dl, Graph graph) {
addEdge(graph, tieLine, dl.getTerminal().getVoltageLevel(), BranchEdge.TIE_LINE_EDGE);
}

private void visitHvdcConverterStation(HvdcConverterStation<?> converterStation, Graph graph) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public int getNum() {
public static final String LINE_EDGE = "LineEdge";
public static final String HVDC_LINE_EDGE = "HvdcLineEdge";
public static final String DANGLING_LINE_EDGE = "DanglingLineEdge";
public static final String TIE_LINE_EDGE = "TieLineEdge";

private List<Point> points1 = Collections.emptyList();
private List<Point> points2 = Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public interface StyleProvider {
String HVDC_EDGE_CLASS = CLASSES_PREFIX + "hvdc-edge";
String THREE_WT_EDGES_CLASS = CLASSES_PREFIX + "3wt-edges";
String DANGLING_LINE_EDGE_CLASS = CLASSES_PREFIX + "dangling-line-edge";
String TIE_LINE_EDGE_CLASS = CLASSES_PREFIX + "tie-line-edge";
String TEXT_EDGES_CLASS = CLASSES_PREFIX + "text-edges";
String EDGE_INFOS_CLASS = CLASSES_PREFIX + "edge-infos";
String EDGE_LABEL_CLASS = CLASSES_PREFIX + "edge-label";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ protected Optional<String> getBaseVoltageStyle(Edge edge) {
return Optional.of(HVDC_EDGE_CLASS);
} else if (branchType.equals(BranchEdge.DANGLING_LINE_EDGE)) {
return Optional.of(DANGLING_LINE_EDGE_CLASS);
} else if (branchType.equals(BranchEdge.TIE_LINE_EDGE)) {
return Optional.of(TIE_LINE_EDGE_CLASS);
}
} else if (edge instanceof ThreeWtEdge) {
Terminal terminal = network.getThreeWindingsTransformer(edge.getEquipmentId())
Expand Down
2 changes: 1 addition & 1 deletion network-area-diagram/src/main/resources/nominalStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.nad-vl-nodes .nad-busnode {fill: var(--nad-vl-color, lightblue)}
.nad-vl-nodes circle.nad-unknown-busnode {stroke: lightgrey; stroke-width: 5; stroke-dasharray: 5,5; fill: none}
.nad-hvdc-edge polyline.nad-hvdc {stroke: grey; stroke-width: 40}
.nad-dangling-line-edge {fill: var(--nad-vl-color, lighgrey)}
.nad-branch-edges .nad-tie-line-edge .nad-edge-path {stroke-width: 7}
.nad-pst-arrow {stroke: #6a6a6a; stroke-width: 4; stroke-linecap: round; fill: none}
.nad-state-out .nad-arrow-in {visibility: hidden}
.nad-state-in .nad-arrow-out {visibility: hidden}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.nad-vl-nodes .nad-busnode {fill: var(--nad-vl-color, lightgrey)}
.nad-vl-nodes circle.nad-unknown-busnode {stroke: var(--nad-vl-color, #808080); stroke-width: 5; stroke-dasharray: 5,5; fill: none}
.nad-hvdc-edge polyline.nad-hvdc {stroke: grey; stroke-width: 40}
.nad-dangling-line-edge {stroke: var(--nad-vl-color, lightgrey); stroke-width: 1; fill: none}
.nad-branch-edges .nad-tie-line-edge .nad-edge-path {stroke-width: 7}
.nad-pst-arrow {stroke: #6a6a6a; stroke-width: 4; stroke-linecap: round; fill: none}
.nad-state-out .nad-arrow-in {visibility: hidden}
.nad-state-in .nad-arrow-out {visibility: hidden}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2023, 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.nad.svg;

import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory;
import com.powsybl.nad.AbstractTest;
import com.powsybl.nad.layout.LayoutParameters;
import com.powsybl.nad.svg.iidm.DefaultLabelProvider;
import com.powsybl.nad.svg.iidm.NominalVoltageStyleProvider;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Sophie Frasnedo <sophie.frasnedo at rte-france.com>
*/
class TieLineTest extends AbstractTest {

@BeforeEach
void setup() {
setLayoutParameters(new LayoutParameters());
setSvgParameters(new SvgParameters()
.setSvgWidthAndHeightAdded(true)
.setFixedWidth(800));
}

@Override
protected StyleProvider getStyleProvider(Network network) {
return new NominalVoltageStyleProvider(network);
}

@Override
protected LabelProvider getLabelProvider(Network network) {
return new DefaultLabelProvider(network, getSvgParameters()) {
};
}

@Test
void testTieLine() {
Network network = EurostagTutorialExample1Factory.createWithTieLine();
assertEquals(toString("/tie_line.svg"), generateSvgString(network, "/tie_line.svg"));
}

}
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/3wt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/3wt_partial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/IEEE_118_bus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/IEEE_14_bus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/IEEE_24_bus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/IEEE_30_bus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/IEEE_57_bus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion network-area-diagram/src/test/resources/current_limits.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1a28286

Please sign in to comment.