-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-regulating-phaseTapChanger
- Loading branch information
Showing
6 changed files
with
214 additions
and
99 deletions.
There are no files selected for viewing
This file contains 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
49 changes: 49 additions & 0 deletions
49
...in/java/org/gridsuite/modification/server/modifications/BusbarSectionFinderTraverser.java
This file contains 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,49 @@ | ||
/** | ||
* Copyright (c) 2024, 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.modification.server.modifications; | ||
|
||
import com.powsybl.iidm.network.IdentifiableType; | ||
import com.powsybl.iidm.network.Switch; | ||
import com.powsybl.iidm.network.Terminal; | ||
import com.powsybl.math.graph.TraverseResult; | ||
|
||
/** | ||
* @author Slimane Amar <slimane.amar at rte-france.com> | ||
*/ | ||
// FIXME : to remove when this class is available in network-store | ||
public class BusbarSectionFinderTraverser implements Terminal.TopologyTraverser { | ||
|
||
private final boolean onlyConnectedBbs; | ||
|
||
private String firstTraversedBbsId; | ||
|
||
public BusbarSectionFinderTraverser(boolean onlyConnectedBbs) { | ||
this.onlyConnectedBbs = onlyConnectedBbs; | ||
} | ||
|
||
@Override | ||
public TraverseResult traverse(Terminal terminal, boolean connected) { | ||
if (terminal.getConnectable().getType() == IdentifiableType.BUSBAR_SECTION) { | ||
firstTraversedBbsId = terminal.getConnectable().getId(); | ||
return TraverseResult.TERMINATE_TRAVERSER; | ||
} | ||
return TraverseResult.CONTINUE; | ||
} | ||
|
||
@Override | ||
public TraverseResult traverse(Switch aSwitch) { | ||
if (onlyConnectedBbs && aSwitch.isOpen()) { | ||
return TraverseResult.TERMINATE_PATH; | ||
} | ||
return TraverseResult.CONTINUE; | ||
} | ||
|
||
public String getFirstTraversedBbsId() { | ||
return firstTraversedBbsId; | ||
} | ||
} | ||
|
Oops, something went wrong.