def get_hes_load_shapes(appliances_hes_matching, year_raw_values, hes_y_peak, enduse): """Read in raw HES data and generate shapes Calculate peak day demand Arguments ---------- appliances_hes_matching : dict HES appliances are matched witch enduses year_raw_values : array Yearly values from raw hes_y_peak : data Peak raw values enduse : string enduse Returns ------- shape_peak_yd_factor : float Peak day demand (Calculate factor which can be used to multiply yearly demand to generate peak demand) shape_peak_yh : float Peak demand of each hours of peak day Notes ----- The HES appliances are matched with enduses """ # Match enduse with HES appliance ID (see look_up table in original files for more information) hes_app_id = appliances_hes_matching[enduse] # Total yearly demand of hes_app_id tot_enduse_y = np.sum(year_raw_values[:, :, hes_app_id]) # ---Peak calculation Get peak daily load shape # Calculate amount of energy demand for peak day of hes_app_id peak_h_values = hes_y_peak[:, hes_app_id] # Shape of peak day (hourly values of peak day) #1.0/tot_peak_demand_d * peak_h_values shape_peak_dh = lp.abs_to_rel(peak_h_values) # Maximum daily demand tot_peak_demand_d = np.sum(peak_h_values) # Factor to calculate daily peak demand from yearly demand shape_peak_yd_factor = tot_peak_demand_d / tot_enduse_y # ---Calculate non-peak shapes shape_non_peak_yd = np.zeros((365), dtype=float) shape_non_peak_y_dh = np.zeros((365, 24), dtype=float) for day in range(365): day_values = year_raw_values[day, :, hes_app_id] shape_non_peak_yd[day] = (1.0 / tot_enduse_y) * np.sum(day_values) shape_non_peak_y_dh[day] = (1.0 / np.sum(day_values)) * day_values # daily shape return shape_peak_dh, shape_non_peak_y_dh, shape_peak_yd_factor, shape_non_peak_yd
def get_fuel_shape_heating_hp_yh(tech_lp_y_dh, tech_stock, rs_hdd_cy, model_yeardays): """Convert daily shapes to houly based on load for heatpump This is for non-peak. Arguments --------- tech_lp_y_dh : dict Technology load profiles tech_stock : object Technology stock rs_hdd_cy : array Heating Degree Days model_yeardays : array Modelled year days Returns ------- shape_yh : array Yearly shape to calculate hourly load (total sum == 1) hp_yd : array Yd shape Note ---- - An average heat pump efficiency is calculated for the whole day depending on hourly temperatures. - See XY in documentation for source of heat pumps """ shape_yh_hp = np.zeros((365, 24), dtype="float") shape_y_dh = np.zeros((365, 24), dtype="float") tech_eff = tech_stock.get_tech_attr( 'rs_space_heating', None, 'heat_pumps_electricity', 'eff_cy') # Convert daily service demand to fuel (fuel = Heat demand / efficiency) # As only the shape is of interest, the HDD # can be used as an indicator for fuel use (which correlates) directly hp_yd = rs_hdd_cy[:, np.newaxis] / tech_eff # Distribute daily according to fuel load curves of heat pumps shape_yh_hp = hp_yd * tech_lp_y_dh # Convert absolute hourly fuel demand to relative fuel demand within a year shape_yh = load_profile.abs_to_rel(shape_yh_hp) # Convert for every day the shape to absolute shape (tot sum for a full year == 365) _shape_y_dh_sum_rows = np.sum(shape_yh_hp, axis=1) with np.errstate(divide='ignore', invalid='ignore'): shape_y_dh = shape_yh_hp / _shape_y_dh_sum_rows[:, np.newaxis] shape_y_dh[np.isnan(shape_y_dh)] = 0 # Select only modelled days return shape_yh[model_yeardays], hp_yd
def test_abs_to_rel(): """Test """ absolute_array = np.array([1, 2, 3]) absolute_array2 = np.array([0, 0, 0]) relative_array = load_profile.abs_to_rel(absolute_array) relative_array2 = load_profile.abs_to_rel(absolute_array2) expected_relative_array = np.array([ float(absolute_array[0]) / np.sum(absolute_array), float(absolute_array[1]) / np.sum(absolute_array), float(absolute_array[2]) / np.sum(absolute_array) ]) np.testing.assert_equal(np.round(relative_array, 3), np.round(expected_relative_array, 3)) np.testing.assert_equal(relative_array2, absolute_array2)
def calc_reg_hdd( temperatures, t_base_heating, model_yeardays, crit_temp_min_max=False ): """Calculate hdd for every day and daily yd shape of heating demand Arguments ---------- temperatures : array Temperatures t_base_heating : float Base temperature for heating model_yeardays : dict Modelled yeardays Return ------ hdd_d : array Heating degree days for every day in a year (nr_of_days, 1) shape_hdd_d : array Shape for heating days (only selected modelling days) Note ----- - Based on temperatures of a year, the HDD are calculated for every day in a year. Based on the sum of all HDD of all days, the relative share of heat used for any day is calculated. - The Heating Degree Days are calculated based on assumptions of the base temperature of the current year. - The shape_yd can be calcuated as follows: 1/ np.sum(hdd_d) * hdd_d - The diffusion is assumed to be sigmoid """ hdd_d = calc_hdd( t_base_heating, temperatures, nr_day_to_av=1, crit_temp_min_max=crit_temp_min_max) shape_hdd_d = load_profile.abs_to_rel(hdd_d) # Select only modelled yeardays shape_hdd_d_selection = shape_hdd_d[model_yeardays] return hdd_d, shape_hdd_d_selection
def calc_reg_cdd(temperatures, t_base_cooling, model_yeardays): """Calculate CDD for every day and daily yd shape of cooling demand Arguments ---------- temperatures : array Temperatures t_base_cooling : array Base temperature cooling model_yeardays : list Modelled yeardays Return ------ shape_yd : array Fraction of heat for every day. Array-shape: nr_of_days, 1 Note ---- - Based on temperatures of a year, the CDD are calculated for every day in a year. Based on the sum of all CDD of all days, the relative share of heat used for any day is calculated. - The Cooling Degree Days are calculated based on assumptions of the base temperature of the current year. """ cdd_d = calc_cdd(t_base_cooling, temperatures, nr_day_to_av=1) shape_cdd_d = load_profile.abs_to_rel(cdd_d) # Select only modelled yeardays shape_cdd_d_selection = shape_cdd_d[[model_yeardays]] cdd_d_selection = cdd_d[[model_yeardays]] # If no calc_provide flat curve if np.sum(cdd_d_selection) == 0: shape_cdd_d_selection = np.full((len(model_yeardays)), 1 / len(model_yeardays)) return cdd_d_selection, shape_cdd_d_selection
def __init__( self, name, assumptions, technologies, enduses, temp_by, temp_cy, tech_lp, sectors, crit_temp_min_max ): """Constructor of weather region """ self.name = name fueltypes = lookup_tables.basic_lookups()['fueltypes'] # Base temperatures of current year rs_t_base_heating_cy = assumptions.non_regional_vars['rs_t_base_heating'][assumptions.curr_yr] ss_t_base_heating_cy = assumptions.non_regional_vars['ss_t_base_heating'][assumptions.curr_yr] ss_t_base_cooling_cy = assumptions.non_regional_vars['ss_t_base_cooling'][assumptions.curr_yr] is_t_base_heating_cy = assumptions.non_regional_vars['is_t_base_heating'][assumptions.curr_yr] # ================================================================== # Technology stocks # ================================================================== rs_tech_stock = technological_stock.TechStock( 'rs_tech_stock', technologies, assumptions.base_yr, assumptions.curr_yr, fueltypes, temp_by, temp_cy, assumptions.t_bases.rs_t_heating, enduses['residential'], rs_t_base_heating_cy, assumptions.specified_tech_enduse_by) ss_tech_stock = technological_stock.TechStock( 'ss_tech_stock', technologies, assumptions.base_yr, assumptions.curr_yr, fueltypes, temp_by, temp_cy, assumptions.t_bases.ss_t_heating, enduses['service'], ss_t_base_heating_cy, assumptions.specified_tech_enduse_by) is_tech_stock = technological_stock.TechStock( 'is_tech_stock', technologies, assumptions.base_yr, assumptions.curr_yr, fueltypes, temp_by, temp_cy, assumptions.t_bases.is_t_heating, enduses['industry'], ss_t_base_heating_cy, assumptions.specified_tech_enduse_by) self.tech_stock = { 'residential': rs_tech_stock, 'service': ss_tech_stock, 'industry': is_tech_stock} # ================================================================== # Load profiles # ================================================================== flat_shape_yd, _, flat_shape_y_dh = generic_shapes.flat_shape() # ================================================================== # Residential submodel load profiles # ================================================================== load_profiles = load_profile.LoadProfileStock("load_profiles") dummy_sector = None # --------Calculate HDD/CDD of used weather year self.rs_hdd_by, _ = hdd_cdd.calc_reg_hdd( temp_by, assumptions.t_bases.rs_t_heating, assumptions.model_yeardays, crit_temp_min_max) self.rs_hdd_cy, rs_fuel_shape_heating_yd = hdd_cdd.calc_reg_hdd( temp_cy, rs_t_base_heating_cy, assumptions.model_yeardays, crit_temp_min_max) # --------Calculate HDD/CDD of base year weather year #self.rs_cdd_by, _ = hdd_cdd.calc_reg_cdd( # temp_by, assumptions.t_bases.rs_t_cooling_by, assumptions.model_yeardays) #self.rs_cdd_cy, rs_fuel_shape_cooling_yd = hdd_cdd.calc_reg_cdd( # temp_cy, rs_t_base_cooling_cy, assumptions.model_yeardays) # -------Calculate climate change correction factors try: f_heat_rs_y = np.nan_to_num( 1.0 / float(np.sum(self.rs_hdd_by))) * np.sum(self.rs_hdd_cy) #self.f_cooling_rs_y = np.nan_to_num( # 1.0 / float(np.sum(self.rs_cdd_by))) * np.sum(self.rs_cdd_cy) f_cooling_rs_y = 1 except ZeroDivisionError: f_heat_rs_y = 1 f_cooling_rs_y = 1 # Calculate rs peak day rs_peak_day = enduse_func.get_peak_day(self.rs_hdd_cy) # ======== # Enduse specific profiles # ======== # -- Apply enduse sepcific shapes for enduses with not technologies with own defined shapes for enduse in enduses['residential']: # Enduses where technology specific load profiles are defined for yh if enduse in ['rs_space_heating']: pass else: # Get all technologies of enduse tech_list = helpers.get_nested_dict_key( assumptions.fuel_tech_p_by[enduse][dummy_sector]) # Remove heat pumps from rs_water_heating tech_list = basic_functions.remove_element_from_list(tech_list, 'heat_pumps_electricity') shape_y_dh = insert_peak_dh_shape( peak_day=rs_peak_day, shape_y_dh=tech_lp['rs_shapes_dh'][enduse]['shape_non_peak_y_dh'], shape_peak_dh=tech_lp['rs_shapes_dh'][enduse]['shape_peak_dh']) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_list, enduses=[enduse], shape_yd=tech_lp['rs_shapes_yd'][enduse]['shape_non_peak_yd'], shape_y_dh=shape_y_dh, sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ========== # Technology specific profiles for residential heating # =========== # ------Heating boiler load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['heating_const'], enduses=['rs_space_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_y_dh=tech_lp['rs_profile_boilers_y_dh'], sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ------Heating CHP rs_profile_chp_y_dh = insert_peak_dh_shape( peak_day=rs_peak_day, shape_y_dh=tech_lp['rs_profile_chp_y_dh'], shape_peak_dh=tech_lp['rs_lp_heating_CHP_dh']['peakday']) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['tech_CHP'], enduses=['rs_space_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_y_dh=rs_profile_chp_y_dh, sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ------Electric heating, storage heating (primary) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['storage_heating_electricity'], enduses=['rs_space_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_y_dh=tech_lp['rs_profile_storage_heater_y_dh'], sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ------Electric heating secondary (direct elec heating) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['secondary_heating_electricity'], enduses=['rs_space_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_y_dh=tech_lp['rs_profile_elec_heater_y_dh'], sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ------Heat pump heating rs_profile_hp_y_dh = insert_peak_dh_shape( peak_day=rs_peak_day, shape_y_dh=tech_lp['rs_profile_hp_y_dh'], shape_peak_dh=tech_lp['rs_lp_heating_hp_dh']['peakday']) rs_fuel_shape_hp_yh, rs_hp_shape_yd = get_fuel_shape_heating_hp_yh( tech_lp_y_dh=rs_profile_hp_y_dh, tech_stock=rs_tech_stock, rs_hdd_cy=self.rs_hdd_cy, model_yeardays=assumptions.model_yeardays) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['heating_non_const'], enduses=['rs_space_heating', 'rs_water_heating'], shape_y_dh=rs_profile_hp_y_dh, shape_yd=rs_hp_shape_yd, shape_yh=rs_fuel_shape_hp_yh, sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ------District_heating_electricity. Assumption made that same curve as CHP load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['tech_district_heating'], enduses=['rs_space_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_y_dh=rs_profile_hp_y_dh, sectors=[dummy_sector], model_yeardays=assumptions.model_yeardays) # ================================================================== # Service Submodel load profiles # ================================================================== # --------HDD/CDD # current weather_yr self.ss_hdd_by, _ = hdd_cdd.calc_reg_hdd( temp_by, assumptions.t_bases.ss_t_heating, assumptions.model_yeardays, crit_temp_min_max) ss_hdd_cy, ss_fuel_shape_heating_yd = hdd_cdd.calc_reg_hdd( temp_cy, ss_t_base_heating_cy, assumptions.model_yeardays, crit_temp_min_max) self.ss_cdd_by, _ = hdd_cdd.calc_reg_cdd( temp_by, assumptions.t_bases.ss_t_cooling, assumptions.model_yeardays, crit_temp_min_max) ss_cdd_cy, ss_lp_cooling_yd = hdd_cdd.calc_reg_cdd( temp_cy, ss_t_base_cooling_cy, assumptions.model_yeardays, crit_temp_min_max) try: f_heat_ss_y = np.nan_to_num( 1.0 / float(np.sum(self.ss_hdd_by))) * np.sum(ss_hdd_cy) f_cooling_ss_y = np.nan_to_num( 1.0 / float(np.sum(self.ss_cdd_by))) * np.sum(ss_cdd_cy) except ZeroDivisionError: f_heat_ss_y = 1 f_cooling_ss_y = 1 # ======== # Enduse specific profiles # ======== # - Assign to each enduse the carbon fuel trust dataset for enduse in enduses['service']: # Skip temperature dependent end uses (regional) because load profile in regional load profile stock if enduse in assumptions.enduse_space_heating or enduse in assumptions.ss_enduse_space_cooling: pass else: for sector in sectors['service']: # Get technologies with assigned fuel shares tech_list = helpers.get_nested_dict_key( assumptions.fuel_tech_p_by[enduse][sector]) # Apply correction factor for weekend_effect shape_non_peak_yd_weighted = load_profile.abs_to_rel( tech_lp['ss_shapes_yd'][enduse][sector]['shape_non_peak_yd'] * assumptions.ss_weekend_f) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_list, enduses=[enduse], shape_yd=shape_non_peak_yd_weighted, shape_y_dh=tech_lp['ss_shapes_dh'][enduse][sector]['shape_non_peak_y_dh'], model_yeardays=assumptions.model_yeardays, sectors=[sector]) # Apply correction factor for weekend_effect for space heating ss_fuel_shape_heating_yd_weighted = load_profile.abs_to_rel( ss_fuel_shape_heating_yd * assumptions.ss_weekend_f) # ======== # Technology specific profiles # ======== # Flatten list of all potential technologies ss_space_heating_tech_lists = list(assumptions.tech_list.values()) all_techs_ss_space_heating = [item for sublist in ss_space_heating_tech_lists for item in sublist] # -----Heat pump (RESIDENTIAL HEAT PUMP PROFILE FOR SERVICE SECTOR) all_techs_ss_space_heating = basic_functions.remove_element_from_list( all_techs_ss_space_heating, 'heat_pumps_electricity') ss_fuel_shape_hp_yh, ss_hp_shape_yd = get_fuel_shape_heating_hp_yh( tech_lp_y_dh=rs_profile_hp_y_dh, tech_stock=rs_tech_stock, rs_hdd_cy=ss_hdd_cy, model_yeardays=assumptions.model_yeardays) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['heating_non_const'], enduses=['ss_space_heating', 'ss_water_heating'], sectors=sectors['service'], shape_y_dh=rs_profile_hp_y_dh, shape_yd=ss_hp_shape_yd, shape_yh=ss_fuel_shape_hp_yh, model_yeardays=assumptions.model_yeardays) # ---secondary_heater_electricity Info: The residential direct heating load profile is used all_techs_ss_space_heating = basic_functions.remove_element_from_list( all_techs_ss_space_heating, 'secondary_heater_electricity') # Get aggregated electricity load profile #ALTERNATIVE :tech_lp['ss_all_tech_shapes_dh']['ss_other_electricity']['shape_non_peak_y_dh'] load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['secondary_heating_electricity'], enduses=['ss_space_heating'], sectors=sectors['service'], shape_yd=ss_fuel_shape_heating_yd_weighted, shape_y_dh=tech_lp['rs_profile_elec_heater_y_dh'], model_yeardays=assumptions.model_yeardays) # ELEC CURVE ss_fuel_shape_electricity # DIRECT HEATING ss_profile_elec_heater_yh # ---Heating technologies (all other) # (the heating shape follows the gas shape of aggregated sectors) # meaning that for all technologies, the load profile is the same load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=all_techs_ss_space_heating, enduses=['ss_space_heating'], sectors=sectors['service'], shape_yd=ss_fuel_shape_heating_yd_weighted, shape_y_dh=tech_lp['ss_all_tech_shapes_dh']['ss_space_heating']['shape_non_peak_y_dh'], model_yeardays=assumptions.model_yeardays) # --Add cooling technologies for service sector coolings_techs = assumptions.tech_list['cooling_const'] for cooling_enduse in assumptions.ss_enduse_space_cooling: for sector in sectors['service']: # Apply correction factor for weekend_effect 'cdd_weekend_cfactors' ss_lp_cooling_yd_weighted = load_profile.abs_to_rel( ss_lp_cooling_yd * assumptions.cdd_weekend_cfactors) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=coolings_techs, enduses=[cooling_enduse], sectors=[sector], shape_yd=ss_lp_cooling_yd_weighted, shape_y_dh=tech_lp['ss_profile_cooling_y_dh'], model_yeardays=assumptions.model_yeardays) # ================================================================== # Industry submodel load profiles # ================================================================== # --------HDD/CDD # Current weather_yr self.is_hdd_by, _ = hdd_cdd.calc_reg_hdd( temp_by, assumptions.t_bases.is_t_heating, assumptions.model_yeardays, crit_temp_min_max) #is_cdd_by, _ = hdd_cdd.calc_reg_cdd( # temp_by, assumptions.t_bases.is_t_cooling, assumptions.model_yeardays) # Take same base temperature as for service sector is_hdd_cy, is_fuel_shape_heating_yd = hdd_cdd.calc_reg_hdd( temp_cy, is_t_base_heating_cy, assumptions.model_yeardays, crit_temp_min_max) #is_cdd_cy, _ = hdd_cdd.calc_reg_cdd( # temp_cy, ss_t_base_cooling_cy, assumptions.model_yeardays) try: f_heat_is_y = np.nan_to_num(1.0 / float(np.sum(self.is_hdd_by))) * np.sum(is_hdd_cy) #self.f_cooling_is_y = np.nan_to_num(1.0 / float(np.sum(is_cdd_by))) * np.sum(is_cdd_cy) f_cooling_is_y = 1 except ZeroDivisionError: f_heat_is_y = 1 f_cooling_is_y = 1 # ======== # Technology specific profiles # ======== # --Heating technologies # Flatten list of all potential heating technologies is_space_heating_tech_lists = list(assumptions.tech_list.values()) all_techs_is_space_heating = [item for sublist in is_space_heating_tech_lists for item in sublist] # Apply correction factor for weekend_effect for space heating load profile is_fuel_shape_heating_yd_weighted = load_profile.abs_to_rel( is_fuel_shape_heating_yd * assumptions.is_weekend_f) # - Direct electric heating # Remove tech from all space heating techs all_techs_is_space_heating = basic_functions.remove_element_from_list( all_techs_is_space_heating, 'secondary_heater_electricity') load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=assumptions.tech_list['secondary_heating_electricity'], enduses=['is_space_heating'], sectors=sectors['industry'], shape_yd=is_fuel_shape_heating_yd_weighted, shape_y_dh=tech_lp['rs_profile_elec_heater_y_dh'], model_yeardays=assumptions.model_yeardays) # Add flat load profiles for non-electric heating technologies load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=all_techs_is_space_heating, enduses=['is_space_heating'], sectors=sectors['industry'], shape_yd=is_fuel_shape_heating_yd_weighted, shape_y_dh=flat_shape_y_dh, model_yeardays=assumptions.model_yeardays) # Apply correction factor for weekend_effect to flat load profile for industry flat_shape_yd = flat_shape_yd * assumptions.is_weekend_f flat_shape_yd_weighted = load_profile.abs_to_rel(flat_shape_yd) # ======== # Enduse specific profiles # ======== for enduse in enduses['industry']: if enduse == "is_space_heating": pass # Do not create non regional stock because temp dependent else: for sector in sectors['industry']: tech_list = helpers.get_nested_dict_key( assumptions.fuel_tech_p_by[enduse][sector]) load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_list, enduses=[enduse], shape_yd=flat_shape_yd_weighted, shape_y_dh=flat_shape_y_dh, model_yeardays=assumptions.model_yeardays, sectors=[sector]) # --------------- # Load profiles # --------------- self.load_profiles = load_profiles self.f_heat = { 'residential': f_heat_rs_y, 'service': f_heat_ss_y, 'industry': f_heat_is_y} self.f_colling = { 'residential': f_cooling_rs_y, 'service': f_cooling_ss_y, 'industry': f_cooling_is_y}
def read_raw_carbon_trust_data(folder_path): """Read in raw carbon trust dataset (used for service sector) Arguments ---------- foder_path : string Path to folder with stored csv files Returns ------- load_shape_y_dh : array Load shape for every day (tot sum 365) ((365, 24)) load_peak_shape_dh : array Peak loadshape for peak day ((24)) shape_non_peak_yd : array Yh load profile ((365)) Note ----- 1. Get gas peak day load shape (the max daily demand can be taken from weather data, the daily shape however is not provided by samson) 2. Iterate individual files which are about a year (even though gaps exist) 3. Select those day with the maximum load 4. Get the hourly shape of this day 5. Calculate total demand of every day 6. Assign percentag of total daily demand to each hour """ def initialise_main_dict(): """Helper function to initialise dict """ out_dict_av = {'working_day': {}, 'holiday': {}} for dtype in out_dict_av: month_dict = {} for month in range(12): month_dict[month] = {k: [] for k in range(24)} out_dict_av[dtype] = month_dict return out_dict_av def initialise_out_dict_av(): """Helper function to initialise dict""" out_dict_av = {'working_day': {}, 'holiday': {}} for dtype in out_dict_av: month_dict = {} for month in range(12): month_dict[month] = {k: 0 for k in range(24)} out_dict_av[dtype] = month_dict return out_dict_av # Get all files in folder all_csv_in_folder = os.listdir(folder_path) main_dict = initialise_main_dict() carbon_trust_raw = dict_init_carbon_trust() nr_of_line_entries = 0 dict_max_dh_shape = {} # Itreatu folder with csv files for path_csv_file in all_csv_in_folder: path_csv_file = os.path.join(folder_path, path_csv_file) print(f"Reading {path_csv_file}") # Read csv file with open(path_csv_file, 'r') as csv_file: read_lines = csv.reader(csv_file, delimiter=',') _ = next(read_lines) max_d_demand = 0 # Used for searching maximum max_dh_shape = np.zeros((24), dtype="float") # Count number of lines in CSV file row_data = list(read_lines) count_row = len(row_data) #print("Number of lines in csv file: " + str(count_row)) # Calc yearly demand based on one year data measurements if count_row > 365: # if more than one year is in csv file for day, row in enumerate(row_data): # Ignore and entries beyond the expected 48 half-hourly entries (plus one date) if len(row) != 49: logging.debug(f"Expected 49 cells in row {day} got {len(row)}: {row} in {path_csv_file}") row = row[:49] # Use only data of one year if day > 365: continue load_shape_dh = np.zeros((24), dtype="float") # Convert all values except date into float values try: # Take zero if any value is negative row[1:] = map(lambda c: max(float(c),0), row[1:]) except ValueError: # Handle empty cells - assume zero if empty def convert_empty(cell): if cell == '': return 0 else: return max(float(cell), 0) row[1:] = map(convert_empty, row[1:]) daily_sum = sum(row[1:]) # Total daily sum nr_of_line_entries += 1 # Nr of lines added day = int(row[0].split("/")[0]) month = int(row[0].split("/")[1]) year = int(row[0].split("/")[2]) # Redefine yearday to another year and skip 28. of Feb. if date_prop.is_leap_year(int(year)) is True: year = year + 1 # Shift whole dataset to another year if month == 2 and day == 29: continue #skip leap day date_row = date(year, month, day) daytype = date_prop.get_weekday_type(date_row) yearday_python = date_row.timetuple().tm_yday - 1 # - 1 because in _info: 1.Jan = 1 month_python = month - 1 # Month Python h_day, cnt, control_sum = 0, 0, 0 # ----------------------------------------------- # Iterate half hour data and summarise to hourly # ----------------------------------------------- for data_h in row[1:]: # Skip first date row in csv file cnt += 1 if cnt == 2: demand_h = first_data_h + data_h control_sum += demand_h # Add demand carbon_trust_raw[yearday_python][h_day].append(demand_h) # Store demand according to daytype (aggregated by doing so) main_dict[daytype][month_python][h_day].append(demand_h) if daily_sum == 0: # Skip row if no demand of the day load_shape_dh[h_day] = 0 continue else: load_shape_dh[h_day] = demand_h / daily_sum cnt = 0 h_day += 1 # Value lagging behind one iteration first_data_h = data_h # Test if this is the day with maximum demand of this CSV file if daily_sum >= max_d_demand: max_d_demand = daily_sum max_dh_shape = load_shape_dh # Check if 100 % np.testing.assert_almost_equal(control_sum, daily_sum, decimal=7, err_msg=f"Row sum failed {day}: {row} in {path_csv_file}") # Add load shape of maximum day in csv file dict_max_dh_shape[path_csv_file] = max_dh_shape # --------------- # Data processing # --------------- # --Average average maxium peak dh of every csv file load_peak_average_dh = np.zeros((24), dtype="float") for peak_shape_dh in dict_max_dh_shape.values(): load_peak_average_dh += peak_shape_dh load_peak_shape_dh = load_peak_average_dh / len(dict_max_dh_shape) # ----------------------------------------------- # Calculate average load shapes for every month # ----------------------------------------------- out_dict_av = initialise_out_dict_av() for daytype in main_dict: for month in main_dict[daytype]: for hour in main_dict[daytype][month]: nr_of_entries = len(main_dict[daytype][month][hour]) if nr_of_entries != 0: out_dict_av[daytype][month][hour] = sum(main_dict[daytype][month][hour]) / nr_of_entries # ---------------------------------------------------------- # Distribute raw data into base year depending on daytype # ---------------------------------------------------------- year_data = assign_data_to_year(out_dict_av, 2015) # Calculate yearly sum yearly_demand = np.sum(year_data) # Create load_shape_dh load_shape_y_dh = np.zeros((365, 24), dtype="float") for day, dh_values in enumerate(year_data): load_shape_y_dh[day] = load_profile.abs_to_rel(dh_values) # daily shape np.testing.assert_almost_equal(np.sum(load_shape_y_dh), 365, decimal=2, err_msg="") # Calculate shape_non_peak_yd shape_non_peak_yd = np.zeros((365), dtype="float") for yearday, carbon_trust_d in enumerate(year_data): shape_non_peak_yd[yearday] = np.sum(carbon_trust_d) shape_non_peak_yd = shape_non_peak_yd / yearly_demand np.testing.assert_almost_equal(np.sum(shape_non_peak_yd), 1, decimal=2, err_msg="") return load_shape_y_dh, load_peak_shape_dh, shape_non_peak_yd
def __init__( self, name, base_yr, curr_yr, strategy_variables, t_bases, t_diff_param, tech_lists, technologies, assumptions, fueltypes, model_yeardays_nrs, model_yeardays, yeardays_month_days, all_enduses, temp_by, tech_lp, sectors, ): """Constructor of weather region """ self.name = name # ----------------------------------- # Calculate current year temperatures # ----------------------------------- temp_cy = change_temp_climate(temp_by, yeardays_month_days, strategy_variables, base_yr, curr_yr) # Change base temperatures depending on change in t_base rs_t_base_heating_cy = hdd_cdd.sigm_temp( strategy_variables['rs_t_base_heating_future_yr'] ['scenario_value'], t_bases.rs_t_heating_by, base_yr, curr_yr, t_diff_param) '''rs_t_base_cooling_cy = hdd_cdd.sigm_temp( strategy_variables['rs_t_base_cooling_future_yr']['scenario_value'], t_bases.rs_t_cooling_by, base_yr, curr_yr, t_diff_param)''' ss_t_base_heating_cy = hdd_cdd.sigm_temp( strategy_variables['ss_t_base_heating_future_yr'] ['scenario_value'], t_bases.ss_t_heating_by, base_yr, curr_yr, t_diff_param) ss_t_base_cooling_cy = hdd_cdd.sigm_temp( strategy_variables['ss_t_base_cooling_future_yr'] ['scenario_value'], t_bases.ss_t_cooling_by, base_yr, curr_yr, t_diff_param) is_t_base_heating_cy = hdd_cdd.sigm_temp( strategy_variables['is_t_base_heating_future_yr'] ['scenario_value'], t_bases.is_t_heating_by, base_yr, curr_yr, t_diff_param) '''is_t_base_cooling_cy = hdd_cdd.sigm_temp( strategy_variables['is_t_base_cooling_future_yr']['scenario_value'], t_bases.is_t_cooling_by, base_yr, curr_yr, t_diff_param)''' # ------------------- # Technology stocks # ------------------- self.rs_tech_stock = technological_stock.TechStock( 'rs_tech_stock', technologies, tech_lists, assumptions.enduse_overall_change['other_enduse_mode_info'], base_yr, curr_yr, fueltypes, temp_by, temp_cy, t_bases.rs_t_heating_by, all_enduses['rs_enduses'], rs_t_base_heating_cy, assumptions.rs_specified_tech_enduse_by) self.ss_tech_stock = technological_stock.TechStock( 'ss_tech_stock', technologies, tech_lists, assumptions.enduse_overall_change['other_enduse_mode_info'], base_yr, curr_yr, fueltypes, temp_by, temp_cy, t_bases.ss_t_heating_by, all_enduses['ss_enduses'], ss_t_base_heating_cy, assumptions.ss_specified_tech_enduse_by) self.is_tech_stock = technological_stock.TechStock( 'is_tech_stock', technologies, tech_lists, assumptions.enduse_overall_change['other_enduse_mode_info'], base_yr, curr_yr, fueltypes, temp_by, temp_cy, t_bases.is_t_heating_by, all_enduses['is_enduses'], ss_t_base_heating_cy, assumptions.is_specified_tech_enduse_by) # ------------------- # Residential Load profiles # ------------------ self.rs_load_profiles = load_profile.LoadProfileStock( "rs_load_profiles") # --------Calculate HDD/CDD self.rs_hdd_by, _ = hdd_cdd.calc_reg_hdd(temp_by, t_bases.rs_t_heating_by, model_yeardays) self.rs_hdd_cy, rs_fuel_shape_heating_yd = hdd_cdd.calc_reg_hdd( temp_cy, rs_t_base_heating_cy, model_yeardays) #self.rs_cdd_by, _ = hdd_cdd.calc_reg_cdd( # temp_by, t_bases.rs_t_cooling_by, model_yeardays) #self.rs_cdd_cy, rs_fuel_shape_cooling_yd = hdd_cdd.calc_reg_cdd( # temp_cy, rs_t_base_cooling_cy, model_yeardays) # -------Calculate climate change correction factors try: self.f_heat_rs_y = np.nan_to_num( 1.0 / float(np.sum(self.rs_hdd_by))) * np.sum(self.rs_hdd_cy) #self.f_cooling_rs_y = np.nan_to_num( # 1.0 / float(np.sum(self.rs_cdd_by))) * np.sum(self.rs_cdd_cy) self.f_cooling_rs_y = 1 except ZeroDivisionError: self.f_heat_rs_y = 1 self.f_cooling_rs_y = 1 # yd peak factors for heating and cooling rs_peak_yd_heating_factor = get_shape_peak_yd_factor(self.rs_hdd_cy) ''' # RESIDENITAL COOLING #rs_peak_yd_cooling_factor = get_shape_peak_yd_factor(self.rs_cdd_cy) rs_cold_techs = tech_lists['rs_cold'] rs_cold_techs.append('placeholder_tech') # ----Cooling residential #rs_fuel_shape_cooling_yh = load_profile.calc_yh( # rs_fuel_shape_cooling_yd, tech_lp['rs_shapes_cooling_dh'], model_yeardays) #or also (if only yd) #shape_yh=tech_lp['rs_shapes_dh'][cooling_enduse]['shape_non_peak_y_dh'] * ss_fuel_shape_coolin_yd[:, np.newaxis], rs_fuel_shape_cooling_yh = self.get_shape_cooling_yh(data, rs_fuel_shape_cooling_yd, 'rs_shapes_cooling_dh') for cooling_enduse in assumptions.enduse_rs_space_cooling: self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=rs_cold_techs, enduses=enduse, #['rs_cooling'], shape_yd=rs_fuel_shape_cooling_yd, shape_yh=rs_fuel_shape_cooling_yh, f_peak_yd=rs_peak_yd_cooling_factor, shape_peak_dh=tech_lp['rs_shapes_cooling_dh']['peakday']) ''' # ------Heating boiler rs_profile_boilers_y_dh = load_profile.calc_yh( rs_fuel_shape_heating_yd, tech_lp['rs_profile_boilers_y_dh'], model_yeardays) self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_lists['heating_const'], enduses=['rs_space_heating', 'rs_water_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_yh=rs_profile_boilers_y_dh, f_peak_yd=rs_peak_yd_heating_factor, shape_peak_dh=tech_lp['rs_lp_heating_boilers_dh']['peakday']) # ------Heating CHP rs_profile_chp_y_dh = load_profile.calc_yh( rs_fuel_shape_heating_yd, tech_lp['rs_profile_chp_y_dh'], model_yeardays) self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_lists['tech_CHP'], enduses=['rs_space_heating', 'rs_water_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_yh=rs_profile_chp_y_dh, f_peak_yd=rs_peak_yd_heating_factor, shape_peak_dh=tech_lp['rs_lp_heating_CHP_dh']['peakday']) # ------Electric heating, storage heating (primary) rs_profile_storage_heater_y_dh = load_profile.calc_yh( rs_fuel_shape_heating_yd, tech_lp['rs_profile_storage_heater_y_dh'], model_yeardays) self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_lists['storage_heating_electricity'], enduses=['rs_space_heating', 'rs_water_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_yh=rs_profile_storage_heater_y_dh, f_peak_yd=rs_peak_yd_heating_factor, shape_peak_dh=tech_lp['rs_lp_storage_heating_dh']['peakday']) # ------Electric heating secondary (direct elec heating) rs_profile_elec_heater_y_dh = load_profile.calc_yh( rs_fuel_shape_heating_yd, tech_lp['rs_profile_elec_heater_y_dh'], model_yeardays) self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_lists['secondary_heating_electricity'], enduses=['rs_space_heating', 'rs_water_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_yh=rs_profile_elec_heater_y_dh, f_peak_yd=rs_peak_yd_heating_factor, shape_peak_dh=tech_lp['rs_lp_second_heating_dh']['peakday']) # ------Heat pump heating rs_fuel_shape_hp_yh, _ = get_fuel_shape_heating_hp_yh( tech_lp['rs_profile_hp_y_dh'], self.rs_tech_stock, self.rs_hdd_cy, model_yeardays) self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_lists['heating_non_const'], enduses=['rs_space_heating', 'rs_water_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_yh=rs_fuel_shape_hp_yh, f_peak_yd=rs_peak_yd_heating_factor, shape_peak_dh=tech_lp['rs_lp_heating_CHP_dh']['peakday']) # ------District_heating_electricity --> Assumption made that same curve as CHP rs_profile_chp_y_dh = load_profile.calc_yh( rs_fuel_shape_heating_yd, tech_lp['rs_profile_chp_y_dh'], model_yeardays) self.rs_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=tech_lists['tech_district_heating'], enduses=['rs_space_heating', 'rs_water_heating'], shape_yd=rs_fuel_shape_heating_yd, shape_yh=rs_profile_chp_y_dh, f_peak_yd=rs_peak_yd_heating_factor, shape_peak_dh=tech_lp['rs_lp_heating_boilers_dh']['peakday']) # ------------------- # Service Load profiles # ------------------ self.ss_load_profiles = load_profile.LoadProfileStock( "ss_load_profiles") # --------HDD/CDD ss_hdd_by, _ = hdd_cdd.calc_reg_hdd(temp_by, t_bases.ss_t_heating_by, model_yeardays) ss_hdd_cy, ss_fuel_shape_heating_yd = hdd_cdd.calc_reg_hdd( temp_cy, ss_t_base_heating_cy, model_yeardays) ss_cdd_by, _ = hdd_cdd.calc_reg_cdd(temp_by, t_bases.ss_t_cooling_by, model_yeardays) ss_cdd_cy, ss_fuel_shape_coolin_yd = hdd_cdd.calc_reg_cdd( temp_cy, ss_t_base_cooling_cy, model_yeardays) try: self.f_heat_ss_y = np.nan_to_num( 1.0 / float(np.sum(ss_hdd_by))) * np.sum(ss_hdd_cy) self.f_cooling_ss_y = np.nan_to_num( 1.0 / float(np.sum(ss_cdd_by))) * np.sum(ss_cdd_cy) except ZeroDivisionError: self.f_heat_ss_y = 1 self.f_cooling_ss_y = 1 # ---------------------------------------------- # Apply weekend correction factor fo ss heating # ---------------------------------------------- ss_peak_yd_heating_factor = get_shape_peak_yd_factor(ss_hdd_cy) ss_peak_yd_cooling_factor = get_shape_peak_yd_factor(ss_cdd_cy) # --Heating technologies for service sector # # (the heating shape follows the gas shape of aggregated sectors) # meaning that for all technologies, the load profile is the same ss_fuel_shape_any_tech, ss_fuel_shape = ss_get_sector_enduse_shape( tech_lp['ss_all_tech_shapes_dh'], ss_fuel_shape_heating_yd, 'ss_space_heating', model_yeardays_nrs) # Apply correction factor for weekend_effect # ------ ss_fuel_shape_heating_yd = ss_fuel_shape_heating_yd * assumptions.ss_weekend_f ss_fuel_shape_heating_yd_weighted = load_profile.abs_to_rel( ss_fuel_shape_heating_yd) # ------ # Flatten list of all potential technologies ss_space_heating_tech_lists = list(tech_lists.values()) all_techs_ss_space_heating = [ item for sublist in ss_space_heating_tech_lists for item in sublist ] # ---------------- # Get peak day and calculate peak load profile for peak day # ---------------- peak_day = get_peak_day_single_fueltype(ss_fuel_shape) ss_space_heating_shape_peak_dh = load_profile.abs_to_rel( ss_fuel_shape[peak_day]) self.ss_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=all_techs_ss_space_heating, enduses=['ss_space_heating'], sectors=sectors['ss_sectors'], shape_yd=ss_fuel_shape_heating_yd_weighted, shape_yh=ss_fuel_shape_any_tech, f_peak_yd=ss_peak_yd_heating_factor, shape_peak_dh=ss_space_heating_shape_peak_dh) #------ # Add cooling technologies for service sector #------ coolings_techs = tech_lists['cooling_const'] for cooling_enduse in assumptions.ss_enduse_space_cooling: for sector in sectors['ss_sectors']: # Apply correction factor for weekend_effect 'cdd_weekend_cfactors' ss_fuel_shape_coolin_yd = ss_fuel_shape_coolin_yd * assumptions.cdd_weekend_cfactors ss_fuel_shape_coolin_yd = load_profile.abs_to_rel( ss_fuel_shape_coolin_yd) # Ev auch tech_lp['ss_shapes_cooling_dh'] ss_shape_yh = load_profile.calc_yh( ss_fuel_shape_coolin_yd, tech_lp['ss_profile_cooling_y_dh'], model_yeardays) self.ss_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=coolings_techs, enduses=[cooling_enduse], sectors=[sector], shape_yd=ss_fuel_shape_coolin_yd, shape_yh=ss_shape_yh, f_peak_yd=ss_peak_yd_cooling_factor, shape_peak_dh=tech_lp['ss_shapes_cooling_dh']['peakday']) # -------------------------------- # Industry submodel # -------------------------------- self.is_load_profiles = load_profile.LoadProfileStock( "is_load_profiles") # --------HDD/CDD is_hdd_by, _ = hdd_cdd.calc_reg_hdd(temp_by, t_bases.is_t_heating_by, model_yeardays) #is_cdd_by, _ = hdd_cdd.calc_reg_cdd( # temp_by, t_bases.is_t_cooling_by, model_yeardays) # Take same base temperature as for service sector is_hdd_cy, is_fuel_shape_heating_yd = hdd_cdd.calc_reg_hdd( temp_cy, is_t_base_heating_cy, model_yeardays) #is_cdd_cy, _ = hdd_cdd.calc_reg_cdd( # temp_cy, ss_t_base_cooling_cy, model_yeardays) try: self.f_heat_is_y = np.nan_to_num( 1.0 / float(np.sum(is_hdd_by))) * np.sum(is_hdd_cy) #self.f_cooling_is_y = np.nan_to_num(1.0 / float(np.sum(is_cdd_by))) * np.sum(is_cdd_cy) self.f_cooling_is_y = 1 except ZeroDivisionError: self.f_heat_is_y = 1 self.f_cooling_is_y = 1 is_peak_yd_heating_factor = get_shape_peak_yd_factor(is_hdd_cy) #is_peak_yd_cooling_factor = self.get_shape_peak_yd_factor(is_cdd_cy) # Cooling for industrial enduse # --Heating technologies for service sector (the heating shape follows # the gas shape of aggregated sectors) # Flatten list of all potential heating technologies is_space_heating_tech_lists = list(tech_lists.values()) all_techs_is_space_heating = [ item for sublist in is_space_heating_tech_lists for item in sublist ] # Apply correction factor for weekend_effect for space heating load profile is_fuel_shape_heating_yd = is_fuel_shape_heating_yd * assumptions.is_weekend_f is_fuel_shape_heating_yd = load_profile.abs_to_rel( is_fuel_shape_heating_yd) # Y_dh Heating profile is taken from service sector is_fuel_shape_any_tech, _ = ss_get_sector_enduse_shape( tech_lp['ss_all_tech_shapes_dh'], is_fuel_shape_heating_yd, 'ss_space_heating', assumptions.model_yeardays_nrs) # Alternatively generate y_dh flat profile #from energy_demand.profiles import generic_shapes #shape_peak_dh, _, shape_peak_yd_factor, shape_non_peak_yd, shape_non_peak_yh = generic_shapes.flat_shape( # assumptions.model_yeardays_nrs) #flat_is_fuel_shape_any_tech = np.full((assumptions.model_yeardays_nrs, 24), (1.0/24.0), dtype=float) #flat_is_fuel_shape_any_tech = flat_is_fuel_shape_any_tech * is_fuel_shape_heating_yd[:, np.newaxis] self.is_load_profiles.add_lp( unique_identifier=uuid.uuid4(), technologies=all_techs_is_space_heating, enduses=['is_space_heating'], sectors=sectors['is_sectors'], shape_yd=is_fuel_shape_heating_yd, shape_yh=is_fuel_shape_any_tech, #flat_is_fuel_shape_any_tech, f_peak_yd=is_peak_yd_heating_factor)
def get_hes_load_shapes( appliances_hes_matching, year_raw_values, hes_y_peak, enduse, single_enduse=True, enduses=False ): """Read in raw HES data and generate shapes Calculate peak day demand Arguments ---------- appliances_hes_matching : dict HES appliances are matched witch enduses year_raw_values : array Yearly values from raw hes_y_peak : data Peak raw values enduse : string enduse Returns ------- shape_peak_yh : float Peak demand of each hours of peak day Notes ----- The HES appliances are matched with enduses """ if single_enduse: # Match enduse with HES appliance ID # (see look_up table in original files for more information) hes_app_id = appliances_hes_matching[enduse] # Values enduse_values = year_raw_values[:, :, hes_app_id] # Total yearly demand of hes_app_id tot_enduse_y = np.sum(year_raw_values[:, :, hes_app_id]) # Get peak daily load shape, calculate amount of energy demand for peak day of hes_app_id peak_h_values = hes_y_peak[:, hes_app_id] else: for multi_enduse in enduses: # Id of enduse hes_app_id = appliances_hes_matching[multi_enduse] try: tot_enduse_y += np.sum(year_raw_values[:, :, hes_app_id]) # Get peak daily load shape, calculate amount of energy demand for peak day of hes_app_id peak_h_values += hes_y_peak[:, hes_app_id] # Values enduse_values += year_raw_values[:, :, hes_app_id] except: # Total yearly demand of hes_app_id tot_enduse_y = np.sum(year_raw_values[:, :, hes_app_id]) # Get peak daily load shape, calculate amount of energy demand for peak day of hes_app_id peak_h_values = hes_y_peak[:, hes_app_id] enduse_values = year_raw_values[:, :, hes_app_id] # Maximum daily demand tot_peak_demand_d = np.sum(peak_h_values) # Shape of peak day (hourly values of peak day) shape_peak_dh = lp.abs_to_rel(peak_h_values) # ---Calculate non-peak shapes shape_non_peak_yd = np.zeros((365), dtype="float") shape_non_peak_y_dh = np.zeros((365, 24), dtype="float") for day, day_values in enumerate(enduse_values): #day_values = year_raw_values[day, :, hes_app_id] shape_non_peak_yd[day] = (1.0 / tot_enduse_y) * np.sum(day_values) shape_non_peak_y_dh[day] = (1.0 / np.sum(day_values)) * day_values return shape_peak_dh, shape_non_peak_y_dh, shape_non_peak_yd