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

add option for thermal demand generator tek and fix bug for show result

thermal demand generation with tek data for therm_demand and water_demand are added since Tooling scripts are modified

bug in show_results, if Storage size is equal to 0, the calculation for charge_status leads divide zero error. fix bug with additional judgment wheather the size is 0
parent 8b87c1e6
No related branches found
No related tags found
No related merge requests found
......@@ -141,13 +141,28 @@ class Main:
input_profiles[self.name_list]['demand_electricity'] = \
ts.generate_profile(self.t_begin_profile, self.t_step, self.t_profile_length,
generate_elec_demand=('h0', self.elec_demand_yearly))
elif path_item == 'demand_heat':
input_profiles[self.name_list]['demand_heat'] = \
ts.generate_profile(self.t_begin_profile, self.t_step, self.t_profile_length,
generate_therm_demand=('EFH', self.therm_demand_yearly, input_profiles[self.name_list]['temperature']),
generate_water_demand=('EFH', self.hot_water_demand_yearly, input_profiles[self.name_list]['temperature']))
elif path_item == 'demand_heat_tek':
input_profiles[self.name_list]['demand_heat'] = \
ts.generate_profile(self.t_begin_profile,
self.t_step,
self.t_profile_length,
generate_therm_demand_tek=(
'Verwaltungsgebäude',
self.therm_demand_yearly,
input_profiles[
self.name_list][
'temperature']),
generate_water_demand_tek=(
'Verwaltungsgebäude',
self.hot_water_demand_yearly,
input_profiles[
self.name_list][
'temperature']))
# Generate prediction time series
# todo: nicer coding required. generic code for all input timeseries
for path_item in prosumer_data_path_dict[self.name_list]:
......@@ -163,7 +178,8 @@ class Main:
self.t_start_loop:self.t_start_loop + pd.Timedelta(hours=self.t_current_value_length - 1)]
# Add timseries to prosumer model
self.prosumer[self.name_list].add_profile(predict_electric_demand)
elif path_item == 'demand_heat':
elif path_item == 'demand_heat' or path_item == \
'demand_heat_tek':
predict_heat_demand = ts.generate_profile(
self.t_start_loop, self.t_step, self.t_horizon,
therm_demand=input_profiles[self.name_list]['demand_heat']['therm_demand'],
......@@ -374,7 +390,8 @@ class Main:
for components in all_comp['Components']:
comp_object = all_comp['Components'][components]
comp_type = comp_object.get_type()
if comp_type == 'Storage':
if comp_type == 'Storage' and all_results.iloc[
amount_results-1][('cap', components[0])] != 0:
self.charge_status[name_list][components[0]] = all_results.iloc[amount_results-1][('energy', components[0])]\
/all_results.iloc[amount_results-1][('cap', components[0])]
except ValueError:
......
......@@ -29,6 +29,7 @@ from datetime import datetime
from Tooling.predictor.PredictionGenerator import PredictionGenerator
from Tooling.demand_generator.electrical_demand.ElectricalDemand import ElectricalDemand
from Tooling.demand_generator.thermal_demand.ThermalDemand import ThermalDemand
import Tooling.demand_generator.tek_data.gen_heat_profile as tek
def generate_profile(t_start, t_step, t_horizon, prediction='Perfect', **kwargs):
......@@ -135,10 +136,18 @@ def generate_profile(t_start, t_step, t_horizon, prediction='Perfect', **kwargs)
bld_typ = kwargs[profile][0]
total_demand = kwargs[profile][1]
weather = kwargs[profile][2]
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)
elif profile == 'generate_water_demand_tek':
bld_typ = kwargs[profile][0]
total_demand = kwargs[profile][1]
weather = kwargs[profile][2]
year = int(pd.Timestamp(t_start).year)
input_profiles['hot_water_demand'] = tek.gen_hot_water_profile(
building_typ=bld_typ, year=year, yearly_demand=total_demand)
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