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

Resource Classes #1481

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Resource Classes #1481

wants to merge 29 commits into from

Conversation

fneum
Copy link
Member

@fneum fneum commented Jan 3, 2025

Closes #713.
Closes #290.

Changes proposed in this Pull Request

This PR adds the option to split renewable potentials and time series into a configurable number of resource classes per carrier and clustered region. The binning is done based on the average capacity factors.

renewables:
  onwind:
    resource_classes: 4

With the above setting, each region would get 4 onshore wind generators, each with different p_max_pu and p_nom_max. This allows more accurate renewable time series even when the spatial resolution might be highly aggregated (e.g. one region per country).

The default number of resource classes is kept at one per cluster, which is recommended for scenarios with high spatial resolution.

The feature replaces the pre-clustering workaround that used to be in simplify_network to have multiple renewable generators of one carrier inside a single cluster.

The main magic happens in build_renewable_profiles. Mainly, a new dimension "bin" is added to the output xarray.Dataset and a new .geojson of clustered regions split by resource classes is exported, which later helps with assigning existing wind and solar capacities not only to the buses but also to the correct resource class. The resource classes are numbered from 0 (lowest capacity factor segment) to N (highest).

Here's an example clustered region ("BE0 0") with the average onshore wind capacity factors of the cutout grid cells involved:

step1

If the number of resource classes is 2, each cutout grid cell of the clustered region would be allocated to one of the two resource classes. In this simple case, the corresponding bins would be defined by the borders cf.min(), cf.min() + (cf.max() - cf.min()) / 2 and cf.max() - i.e. simple linear spacing. Note that the bins are specific to the clustered region! Different regions have different splits!

step2

Based on this, we can now also split the shapefile of the clustered region (e.g. to allocate existing RES capacities to the right resource class). Note that these splits do not have to be contiguous! You could have resource class 0 in the North and South and resource class 1 in the middle!

step3

Since the resource class indicator matrix is multiplied by the availability matrix, the potentials / land eligibility are also geographically split. Of course, the overlaps of involved grid cells into other clustered regions are also taken care of! The potentials (p_nom_max) now have coordinates (bus, bin):

<xarray.DataArray (bus: 5, bin: 2)> Size: 80B
array([[ 344.37801566, 1978.24694203],
       [ 300.90176106, 2388.85578706],
       [3000.08993939,  365.11551634],
       [1939.36472633, 3834.88855738],
       [ 318.39363366,  323.66654609]])
Coordinates:
  * bus      (bus) <U5 100B 'BE0 0' 'BE0 1' 'BE0 2' 'BE0 3' 'BE0 4'
  * bin      (bin) int64 16B 0 1

The output of build_renewable_profiles now looks like this (which is then handled in the subsequent rules and scripts):

image

Another feature added as an aside is the use of Global Energy Monitor (GEM) renewable capacity data, which now replaces the less complete OPSD VRE data in add_electricity. As a note for a future PR, this should also be used for add_existing_baseyear very soon, but I intentionally left it out here to reduce complexity.

Furthermore, a small functionality reduction is included in this PR. The technology mapping from powerplantmatching to pypsa now has to be 1:1 rather than 1:n. I.e. existing offshore wind has to be -dc or -ac. Since it aligns with how it is done in add_existing_baseyear, in my view, this is a negligible drawback.

TODO

  • Some testing and benchmarking for full-scale runs is required.

Checklist

  • I tested my contribution locally and it works as intended. (for CI tests)
  • 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.
  • A release note doc/release_notes.rst is added.

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Validator Report

I am the Validator. Download all artifacts here.
I'll be back and edit this comment for each new commit.

General

Plots comparison
Main branch Feature branch
Image not available Image not available
Image not available Image not available
Image not available Image not available
Image not available Image not available
Image not available Image not available
Image not available Image not available
Files comparison
Status NRMSE MAE (norm)
nodal_cfs.csv ⚠️ Missing
supply.csv ⚠️ Missing
prices.csv ⚠️ Missing
nodal_supply_energy.csv ⚠️ Missing
nodal_capacities.csv ⚠️ Missing
weighted_prices.csv ⚠️ Missing
market_values.csv ⚠️ Missing
nodal_costs.csv ⚠️ Missing
price_statistics.csv ⚠️ Missing
curtailment.csv ⚠️ Missing
capacities.csv ⚠️ Missing
costs.csv ⚠️ Missing
metrics.csv ⚠️ Missing
cfs.csv ⚠️ Missing
supply_energy.csv ⚠️ Missing
energy.csv ⚠️ Missing

NRMSE: Normalized (combined-min-max) Root Mean Square Error
MAE (norm): Mean Absolute Error on normalized data (min-max)
Status Threshold: MAE (norm) > 0.05 and NRMSE > 0.3

Model Metrics

Benchmarks Image not available Image not available Image not available

Comparing resource-classes (2659938) with master (ec5f877).
Branch is 29 commits ahead and 2 commits behind.
Last updated on 2025-01-07 09:09:21 CET.

@fneum fneum force-pushed the resource-classes branch from fc34742 to 454f473 Compare January 6, 2025 10:58
@fneum fneum force-pushed the resource-classes branch from 8e04539 to bab427d Compare January 6, 2025 17:39
@fneum fneum marked this pull request as ready for review January 6, 2025 18:52
@fneum
Copy link
Member Author

fneum commented Jan 6, 2025

FYI @oruhnau @aleks-g (it still requires a little bit of testing etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant