Skip to content

Commit

Permalink
Bug fix in getConnectableBus() in calculated bus branch topology
Browse files Browse the repository at this point in the history
- method independent of switches' order
- if connectableBus null, return first bus

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Sep 24, 2019
1 parent 754fdae commit 0e25787
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,17 @@ BusExt getConnectableBus(int node) {
// node associated to a bus
BusExt[] connectableBus2 = new BusExt[1];
graph.traverse(node, (v1, e, v2) -> {
if (connectableBus2[0] != null) {
return TraverseResult.TERMINATE;
}
connectableBus2[0] = getBus(v2);
if (connectableBus2[0] != null) {
return TraverseResult.TERMINATE;
}
return TraverseResult.CONTINUE;
});
// if nothing found, just take the first bus
if (connectableBus2[0] != null) {
if (connectableBus2[0] == null) {
Iterator<CalculatedBus> it = getBuses().iterator();
if (!it.hasNext()) {
throw new AssertionError("Should not happen");
Expand Down

0 comments on commit 0e25787

Please sign in to comment.