diff --git a/config/config.default.yaml b/config/config.default.yaml index d438c51f..0d40bafc 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -361,7 +361,7 @@ solar_thermal: # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#existing-capacities existing_capacities: grouping_years_power: [1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025, 2030] - grouping_years_heat: [1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2019] # these should not extend 2020 + grouping_years_heat: [1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020] # heat grouping years >= baseyear will be ignored threshold_capacity: 10 default_heating_lifetime: 20 conventional_carriers: diff --git a/doc/release_notes.rst b/doc/release_notes.rst index d42b149f..cdad3fa0 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -9,6 +9,7 @@ Release Notes Upcoming Release ================ +* Group existing capacities to the earlier grouping_year for consistency with optimized capacities * Include gas and oil fields and saline aquifers in estimation of CO2 sequestration potential. diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index f445efe3..75d83e38 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -190,8 +190,8 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas df_agg.drop(phased_out, inplace=True) df_agg["grouping_year"] = np.take( - grouping_years, np.digitize(df_agg.DateIn, grouping_years, right=True) - ) + grouping_years[::-1], + np.digitize(df_agg.DateIn, grouping_years[::-1])) # calculate (adjusted) remaining lifetime before phase-out (+1 because assuming # phase out date at the end of the year) @@ -444,12 +444,16 @@ def add_heating_capacities_installed_before_baseyear( else: efficiency = costs.at[costs_name, "efficiency"] - for i, grouping_year in enumerate(grouping_years): - if int(grouping_year) + default_lifetime <= int(baseyear): - continue - - # installation is assumed to be linear for the past default_lifetime years - ratio = (int(grouping_year) - int(grouping_years[i - 1])) / default_lifetime + valid_grouping_years = pd.Series( + [int(gy) for gy in grouping_years if + int(baseyear) - default_lifetime <= int(gy) < int(baseyear)]) + # Installation is assumed to be linear for the past + _intervals = pd.concat( + [valid_grouping_years[1:], pd.Series(baseyear)], + ignore_index=True) - valid_grouping_years + ratios = _intervals / _intervals.sum() + + for ratio, grouping_year in zip(ratios, valid_grouping_years): n.madd( "Link",