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

Clustering: build renewable profiles and add all assets after clustering

Open fneum opened this issue 1 year ago • 10 comments

Closes #1189.

Changes proposed in this Pull Request

  • Moved rules simplify_network and cluster_network before add_electricity and build_renewable_profiles
  • Split rule build_renewable_profiles into two separate rules, determine_availability_matrix for land eligibility analysis and build_renewable_profiles, which now only computes the profiles and total potentials from the pre-computed availability matrix.
  • Removed variables weight and potential from output of build_renewable_profiles as it is no longer needed
  • HAC-clustering is now based on wind speeds and irradiation time series rather than capacity factors
  • Added new rule build_hac_features that aggregates cutout weather data to base regions
  • Removed {simpl} wildcard and all associated code of the m suffix of the {cluster} wildcard. This means that the option to pre-cluster the network in simplify_network was removed. It will be superseded by clustering renewable profiles and potentials within clustered regions by resource classes.
  • The rule build_line_rating now directly attaches the DLR profiles to the pypsa.Network which is then returned as output.
  • The rule add_extra_components was integrated into add_electricity
  • Added new rule build_electricity_demand_base to determine the load distribution of the substations in the base network (which was previously done in add_electricity). This time series is used as weights for kmeans-clustering in cluster_network and is later added to the network in add_electricity in aggregated form.
  • The weights of the kmeans clustering algorithm are now exclusively based on the load distribution. Previously, they also included the distribution of thermal capacity.
  • Since the networks no longer start with the whole electricity system added pre-clustering, the files have been renamed from elec...nc to base...nc.
  • The scripts simplify_network.py and cluster_network.py were simplified to become less nested and profited from the removed need to deal with cost data.
  • New configuration options to calculate connection costs of offshore wind plants.

Updated Workflow Graph

intro-workflow

Testing

To be done.

A first observation is that build_renewable_profiles on clustered regions is much faster!

Without a doubt, this PR is not going to be backward compatible, which is why it should be pulled after a v0.12.0 release.

Next steps

  • Cluster renewable profiles and potentials within clustered regions by resource classes, emulating the previous m option in {clusters} wildcard, but better.
  • Add option to cluster by administrative shapes #263.

Checklist

  • [x] I tested my contribution locally and it seems to work fine.
  • [x] Code and workflow changes are sufficiently documented.
  • [x] Changed dependencies are added to envs/environment.yaml.
  • [x] Changes in configuration options are added in all of config.default.yaml.
  • [x] Changes in configuration options are also documented in doc/configtables/*.csv.
  • [ ] A release note doc/release_notes.rst is added.

fneum avatar Aug 06 '24 18:08 fneum

Capacity factors (pre-solve)

cf_comparison_64 cf_comparison_128 cf_comparison_256 cf_comparison_512

Loads

load_comparison_64 load_comparison_128 load_comparison_256 load_comparison_512

Installed capacities

64 clusters

capacity_comparison_solar_64 capacity_comparison_ror_64 capacity_comparison_onwind_64 capacity_comparison_oil_64 capacity_comparison_offwind-float_64 capacity_comparison_offwind-dc_64 capacity_comparison_offwind-ac_64 capacity_comparison_OCGT_64 capacity_comparison_nuclear_64 capacity_comparison_lignite_64 capacity_comparison_geothermal_64 capacity_comparison_coal_64 capacity_comparison_CCGT_64 capacity_comparison_biomass_64

512 clusters

capacity_comparison_solar_512 capacity_comparison_ror_512 capacity_comparison_onwind_512 capacity_comparison_oil_512 capacity_comparison_offwind-float_512 capacity_comparison_offwind-dc_512 capacity_comparison_offwind-ac_512 capacity_comparison_OCGT_512 capacity_comparison_nuclear_512 capacity_comparison_lignite_512 capacity_comparison_geothermal_512 capacity_comparison_coal_512 capacity_comparison_CCGT_512 capacity_comparison_biomass_512

cpschau avatar Aug 13 '24 13:08 cpschau

Shapes

shape_comparison_cluster_64 shape_comparison_cluster_128 shape_comparison_cluster_256 shape_comparison_cluster_512

Clusters per country

bus_comparison_64_clusters bus_comparison_128_clusters bus_comparison_256_clusters bus_comparison_512_clusters

cpschau avatar Aug 13 '24 13:08 cpschau

@fneum this is awesome. One minor comment about the infixes (will have a deeper look when there is time). I was wondering why we keep the _s_ infix. It seems that this is because the dlr is still done before clustering. However, I doubt that this actually makes much sense. First calculating dlr and clustering, is probably as bad as first clustering and then calculating dlr. The reason being that one does not know which of the clustered transmission lines are parallel and which are in series.

FabianHofmann avatar Aug 13 '24 15:08 FabianHofmann

Change in capital_cost for offwind depending on later or earlier clustering for 37 nodes offwind-ac-capital_cost offwind-dc-capital_cost offwind-float-capital_cost

lisazeyen avatar Aug 16 '24 15:08 lisazeyen

Changes in p_nom_max. In general, seems to be quite similar higher solar potential in Norway offwind-ac-p_nom_max offwind-dc-p_nom_max offwind-float-p_nom_max onwind-p_nom_max solar-hsat-p_nom_max solar-p_nom_max

Warning for the following nodes that installed capacity is larger than technical potential ['BE1 0 offwind-ac-2025', 'DE1 0 offwind-ac-2025', 'GB5 0 offwind-ac-2025', 'NL1 0 offwind-ac-2025', 'ES4 0 onwind-2025', 'ES4 0 solar-2025']

lisazeyen avatar Aug 19 '24 08:08 lisazeyen

Change in offwind-acprofiles for 37 nodes offwind-ac-distance offwind-ac-underwater

lisazeyen avatar Aug 19 '24 09:08 lisazeyen

Change in offwind-acprofiles for 37 nodes offwind-ac-distance offwind-ac-underwater

this is not important anymore since underwater fraction is removed in this PR

lisazeyen avatar Aug 20 '24 14:08 lisazeyen

Looks good to me now! Just the offwind-float capital cost seem to increase somewhat. Amazing, that the investment costs are so similar now even though the calculation is quite different...

lisazeyen avatar Aug 20 '24 14:08 lisazeyen

When checking the p_max_pu for onshore and offshore wind I see some larger deviations, averaged over all 38 nodes and all time steps: average_cf

For example for Belgium, 38 nodes, wind seems to have always higher capacity factors in the feature branch diff-pmaxpu-offwind-dc-BE1 0 example-week-offwind-dc-BE1 0 diff-pmaxpu-onwind-BE1 0 example-week-onwind-BE1 0 diff-pmaxpu-offwind-float-BE1 0 example-week-offwind-float-BE1 0 diff-pmaxpu-offwind-ac-BE1 0 example-week-offwind-ac-BE1 0

Similar in Austria onshore wind diff-pmaxpu-onwind-AT1 0 example-week-onwind-AT1 0

lisazeyen avatar Aug 20 '24 15:08 lisazeyen

run of river in LU is missing in feature branch, Italy as slightly larger capacities. Overall summed capacity of ror stays constant. pnom_ror

lisazeyen avatar Aug 20 '24 15:08 lisazeyen

I could not reproduce the divergence in capacity factor time series. All looks good from my side; I checked:

  • average capacity factors per carrier and country
  • average loads per country
  • existing powerplants capacity per country
  • capital_cost per carrier and country
  • installable potential per carrier and country
  • total network volume by DC and AC

All values are acceptably similar.

Indeed closes #1216.

fneum avatar Sep 12 '24 16:09 fneum

Ready to be merged from my side @lisazeyen, @cpschau, @FabianHofmann. Most tests pass, I extensively tested and compared the outputs. Now is a good time as there are not too many other open PRs and there was a recent release. It's much faster :)

fneum avatar Sep 12 '24 17:09 fneum

Ready to be merged from my side @lisazeyen, @cpschau, @FabianHofmann. Most tests pass, I extensively tested and compared the outputs. Now is a good time as there are not too many other open PRs and there was a recent release. It's much faster :)

Great, looks good to me!

lisazeyen avatar Sep 13 '24 06:09 lisazeyen

Ready to be merged from my side @lisazeyen, @cpschau, @FabianHofmann. Most tests pass, I extensively tested and compared the outputs. Now is a good time as there are not too many other open PRs and there was a recent release. It's much faster :)

Great! Looking very much forward to the fast RES profiles build!

cpschau avatar Sep 13 '24 07:09 cpschau

let's do it! :rocket:

FabianHofmann avatar Sep 13 '24 08:09 FabianHofmann