Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue10 bidirectional #12

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
19 changes: 15 additions & 4 deletions uesgraphs/uesgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,17 @@ def from_json(self, path, network_type, check_overlap=False):
# TODO: This currently only supports heating and cooling supplies
if 'supply' in node['node_type']:
supply_id = node['name']
if 'heating' in node['node_type']:
if ('heating' in node['node_type'] and
'cooling' in node['node_type']):
new_node = self.add_building(name=supply_id,
position=this_position,
is_supply_heating=True,
is_supply_cooling=True)
elif 'heating' in node['node_type']:
new_node = self.add_building(name=supply_id,
position=this_position,
is_supply_heating=True)
if 'cooling' in node['node_type']:
elif 'cooling' in node['node_type']:
new_node = self.add_building(name=supply_id,
position=this_position,
is_supply_cooling=True)
Expand Down Expand Up @@ -935,10 +941,15 @@ def to_json(self, path, name, description='json export from uesgraph',
if 'node_type' in self.nodes[node]:
node_type = self.nodes[node]['node_type']
if 'building' in node_type:
if 'is_supply_heating' in self.nodes[node]:
if ('is_supply_heating' in self.nodes[node] and
'is_supply_cooling' in self.nodes[node]):
if (self.nodes[node]['is_supply_heating'] is True and
self.nodes[node]['is_supply_cooling'] is True):
node_type = 'supply_heating_cooling'
elif 'is_supply_heating' in self.nodes[node]:
if self.nodes[node]['is_supply_heating'] is True:
node_type = 'supply_heating'
if 'is_supply_cooling' in self.nodes[node]:
elif 'is_supply_cooling' in self.nodes[node]:
if self.nodes[node]['is_supply_cooling'] is True:
node_type = 'supply_cooling'
nodes[-1]['node_type'] = node_type
Expand Down