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

Merge branch 'dev_cvo_input_format' into 'main'

New input format

See merge request focus/tooling!16
parents a83e46cf 72ede07f
No related branches found
No related tags found
No related merge requests found
...@@ -32,18 +32,18 @@ from Tooling.modifier import Modifier ...@@ -32,18 +32,18 @@ from Tooling.modifier import Modifier
def process_input_profiles(input_profile_dict, t_start, t_horizon, t_step): def process_input_profiles(input_profile_dict, t_start, t_horizon, t_step):
input_profiles = {} input_profiles = {}
for input_profile_name, input_profile_config in input_profile_dict.items(): for input_profile_name, input_profile_config in input_profile_dict.items():
if input_profile_config[1] == 'generate': if 'file' in input_profile_config:
profile = generate_profile(input_profile_config[0], input_profile_config[2:], input_profiles, t_start, t_horizon, t_step) profile = pd.read_csv(input_profile_config['file'], index_col = 0)
elif input_profile_config[1] == 'modify':
profile = modify_profile(input_profile_config[0], input_profile_config[2:], input_profiles, t_start, t_horizon, t_step)
else:
profile = pd.read_csv(input_profile_config[1], index_col = 0)
try: try:
profile.index = pd.to_datetime(profile.index, format = '%d-%m-%Y %H:%M:%S') profile.index = pd.to_datetime(profile.index, format = '%d-%m-%Y %H:%M:%S')
except ValueError: except ValueError:
profile.index = pd.to_datetime(profile.index, format = '%Y-%m-%d %H:%M:%S') profile.index = pd.to_datetime(profile.index, format = '%Y-%m-%d %H:%M:%S')
profile = profile.resample(str(t_step) + 'H').mean().interpolate('linear') profile = profile.resample(str(t_step) + 'H').mean().interpolate('linear')
input_profiles[input_profile_name] = (input_profile_config[0], profile) elif 'generate' in input_profile_config:
profile = generate_profile(input_profile_config['type'], input_profile_config['generate'], input_profiles, t_start, t_horizon, t_step)
elif 'modify' in input_profile_config:
profile = modify_profile(input_profile_config['type'], input_profile_config['modify'], input_profiles, t_start, t_horizon, t_step)
input_profiles[input_profile_name] = (input_profile_config['type'], profile)
for input_profile_name, (input_profile_type, input_profile) in input_profiles.items(): for input_profile_name, (input_profile_type, input_profile) in input_profiles.items():
input_profile = input_profile[t_start:t_start + pd.Timedelta(hours = t_horizon * t_step - t_step)] input_profile = input_profile[t_start:t_start + pd.Timedelta(hours = t_horizon * t_step - t_step)]
...@@ -69,7 +69,7 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo ...@@ -69,7 +69,7 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo
if profile_type == 'elec_demand': if profile_type == 'elec_demand':
profiles = [] profiles = []
for year in years: for year in years:
profile = ElectricalDemand(year).get_profile(parameters[0], 'h0', True) # True: with smoothing function for household profiles, False: no smoothing function for household profiles profile = ElectricalDemand(year).get_profile(parameters['yearly_demand'], 'h0', True) # True: with smoothing function for household profiles, False: no smoothing function for household profiles
profile = profile.resample(str(t_step) + 'H').mean().interpolate('linear') profile = profile.resample(str(t_step) + 'H').mean().interpolate('linear')
profiles.append(profile) profiles.append(profile)
timeseries = pd.concat(profiles) timeseries = pd.concat(profiles)
...@@ -85,10 +85,10 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo ...@@ -85,10 +85,10 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo
# same problem for hot water demand. # same problem for hot water demand.
profile = ThermalDemand(demand_df.index, profile = ThermalDemand(demand_df.index,
shlp_type='EFH', shlp_type='EFH',
temperature=input_profiles[parameters[1]][1], temperature=input_profiles[parameters['temperature']][1],
building_class=1, building_class=1,
wind_class=1, wind_class=1,
annual_heat_demand=parameters[0] / t_step, annual_heat_demand=parameters['yearly_demand'] / t_step,
name='HeatDemand_EFH', name='HeatDemand_EFH',
ww_incl=0).get_bdew_profile() ww_incl=0).get_bdew_profile()
profiles.append(profile) profiles.append(profile)
...@@ -102,10 +102,10 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo ...@@ -102,10 +102,10 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo
freq=str(t_step) + 'H')) freq=str(t_step) + 'H'))
profile = ThermalDemand(demand_df.index, profile = ThermalDemand(demand_df.index,
shlp_type='EFH', shlp_type='EFH',
temperature=input_profiles[parameters[1]][1], temperature=input_profiles[parameters['temperature']][1],
building_class=1, building_class=1,
wind_class=1, wind_class=1,
annual_heat_demand=parameters[0] / t_step, annual_heat_demand=parameters['yearly_demand'] / t_step,
name='DomesticHotWaterDemand_EFH', name='DomesticHotWaterDemand_EFH',
ww_incl=1).get_bdew_profile() ww_incl=1).get_bdew_profile()
profiles.append(profile) profiles.append(profile)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment