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

Major improvement to OSM-based electricity grid (e.g. using relations, preserving substation locations) #1384

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

Conversation

bobbyxng
Copy link
Contributor

Changes proposed in this Pull Request

  • Major improvement to the OSM-based electricity grid
  • build_osm_network completely rewritten:
    • Use of OSM relations, where available and where a single linestring could be extracted to replace member ways
    • substantial speed improvements
    • Exact locations of original substations are preserved
    • Lines with identical geometries and voltages are aggregated (num_parallel is increased)
    • Lines overpassing "virtual nodes" (not actual substations as per OSM raw data) are merged, if their electric properties allow it (same voltage levels, same number of circuits)
    • Geometries are preserved. Method to extend line/link to the substation has been improved significantly. No "mess" inside of a substation cluster anymore.
    • Method to determine substation point improved, based on "Point of Inaccessibility" (PoI) method developed by Garcia-Castellanos & Lombardo 2007, doi.org/10.1080/14702540801897809 which ensures that an interior point in non-convex shapes is always found.
    • Clustering resolution has been sharpened from 5000 meter radius to only 500 meters, while still ensuring topological connectivity.
    • Single bus for each voltage level in each substation. Buses of different voltages are arranged in geometric shape (three buses form a triangle, see screenshot)
    • Transformers now have a capacity s_nom based on the maximum of connected capacity connected to each bus
    • Resolves many issues related around cross-border capacity, especially if the substation was located close to a border. @lindnemi @toniseibold @JulianGeis @nworbmot

Todo:

  • Validation runs still open

image

image

image

Checklist

  • I tested my contribution locally and it works as intended.
  • 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 Oct 22, 2024

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)
prices.csv ⚠️Changed 0.000 0.08
weighted_prices.csv ⚠️Changed 0.449 0.42
market_values.csv ⚠️Changed 0.000 0.10
price_statistics.csv ⚠️Changed 0.000 0.17
curtailment.csv ⚠️Changed 0.000 0.14
metrics.csv ⚠️Changed 0.000 0.06
nodal_supply_energy.csv ✅ Almost equal 0.000 0.00
nodal_cfs.csv ✅ Almost equal 0.065 0.02
nodal_costs.csv ✅ Almost equal 0.003 0.00
nodal_capacities.csv ✅ Almost equal 0.000 0.00
supply.csv ✅ Almost equal 0.000 0.01
capacities.csv ✅ Almost equal 0.000 0.02
costs.csv ✅ Almost equal 0.001 0.00
cfs.csv ✅ Almost equal 0.030 0.02
supply_energy.csv ✅ Almost equal 0.000 0.01
energy.csv ✅ Almost equal 0.000 0.01

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 osm-relations (c7c453d) with master (ef20ee8).
Branch is 25 commits ahead and 0 commits behind.
Last updated on 2024-10-25 10:00:59 CEST.

Copy link
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check every line in detail, but the structure looks good and comparable to the previous version. I have a series of small comments that are easy to address:

Comment on lines +459 to +460
if "s_nom" not in transformers:
transformers["s_nom"] = config.get("s_nom", 2000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if some transformers have s_nom, but not all of them. Will missing values be filled?

Comment on lines +126 to +128
snakemake = mock_snakemake(
"build_gdp_pop_non_nuts3", configfiles=["config/config.osm-raw.yaml"]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert?

@@ -84,7 +84,7 @@ co2_budget:

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#electricity
electricity:
voltages: [200., 220., 300., 380., 500., 750.]
voltages: [220., 300., 330., 380., 400., 500., 750.]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a short note why 200 kV disappears for clarification would be good.

Comment on lines +425 to +427
# # list of all countries
# country = ';'.join([G.nodes[node].get('country', '') for node in subgraph.nodes()])
# country = ';'.join(sorted(set(country.split(';'))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could remove unused code?

temp_list = [split(l, p) for l in list_linestrings]
# nest all geometries
list_linestrings = [lstring for tval in temp_list for lstring in tval.geoms]
for g_name, g_value in buses_all.groupby("station_id"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is slow, could be converted to an apply function applied to each group.

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

Successfully merging this pull request may close these issues.

2 participants