diff --git a/input_profile_processor/input_profile_processor.py b/input_profile_processor/input_profile_processor.py index 58137e835a75cbbecea82ca0e8aae754612f14c5..66ad5b8b0b482ae500d061711f457357aba9cf1d 100644 --- a/input_profile_processor/input_profile_processor.py +++ b/input_profile_processor/input_profile_processor.py @@ -32,18 +32,18 @@ from Tooling.modifier import Modifier def process_input_profiles(input_profile_dict, t_start, t_horizon, t_step): input_profiles = {} for input_profile_name, input_profile_config in input_profile_dict.items(): - if input_profile_config[1] == 'generate': - profile = generate_profile(input_profile_config[0], input_profile_config[2:], input_profiles, t_start, t_horizon, t_step) - 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) + if 'file' in input_profile_config: + profile = pd.read_csv(input_profile_config['file'], index_col = 0) try: profile.index = pd.to_datetime(profile.index, format = '%d-%m-%Y %H:%M:%S') except ValueError: profile.index = pd.to_datetime(profile.index, format = '%Y-%m-%d %H:%M:%S') 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(): 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 if profile_type == 'elec_demand': profiles = [] 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') profiles.append(profile) timeseries = pd.concat(profiles) @@ -85,10 +85,10 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo # same problem for hot water demand. profile = ThermalDemand(demand_df.index, shlp_type='EFH', - temperature=input_profiles[parameters[1]][1], + temperature=input_profiles[parameters['temperature']][1], building_class=1, wind_class=1, - annual_heat_demand=parameters[0] / t_step, + annual_heat_demand=parameters['yearly_demand'] / t_step, name='HeatDemand_EFH', ww_incl=0).get_bdew_profile() profiles.append(profile) @@ -102,10 +102,10 @@ def generate_profile(profile_type, parameters, input_profiles, t_start, t_horizo freq=str(t_step) + 'H')) profile = ThermalDemand(demand_df.index, shlp_type='EFH', - temperature=input_profiles[parameters[1]][1], + temperature=input_profiles[parameters['temperature']][1], building_class=1, wind_class=1, - annual_heat_demand=parameters[0] / t_step, + annual_heat_demand=parameters['yearly_demand'] / t_step, name='DomesticHotWaterDemand_EFH', ww_incl=1).get_bdew_profile() profiles.append(profile)