From fb80959f2dcdb56e48250ae168f4c23913523cd5 Mon Sep 17 00:00:00 2001 From: Nie <yni@eonerc.rwth-aachen.de> Date: Fri, 12 Aug 2022 17:32:28 +0200 Subject: [PATCH] fix bug in thermal demand and water demand generator in last version the generated demand for heating and hot water was python list, which is changed into pandas series with timestample. otherwise the Prediction would cause error --- Prosumer/scripts/time_series_processing.py | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Prosumer/scripts/time_series_processing.py b/Prosumer/scripts/time_series_processing.py index 0b14808..32c6386 100644 --- a/Prosumer/scripts/time_series_processing.py +++ b/Prosumer/scripts/time_series_processing.py @@ -135,19 +135,44 @@ def generate_profile(t_start, t_step, t_horizon, prediction='Perfect', **kwargs) elif profile == 'generate_therm_demand_tek': bld_typ = kwargs[profile][0] total_demand = kwargs[profile][1] - weather = kwargs[profile][2] + weather = kwargs[profile][2]['temperature'].values year = int(pd.Timestamp(t_start).year) - input_profiles['therm_demand'] = tek.gen_heat_profile( - building_typ=bld_typ, temperature_profile=weather, year=year, - yearly_demand=total_demand) + demands = tek.gen_heat_profile(building_typ=bld_typ, + temperature_profile=weather, + year=year, + yearly_demand=total_demand) + + profile_date = pd.date_range(start=str(year)+"0101", periods=8760, + freq='H') + demands = pd.Series(demands, index=profile_date) + + predictors['therm_demand'] = PredictionGenerator(demands, + method=prediction) + input_profiles['therm_demand'] = predictors['therm_demand'].predict( + str(t_step) + 'H', + t_start, + t_horizon / t_step) elif profile == 'generate_water_demand_tek': bld_typ = kwargs[profile][0] total_demand = kwargs[profile][1] year = int(pd.Timestamp(t_start).year) - input_profiles['hot_water_demand'] = tek.gen_hot_water_profile( + # input_profiles['hot_water_demand'] = tek.gen_hot_water_profile( + # building_typ=bld_typ, year=year, yearly_demand=total_demand) + + demands = tek.gen_hot_water_profile( building_typ=bld_typ, year=year, yearly_demand=total_demand) + profile_date = pd.date_range(start=str(year) + "0101", periods=8760, + freq='H') + demands = pd.Series(demands, index=profile_date) + + predictors['hot_water_demand'] = PredictionGenerator(demands, + method=prediction) + input_profiles['hot_water_demand'] = predictors['hot_water_demand'].predict( + str(t_step) + 'H', + t_start, + t_horizon / t_step) else: # apply prediction methods upon other input profiles (air_temp, irradiance, etc.) predictors[profile] = PredictionGenerator(kwargs[profile], method=prediction) -- GitLab