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

Merge branch 'dev_cvo_naming' into 'main'

Release focused refactoring

See merge request ineed-dc/ineed-dc-framework!18
parents 8ffcb92e 43c7c834
No related branches found
No related tags found
No related merge requests found
Showing
with 336 additions and 209 deletions
Subproject commit eedf77f1e62b29c8ffbf012f6d9b634d155efdaf
Subproject commit 464d488d4660999a14542f1c636825c3b28fc2ab
......@@ -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.
- `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).
- `City/` : Will contain city level model (implementation in progress).
......
Subproject commit 0c0e53de7c208ec319d660072c45e3e206f801b5
Subproject commit ba6b26e2db1c800c5d0f77b56efbff0bf7161333
"""
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", None, "cold", None
if type == "CompressorChiller":
return "electricity", None, "cold", None
if type == "CoolConsumption":
return "cold", None, None, None
if type == "CoolGrid":
return "cold", None, "cold", None
if type == "ChargingInfrastructure":
return "electricity", None, None, None
if type == "ElectricalBusBar":
return "electricity", None, "electricity", None
if type == "ElectricalConsumption":
return "electricity", None, None, None
if type == "ElectricalGrid":
return "electricity", None, "electricity", None
if type == "PVGenerator":
return None, None, "electricity", None
if type == "DynamicInverter":
return "electricity", None, "electricity", None
if type == "StaticInverter":
return "electricity", None, "electricity", None
if type == "LiionBattery":
return "electricity", None, "electricity", None
if type == "BHKW":
return "gas", None, "heat", "electricity"
if type == "CHP":
return "gas", None, "heat", "electricity"
if type == "GasGrid":
return "gas", None, "gas", None
if type == "ElectricBoiler":
return "electricity", None, "heat", None
if type == "GasBoiler":
return "gas", None, "heat", None
if type == "HeatGrid":
return "heat", None, "heat", None
if type == "ElectricRadiator":
return "electricity", None, "heat", None
if type == "HeatConsumption":
return "heat", None, None, None
if type == "Radiator":
return "heat", None, None, None
if type == "UnderfloorHeat":
return "heat", None, "heat", None
if type == "HeatExchanger":
return "heat", None, "heat", None
if type == "GasHeatPump":
return "gas", None, "heat", None
if type == "HeatPump":
return "electricity", None, "heat", None
if type == "HotWaterConsumption":
return "heat", None, None, None
if type == "SolarThermalCollector":
return None, None, "heat", None
if type == "HotWaterStorage":
return "heat", None, "heat", None
if type == "PEMElectrolyzer":
return "electricity", None, "hydrogen", None
if type == "PEMFuelCell":
return "hydrogen", None, "electricity", "heat"
if type == "PEMElectrolyzer":
return "electricity", None, "hydrogen", None
if type == "PressureStorage":
return "hydrogen", None, "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_1, input_commodity_2, 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_1, input_commodity_2, output_commodity_1, output_commodity_2 = component_to_commodities(to_type)
if commodity == input_commodity_1:
connections['input'][i] = "1"
elif commodity == input_commodity_2:
connections['input'][i] = "2"
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
electricity,inv_pv_bat,battery
electricity,inv_pv_bat,grd
electricity,inv_pv_bat,elec_cns
electricity,battery,inv_pv_bat
electricity,grd,inv_pv_bat
electricity,grd,elec_cns
from,output,to,input
inv_pv_bat,1,battery,1
inv_pv_bat,1,grd,1
inv_pv_bat,1,elec_cns,1
battery,1,inv_pv_bat,1
grd,1,inv_pv_bat,1
grd,1,elec_cns,1
sector,from,to
electricity,pv_roof,inv_pv_bat
electricity,inv_pv_bat,battery
electricity,inv_pv_bat,grd
electricity,inv_pv_bat,elec_cns
electricity,battery,inv_pv_bat
electricity,grd,inv_pv_bat
electricity,grd,elec_cns
from,output,to,input
pv_roof,1,inv_pv_bat,1
inv_pv_bat,1,battery,1
inv_pv_bat,1,grd,1
inv_pv_bat,1,elec_cns,1
battery,1,inv_pv_bat,1
grd,1,inv_pv_bat,1
grd,1,elec_cns,1
sector,from,to
electricity,pv_roof,inv_pv_bat
electricity,inv_pv_bat,battery
electricity,inv_pv_bat,grd
electricity,inv_pv_bat,elec_cns
electricity,battery,inv_pv_bat
electricity,grd,inv_pv_bat
electricity,grd,elec_cns
from,output,to,input
pv_roof,1,inv_pv_bat,1
inv_pv_bat,1,battery,1
inv_pv_bat,1,grd,1
inv_pv_bat,1,elec_cns,1
battery,1,inv_pv_bat,1
grd,1,inv_pv_bat,1
grd,1,elec_cns,1
sector,from,to
electricity,pv_roof,inv_pv_bat
electricity,inv_pv_bat,battery
electricity,inv_pv_bat,grd
electricity,inv_pv_bat,elec_cns
electricity,battery,inv_pv_bat
electricity,grd,inv_pv_bat
electricity,grd,elec_cns
from,output,to,input
pv_roof,1,inv_pv_bat,1
inv_pv_bat,1,battery,1
inv_pv_bat,1,grd,1
inv_pv_bat,1,elec_cns,1
battery,1,inv_pv_bat,1
grd,1,inv_pv_bat,1
grd,1,elec_cns,1
sector,from,to
electricity,grd,elec_cns
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
from,output,to,input
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,grd,elec_cns
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,inv_pv,inv_bat
electricity,battery,inv_bat
electricity,grd,elec_cns
electricity,grd,inv_bat
electricity,inv_bat,battery
electricity,inv_bat,grd
electricity,inv_bat,elec_cns
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
inv_pv,1,inv_bat,1
battery,1,inv_bat,1
grd,1,elec_cns,1
grd,1,inv_bat,1
inv_bat,1,battery,1
inv_bat,1,grd,1
inv_bat,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,heat_pump
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,inv_pv,inv_bat
electricity,battery,inv_bat
electricity,grd,heat_pump
electricity,grd,elec_cns
electricity,inv_bat,battery
electricity,inv_bat,heat_pump
electricity,inv_bat,grd
electricity,inv_bat,elec_cns
gas,gas_grd,gas_boi
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,heat_pump,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
inv_pv,1,inv_bat,1
battery,1,inv_bat,1
grd,1,heat_pump,1
grd,1,elec_cns,1
inv_bat,1,battery,1
inv_bat,1,heat_pump,1
inv_bat,1,grd,1
inv_bat,1,elec_cns,1
gas_grd,1,gas_boi,1
heat_pump,1,water_tes,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
heat_pump,1,therm_cns,1
heat_pump,1,dhw_dmd,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,heat_pump
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,grd,heat_pump
electricity,grd,elec_cns
gas,gas_grd,gas_boi
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,heat_pump,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
grd,1,heat_pump,1
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
heat_pump,1,water_tes,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
heat_pump,1,therm_cns,1
heat_pump,1,dhw_dmd,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,grd,elec_cns
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,inv_pv,inv_bat
electricity,battery,inv_bat
electricity,grd,elec_cns
electricity,inv_bat,battery
electricity,inv_bat,grd
electricity,inv_bat,elec_cns
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
inv_pv,1,inv_bat,1
battery,1,inv_bat,1
grd,1,elec_cns,1
inv_bat,1,battery,1
inv_bat,1,grd,1
inv_bat,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,heat_pump
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,inv_pv,inv_bat
electricity,battery,inv_bat
electricity,grd,heat_pump
electricity,grd,elec_cns
electricity,inv_bat,battery
electricity,inv_bat,heat_pump
electricity,inv_bat,grd
electricity,inv_bat,elec_cns
gas,gas_grd,gas_boi
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,heat_pump,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
inv_pv,1,inv_bat,1
battery,1,inv_bat,1
grd,1,heat_pump,1
grd,1,elec_cns,1
inv_bat,1,battery,1
inv_bat,1,heat_pump,1
inv_bat,1,grd,1
inv_bat,1,elec_cns,1
gas_grd,1,gas_boi,1
heat_pump,1,water_tes,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
heat_pump,1,therm_cns,1
heat_pump,1,dhw_dmd,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,heat_pump
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,grd,heat_pump
electricity,grd,elec_cns
gas,gas_grd,gas_boi
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,heat_pump,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
grd,1,heat_pump,1
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
heat_pump,1,water_tes,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
heat_pump,1,therm_cns,1
heat_pump,1,dhw_dmd,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,grd,elec_cns
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
from,output,to,input
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,grd,elec_cns
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
grd,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
sector,from,to
electricity,pv_roof,inv_pv
electricity,inv_pv,grd
electricity,inv_pv,elec_cns
electricity,inv_pv,inv_bat
electricity,battery,inv_bat
electricity,grd,elec_cns
electricity,grd,inv_bat
electricity,inv_bat,battery
electricity,inv_bat,grd
electricity,inv_bat,elec_cns
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
from,output,to,input
pv_roof,1,inv_pv,1
inv_pv,1,grd,1
inv_pv,1,elec_cns,1
inv_pv,1,inv_bat,1
battery,1,inv_bat,1
grd,1,elec_cns,1
grd,1,inv_bat,1
inv_bat,1,battery,1
inv_bat,1,grd,1
inv_bat,1,elec_cns,1
gas_grd,1,gas_boi,1
water_tes,1,therm_cns,1
water_tes,1,dhw_dmd,1
gas_boi,1,water_tes,1
gas_boi,1,therm_cns,1
gas_boi,1,dhw_dmd,1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment