Skip to content
Snippets Groups Projects
Commit aa554362 authored by Jonas Brucksch's avatar Jonas Brucksch
Browse files

Now running file for all building types is used so that the scenarios can be...

Now running file for all building types is used so that the scenarios can be build based on the "real" district.
parent 96205c1b
No related branches found
No related tags found
No related merge requests found
Subproject commit c02cc107f706aeda8c1ce9a195d40d94c1cd50d5
Subproject commit 61ae4e9cb13a58b7eb5a39aeeb41899c4d4e9cd9
......@@ -14,14 +14,57 @@ class SimulationScope(Enum):
PROSUMER = 1
DISTRICT = 2
# Define a function to split strings and extract base names
def extract_base_name(s):
splits = s.split("_")
return splits[0] + "_" + splits[1]
# Define a function to split strings and extract base names
def extract_str_name(s):
splits = s.split("_")
if len(splits) == 3 and 'STR' in splits[2]: # only storage in prosumer -> return original
return s
elif len(splits) == 3 and 'PV' in splits[2]: # only pv in prosumer --> add storage
return s + '_STR'
else: # pv and storage in prosumer --> return original
return s
# Define a function to split strings and extract base names
def extract_pv_name(s):
splits = s.split("_")
if len(splits) > 2 and 'PV' in splits[2]: # only give back pv system
return splits[0] + "_" + splits[1] + "_" + splits[2]
else: # there is a storage in the prosumer --> exclude it
return splits[0] + "_" + splits[1]
simulation_scope = SimulationScope.DISTRICT
t_start = pd.Timestamp("2019-01-01 00:00:00") # start time of simulation
t_horizon = 8760 # number of time steps to be simulated
t_step = 1 # length of a time step in hours
inputpath_dataframe = 'input_files/models/prosumer_models/building_types_aachen_2022/running_77_2022.csv'
folder_building_configs = 'building_types_aachen_2022'
inputpath_dataframe_district = 'input_files/models/prosumer_models/building_types_aachen_2022/running_77_2022.csv'
inputpath_dataframe_all = 'input_files/models/prosumer_models/building_types_aachen_2022/running_info_2022.csv'
#inputpath_dataframe = 'input_files/models/district_models/quarter_extraction_df_Q_0.csv'
building_types = pd.read_csv(inputpath_dataframe)
building_types_district = pd.read_csv(inputpath_dataframe_district)
building_types = pd.read_csv(inputpath_dataframe_all)
# Initialize empty lists to store the results
only_pv = [] # contains the community without storage
original_names = [] # contains the original community names
full_storage = [] # community with added storage to all prosumers
# Loop over the column of interest and store the indices and strings that match the conditions
indices = []
for i, s in enumerate(building_types_district["ID_Building"]):
if "STR" in s or "PV" in s:
indices.append(i)
original_names.append(s)
full_storage.append(extract_str_name(s))
only_pv.append(extract_pv_name(s))
input_profile_dict = {'pv_factors_aachen_1': ['pv_factors', 'input_files/data/irradiance/aachen_pv_factors_ninja_2019_1h_to_2019_15min.csv'],
'pv_factors_germany_1': ['pv_factors', 'input_files/data/irradiance/irr_ren_ninja_avg_Germany.csv'],
......@@ -33,22 +76,24 @@ input_profile_dict = {'pv_factors_aachen_1': ['pv_factors', 'input_files/data/ir
'dhw_mhf_passive': ['hot_water_demand', 'input_files/data/demand/domestic_hot_water/synPRO_passive_multi_party_house_dhw_2021_to_2019_kW.csv'],
'elec_price_1': ['prices', 'input_files/data/prices/day-ahead/hourly_price.csv']}
for i in building_types.index[53:56]:
if 'A_' in building_types.iloc[i]['ID_Building']:
for i in building_types.index[:]:
if building_types.iloc[i]['ID_building'] not in (only_pv + original_names + full_storage):
continue
if 'A_' in building_types.iloc[i]['ID_building']:
pass
else:
if len(building_types['profile_el'][i]) > 2:
profile_list = building_types['profile_el'][i].split('+')
input_profile_dict['elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building'])] = ['elec_demand','generate',
building_types['reference_el_demand'][i],
if len(building_types['Profile_el'][i]) > 2:
profile_list = building_types['Profile_el'][i].split('+')
input_profile_dict['elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building'])] = ['elec_demand','generate',
building_types['Electricity_demand'][i],
profile_list[0]]
input_profile_dict['Add_elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building'])] = ['elec_demand','generate',
building_types['reference_el_demand'][i],
input_profile_dict['Add_elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building'])] = ['elec_demand','generate',
building_types['Electricity_demand'][i],
profile_list[1]]
else:
input_profile_dict['elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building'])] = ['elec_demand', 'generate',
building_types['reference_el_demand'][i],
building_types['profile_el'][i]]
input_profile_dict['elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building'])] = ['elec_demand', 'generate',
building_types['Electricity_demand'][i],
building_types['Profile_el'][i]]
input_profiles = Tooling.input_profile_processor.input_profile_processor.process_input_profiles(input_profile_dict, t_start, t_horizon, t_step)
......@@ -68,7 +113,7 @@ ref_yearly_dhw_demand = input_profiles['dhw_mhf_passive'].sum()*t_step # in kWh
# Create a new column in building_types to store the index of the closest value
building_types['closest_index'] = building_types.apply(
lambda row: np.abs(row['reference_el_demand'] - ref_yearly_elec_demand).idxmin(),
lambda row: np.abs(row['Electricity_demand'] - ref_yearly_elec_demand).idxmin(),
axis=1)
# 'config_path': path to global configurations like prices, injection prices, emission costs, etc.
......@@ -76,15 +121,15 @@ building_types['closest_index'] = building_types.apply(
prosumer_dict = {}
# drop the heatpump
building_types.drop(index=141, inplace=True)
building_types.reset_index(inplace=True)
building_types_district.drop(index=141, inplace=True)
building_types_district.reset_index(inplace=True)
# building_types.index[53:61]
community_sample = random.sample(range(197),30)
# how many storages
ids = building_types.loc[:]['ID_Building']
ids = building_types_district.loc[:]['ID_Building']
string_str = 'STR'
string_pv = 'PV'
string_ac = 'AC'
......@@ -101,64 +146,62 @@ print('Number of storages: ' + str(count_str))
print('Number of PV: ' + str(count_pv))
print('Number of AC: ' + str(count_ac))
consumer_count = 0
for i in building_types.index[54:56]:
ps_count = 1
for i in building_types.index[:]:
if 'A_' in building_types.iloc[i]['ID_Building']:
if len(prosumer_dict) > 2:
continue
if building_types.iloc[i]['ID_building'] not in original_names or 'HP' in building_types.iloc[i]['ID_building']:
continue
else:
prosumer_name = building_types.iloc[i]['ID_building'] + '_Q_' + str(ps_count)
ps_count += 1
if building_types.iloc[i]['ID_building'] != 'A_21_PV28.0_STR':
pass
if 'A_' in building_types.iloc[i]['ID_building']:
# get the index of the reference profile for this building type
index_ref_elec_demand = building_types['closest_index'][i]
# scale profiles based on the reference data
# ELECTRICITY
scaled_heat_demand = building_types['reference_el_demand'][i] / ref_yearly_elec_demand[index_ref_elec_demand] * input_profiles['ref_elec_demand_id_' + str(index_ref_elec_demand)]
input_profiles['elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building'])] = scaled_heat_demand
scaled_heat_demand = building_types['Electricity_demand'][i] / ref_yearly_elec_demand[index_ref_elec_demand] * input_profiles['ref_elec_demand_id_' + str(index_ref_elec_demand)]
input_profiles['elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building'])] = scaled_heat_demand
# ROOM HEATING
scaled_heat_demand = building_types['reference_heat_demand'][i] / ref_yearly_rh_demand * input_profiles['room_heating_mfh_passive']
input_profiles['room_heat_demand_prosumer_' + str(building_types.loc[i,'ID_Building'])] = scaled_heat_demand
scaled_heat_demand = building_types['Thermal_demand'][i] / ref_yearly_rh_demand * input_profiles['room_heating_mfh_passive']
input_profiles['room_heat_demand_prosumer_' + str(building_types.loc[i,'ID_building'])] = scaled_heat_demand
# HOT WATER
scaled_hot_water_demand = building_types['reference_hot_water'][i] / ref_yearly_rh_demand * input_profiles['dhw_mhf_passive']
input_profiles['hot_water_demand_prosumer_' + str(building_types.loc[i, 'ID_Building'])] = scaled_hot_water_demand
scaled_hot_water_demand = building_types['HotWater_demand'][i] / ref_yearly_rh_demand * input_profiles['dhw_mhf_passive']
input_profiles['hot_water_demand_prosumer_' + str(building_types.loc[i, 'ID_building'])] = scaled_hot_water_demand
if 'PV' in building_types.loc[i,'ID_Building'] and 'HP' in building_types.loc[i, 'ID_Building']:
if 'HP' in building_types.loc[i, 'ID_building']:
prosumer_dict[building_types.loc[i,'name_building']]= {'config_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i,'ID_Building']) + '/config.csv',
'topology_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i,'ID_Building']),
'profiles':{'elec_cns': 'elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building']),
'therm_cns': 'room_heat_demand_prosumer_' + str(building_types.loc[i,'ID_Building']),
'dhw_dmd': 'hot_water_demand_prosumer_' + str(building_types.loc[i, 'ID_Building']),
prosumer_dict[prosumer_name]= {'config_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i,'ID_building']) + '/config.csv',
'topology_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i,'ID_building']),
'profiles':{'elec_cns': 'elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building']),
'therm_cns': 'room_heat_demand_prosumer_' + str(building_types.loc[i,'ID_building']),
'dhw_dmd': 'hot_water_demand_prosumer_' + str(building_types.loc[i, 'ID_building']),
'pv_roof': ['pv_factors_aachen_1'],
'heat_pump': 'temperature_1'}}
elif 'PV' in building_types.loc[i,'ID_Building']:
prosumer_dict[building_types.loc[i, 'name_building']] = {'config_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i, 'ID_Building']) + '/config.csv',
'topology_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i, 'ID_Building']),
'profiles': {'elec_cns': 'elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building']),
elif 'PV' in building_types.loc[i,'ID_building']:
prosumer_dict[prosumer_name] = {'config_path': 'input_files/models/prosumer_models/' + folder_building_configs + '/' + str(building_types.loc[i, 'ID_building']) + '/config.csv',
'topology_path': 'input_files/models/prosumer_models/' + folder_building_configs + '/' + str(building_types.loc[i, 'ID_building']),
'profiles': {'elec_cns': 'elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building']),
'pv_roof': ['pv_factors_aachen_1']}}
else:
prosumer_dict[building_types.loc[i, 'name_building']] = {'config_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i, 'ID_Building']) + '/config.csv',
'topology_path': 'input_files/models/prosumer_models/building_types_aachen_2022/'+ str(building_types.loc[i, 'ID_Building']),
'profiles': {'elec_cns': 'elec_demand_prosumer_' + str(building_types.loc[i, 'ID_Building'])}}
prosumer_dict[prosumer_name] = {'config_path': 'input_files/models/prosumer_models/' + folder_building_configs + '/' + str(building_types.loc[i, 'ID_building']) + '/config.csv',
'topology_path': 'input_files/models/prosumer_models/' + folder_building_configs + '/' + str(building_types.loc[i, 'ID_building']),
'profiles': {'elec_cns': 'elec_demand_prosumer_' + str(building_types.loc[i, 'ID_building'])}}
num=0
"""
prosumer_dict = {'SCN2_CAT1_PV11_3000_6000':{'config_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11/config.csv',
'topology_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11',
'profiles': {'pv_roof': ['irradiance_1', 'temperature_1'],
'elec_cns': 'demand_electric_1',
'therm_cns': 'demand_heat_1',
'dhw_dmd': 'demand_hot_water_1'}},
'SCN0_CAT1_3000_6000': {'config_path': 'input_files/models/prosumer_models/SCN0_CAT1/config.csv',
'topology_path': 'input_files/models/prosumer_models/SCN0_CAT1',
'profiles': {'elec_cns': 'demand_electric_2',
'therm_cns': 'demand_heat_2',
'dhw_dmd': 'demand_hot_water_2'}}}
"""
prosumer_main = main_prosumer.ProsumerMain(prosumer_dict, input_profiles, t_horizon, t_step)
prosumer_sizing_strategy = 'annuity'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment