powsybl-diagram icon indicating copy to clipboard operation
powsybl-diagram copied to clipboard

Fix HighlightLineState feeder bug

Open flo-dup opened this issue 3 years ago • 2 comments

  • Do you want to request a feature or report a bug? Bug

  • What is the current behavior? HighlightLineState only applies to the FeederPrimaryBlock, it stops at its fictitious node highlightLineStateFeeder

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Use NominalVoltageDiagramStyleProvider or TopologicalStyleProvider with LayoutParameters::highlightLineState set to true (default value).

  • What is the expected behavior? Style applied from feeder to the first component

flo-dup avatar May 28 '21 10:05 flo-dup

Thanks for reporting this issue , I have the same need to apply HighlightLineState to the all wires between feeder node and the breaker node .

Like this :

image

As a workaround that works perfect, is to apply a custom class in the NominalVoltageDiagramStyleProvider on the edges between feeder node and the breaked node, thoses edges selected using two criteria :

private boolean edgeHasAdjacentDisconnector(Edge edge) { boolean node1HasAdjacentDisconnector = edge.getNode1().getAdjacentNodes().stream().anyMatch(n -> DISCONNECTOR.equals(n.getComponentType())); boolean node2HasAdjacentDisconnector = edge.getNode2().getAdjacentNodes().stream().anyMatch(n -> DISCONNECTOR.equals(n.getComponentType())); return node1HasAdjacentDisconnector || node2HasAdjacentDisconnector; }

private boolean edgeConnectedToBusbarSection(Edge edge) { return edge.getNodes().stream().anyMatch(n -> BUSBAR_SECTION.equals(n.getComponentType())); }

yasstec avatar Oct 22 '21 07:10 yasstec

I've improved the criteria to define wire and node between the Breaker and Feeder node to to be more generic (we had a bug in a particular case of SAB Disconnector between the feeder node and the breaker node) :

At the CustomVoltageDiagramStyleProvider.java :

    private boolean nodeIsNotBreaker(Node node) {
        return !ComponentTypeEnum.BREAKER.name().equals(node.getComponentType());
    }
    private boolean edgeHasAdjacentBusbarSection(Edge edge) {
        final Node node1 = edge.getNode1();
        final Node node2 = edge.getNode2();
        List<Node> allAdjacentNodes = ListUtils.union(node1.getAdjacentNodes(), node2.getAdjacentNodes());
        for (Node node : allAdjacentNodes) {
            if (node.getAdjacentNodes().stream().anyMatch(n -> BUSBAR_SECTION.equals(n.getComponentType()))) {
                return true;
            }
        }
        return false;
    }
    private boolean nodeHasAdjacentBusbarSection(Node node) {
        List<Node> adjacentNodes = node.getAdjacentNodes();
        for (Node elm : adjacentNodes) {
            if (BUSBAR_SECTION.equals(elm.getComponentType()) || elm.getAdjacentNodes().stream().anyMatch(n -> BUSBAR_SECTION.equals(n.getComponentType()))) {
                return true;
            }
        }
        return false;
    }

yasstec avatar Nov 12 '21 13:11 yasstec