diff --git a/Model_Library b/Model_Library index 09f026c22cca6060b606e9cd33483bea01ba59d3..3b93e0eec3f1e8451251da02e209a90968ff89c4 160000 --- a/Model_Library +++ b/Model_Library @@ -1 +1 @@ -Subproject commit 09f026c22cca6060b606e9cd33483bea01ba59d3 +Subproject commit 3b93e0eec3f1e8451251da02e209a90968ff89c4 diff --git a/input_files/convert_input_files_refactoring_part_2.py b/input_files/convert_input_files_refactoring_part_2.py index 14959bbf7942f94245f894e9b58ae1d66be12f17..2948a10f948d0c71e26bbf2c14710ef00c091a99 100644 --- a/input_files/convert_input_files_refactoring_part_2.py +++ b/input_files/convert_input_files_refactoring_part_2.py @@ -40,6 +40,33 @@ def get_connected_components(matrix, components, comp): def get_connection(matrix, components, comp_from, 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): config_df = pd.read_csv(config_path) config_dict = config_df.to_dict(orient='list') @@ -59,6 +86,7 @@ renamed_components = {'StandardElectricalConsumption': 'ElectricalConsumption', 'BasicInverter': 'StaticInverter', 'Inverter': 'DynamicInverter'} consumption_components = ['CoolConsumption', 'ChargingInfrastructure', 'ElectricalConsumption', 'HeatConsumption', 'Radiator', 'HotWaterConsumption'] +storage_components = ['LiionBattery', 'HotWaterStorage', 'PressureStorage'] for dirpath, dirnames, filenames in os.walk(".\\input_files"): topology_here = False matrix_files = [] @@ -102,6 +130,16 @@ for dirpath, dirnames, filenames in os.walk(".\\input_files"): raise KeyError 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) + 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")) changed_topologies.append(dirpath) new_config = dict() diff --git a/input_files/models/prosumer_models/SCN0_CAT1/connections.csv b/input_files/models/prosumer_models/SCN0_CAT1/connections.csv index 3e485ceed89794793954afab46ff6a9be59a33d0..f911b10874d9f6ebe55ee5525ffe45638bdc258a 100644 --- a/input_files/models/prosumer_models/SCN0_CAT1/connections.csv +++ b/input_files/models/prosumer_models/SCN0_CAT1/connections.csv @@ -4,3 +4,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV11/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV11/connections.csv index 43a54d1318fcc8dfb48282fae4993e1ce42f7223..07be821df10b12425e1874ef03d8cd624fd2f00a 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV11/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV11/connections.csv @@ -7,3 +7,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV12_BA/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV12_BA/connections.csv index 83a66459d5a385444a49b34fc3bf1ee37d6e49da..907c9e7e18816817dd11611659105994e0026cc7 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV12_BA/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV12_BA/connections.csv @@ -13,3 +13,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV13_BA_HP/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV13_BA_HP/connections.csv index b6e01aecd8630699fab1263b1a14940b8aa2020b..c82fe1d4ec799d877bb423124caebc1e8dd84053 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV13_BA_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV13_BA_HP/connections.csv @@ -16,3 +16,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/connections.csv index 97283663a5316bf86995a0f9777a4267917a7ba0..4048376f0e1f750128105af3c99da1f68d5c6591 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/connections.csv @@ -10,3 +10,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV31/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV31/connections.csv index 43a54d1318fcc8dfb48282fae4993e1ce42f7223..07be821df10b12425e1874ef03d8cd624fd2f00a 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV31/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV31/connections.csv @@ -7,3 +7,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV32_BA/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV32_BA/connections.csv index fb91ba92c0c99dc3f5a4644361616ba92e4540d2..aedf9635c2d6cb19efa6ffae675a58c55a5a7c48 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV32_BA/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV32_BA/connections.csv @@ -12,3 +12,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV33_BA_HP/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV33_BA_HP/connections.csv index b6e01aecd8630699fab1263b1a14940b8aa2020b..c82fe1d4ec799d877bb423124caebc1e8dd84053 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV33_BA_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV33_BA_HP/connections.csv @@ -16,3 +16,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN2_CAT1_PV34_HP/connections.csv b/input_files/models/prosumer_models/SCN2_CAT1_PV34_HP/connections.csv index 97283663a5316bf86995a0f9777a4267917a7ba0..4048376f0e1f750128105af3c99da1f68d5c6591 100644 --- a/input_files/models/prosumer_models/SCN2_CAT1_PV34_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN2_CAT1_PV34_HP/connections.csv @@ -10,3 +10,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN3_CAT1/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1/connections.csv index 3e485ceed89794793954afab46ff6a9be59a33d0..f911b10874d9f6ebe55ee5525ffe45638bdc258a 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1/connections.csv @@ -4,3 +4,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV11/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV11/connections.csv index 43a54d1318fcc8dfb48282fae4993e1ce42f7223..07be821df10b12425e1874ef03d8cd624fd2f00a 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV11/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV11/connections.csv @@ -7,3 +7,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV12_BA/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV12_BA/connections.csv index 83a66459d5a385444a49b34fc3bf1ee37d6e49da..907c9e7e18816817dd11611659105994e0026cc7 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV12_BA/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV12_BA/connections.csv @@ -13,3 +13,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV13_BA_HP/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV13_BA_HP/connections.csv index 1ce26af83ca14a8af80a8cdb01f1096fde610b47..14d304ec74d8ef0f33505e4fef9eafbc0d93b405 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV13_BA_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV13_BA_HP/connections.csv @@ -17,3 +17,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV14_HP/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV14_HP/connections.csv index 97283663a5316bf86995a0f9777a4267917a7ba0..4048376f0e1f750128105af3c99da1f68d5c6591 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV14_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV14_HP/connections.csv @@ -10,3 +10,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV31/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV31/connections.csv index 43a54d1318fcc8dfb48282fae4993e1ce42f7223..07be821df10b12425e1874ef03d8cd624fd2f00a 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV31/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV31/connections.csv @@ -7,3 +7,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV32_BA/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV32_BA/connections.csv index 83a66459d5a385444a49b34fc3bf1ee37d6e49da..907c9e7e18816817dd11611659105994e0026cc7 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV32_BA/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV32_BA/connections.csv @@ -13,3 +13,5 @@ gas,gas_grd,gas_boi heat,water_tes,therm_cns heat,water_tes,dhw_dmd heat,gas_boi,water_tes +heat,gas_boi,therm_cns +heat,gas_boi,dhw_dmd diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV33_BA_HP/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV33_BA_HP/connections.csv index 1ce26af83ca14a8af80a8cdb01f1096fde610b47..14d304ec74d8ef0f33505e4fef9eafbc0d93b405 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV33_BA_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV33_BA_HP/connections.csv @@ -17,3 +17,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/SCN3_CAT1_PV34_HP/connections.csv b/input_files/models/prosumer_models/SCN3_CAT1_PV34_HP/connections.csv index 97283663a5316bf86995a0f9777a4267917a7ba0..4048376f0e1f750128105af3c99da1f68d5c6591 100644 --- a/input_files/models/prosumer_models/SCN3_CAT1_PV34_HP/connections.csv +++ b/input_files/models/prosumer_models/SCN3_CAT1_PV34_HP/connections.csv @@ -10,3 +10,7 @@ heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd 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 diff --git a/input_files/models/prosumer_models/office_pv_heatpump/connections.csv b/input_files/models/prosumer_models/office_pv_heatpump/connections.csv index f05079cf72987017e6ee9a485fcb1e014cc28e28..2648881f72c712482bc13125ef1170dbd0a38ee6 100644 --- a/input_files/models/prosumer_models/office_pv_heatpump/connections.csv +++ b/input_files/models/prosumer_models/office_pv_heatpump/connections.csv @@ -11,3 +11,5 @@ electricity,grd,elec_cns heat,heat_pump,water_tes heat,water_tes,therm_cns heat,water_tes,dhw_dmd +heat,heat_pump,therm_cns +heat,heat_pump,dhw_dmd