From 6d94439bbb9b650dc6d3c8d1da3064ee5affd813 Mon Sep 17 00:00:00 2001 From: Tom Brown Date: Mon, 29 Jan 2024 11:25:09 +0100 Subject: [PATCH] for existing heating use new default_heating_lifetime This is because old costs default (25) is longer than all heating technologies (20). Script was distributing across 25 years, then throwing out boilers older than 20 years, an inconsistent behaviour. Now existing boilers are smoothly distributed across 20 years. --- config/config.default.yaml | 1 + scripts/add_existing_baseyear.py | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index 93b0568e..633bed70 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -357,6 +357,7 @@ existing_capacities: grouping_years_power: [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 conventional_carriers: - lignite - coal diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index e8683e16..13527fad 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -429,7 +429,7 @@ def add_heating_capacities_installed_before_baseyear( if int(grouping_year) + default_lifetime <= int(baseyear): continue - # installation is assumed to be linear for the past 25 years (default lifetime) + # installation is assumed to be linear for the past default_lifetime years ratio = (int(grouping_year) - int(grouping_years[i - 1])) / default_lifetime n.madd( @@ -536,12 +536,6 @@ def add_heating_capacities_installed_before_baseyear( ], ) - # drop assets which are at the end of their lifetime - links_i = n.links[(n.links.build_year + n.links.lifetime <= baseyear)].index - logger.info("Removing following links because at end of their lifetime:") - logger.info(links_i) - n.mremove("Link", links_i) - if __name__ == "__main__": if "snakemake" not in globals(): @@ -598,7 +592,7 @@ if __name__ == "__main__": .to_pandas() .reindex(index=n.snapshots) ) - default_lifetime = snakemake.params.costs["fill_values"]["lifetime"] + default_lifetime = snakemake.params.existing_capacities["default_heating_lifetime"] add_heating_capacities_installed_before_baseyear( n, baseyear,