group existing capacities to the earlier grouping_year for consistency with optimized capacities

This commit is contained in:
Michael Lindner 2024-03-14 13:44:15 +01:00 committed by lisazeyen
parent 15345ff1cf
commit 380884e9ab
3 changed files with 14 additions and 9 deletions

View File

@ -361,7 +361,7 @@ solar_thermal:
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#existing-capacities # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#existing-capacities
existing_capacities: existing_capacities:
grouping_years_power: [1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2020, 2025, 2030] 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 threshold_capacity: 10
default_heating_lifetime: 20 default_heating_lifetime: 20
conventional_carriers: conventional_carriers:

View File

@ -9,6 +9,7 @@ Release Notes
Upcoming Release 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. * Include gas and oil fields and saline aquifers in estimation of CO2 sequestration potential.

View File

@ -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.drop(phased_out, inplace=True)
df_agg["grouping_year"] = np.take( 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 # calculate (adjusted) remaining lifetime before phase-out (+1 because assuming
# phase out date at the end of the year) # phase out date at the end of the year)
@ -451,12 +451,16 @@ def add_heating_capacities_installed_before_baseyear(
else: else:
efficiency = costs.at[costs_name, "efficiency"] efficiency = costs.at[costs_name, "efficiency"]
for i, grouping_year in enumerate(grouping_years): valid_grouping_years = pd.Series(
if int(grouping_year) + default_lifetime <= int(baseyear): [int(gy) for gy in grouping_years if
continue int(baseyear) - default_lifetime <= int(gy) < int(baseyear)])
# Installation is assumed to be linear for the past
# installation is assumed to be linear for the past default_lifetime years _intervals = pd.concat(
ratio = (int(grouping_year) - int(grouping_years[i - 1])) / default_lifetime [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( n.madd(
"Link", "Link",