Merge pull request #958 from PyPSA/fix-lifetime
compute lifetime after grouping DateIn
This commit is contained in:
commit
cb5d9c4319
@ -353,7 +353,7 @@ solar_thermal:
|
||||
|
||||
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#existing-capacities
|
||||
existing_capacities:
|
||||
grouping_years_power: [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
|
||||
threshold_capacity: 10
|
||||
default_heating_lifetime: 20
|
||||
|
@ -10,6 +10,10 @@ Release Notes
|
||||
Upcoming Release
|
||||
================
|
||||
|
||||
* Corrected a bug leading to power plants operating after their DateOut
|
||||
(https://github.com/PyPSA/pypsa-eur/pull/958). Added additional grouping years
|
||||
before 1980.
|
||||
|
||||
* The Eurostat data was updated to the 2023 version in :mod:`build_energy_totals`.
|
||||
|
||||
* The latest `Swiss energy totals
|
||||
|
@ -171,10 +171,6 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
|
||||
phased_out = df_agg[df_agg["DateOut"] < baseyear].index
|
||||
df_agg.drop(phased_out, inplace=True)
|
||||
|
||||
# calculate remaining lifetime before phase-out (+1 because assuming
|
||||
# phase out date at the end of the year)
|
||||
df_agg["lifetime"] = df_agg.DateOut - df_agg.DateIn + 1
|
||||
|
||||
# assign clustered bus
|
||||
busmap_s = pd.read_csv(snakemake.input.busmap_s, index_col=0).squeeze()
|
||||
busmap = pd.read_csv(snakemake.input.busmap, index_col=0).squeeze()
|
||||
@ -195,6 +191,10 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
|
||||
grouping_years, np.digitize(df_agg.DateIn, grouping_years, right=True)
|
||||
)
|
||||
|
||||
# calculate (adjusted) remaining lifetime before phase-out (+1 because assuming
|
||||
# phase out date at the end of the year)
|
||||
df_agg["lifetime"] = df_agg.DateOut - df_agg["grouping_year"] + 1
|
||||
|
||||
df = df_agg.pivot_table(
|
||||
index=["grouping_year", "Fueltype"],
|
||||
columns="cluster_bus",
|
||||
|
Loading…
Reference in New Issue
Block a user