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

Sector stuff

Renamed sector to commdity
In connections.csv replaced sector with output/input index
parent 8ffcb92e
No related branches found
No related tags found
No related merge requests found
Showing
with 334 additions and 209 deletions
Subproject commit eedf77f1e62b29c8ffbf012f6d9b634d155efdaf Subproject commit 1d0e19b23f9d69ae0bef98e48522d01cfbf7e797
...@@ -161,7 +161,7 @@ The ineed-dc-framework repository is the framework's main repository. It contain ...@@ -161,7 +161,7 @@ The ineed-dc-framework repository is the framework's main repository. It contain
The sub-repository Model_Libary contains the mathematical models of component, prosumer, quarter, and city levels. The sub-repository Model_Libary contains the mathematical models of component, prosumer, quarter, and city levels.
- `Components/` : Contains all component models and initialized pre-configured components - `Components/` : Contains all component models and initialized pre-configured components
- `Prosumer/` : Includes BaseProsumer model whhich allows to flexibily model any Prosumer application - `Prosumer/` : Includes Prosumer model whhich allows to flexibily model any Prosumer application
- `District/` : Will contain district level model (implementation in progress). - `District/` : Will contain district level model (implementation in progress).
- `City/` : Will contain city level model (implementation in progress). - `City/` : Will contain city level model (implementation in progress).
......
Subproject commit 0c0e53de7c208ec319d660072c45e3e206f801b5 Subproject commit 70c50a8cd16381928ed5e162b03f214750889a13
"""
This script inspects the input files and modifies them such that they adhere to the new input file specification used by the framework after merge of merge request !13 Release focused refactoring.
"""
import os.path
import pandas as pd
def component_to_commodities(type):
if type == "AbsorptionChiller":
return "heat", "cold", None
if type == "CompressorChiller":
return "electricity", "cold", None
if type == "CoolConsumption":
return "cold", None, None
if type == "CoolGrid":
return "cold", "cold", None
if type == "ChargingInfrastructure":
return "electricity", None, None
if type == "ElectricalBusBar":
return "electricity", "electricity", None
if type == "ElectricalConsumption":
return "electricity", None, None
if type == "ElectricalGrid":
return "electricity", "electricity", None
if type == "PVGenerator":
return None, "electricity", None
if type == "DynamicInverter":
return "electricity", "electricity", None
if type == "StaticInverter":
return "electricity", "electricity", None
if type == "LiionBattery":
return "electricity", "electricity", None
if type == "BHKW":
return "gas", "heat", "electricity"
if type == "CHP":
return "gas", "heat", "electricity"
if type == "GasGrid":
return "gas", "gas", None
if type == "ElectricBoiler":
return "electricity", "heat", None
if type == "GasBoiler":
return "gas", "heat", None
if type == "HeatGrid":
return "heat", "heat", None
if type == "ElectricRadiator":
return "electricity", "heat", None
if type == "HeatConsumption":
return "heat", None, None
if type == "Radiator":
return "heat", None, None
if type == "UnderfloorHeat":
return "heat", "heat", None
if type == "HeatExchanger":
return "heat", "heat", None
if type == "GasHeatPump":
return "gas", "heat", None
if type == "HeatPump":
return "electricity", "heat", None
if type == "HotWaterConsumption":
return "heat", None, None
if type == "SolarThermalCollector":
return None, "heat", None
if type == "HotWaterStorage":
return "heat", "heat", None
if type == "PEMElectrolyzer":
return "electricity", "hydrogen", None
if type == "PEMFuelCell":
return "hydrogen", "electricity", "heat"
if type == "PEMElectrolyzer":
return "electricity", "hydrogen", None
if type == "PressureStorage":
return "hydrogen", "hydrogen", None
raise KeyError
changed_topologies = []
invalid_topologies = []
for dirpath, dirnames, filenames in os.walk(".\\input_files"):
components_here = False
connections_here = False
for filename in filenames:
if filename == "components.csv":
components_file = filename
components_here = True
elif filename == "connections.csv":
connections_file = filename
connections_here = True
if components_here and connections_here:
try:
print(f"Inspecting topology {dirpath}")
components_df = pd.read_csv(os.path.join(dirpath, components_file))
components = {}
for i in components_df.index:
components[components_df["name"][i]] = components_df.loc[i]
connections = pd.read_csv(os.path.join(dirpath, connections_file))
connections['output'] = pd.Series("", index = connections.index)
connections['input'] = pd.Series("", index = connections.index)
for i in connections.index:
commodity = connections['sector'][i]
connection_from = connections['from'][i]
connection_to = connections['to'][i]
from_type = components[connection_from]['type']
input_commodity, output_commodity_1, output_commodity_2 = component_to_commodities(from_type)
if commodity == output_commodity_1:
connections['output'][i] = "1"
elif commodity == output_commodity_2:
connections['output'][i] = "2"
else:
raise KeyError
to_type = components[connection_to]['type']
input_commodity, output_commodity_1, output_commodity_2 = component_to_commodities(to_type)
if commodity == input_commodity:
connections['input'][i] = ""
else:
raise KeyError
connections.drop("sector", axis = 1)
connections = connections[["from", "output", "to", "input"]]
changed_topologies.append(dirpath)
connections.to_csv(os.path.join(dirpath, "connections.csv"), index = False)
except:
invalid_topologies.append(dirpath)
for directory in changed_topologies:
print(f"Modified topology {directory}!")
for file in invalid_topologies:
print(f"Topology {file} breaks some part of the input file specification!")
sector,from,to from,output,to,input
electricity,inv_pv_bat,battery inv_pv_bat,1,battery,
electricity,inv_pv_bat,grd inv_pv_bat,1,grd,
electricity,inv_pv_bat,elec_cns inv_pv_bat,1,elec_cns,
electricity,battery,inv_pv_bat battery,1,inv_pv_bat,
electricity,grd,inv_pv_bat grd,1,inv_pv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv_bat pv_roof,1,inv_pv_bat,
electricity,inv_pv_bat,battery inv_pv_bat,1,battery,
electricity,inv_pv_bat,grd inv_pv_bat,1,grd,
electricity,inv_pv_bat,elec_cns inv_pv_bat,1,elec_cns,
electricity,battery,inv_pv_bat battery,1,inv_pv_bat,
electricity,grd,inv_pv_bat grd,1,inv_pv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv_bat pv_roof,1,inv_pv_bat,
electricity,inv_pv_bat,battery inv_pv_bat,1,battery,
electricity,inv_pv_bat,grd inv_pv_bat,1,grd,
electricity,inv_pv_bat,elec_cns inv_pv_bat,1,elec_cns,
electricity,battery,inv_pv_bat battery,1,inv_pv_bat,
electricity,grd,inv_pv_bat grd,1,inv_pv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv_bat pv_roof,1,inv_pv_bat,
electricity,inv_pv_bat,battery inv_pv_bat,1,battery,
electricity,inv_pv_bat,grd inv_pv_bat,1,grd,
electricity,inv_pv_bat,elec_cns inv_pv_bat,1,elec_cns,
electricity,battery,inv_pv_bat battery,1,inv_pv_bat,
electricity,grd,inv_pv_bat grd,1,inv_pv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
sector,from,to from,output,to,input
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,inv_pv,inv_bat inv_pv,1,inv_bat,
electricity,battery,inv_bat battery,1,inv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
electricity,grd,inv_bat grd,1,inv_bat,
electricity,inv_bat,battery inv_bat,1,battery,
electricity,inv_bat,grd inv_bat,1,grd,
electricity,inv_bat,elec_cns inv_bat,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,heat_pump inv_pv,1,heat_pump,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,inv_pv,inv_bat inv_pv,1,inv_bat,
electricity,battery,inv_bat battery,1,inv_bat,
electricity,grd,heat_pump grd,1,heat_pump,
electricity,grd,elec_cns grd,1,elec_cns,
electricity,inv_bat,battery inv_bat,1,battery,
electricity,inv_bat,heat_pump inv_bat,1,heat_pump,
electricity,inv_bat,grd inv_bat,1,grd,
electricity,inv_bat,elec_cns inv_bat,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,heat_pump,water_tes heat_pump,1,water_tes,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,heat_pump,therm_cns heat_pump,1,therm_cns,
heat,heat_pump,dhw_dmd heat_pump,1,dhw_dmd,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,heat_pump inv_pv,1,heat_pump,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,grd,heat_pump grd,1,heat_pump,
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,heat_pump,water_tes heat_pump,1,water_tes,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,heat_pump,therm_cns heat_pump,1,therm_cns,
heat,heat_pump,dhw_dmd heat_pump,1,dhw_dmd,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,inv_pv,inv_bat inv_pv,1,inv_bat,
electricity,battery,inv_bat battery,1,inv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
electricity,inv_bat,battery inv_bat,1,battery,
electricity,inv_bat,grd inv_bat,1,grd,
electricity,inv_bat,elec_cns inv_bat,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,heat_pump inv_pv,1,heat_pump,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,inv_pv,inv_bat inv_pv,1,inv_bat,
electricity,battery,inv_bat battery,1,inv_bat,
electricity,grd,heat_pump grd,1,heat_pump,
electricity,grd,elec_cns grd,1,elec_cns,
electricity,inv_bat,battery inv_bat,1,battery,
electricity,inv_bat,heat_pump inv_bat,1,heat_pump,
electricity,inv_bat,grd inv_bat,1,grd,
electricity,inv_bat,elec_cns inv_bat,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,heat_pump,water_tes heat_pump,1,water_tes,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,heat_pump,therm_cns heat_pump,1,therm_cns,
heat,heat_pump,dhw_dmd heat_pump,1,dhw_dmd,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,heat_pump inv_pv,1,heat_pump,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,grd,heat_pump grd,1,heat_pump,
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,heat_pump,water_tes heat_pump,1,water_tes,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,heat_pump,therm_cns heat_pump,1,therm_cns,
heat,heat_pump,dhw_dmd heat_pump,1,dhw_dmd,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,grd,elec_cns grd,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
sector,from,to from,output,to,input
electricity,pv_roof,inv_pv pv_roof,1,inv_pv,
electricity,inv_pv,grd inv_pv,1,grd,
electricity,inv_pv,elec_cns inv_pv,1,elec_cns,
electricity,inv_pv,inv_bat inv_pv,1,inv_bat,
electricity,battery,inv_bat battery,1,inv_bat,
electricity,grd,elec_cns grd,1,elec_cns,
electricity,grd,inv_bat grd,1,inv_bat,
electricity,inv_bat,battery inv_bat,1,battery,
electricity,inv_bat,grd inv_bat,1,grd,
electricity,inv_bat,elec_cns inv_bat,1,elec_cns,
gas,gas_grd,gas_boi gas_grd,1,gas_boi,
heat,water_tes,therm_cns water_tes,1,therm_cns,
heat,water_tes,dhw_dmd water_tes,1,dhw_dmd,
heat,gas_boi,water_tes gas_boi,1,water_tes,
heat,gas_boi,therm_cns gas_boi,1,therm_cns,
heat,gas_boi,dhw_dmd gas_boi,1,dhw_dmd,
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment