Skip to content

Commit

Permalink
Fix BranchTee ID setting if its the first BT in the grid
Browse files Browse the repository at this point in the history
  • Loading branch information
gplessm committed Oct 26, 2017
1 parent 3fdfaa5 commit f7a1bde
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions edisgo/grid/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,12 @@ def __init__(self, **kwargs):

# set id of BranchTee automatically if not provided
if not self._id:
self._id = max([_.id for _ in
self.grid.graph.nodes_by_attribute('branch_tee')]) + 1
ids = [_.id for _ in
self.grid.graph.nodes_by_attribute('branch_tee')]
if ids:
self._id = max(ids) + 1
else:
self._id = 1

def __repr__(self):
return '_'.join([self.__class__.__name__, repr(self.grid), str(self._id)])
Expand Down

0 comments on commit f7a1bde

Please sign in to comment.