Skip to content
Snippets Groups Projects
Commit fb80959f authored by Nie's avatar Nie
Browse files

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
parent 557aa973
No related branches found
No related tags found
No related merge requests found
......@@ -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,
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment