Drop assets including renewables in add_existing_baseyear

This commit is contained in:
Thomas Gilon 2024-03-06 10:26:23 +01:00 committed by Thomas Gilon
parent 43884a39f8
commit 9558f44051
2 changed files with 10 additions and 6 deletions

View File

@ -68,6 +68,8 @@ Upcoming Release
(https://github.com/PyPSA/pypsa-eur/pull/958). Added additional grouping years (https://github.com/PyPSA/pypsa-eur/pull/958). Added additional grouping years
before 1980. before 1980.
* Add decommissioning of renewables assets in `add_existing_baseyear`.
* The Eurostat data was updated to the 2023 version in :mod:`build_energy_totals`. * The Eurostat data was updated to the 2023 version in :mod:`build_energy_totals`.
* The latest `Swiss energy totals * The latest `Swiss energy totals

View File

@ -55,7 +55,7 @@ def add_build_year_to_new_assets(n, baseyear):
c.pnl[attr] = c.pnl[attr].rename(columns=rename) c.pnl[attr] = c.pnl[attr].rename(columns=rename)
def add_existing_renewables(df_agg): def add_existing_renewables(df_agg, costs):
""" """
Append existing renewables to the df_agg pd.DataFrame with the conventional Append existing renewables to the df_agg pd.DataFrame with the conventional
power plants. power plants.
@ -103,6 +103,8 @@ def add_existing_renewables(df_agg):
df_agg.at[name, "Fueltype"] = tech df_agg.at[name, "Fueltype"] = tech
df_agg.at[name, "Capacity"] = capacity df_agg.at[name, "Capacity"] = capacity
df_agg.at[name, "DateIn"] = year df_agg.at[name, "DateIn"] = year
df_agg.at[name, "lifetime"] = costs.at[tech, "lifetime"]
df_agg.at[name, "DateOut"] = year + costs.at[tech, "lifetime"] - 1
df_agg.at[name, "cluster_bus"] = node df_agg.at[name, "cluster_bus"] = node
@ -167,10 +169,6 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
) )
df_agg.loc[biomass_i, "DateOut"] = df_agg.loc[biomass_i, "DateOut"].fillna(dateout) df_agg.loc[biomass_i, "DateOut"] = df_agg.loc[biomass_i, "DateOut"].fillna(dateout)
# drop assets which are already phased out / decommissioned
phased_out = df_agg[df_agg["DateOut"] < baseyear].index
df_agg.drop(phased_out, inplace=True)
# assign clustered bus # assign clustered bus
busmap_s = pd.read_csv(snakemake.input.busmap_s, index_col=0).squeeze() busmap_s = pd.read_csv(snakemake.input.busmap_s, index_col=0).squeeze()
busmap = pd.read_csv(snakemake.input.busmap, index_col=0).squeeze() busmap = pd.read_csv(snakemake.input.busmap, index_col=0).squeeze()
@ -185,7 +183,11 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
df_agg["cluster_bus"] = df_agg.bus.map(clustermaps) df_agg["cluster_bus"] = df_agg.bus.map(clustermaps)
# include renewables in df_agg # include renewables in df_agg
add_existing_renewables(df_agg) add_existing_renewables(df_agg, costs)
# drop assets which are already phased out / decommissioned
phased_out = df_agg[df_agg["DateOut"] < baseyear].index
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, np.digitize(df_agg.DateIn, grouping_years, right=True)