pypsa-eur icon indicating copy to clipboard operation
pypsa-eur copied to clipboard

Improve consistency of nuclear modelling

Open tgilon opened this issue 9 months ago • 2 comments

Changes proposed in this Pull Request

This PR proposes to improve the consistency of nuclear power plants through the different foresight options (i.e. overnight, myopic and perfect) and the electricity only configuration. Depending on the configuration, the nuclear power plants are modelled as Generator(added in scripts/add_electricity.py) or Link (added in scripts/add_existing_baseyear.py). The configuration section pypsa_eur:generator currently includes nuclear. This is an issue for myopic and perfect foresight optimisation.

For test cases using add_existing_baseyear, existing nuclear power plants exist both as Generator and Linkin the system. This is observed for myopic optimisations and can be observed on perfect foresight depending of the configuration of set_all_phase_outs() in scripts/prepare_perfect_foresight.py(here).

To test the different cases, I use the config/test/ configuration files (via the make test rule from the Makefile). By default, the data doesn't cover all cases thoroughly. To improve the test, the DateOut of one of the nuclear power plants needs to be set after the last planning horizon (e.g. 2100). This is done by adding this in here (i.e. line 165 of scripts/build_powerplants.py).

    ppl.loc[ppl.query("Name=='Doel'").index, "DateOut"] = 2100

The hardcoded nuclear phase out in set_all_phase_outs() also needs to be commented out (as the test case uses Belgium) here (i.e. line 348 of scripts/prepare_perfect_foresight.py).

Here is a summary of my observations. A test case shouldn't model nuclear with two types of components:

Test case Generator Link
config.electricity.yaml x
config.overnight.yaml x
config.myopic.yaml x x
config.perfect.yaml x x

Removing the argument nuclear from pypsa_eur:generatorin config/config.default.yaml is an option. It removes nuclear power plants modelled as Generator in all sector coupled studies. We get the expected behaviour for all the test cases expect for the overnight one (config/test/config.overnight.yaml). To recover the expected behaviour, I'm introducing config/config.default.overnight.yaml to model nuclear power plants as Generator in this specific case.

This update gives the following:

Test case Generator Link
config.electricity.yaml x
config.overnight.yaml x
config.myopic.yaml x
config.perfect.yaml x

A second issue is the p_max_puvalue. When using Generator, the workflow uses by default the country specific values given in data/nuclear_p_max_pu.csv. This is not the case for Link, where the value is set to 1 by default. To solve this, some code is introduced in add_power_capacities_installed_before_baseyear().

Checklist

  • [x] I tested my contribution locally and it works as intended.
  • [x] Code and workflow changes are sufficiently documented.
  • [ ] Changed dependencies are added to envs/environment.yaml.
  • [ ] Changes in configuration options are added in config/config.default.yaml.
  • [ ] Changes in configuration options are documented in doc/configtables/*.csv.
  • [ ] Sources of newly added data are documented in doc/data_sources.rst.
  • [x] A release note doc/release_notes.rst is added.

tgilon avatar Feb 11 '25 16:02 tgilon

@daniel-rdt FYI

tgilon avatar Feb 11 '25 16:02 tgilon

I will place this PR on hold since @FabianHofmann and I will do some restructuring first in relation to how power plants are added between different foresight options.

fneum avatar Feb 18 '25 09:02 fneum

I will place this PR on hold since @FabianHofmann and I will do some restructuring first in relation to how power plants are added between different foresight options.

@fneum Hi, just wanted to follow up on this as the big restructuring hasn't yet materialized and the nuclear issue still persists as far as I can tell. Additionally, I noticed that when nuclear is being modelled as a Link, the corresponding Uranium generator is missing as only fossil fuel generators for coal, gas, oil and lignite are added to the model in prepare_sector_network here. @JulianGeis addressed this issue for the ariadne2 branch of pypsa-eur here but it never made it to the master branch.

Therefore, the currently existing issues still encompass the following bugs:

  • inconsistency in modelling that leads to existing nuclear power plants twice, both as generators and links, for myopic and perfect foresight optimization (fix presented in this PR)
  • missing country specific p_max_pu for nuclear links added in add_existing_baseyear (fix presented in this PR)
  • missing Uranium bus for nuclear links (fix presented in #1303 but never introduced into master)

I also created an analogue issue to summarizes these bugs in https://github.com/PyPSA/pypsa-eur/issues/1836.

daniel-rdt avatar Sep 17 '25 10:09 daniel-rdt