Skip to content

Commit

Permalink
Merge branch 'main' into add-reporting-for-limits-and-setpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazwarhili authored Oct 18, 2024
2 parents f72a057 + 80a1fac commit 75b8b24
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 98 deletions.
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;
}
}

Loading

0 comments on commit 75b8b24

Please sign in to comment.