Skip to content
Snippets Groups Projects
Commit 842e0110 authored by Christoph von Oy's avatar Christoph von Oy
Browse files

Moved bi_flow constraints into components

parent f680f21f
Branches
Tags
No related merge requests found
Showing
with 91 additions and 1 deletion
Subproject commit 09f026c22cca6060b606e9cd33483bea01ba59d3 Subproject commit 3b93e0eec3f1e8451251da02e209a90968ff89c4
...@@ -40,6 +40,33 @@ def get_connected_components(matrix, components, comp): ...@@ -40,6 +40,33 @@ def get_connected_components(matrix, components, comp):
def get_connection(matrix, components, comp_from, comp_to): def get_connection(matrix, components, comp_from, comp_to):
return matrix[components[comp_from]][components[comp_to]] return matrix[components[comp_from]][components[comp_to]]
def get_bypasses(component_name, connections):
inputs = []
outputs = []
sector = ''
for i in connections.index:
if connections['to'][i] == component_name and connections['from'][i] not in inputs:
inputs.append(connections['from'][i])
if sector == '':
sector = connections['sector'][i]
else:
if sector != connections['sector'][i]:
raise KeyError
if connections['from'][i] == component_name and connections['to'][i] not in outputs:
outputs.append(connections['to'][i])
if sector == '':
sector = connections['sector'][i]
else:
if sector != connections['sector'][i]:
raise KeyError
bypasses = []
for input in inputs:
for output in outputs:
if input != output:
if not ((connections['sector'] == sector) & (connections['from'] == input) & (connections['to'] == output)).any():
bypasses.append((sector, input, output))
return bypasses
def read_config(config_path): def read_config(config_path):
config_df = pd.read_csv(config_path) config_df = pd.read_csv(config_path)
config_dict = config_df.to_dict(orient='list') config_dict = config_df.to_dict(orient='list')
...@@ -59,6 +86,7 @@ renamed_components = {'StandardElectricalConsumption': 'ElectricalConsumption', ...@@ -59,6 +86,7 @@ renamed_components = {'StandardElectricalConsumption': 'ElectricalConsumption',
'BasicInverter': 'StaticInverter', 'BasicInverter': 'StaticInverter',
'Inverter': 'DynamicInverter'} 'Inverter': 'DynamicInverter'}
consumption_components = ['CoolConsumption', 'ChargingInfrastructure', 'ElectricalConsumption', 'HeatConsumption', 'Radiator', 'HotWaterConsumption'] consumption_components = ['CoolConsumption', 'ChargingInfrastructure', 'ElectricalConsumption', 'HeatConsumption', 'Radiator', 'HotWaterConsumption']
storage_components = ['LiionBattery', 'HotWaterStorage', 'PressureStorage']
for dirpath, dirnames, filenames in os.walk(".\\input_files"): for dirpath, dirnames, filenames in os.walk(".\\input_files"):
topology_here = False topology_here = False
matrix_files = [] matrix_files = []
...@@ -102,6 +130,16 @@ for dirpath, dirnames, filenames in os.walk(".\\input_files"): ...@@ -102,6 +130,16 @@ for dirpath, dirnames, filenames in os.walk(".\\input_files"):
raise KeyError raise KeyError
for connected_component in get_connected_components(matrix, components, component): for connected_component in get_connected_components(matrix, components, component):
all_connections = pd.concat([all_connections, pd.Series({'sector': sector, 'from': component, 'to': connected_component}).to_frame().T], ignore_index = True) all_connections = pd.concat([all_connections, pd.Series({'sector': sector, 'from': component, 'to': connected_component}).to_frame().T], ignore_index = True)
while True:
number_of_connections_before = len(all_connections)
for i in all_components.index:
if all_components['type'][i] in storage_components:
for sector, from_component, to_component in get_bypasses(all_components['name'][i], all_connections):
all_connections = pd.concat([all_connections, pd.Series({'sector': sector, 'from': from_component, 'to': to_component}).to_frame().T], ignore_index = True)
number_of_connections_after = len(all_connections)
if number_of_connections_before == number_of_connections_after:
break
config = read_config(os.path.join(dirpath, "config.csv")) config = read_config(os.path.join(dirpath, "config.csv"))
changed_topologies.append(dirpath) changed_topologies.append(dirpath)
new_config = dict() new_config = dict()
......
...@@ -4,3 +4,5 @@ gas,gas_grd,gas_boi ...@@ -4,3 +4,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi ...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -13,3 +13,5 @@ gas,gas_grd,gas_boi ...@@ -13,3 +13,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -16,3 +16,7 @@ heat,heat_pump,water_tes ...@@ -16,3 +16,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes ...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi ...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -12,3 +12,5 @@ gas,gas_grd,gas_boi ...@@ -12,3 +12,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -16,3 +16,7 @@ heat,heat_pump,water_tes ...@@ -16,3 +16,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes ...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -4,3 +4,5 @@ gas,gas_grd,gas_boi ...@@ -4,3 +4,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi ...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -13,3 +13,5 @@ gas,gas_grd,gas_boi ...@@ -13,3 +13,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -17,3 +17,7 @@ heat,heat_pump,water_tes ...@@ -17,3 +17,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes ...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi ...@@ -7,3 +7,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -13,3 +13,5 @@ gas,gas_grd,gas_boi ...@@ -13,3 +13,5 @@ gas,gas_grd,gas_boi
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -17,3 +17,7 @@ heat,heat_pump,water_tes ...@@ -17,3 +17,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes ...@@ -10,3 +10,7 @@ heat,heat_pump,water_tes
heat,water_tes,therm_cns heat,water_tes,therm_cns
heat,water_tes,dhw_dmd heat,water_tes,dhw_dmd
heat,gas_boi,water_tes heat,gas_boi,water_tes
heat,heat_pump,therm_cns
heat,heat_pump,dhw_dmd
heat,gas_boi,therm_cns
heat,gas_boi,dhw_dmd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment