Skip to content

Commit

Permalink
Make load-break-switch looks like breaker (#394)
Browse files Browse the repository at this point in the history
* Change sld-load-break-switch style
* Add test for sld-load-break-switch new style
* Add white background
* Update test references

Signed-off-by: Thomas ADAM <tadam@silicom.fr>
  • Loading branch information
tadam50 authored Jun 14, 2022
1 parent bb52de3 commit 303fdf2
Show file tree
Hide file tree
Showing 48 changed files with 549 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
.sld-disconnector {stroke-width: 3; stroke: black; fill: none}
/* Stroke blue */
.sld-breaker {stroke-width: 2; stroke: blue; fill:white}
.sld-load-break-switch {stroke: blue; fill: white}
/* Stroke --sld-vl-color with fallback black */
.sld-bus-connection {fill: var(--sld-vl-color, black)}
.sld-cell-shape-flat .sld-bus-connection {visibility: hidden}
.sld-busbar-section {stroke: var(--sld-vl-color, black); stroke-width: 3; fill: none}
/* Stroke --sld-vl-color with fallback red */
.sld-wire {stroke: var(--sld-vl-color, #c80000); fill: none}
/* Stroke --sld-vl-color with fallback blue */
.sld-load-break-switch {stroke: var(--sld-vl-color, blue); fill: none}
.sld-load {stroke: var(--sld-vl-color, blue); fill: none}
.sld-generator {stroke: var(--sld-vl-color, blue); fill: none}
.sld-two-wt {stroke: var(--sld-vl-color, blue); fill: none}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright (c) 2019, 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.sld.iidm;

import com.powsybl.iidm.network.Country;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.SwitchKind;
import com.powsybl.iidm.network.TopologyKind;
import com.powsybl.sld.builders.NetworkGraphBuilder;
import com.powsybl.sld.iidm.extensions.ConnectablePosition;
import com.powsybl.sld.model.graphs.VoltageLevelGraph;
import com.powsybl.sld.util.TopologicalStyleProvider;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
* @author Thomas Adam <tadam at silicom.fr>
*/
public class TestCaseLoadBreakSwitch extends AbstractTestCaseIidm {

@Before
public void setUp() {
network = Network.create("testCaseLoadBreakSwitch", "test");
graphBuilder = new NetworkGraphBuilder(network);
substation = createSubstation(network, "s", "s", Country.FR);
vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10);
createBusBarSection(vl, "bbs", "bbs", 0, 1, 1);
createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 2);
createGenerator(vl, "G", "G", "G", 0, ConnectablePosition.Direction.TOP, 2, 50, 100, false, 100, 400);
createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.BOTTOM, 3, 10, 10);
createSwitch(vl, "d", "d", SwitchKind.LOAD_BREAK_SWITCH, false, false, false, 0, 2);
createSwitch(vl, "b", "b", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 1, 3);
createSwitch(vl, "b1", "b1", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 0, 1);

createTwoWindingsTransformer(substation, "T11", "T11", 250, 100, 52, 12, 65, 90,
4, 6, vl.getId(), vl.getId(),
"T11", null, ConnectablePosition.Direction.TOP,
"T11", null, ConnectablePosition.Direction.BOTTOM);
createSwitch(vl, "b2", "b2", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 0, 4);
createSwitch(vl, "b3", "b3", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 1, 5);
createSwitch(vl, "b4", "b4", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 5, 6);
createSwitch(vl, "b5", "b5", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 5, 3);
}

@Test
public void test() {
// build graph
VoltageLevelGraph g = graphBuilder.buildVoltageLevelGraph(vl.getId());

// Run layout
voltageLevelGraphLayout(g);

// write Json and compare to reference
assertEquals(toString("/TestCaseLoadBreakSwitch.svg"), toSVG(g, "/TestCaseLoadBreakSwitch.svg", getDefaultDiagramLabelProvider(), new TopologicalStyleProvider(network)));
}
}
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 single-line-diagram-core/src/test/resources/TestCase1.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
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
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 303fdf2

Please sign in to comment.