From 5397f3fe85f60e3c68675e8fb965a020f90811fb Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 24 May 2024 09:47:23 +0200 Subject: [PATCH] avoid duplicate existing RES capacities (closes #1016) --- doc/configtables/electricity.csv | 2 +- doc/release_notes.rst | 7 +++++++ rules/build_electricity.smk | 1 + scripts/add_electricity.py | 25 ++++++++++++++++--------- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/doc/configtables/electricity.csv b/doc/configtables/electricity.csv index e94af44a8..ee733660c 100644 --- a/doc/configtables/electricity.csv +++ b/doc/configtables/electricity.csv @@ -29,7 +29,7 @@ conventional_carriers,--,"Any subset of {nuclear, oil, OCGT, CCGT, coal, lignite ,,, renewable_carriers,--,"Any subset of {solar, onwind, offwind-ac, offwind-dc, offwind-float, hydro}",List of renewable generators to include in the model. estimate_renewable_capacities,,, --- enable,,bool,Activate routine to estimate renewable capacities +-- enable,,bool,Activate routine to estimate renewable capacities in rule :mod:`add_electricity`. This option should not be used in combination with pathway planning ``foresight: myopic`` or ``foresight: perfect`` as renewable capacities are added differently in :mod:`add_existing_baseyear`. -- from_opsd,--,bool,Add renewable capacities from `OPSD database `_. The value is depreciated but still can be used. -- year,--,bool,Renewable capacities are based on existing capacities reported by IRENA (IRENASTAT) for the specified year -- expansion_limit,--,float or false,"Artificially limit maximum IRENA capacities to a factor. For example, an ``expansion_limit: 1.1`` means 110% of capacities . If false are chosen, the estimated renewable potentials determine by the workflow are used." diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 085e53ed7..62d10a2d6 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -10,6 +10,13 @@ Release Notes Upcoming Release ================ +* Bugfix: The configuration setting ``electricity: + estimate_renewable_capacities: enable:`` for rule :mod:`add_electricity` is + not compatible with ``foresight: myopic``, as the former adds existing + renewable capacities in a different way in :mod:`add_existing_baseyear`. + The logic was changed so that adding existing renewable capacities is now + skipped in :mod:`add_electricity` if the foresight mode is ``myopic``. + * Bugfix: Make sure that gas-fired power plants are correctly added as OCGT or CCGT in :mod:`add_electricity`. Previously they were always added as OCGT. diff --git a/rules/build_electricity.smk b/rules/build_electricity.smk index 6d5a11314..43cadb935 100644 --- a/rules/build_electricity.smk +++ b/rules/build_electricity.smk @@ -385,6 +385,7 @@ rule add_electricity: electricity=config_provider("electricity"), conventional=config_provider("conventional"), costs=config_provider("costs"), + foresight=config_provider("foresight"), drop_leap_day=config_provider("enable", "drop_leap_day"), input: unpack(input_profile_tech), diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 7a856b95f..3be23f75b 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -881,15 +881,22 @@ def attach_line_rating( estimate_renewable_caps = params.electricity["estimate_renewable_capacities"] if estimate_renewable_caps["enable"]: - tech_map = estimate_renewable_caps["technology_mapping"] - expansion_limit = estimate_renewable_caps["expansion_limit"] - year = estimate_renewable_caps["year"] - - if estimate_renewable_caps["from_opsd"]: - attach_OPSD_renewables(n, tech_map) - estimate_renewable_capacities( - n, year, tech_map, expansion_limit, params.countries - ) + if params.foresight != "overnight": + logger.info( + "Skipping renewable capacity estimation because they are added later " + "in rule `add_existing_baseyear` with foresight mode 'myopic'." + ) + else: + tech_map = estimate_renewable_caps["technology_mapping"] + expansion_limit = estimate_renewable_caps["expansion_limit"] + year = estimate_renewable_caps["year"] + + if estimate_renewable_caps["from_opsd"]: + attach_OPSD_renewables(n, tech_map) + + estimate_renewable_capacities( + n, year, tech_map, expansion_limit, params.countries + ) update_p_nom_max(n)