Exemple #1
0
                data['assumptions'].seasons,
                data['assumptions'].model_yeardays_daytype,
                config['CRITERIA']['plot_crit'])

        # -------------------------------------
        # # Generate YAML file with keynames for `sector_model`
        # -------------------------------------
        if config['CRITERIA']['mode_constrained']:
            supply_results = demand_supply_interaction.constrained_results(
                sim_obj.results_constrained,
                sim_obj.results_unconstrained,
                data['assumptions'].submodels_names,
                data['assumptions'].technologies)
        else:
            supply_results = demand_supply_interaction.unconstrained_results(
                sim_obj.results_unconstrained,
                data['assumptions'].submodels_names)

        # --------------------------
        # Write out all calculations
        # --------------------------
        if config['CRITERIA']['write_txt_additional_results']:
            if config['CRITERIA']['crit_plot_enduse_lp']:

                # Maybe move to result folder in a later step
                path_folder_lp = os.path.join(data['weather_yr_result_paths']['data_results'], 'individual_enduse_lp')
                basic_functions.delete_folder(path_folder_lp)
                basic_functions.create_folder(path_folder_lp)
                winter_week, _, _, _ = date_prop.get_seasonal_weeks()

                # Plot electricity
Exemple #2
0
def aggregate_across_all_regs(aggr_results, fueltypes_nr, reg_nrs, enduses,
                              assumptions, criterias, technologies):
    """Aggregate the regional results into different
    forms used for outputs

    Arguments
    ---------
    aggr_results : dict
        Aggregation container
    fueltypes_nr : int
        Number of fueltypes
    reg_nrs : int
        Number of regions
    enduses : dict
        Submodels and their sectors
    assumptions : dict
        Assumptions
    criterias : dict
        Criteria
    technologies : dict
        Technologies per enduse
    """
    fueltypes = lookup_tables.basic_lookups()['fueltypes']

    # ----------------------------------------------------
    # Aggregate: [fueltype, region, fuel_yh_8760]
    # ----------------------------------------------------
    array_init = np.zeros((fueltypes_nr, reg_nrs, 8760))
    aggr_results['ed_fueltype_regs_yh'] = aggregate_from_full_results(
        assumptions.lookup_enduses,
        array_init,
        aggr_results['ed_enduse_fueltype_regs_yh'],
        time_resolution='8760_h',
        per_region=True,
        per_sector=False,
        per_enduse=False)

    # ----------------------------------------------------
    # Aggregate: [fueltype, fuel_yh_8760]
    # ----------------------------------------------------
    array_init = np.zeros((fueltypes_nr, 365, 24))
    aggr_results['ed_fueltype_national_yh'] = aggregate_from_full_results(
        assumptions.lookup_enduses,
        array_init,
        aggr_results['ed_enduse_fueltype_regs_yh'],
        time_resolution='365_24',
        per_region=False,
        per_sector=False,
        per_enduse=False)

    # ----------------------------------------------------
    # Aggregate: [fueltype, enduse, fuel_yh, 8760]
    # ----------------------------------------------------
    array_init = {}
    for submodel in enduses:
        for enduse in enduses[submodel]:
            array_init[enduse] = np.zeros((fueltypes_nr, 8760))
    aggr_results[
        'tot_fuel_y_enduse_specific_yh'] = aggregate_from_full_results(
            assumptions.lookup_enduses,
            array_init,
            aggr_results['ed_enduse_fueltype_regs_yh'],
            time_resolution='8760_h',
            per_region=False,
            per_sector=False,
            per_enduse=True)

    # ----------------------------------------------------
    # Calculate averaged hour profile per season
    # ----------------------------------------------------
    aggr_results['averaged_h'] = averaged_season_hourly(
        aggr_results['ed_fueltype_regs_yh'], fueltypes.values(), fueltypes_nr,
        assumptions.seasons, reg_nrs)

    # ----------------------------------------------------
    # Regional load factor calculations
    # ----------------------------------------------------
    aggr_results['reg_load_factor_y'], aggr_results[
        'reg_load_factor_yd'] = aggregate_load_factors(
            aggr_results['ed_fueltype_regs_yh'], fueltypes_nr, reg_nrs)

    # ----------------------------------------------------
    # Generate dict for supply model
    # ----------------------------------------------------
    print("Mode: " + str(criterias['mode_constrained']))
    if criterias['mode_constrained']:
        aggr_results[
            'supply_results'] = demand_supply_interaction.constrained_results(
                aggr_results['results_constrained'],
                aggr_results['results_unconstrained_no_heating'],
                assumptions.submodels_names, technologies)
    else:
        aggr_results[
            'supply_results'] = demand_supply_interaction.unconstrained_results(
                aggr_results['results_unconstrained_no_heating'],
                assumptions.submodels_names)

    return aggr_results