diff --git a/input_files/models/prosumer_models/office_pv_heatpump/config.csv b/input_files/models/prosumer_models/office_pv_heatpump/config.csv new file mode 100644 index 0000000000000000000000000000000000000000..be5d6200a2f1f62a9a82ce2293bdb5ec8a02d3d5 --- /dev/null +++ b/input_files/models/prosumer_models/office_pv_heatpump/config.csv @@ -0,0 +1,2 @@ +injection_price,injection_price_variable,injection/pvpeak,gas_price,gas_price_variable,elec_price,elec_price_variable,heat_price,heat_price_variable,cooling_price,cooling_price_variable,injection_price_gas,injection_price_gas_variable,injection_price_heat,injection_price_heat_variable,injection_price_cooling,injection_price_cooling_variable,elec_emission,gas_emission,yearly_interest,planning_horizon,elec_price_cap_low,elec_price_cap_high +0.0793,0,0.7,0.0606,0,0.3046,0,0,0,0,0,0,0,0,0,0,0,0.401,0.21,0.03,20,15,107 diff --git a/input_files/models/prosumer_models/office_pv_heatpump/data_path.csv b/input_files/models/prosumer_models/office_pv_heatpump/data_path.csv new file mode 100644 index 0000000000000000000000000000000000000000..aa0479f160f0098ef724bba48c299f1cb0ca738d --- /dev/null +++ b/input_files/models/prosumer_models/office_pv_heatpump/data_path.csv @@ -0,0 +1,5 @@ +type,path,unit +demand_electric,generate,h +demand_heat,generate,h +irradiance,input_files/data/irradiance/Lindenberg2006BSRN_Irradiance_60sec.csv,min +temperature,input_files/data/temperature/temperature.csv,h diff --git a/input_files/models/prosumer_models/office_pv_heatpump/elec_matrix.csv b/input_files/models/prosumer_models/office_pv_heatpump/elec_matrix.csv new file mode 100644 index 0000000000000000000000000000000000000000..51d563713936974eda2a41a665fe4485c81d93a9 --- /dev/null +++ b/input_files/models/prosumer_models/office_pv_heatpump/elec_matrix.csv @@ -0,0 +1,7 @@ +comp_name,comp_type,model,min_size,max_size,current_size,pv_roof,inv_pv_bat,battery,heat_pump,grd,elec_cns +pv_roof,StandardPVGenerator,PV2,0,30,0,0,1,0,0,0,0 +inv_pv_bat,Inverter,STP-7000TL-20,0,30,0,0,0,1,1,1,1 +battery,LiionBattery,BAT1,0,1000,0,0,1,0,0,0,0 +heat_pump,HeatPump,EHP1,2,50,0,0,0,0,0,0,0 +grd,StandardACGrid,GRD1,1000,1000,0,0,1,0,1,0,1 +elec_cns,StandardElectricalConsumption,CNS1,1000,1000,0,0,0,0,0,0,0 diff --git a/input_files/models/prosumer_models/office_pv_heatpump/therm_matrix.csv b/input_files/models/prosumer_models/office_pv_heatpump/therm_matrix.csv new file mode 100644 index 0000000000000000000000000000000000000000..3f54f72d2981ba422a521c1bdb61070f66b6d997 --- /dev/null +++ b/input_files/models/prosumer_models/office_pv_heatpump/therm_matrix.csv @@ -0,0 +1,5 @@ +comp_name,comp_type,model,min_size,max_size,current_size,heat_pump,therm_cns,dhw_dmd,water_tes +heat_pump,HeatPump,EHP1,,,,0,0,0,1 +therm_cns,HeatConsumption,HeatCNS1,1000,1000,0,0,0,0,0 +dhw_dmd,HotWaterConsumption,HWCNS1,1000,1000,0,0,0,0,0 +water_tes,HotWaterStorage,TES1,10,93,0,0,1,1,0 diff --git a/runme.py b/runme.py index 7eaa0a1f645ef803730315d894e985fc66091dc0..493848312945111bb14ea7f15d105b29f9efdb48 100644 --- a/runme.py +++ b/runme.py @@ -30,11 +30,14 @@ import Model_Library.Prosumer.main as main from multiprocessing import Pool import os from functools import partial -from Model_Library.Prosumer.scripts.results_evaluation.results_evaluation import Plot_savings +from Model_Library.Prosumer.scripts.results_evaluation.results_evaluation import \ + Plot_savings + # from Tooling.results_evaluation.results_evaluation import Plot_savings -def process_each_prosumer(prosumer_name, prosumer_dict, data_source, commentary, no_process_bar_rh): +def process_each_prosumer(prosumer_name, prosumer_dict, data_source, commentary, + no_process_bar_rh): """ The method XYZ adds ... :param @@ -100,13 +103,18 @@ def process_each_prosumer(prosumer_name, prosumer_dict, data_source, commentary, final_iteration = False # Set aggregation options - parser = argparse.ArgumentParser(description='Start optimization from DB or local data') - parser.add_argument('-a', '--aggregate', action="store_true", dest="aggregate", - help="activating aggregation of input time series", default=False) + parser = argparse.ArgumentParser( + description='Start optimization from DB or local data') + parser.add_argument('-a', '--aggregate', action="store_true", + dest="aggregate", + help="activating aggregation of input time series", + default=False) options = parser.parse_args() # Calculate number of rolling horizon intervals and loop through them - for t in tqdm(pd.date_range(t_start, t_end - pd.Timedelta(hours=t_rh_shift + 1), freq=str(t_rh_shift) + 'H'), + for t in tqdm(pd.date_range(t_start, + t_end - pd.Timedelta(hours=t_rh_shift + 1), + freq=str(t_rh_shift) + 'H'), disable=no_process_bar_rh): # ToDo: replace first value with perfect value (can be done in runme) # set end date for current loop @@ -115,23 +123,29 @@ def process_each_prosumer(prosumer_name, prosumer_dict, data_source, commentary, # exceptions that occur at global end of simulation horizon if t_end_loop > t_end: t_end_loop = t_end - if t_current_value_length > (t_end_loop - t) / pd.Timedelta(hours=1): - t_current_value_length = (t_end_loop - t) / pd.Timedelta(hours=1) + if t_current_value_length > (t_end_loop - t) / pd.Timedelta( + hours=1): + t_current_value_length = (t_end_loop - t) / pd.Timedelta( + hours=1) # Set flag for final iteration if t == t_end - pd.Timedelta(hours=t_rh_shift + 1): final_iteration = True # Start main programme - prosumer = main.Main(data_source, {prosumer_name: prosumer_dict[prosumer_name]}, t, t_end_loop, t_step, + prosumer = main.Main(data_source, + {prosumer_name: prosumer_dict[prosumer_name]}, + t, t_end_loop, t_step, predictions, t_current_value_length, t_end, - t_history, commentary, storage_states, t_rh_shift, aggregation=options.aggregate) + t_history, commentary, storage_states, + t_rh_shift, aggregation=options.aggregate) # Run optimization prosumer.run_optimization(prosumer.prosumer_name_list) # Show results - Results are only plotted after last iteration of rolling horizon - prosumer.show_results(prosumer.prosumer_name_list, interim_results, final_iteration) + prosumer.show_results(prosumer.prosumer_name_list, interim_results, + final_iteration) # Get storage states from this iteration storage_states = prosumer.charge_status @@ -164,16 +178,16 @@ if __name__ == "__main__": # data_path = topology_path + '/data_path.csv' # prosumer_name = 'office' # prosumer_dict = {prosumer_name: {'topology_path': topology_path, 'config_path': config_path, 'data_path': data_path}} - topology_path = ['input_files/models/SCN0_CAT1'] - prosumer_name = ['SCN0_CAT1'] - rolling_horizon = [False] - elec_demand = [1500, 10000] - therm_demand = [5000, 20000] - hot_water_demand = 1500 # [1500, 1500] - step_elec_demand = 500 - step_therm_demand = 500 + # topology_path = ['input_files/models/SCN0_CAT1'] + # prosumer_name = ['SCN0_CAT1'] + # rolling_horizon = [False] + # elec_demand = [1500, 10000] + # therm_demand = [5000, 20000] + # hot_water_demand = 1500 # [1500, 1500] + # step_elec_demand = 500 + # step_therm_demand = 500 # step_hot_water_demand = 0 - prosumer_dict = {} + # prosumer_dict = {} """ for i in range(len(prosumer_name)): for j in range(elec_demand[0], elec_demand[1], step_elec_demand): for k in range(therm_demand[0], therm_demand[1], step_therm_demand): @@ -186,16 +200,24 @@ if __name__ == "__main__": 'data_path': topology_path[i] + '/data_path.csv', 'rolling_horizon': rolling_horizon[i]}""" - prosumer_dict={#'SCN0_CAT1_2000_6000': {'elec_demand': 2000, 'therm_demand': 6000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN0_CAT1', 'config_path': 'input_files/models/SCN0_CAT1/config.csv', 'data_path': 'input_files/models/SCN0_CAT1/data_path.csv', 'rolling_horizon': False}, - #'SCN3_CAT1_3000_6000': {'elec_demand': 3000, 'therm_demand': 6000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN3_CAT1', 'config_path': 'input_files/models/SCN3_CAT1/config.csv', 'data_path': 'input_files/models/SCN3_CAT1/data_path.csv', 'rolling_horizon': False}, - #'SCN1_CAT1_3000_6000': {'elec_demand': 3000, 'therm_demand': 6000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN1_CAT1', 'config_path': 'input_files/models/SCN1_CAT1/config.csv', 'data_path': 'input_files/models/SCN1_CAT1/data_path.csv', 'rolling_horizon': False}, - 'SCN2_CAT1_PV14_HP_3000_6000': {'elec_demand': 3000, 'therm_demand': 6000, - 'hot_water_demand': 1500, - 'topology_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV14_HP', - 'config_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/config.csv', - 'data_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/data_path.csv', - 'rolling_horizon': False} - #'SCN2_CAT1_PV12_BA_3000_6000': {'elec_demand': 9000, 'therm_demand': 20000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN2_CAT1_PV12_BA', 'config_path': 'input_files/models/SCN2_CAT1_PV12_BA/config.csv', 'data_path': 'input_files/models/SCN3_CAT1_PV12_BA/data_path.csv', 'rolling_horizon': True}} + prosumer_dict = { + # 'SCN0_CAT1_2000_6000': {'elec_demand': 2000, 'therm_demand': 6000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN0_CAT1', 'config_path': 'input_files/models/SCN0_CAT1/config.csv', 'data_path': 'input_files/models/SCN0_CAT1/data_path.csv', 'rolling_horizon': False}, + # 'SCN3_CAT1_3000_6000': {'elec_demand': 3000, 'therm_demand': 6000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN3_CAT1', 'config_path': 'input_files/models/SCN3_CAT1/config.csv', 'data_path': 'input_files/models/SCN3_CAT1/data_path.csv', 'rolling_horizon': False}, + # 'SCN1_CAT1_3000_6000': {'elec_demand': 3000, 'therm_demand': 6000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN1_CAT1', 'config_path': 'input_files/models/SCN1_CAT1/config.csv', 'data_path': 'input_files/models/SCN1_CAT1/data_path.csv', 'rolling_horizon': False}, + # 'SCN2_CAT1_PV14_HP_3000_6000': {'elec_demand': 3000, 'therm_demand': 6000, + # 'hot_water_demand': 1500, + # 'topology_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV14_HP', + # 'config_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/config.csv', + # 'data_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV14_HP/data_path.csv', + # 'rolling_horizon': False} + 'office_pv_heatpump': {'elec_demand': 32905, + 'therm_demand': 115154, + 'hot_water_demand': 11882, + 'topology_path': 'input_files/models/prosumer_models/office_pv_heatpump', + 'config_path': 'input_files/models/prosumer_models/office_pv_heatpump/config.csv', + 'data_path': 'input_files/models/prosumer_models/office_pv_heatpump/data_path.csv', + 'rolling_horizon': False} + # 'SCN2_CAT1_PV12_BA_3000_6000': {'elec_demand': 9000, 'therm_demand': 20000, 'hot_water_demand': 1500, 'topology_path': 'input_files/models/SCN2_CAT1_PV12_BA', 'config_path': 'input_files/models/SCN2_CAT1_PV12_BA/config.csv', 'data_path': 'input_files/models/SCN3_CAT1_PV12_BA/data_path.csv', 'rolling_horizon': True}} } # PLEASE CHANGE HERE @@ -214,14 +236,22 @@ if __name__ == "__main__": if parallel_processing: count_processes = len(prosumer_dict.keys()) pool = Pool(os.cpu_count()) - parallel_func = partial(process_each_prosumer, prosumer_dict=prosumer_dict, data_source=data_source, - commentary=commentary, no_process_bar_rh=no_process_bar_rh) - mapped_values = list(tqdm(pool.map(parallel_func, list(prosumer_dict.keys())), total=count_processes)) + parallel_func = partial(process_each_prosumer, + prosumer_dict=prosumer_dict, + data_source=data_source, + commentary=commentary, + no_process_bar_rh=no_process_bar_rh) + mapped_values = list( + tqdm(pool.map(parallel_func, list(prosumer_dict.keys())), + total=count_processes)) # Normal processing, one core only else: for prosumer_name in list(prosumer_dict.keys()): - process_each_prosumer(prosumer_name=prosumer_name, prosumer_dict=prosumer_dict, data_source=data_source, - commentary=commentary, no_process_bar_rh=no_process_bar_rh) + process_each_prosumer(prosumer_name=prosumer_name, + prosumer_dict=prosumer_dict, + data_source=data_source, + commentary=commentary, + no_process_bar_rh=no_process_bar_rh) # Timer output toc = time.time()