Exemple #1
0
def dummy_sectoral_load_profiles(local_paths, path_main):
    """Create dummy sectoral load profiles

    Arguments
    ---------
    local_paths : dict
        Paths
    path_main : str
        Main path
    """
    create_folders_to_file(
        os.path.join(local_paths['ss_load_profile_txt'], "dumm"), "_processed_data")

    paths = data_loader.load_paths(path_main)

    dict_enduses, dict_sectors, _, _, _ = data_loader.load_fuels(paths)

    for enduse in dict_enduses['service']:
        for sector in dict_sectors['service']:

            joint_string_name = str(sector) + "__" + str(enduse)

            # Flat profiles
            load_peak_shape_dh = np.full((24), 1)
            shape_non_peak_y_dh = np.full((365, 24), 1/24)
            shape_non_peak_yd = np.full((365), 1/365)

            write_data.create_txt_shapes(
                joint_string_name,
                local_paths['ss_load_profile_txt'],
                load_peak_shape_dh,
                shape_non_peak_y_dh,
                shape_non_peak_yd)
Exemple #2
0
def dummy_sectoral_load_profiles(local_paths, path_main):
    """
    """
    create_folders_to_file(os.path.join(local_paths['ss_load_profile_txt'], "dumm"), "_processed_data")

    paths = data_loader.load_paths(path_main)
    lu = lookup_tables.basic_lookups()

    dict_enduses, dict_sectors, dict_fuels = data_loader.load_fuels(paths, lu)

    for enduse in dict_enduses['ss_enduses']:
        for sector in dict_sectors['ss_sectors']:

            joint_string_name = str(sector) + "__" + str(enduse)

            # Flat profiles
            load_peak_shape_dh = np.full((24), 1)
            shape_non_peak_y_dh = np.full((365, 24), 1/24)
            shape_peak_yd_factor = 1.0
            shape_non_peak_yd = np.full((365), 1/365)

            write_data.create_txt_shapes(
                joint_string_name,
                local_paths['ss_load_profile_txt'],
                load_peak_shape_dh,
                shape_non_peak_y_dh,
                shape_peak_yd_factor,
                shape_non_peak_yd)
def run(paths, local_paths, base_yr):
    """Function to run script
    """
    print("... start script %s", os.path.basename(__file__))

    hes_appliances_matching = {
        'rs_cold': 0,
        'rs_cooking': 1,
        'rs_lighting': 2,
        'rs_consumer_electronics': 3,
        'rs_home_computing': 4,
        'rs_wet': 5,
        'rs_water_heating': 6,
        'NOT_USED_unkown_1': 7,
        'NOT_USED_unkown_2': 8,
        'NOT_USED_unkown_3': 9,
        'NOT_USED_showers': 10}

    # HES data -- Generate generic load profiles
    # for all electricity appliances from HES data
    hes_data, hes_y_peak = read_hes_data( 
        paths['lp_rs'],
        len(hes_appliances_matching))

    # Assign read in raw data to the base year
    year_raw_hes_values = assign_hes_data_to_year(
        len(hes_appliances_matching),
        hes_data,
        int(base_yr))

    _, rs_enduses = read_data.read_fuel_rs(
        paths['rs_fuel_raw'])

    # Load shape for all enduses
    for enduse in rs_enduses:
        if enduse not in hes_appliances_matching:
            logging.debug(
                "Warning: The enduse %s is not definedin hes_appliances_matching",
                enduse)
        else:
            # Generate HES load shapes
            shape_peak_dh, shape_non_peak_y_dh, shape_peak_yd_factor, shape_non_peak_yd = get_hes_load_shapes(
                hes_appliances_matching,
                year_raw_hes_values,
                hes_y_peak,
                enduse)

            # Write txt files
            write_data.create_txt_shapes(
                enduse,
                local_paths['rs_load_profile_txt'],
                shape_peak_dh,
                shape_non_peak_y_dh,
                shape_peak_yd_factor,
                shape_non_peak_yd)

    logging.info("... finished script %s", os.path.basename(__file__))
    return
Exemple #4
0
def run(paths, local_paths, lookups):
    """Function to run script
    """
    print("... start script %s", os.path.basename(__file__))
    _, ss_sectors, ss_enduses = read_data.read_fuel_ss(
        paths['ss_fuel_raw'],
        lookups['fueltypes_nr'])

    # Iterate sectors and read in shape
    for sector in ss_sectors:
        # Match electricity shapes for every sector
        # to correct folder with load profiles
        if sector == 'community_arts_leisure':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "Community")
        elif sector == 'education':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "Education")
        elif sector == 'emergency_services':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "_all_elec")
        elif sector == 'health':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "Health")
        elif sector == 'hospitality':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "_all_elec")
        elif sector == 'military':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "_all_elec")
        elif sector == 'offices':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "Offices")
        elif sector == 'retail':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "Retail")
        elif sector == 'storage':
            sector_folder_path_elec = os.path.join(
                local_paths['folder_raw_carbon_trust'], "_all_elec")
        else:
            raise Exception("Error: The sector {} could not be assigned".format(sector))

        # ------------------------------------------------------
        # Assign shape across enduse for service sector
        # ------------------------------------------------------
        for enduse in ss_enduses:
            print("Enduse service: %s in sector %s", enduse, sector)

            # Enduses
            enduses_mainly_gas = ['ss_water_heating', 'ss_space_heating', 'ss_other_gas']

            # Select shape depending on enduse
            if enduse in enduses_mainly_gas:
                folder_path = os.path.join(
                    local_paths['folder_raw_carbon_trust'],
                    "_all_gas")
            else:
                folder_path = sector_folder_path_elec

            # Read in shape from carbon trust metering trial dataset
            shape_non_peak_y_dh, load_peak_shape_dh, shape_non_peak_yd = read_raw_carbon_trust_data(
                folder_path)

            # Write shapes to txt
            joint_string_name = str(sector) + "__" + str(enduse)

            write_data.create_txt_shapes(
                joint_string_name,
                local_paths['ss_load_profile_txt'],
                load_peak_shape_dh,
                shape_non_peak_y_dh,
                shape_non_peak_yd)

    print("... finished script %s", os.path.basename(__file__))
    return