Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop renewables #1001

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Upcoming Release
(https://github.com/PyPSA/pypsa-eur/pull/958). Added additional grouping years
before 1980.

* Add decommissioning of existing renewables assets in `add_existing_baseyear`.

* The Eurostat data was updated to the 2023 version in :mod:`build_energy_totals`.

* The latest `Swiss energy totals
Expand Down
14 changes: 8 additions & 6 deletions scripts/add_existing_baseyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def add_build_year_to_new_assets(n, baseyear):
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
power plants.
Expand Down Expand Up @@ -103,6 +103,8 @@ def add_existing_renewables(df_agg):
df_agg.at[name, "Fueltype"] = tech
df_agg.at[name, "Capacity"] = capacity
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


Expand Down Expand Up @@ -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)

# 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
busmap_s = pd.read_csv(snakemake.input.busmap_s, index_col=0).squeeze()
busmap = pd.read_csv(snakemake.input.busmap, index_col=0).squeeze()
Expand All @@ -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)

# 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(
grouping_years, np.digitize(df_agg.DateIn, grouping_years, right=True)
Expand Down
Loading