Skip to content

Commit

Permalink
#8 Add node coordinates to NetworkTopology
Browse files Browse the repository at this point in the history
  • Loading branch information
andreArtelt committed Jun 8, 2024
1 parent 2bb8329 commit c971f9c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions epyt_flow/simulation/scenario_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ def get_topology(self) -> NetworkTopology:
nodes_id = self.epanet_api.getNodeNameID()
nodes_elevation = self.epanet_api.getNodeElevations()
nodes_type = [self.epanet_api.TYPENODE[i] for i in self.epanet_api.getNodeTypeIndex()]
nodes_coord = [self.epanet_api.api.ENgetcoord(node_idx)
for node_idx in self.epanet_api.getNodeIndex()]
node_tank_names = self.epanet_api.getNodeTankNameID()

links_id = self.epanet_api.getLinkNameID()
Expand All @@ -774,8 +776,11 @@ def get_topology(self) -> NetworkTopology:

# Build graph describing the topology
nodes = []
for node_id, node_elevation, node_type in zip(nodes_id, nodes_elevation, nodes_type):
node_info = {"elevation": node_elevation, "type": node_type}
for node_id, node_elevation, node_type, node_coord in zip(nodes_id, nodes_elevation,
nodes_type, nodes_coord):
node_info = {"elevation": node_elevation,
"coord": node_coord,
"type": node_type}
if node_type == "TANK":
node_tank_idx = node_tank_names.index(node_id) + 1
node_info["diameter"] = float(self.epanet_api.getNodeTankDiameter(node_tank_idx))
Expand Down

0 comments on commit c971f9c

Please sign in to comment.