Skip to content

Commit eaac712

Browse files
authored
Merge pull request #129 from Zenmo/AlternativeFixForDuplicateGCsinGridNode
Modified f_getLowerLVLConnectedGridNodes() to prevent duplicate entri…
2 parents 6e5f2ba + 69f326f commit eaac712

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

_alp/Agents/GridNode/Code/Functions.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,13 @@ else if (energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC) {
656656

657657
List<GridNode> f_getLowerLVLConnectedGridNodes()
658658
{/*ALCODESTART::1725964027407*/
659-
return f_getAllConnectedGridNodes_recursion(new ArrayList<GridNode>());
659+
List<GridNode> allConnectedGridNodes = new ArrayList<GridNode>();
660+
661+
for(GridNode GN : c_connectedGridNodes){
662+
allConnectedGridNodes.addAll(GN.f_getAllConnectedGridNodes_recursion(allConnectedGridNodes));
663+
}
664+
665+
return allConnectedGridNodes;
660666
/*ALCODEEND*/}
661667

662668
List<GridNode> f_getAllConnectedGridNodes_recursion(List<GridNode> allConnectedGridNodes)
@@ -688,7 +694,6 @@ ArrayList<GridConnection> f_getAllLowerLVLConnectedGridConnections()
688694

689695
AllLowerLVLConnectedGridConnections.addAll(this.c_connectedGridConnections);
690696

691-
692697
return AllLowerLVLConnectedGridConnections;
693698
/*ALCODEEND*/}
694699

0 commit comments

Comments
 (0)