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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a1d076c
Implemented line merge over virtual bus functionality.
bobbyxng Oct 14, 2024
0287872
Implemented: Aggregating identical lines, bus merging to stations, cr…
bobbyxng Oct 15, 2024
ce15373
Implemented: Mapping of lines to buses and extending lines to buses.
bobbyxng Oct 16, 2024
77f77c8
Finished implementing converters and links.
bobbyxng Oct 17, 2024
24145f7
Finished implementation of entirely new build_osm_network.py script.
bobbyxng Oct 18, 2024
9aca61a
Merge branch 'master' into osm-interconnectors
bobbyxng Oct 18, 2024
fc5b36c
Updated configtables.
bobbyxng Oct 18, 2024
43cf668
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 18, 2024
caf8eb9
Temporarily disabled tqdm in retrieve. Line splitting disabled as well.
bobbyxng Oct 19, 2024
6b00178
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 19, 2024
fb653fb
Implemented relations. Running, converging workflow.
bobbyxng Oct 22, 2024
b2c21f7
Added updated simplify_network.py
bobbyxng Oct 22, 2024
2aefa9b
Cleaned up code.
bobbyxng Oct 22, 2024
5420fec
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 22, 2024
9b24312
Updated doc
bobbyxng Oct 22, 2024
4ef062f
Merge remote-tracking branch 'refs/remotes/origin/osm-relations' into…
bobbyxng Oct 22, 2024
8aec857
Reactivated line splitting.
bobbyxng Oct 22, 2024
13391d6
Updated build_osm_network.
bobbyxng Oct 23, 2024
639eef7
Cleaned up code.
bobbyxng Oct 23, 2024
aca66fb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 23, 2024
0cca562
Added 400 kV voltage level to config.default
bobbyxng Oct 23, 2024
b3fec47
Merge branch 'osm-relations' of https://github.com/pypsa/pypsa-eur in…
bobbyxng Oct 23, 2024
db2f593
Merge branch 'master' into osm-relations
bobbyxng Oct 25, 2024
e9f7798
Updated Zenodo link
bobbyxng Oct 25, 2024
c7c453d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

base_network: osm-prebuilt
osm-prebuilt-version: 0.4
gaslimit_enable: false
Expand Down Expand Up @@ -278,10 +278,11 @@ conventional:
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#lines
lines:
types:
200.: "Al/St 240/40 2-bundle 200.0"
220.: "Al/St 240/40 2-bundle 220.0"
300.: "Al/St 240/40 3-bundle 300.0"
330.: "Al/St 240/40 3-bundle 300.0"
380.: "Al/St 240/40 4-bundle 380.0"
400.: "Al/St 240/40 4-bundle 380.0"
500.: "Al/St 240/40 4-bundle 380.0"
750.: "Al/St 560/50 4-bundle 750.0"
s_max_pu: 0.7
Expand Down
2 changes: 1 addition & 1 deletion doc/configtables/electricity.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
,Unit,Values,Description
voltages,kV,"Any subset of {200., 220., 300., 380., 500., 750.}",Voltage levels to consider
voltages,kV,"Any subset of {220., 300., 330., 380., 400., 500., 750.}",Voltage levels to consider
base_network, --, "Any value in {'entsoegridkit', 'osm-prebuilt', 'osm-raw}", "Specify the underlying base network, i.e. GridKit (based on ENTSO-E web map extract, OpenStreetMap (OSM) prebuilt or raw (built from raw OSM data), takes longer."
osm-prebuilt-version, --, "float, any value in range 0.1-0.4", "Choose the version of the prebuilt OSM network. Defaults to latest Zenodo release."
gaslimit_enable,bool,true or false,Add an overall absolute gas limit configured in ``electricity: gaslimit``.
Expand Down
11 changes: 9 additions & 2 deletions rules/build_electricity.smk
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,8 @@ if config["electricity"]["base_network"] == "osm-raw":
"data/osm-raw/{country}/lines_way.json",
country=config_provider("countries"),
),
links_relation=expand(
"data/osm-raw/{country}/links_relation.json",
routes_relation=expand(
"data/osm-raw/{country}/routes_relation.json",
country=config_provider("countries"),
),
substations_way=expand(
Expand All @@ -774,6 +774,7 @@ if config["electricity"]["base_network"] == "osm-raw":
output:
substations=resources("osm-raw/clean/substations.geojson"),
substations_polygon=resources("osm-raw/clean/substations_polygon.geojson"),
converters_polygon=resources("osm-raw/clean/converters_polygon.geojson"),
lines=resources("osm-raw/clean/lines.geojson"),
links=resources("osm-raw/clean/links.geojson"),
log:
Expand All @@ -792,8 +793,14 @@ if config["electricity"]["base_network"] == "osm-raw":
if config["electricity"]["base_network"] == "osm-raw":

rule build_osm_network:
params:
countries=config_provider("countries"),
voltages=config_provider("electricity", "voltages"),
line_types=config_provider("lines", "types"),
input:
substations=resources("osm-raw/clean/substations.geojson"),
substations_polygon=resources("osm-raw/clean/substations_polygon.geojson"),
converters_polygon=resources("osm-raw/clean/converters_polygon.geojson"),
lines=resources("osm-raw/clean/lines.geojson"),
links=resources("osm-raw/clean/links.geojson"),
country_shapes=resources("country_shapes.geojson"),
Expand Down
5 changes: 3 additions & 2 deletions rules/retrieve.smk
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ if config["enable"]["retrieve"] and (
0.2: "13342577",
0.3: "13358976",
0.4: "13759222",
0.5: "13981528",
}

# update rule to use the correct version
Expand Down Expand Up @@ -592,7 +593,7 @@ if config["enable"]["retrieve"] and (
output:
cables_way="data/osm-raw/{country}/cables_way.json",
lines_way="data/osm-raw/{country}/lines_way.json",
links_relation="data/osm-raw/{country}/links_relation.json",
routes_relation="data/osm-raw/{country}/routes_relation.json",
substations_way="data/osm-raw/{country}/substations_way.json",
substations_relation="data/osm-raw/{country}/substations_relation.json",
log:
Expand All @@ -619,7 +620,7 @@ if config["enable"]["retrieve"] and (
country=config_provider("countries"),
),
expand(
"data/osm-raw/{country}/links_relation.json",
"data/osm-raw/{country}/routes_relation.json",
country=config_provider("countries"),
),
expand(
Expand Down
2 changes: 2 additions & 0 deletions scripts/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ def aggregate_costs(n, flatten=False, opts=None, existing_only=False):

def progress_retrieve(url, file, disable=False):
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
# Hotfix - Bug, tqdm not working with disable=False
disable = True

if disable:
response = requests.get(url, headers=headers, stream=True)
Expand Down
3 changes: 2 additions & 1 deletion scripts/base_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ def _set_electrical_parameters_transformers(transformers, config):

## Add transformer parameters
transformers["x"] = config.get("x", 0.1)
transformers["s_nom"] = config.get("s_nom", 2000)
if "s_nom" not in transformers:
transformers["s_nom"] = config.get("s_nom", 2000)
Comment on lines +459 to +460
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?

transformers["type"] = config.get("type", "")

return transformers
Expand Down
4 changes: 3 additions & 1 deletion scripts/build_gdp_pop_non_nuts3.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def calc_gdp_pop(country, regions, gdp_non_nuts3, pop_non_nuts3):
if "snakemake" not in globals():
from _helpers import mock_snakemake

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

Choose a reason for hiding this comment

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

revert?

configure_logging(snakemake)
set_scenario_config(snakemake)

Expand Down
Loading
Loading