-
Notifications
You must be signed in to change notification settings - Fork 0
get all voltage level connections #277
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
Closed
Closed
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
98d2a6e
get all voltage level connections
EtienneLt 397e97c
Merge branch 'main' into get-all-voltage-levels-connections
EtienneLt 884a664
fix
EtienneLt 732185b
refactor
EtienneLt 46700f8
refactor everything
EtienneLt 6b9b5a4
fix
EtienneLt 6d0e15e
fix
EtienneLt 01cbb74
fix
EtienneLt 80a13c0
Merge branch 'main' into get-all-voltage-levels-connections
EtienneLt 7774634
fix
EtienneLt 0305db9
remove error from merge
EtienneLt 84cff31
checkstyle
EtienneLt a971d0c
Merge branch 'main' into get-all-voltage-levels-connections
EtienneLt 1e5770b
add tests
EtienneLt f63c963
add side for branches
EtienneLt 7e6fd6b
add side
ghazwarhili c966b59
rename side to connectionSide
ghazwarhili c2a535e
fix naming
ghazwarhili 12d9d9f
renaming
ghazwarhili fed0ec8
fix for BusbarSectionFinderTraverser
ghazwarhili c112b6a
enhance BusbarSectionFinderTraverser to handle all cases
ghazwarhili 34b31cc
code review remarks part 1
ghazwarhili 5a615ba
code review remarks part 2
ghazwarhili 8163bb1
resolving conflicts
ghazwarhili 8bcf99a
Merge branch 'fix-busbar-section-finder-traverser' into get-all-volta…
ghazwarhili fff52f6
Etienne H Request to use FeederSide
ghazwarhili c40fe02
resolving conflicts and revert BusbarSectionFinderTraverser
ghazwarhili File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...ain/java/org/gridsuite/network/map/dto/definition/extension/ConnectablePositionInfos.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/org/gridsuite/network/map/dto/definition/voltagelevel/FeederBayInfos.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) 2025, 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 org.gridsuite.network.map.dto.definition.voltagelevel; | ||
|
||
import com.powsybl.iidm.network.TwoSides; | ||
import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; | ||
|
||
/** | ||
* @author Etienne Lesot <etienne.lesot at rte-france.com> | ||
*/ | ||
public record FeederBayInfos(String busbarSectionId, ConnectablePositionInfos connectablePositionInfos, TwoSides connectionSide) { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,14 @@ | |
package org.gridsuite.network.map.dto.utils; | ||
|
||
import com.powsybl.iidm.network.*; | ||
import com.powsybl.iidm.network.extensions.ConnectablePosition; | ||
import com.powsybl.math.graph.TraversalType; | ||
import lombok.NonNull; | ||
import org.gridsuite.network.map.dto.common.ReactiveCapabilityCurveMapData; | ||
import org.gridsuite.network.map.dto.common.TapChangerData; | ||
import org.gridsuite.network.map.dto.common.TapChangerStepData; | ||
import org.gridsuite.network.map.dto.definition.extension.BusbarSectionFinderTraverser; | ||
import org.springframework.lang.NonNull; | ||
import org.gridsuite.network.map.dto.definition.extension.ConnectablePositionInfos; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
|
@@ -39,6 +41,53 @@ public static void setIfNotNan(@NonNull final DoubleConsumer setter, final doubl | |
} | ||
} | ||
|
||
public enum FeederSide { | ||
INJECTION_SINGLE_SIDE, | ||
BRANCH_SIDE_ONE, | ||
BRANCH_SIDE_TWO; | ||
|
||
public static FeederSide from(Optional<ThreeSides> connectableSide) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
ThreeSides threeSides = connectableSide.orElse(null); | ||
if (threeSides == null) { | ||
return INJECTION_SINGLE_SIDE; | ||
} | ||
return threeSides == ThreeSides.ONE ? BRANCH_SIDE_ONE : BRANCH_SIDE_TWO; | ||
} | ||
} | ||
|
||
private static ConnectablePosition.Feeder getFeederInfos(Identifiable<?> identifiable, FeederSide side) { | ||
var connectablePosition = identifiable.getExtension(ConnectablePosition.class); | ||
if (connectablePosition == null) { | ||
return null; | ||
} | ||
|
||
switch (side) { | ||
case INJECTION_SINGLE_SIDE: | ||
return connectablePosition.getFeeder(); | ||
case BRANCH_SIDE_ONE: | ||
return connectablePosition.getFeeder1(); | ||
case BRANCH_SIDE_TWO: | ||
return connectablePosition.getFeeder2(); | ||
default: | ||
throw new IllegalArgumentException("Invalid feeder side: " + side); | ||
} | ||
} | ||
|
||
public static ConnectablePositionInfos getConnectablePosition(Identifiable<?> identifiable, FeederSide side) { | ||
ConnectablePosition.Feeder feeder = getFeederInfos(identifiable, side); | ||
return buildConnectablePositionInfos(feeder); | ||
} | ||
|
||
public static ConnectablePositionInfos buildConnectablePositionInfos(ConnectablePosition.Feeder feeder) { | ||
ConnectablePositionInfos.ConnectablePositionInfosBuilder builder = ConnectablePositionInfos.builder(); | ||
if (feeder != null) { | ||
builder.connectionDirection(feeder.getDirection() == null ? null : feeder.getDirection()) | ||
.connectionPosition(feeder.getOrder().orElse(null)) | ||
.connectionName(feeder.getName().orElse(null)); | ||
} | ||
return builder.build(); | ||
} | ||
|
||
public static String getBusOrBusbarSection(Terminal terminal) { | ||
if (terminal.getVoltageLevel().getTopologyKind().equals(TopologyKind.BUS_BREAKER)) { | ||
if (terminal.isConnected()) { | ||
|
@@ -47,9 +96,10 @@ public static String getBusOrBusbarSection(Terminal terminal) { | |
return terminal.getBusBreakerView().getConnectableBus().getId(); | ||
} | ||
} else { | ||
final BusbarSectionFinderTraverser connectedBusbarSectionFinder = new BusbarSectionFinderTraverser(terminal.isConnected()); | ||
terminal.traverse(connectedBusbarSectionFinder, TraversalType.BREADTH_FIRST); | ||
return connectedBusbarSectionFinder.getFirstTraversedBbsId(); | ||
// NODE_BREAKER: explore all paths and choose the busbar with the closed disconnector | ||
etiennehomer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
BusbarSectionFinderTraverser finder = new BusbarSectionFinderTraverser(); | ||
terminal.traverse(finder, TraversalType.BREADTH_FIRST); | ||
return finder.getBusbarWithClosedDisconnector(); | ||
} | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move those changes in another PR. So the review can be done with #288. And the changes in the tests will be reviewed with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's back lol