Skip to content

Commit

Permalink
Fix bug on fictitious busNodes (#654)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
(cherry picked from commit 1e06516)
  • Loading branch information
flo-dup committed Oct 18, 2024
1 parent c822b76 commit 254fef5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ public List<String> getEdgeStyles(Graph graph, Edge edge) {

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

private boolean isBusOrBbsConnected(String equipmentId) {
private boolean isBusOrBbsConnected(BusNode busNode) {
if (busNode.isFictitious()) {
return true; // always displayed like a connected bbs
}
String equipmentId = busNode.getEquipmentId();
BusbarSection busbarSection = network.getBusbarSection(equipmentId);
if (busbarSection != null) {
return busbarSection.getTerminal().isConnected();
Expand All @@ -55,7 +59,7 @@ private boolean isBusOrBbsConnected(String equipmentId) {
if (bus != null) {
return bus.getConnectedTerminalStream().anyMatch(Terminal::isConnected);
}
return false;
return true; // should not happen
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 254fef5

Please sign in to comment.