Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add style for disconnected BusbarSection #624

Merged
merged 7 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public final class StyleClassConstants {
public static final String FRAME_CLASS = STYLE_PREFIX + "frame";
public static final String TOP_FEEDER = STYLE_PREFIX + "top-feeder";
public static final String BOTTOM_FEEDER = STYLE_PREFIX + "bottom-feeder";
public static final String BUS_DISCONNECTED = STYLE_PREFIX + "bus-disconnected";
public static final String FEEDER_DISCONNECTED_CONNECTED = STYLE_PREFIX + "feeder-disconnected-connected";
public static final String FEEDER_CONNECTED_DISCONNECTED = STYLE_PREFIX + "feeder-connected-disconnected";
public static final String FEEDER_DISCONNECTED = STYLE_PREFIX + "feeder-disconnected";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
package com.powsybl.sld.svg.styles.iidm;

import com.powsybl.iidm.network.*;
import com.powsybl.sld.library.ComponentLibrary;
import com.powsybl.sld.library.ComponentTypeName;
import com.powsybl.sld.model.graphs.Graph;
import com.powsybl.sld.model.graphs.VoltageLevelGraph;
import com.powsybl.sld.model.nodes.*;
import com.powsybl.sld.model.nodes.feeders.FeederWithSides;
import com.powsybl.sld.svg.styles.EmptyStyleProvider;
Expand All @@ -36,6 +38,27 @@ public List<String> getEdgeStyles(Graph graph, Edge edge) {
.orElse(Collections.emptyList());
}

@Override
public List<String> getNodeStyles(VoltageLevelGraph graph, Node node, ComponentLibrary componentLibrary, boolean showInternalNodes) {
if (node instanceof BusNode busNode && !isBusOrBbsConnected(busNode.getEquipmentId())) {
return List.of(StyleClassConstants.BUS_DISCONNECTED);
}
return Collections.emptyList();
}

private boolean isBusOrBbsConnected(String equipmentId) {
BusbarSection busbarSection = network.getBusbarSection(equipmentId);
if (busbarSection != null) {
return busbarSection.getTerminal().isConnected();
} else {
Bus bus = network.getBusBreakerView().getBus(equipmentId);
if (bus != null) {
return bus.getConnectedTerminalStream().anyMatch(Terminal::isConnected);
}
return false;
}
}

private Optional<String> getHighlightLineStateStyle(Graph graph, Edge edge) {
Node n1 = edge.getNode1();
Node n2 = edge.getNode2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.sld-wire.sld-feeder-disconnected {stroke: black}
.sld-wire.sld-feeder-connected-disconnected {stroke-dasharray: 3,3}
.sld-wire.sld-feeder-disconnected-connected {stroke: black; stroke-dasharray: 3,3}
.sld-busbar-section.sld-bus-disconnected {stroke-dasharray: 3,3}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void testAttributes() {

Node node3 = graph3.getNode("bbs3");
List<String> nodeStyle3 = styleProvider.getNodeStyles(graph3, node3, componentLibrary, false);
assertEquals(2, nodeStyle3.size());
assertEquals(3, nodeStyle3.size());
assertTrue(nodeStyle3.contains("sld-busbar-section"));
assertTrue(nodeStyle3.contains("sld-vl50to70"));

Expand Down
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
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