2017-12-18 19:31:27 +00:00
# -*- coding: utf-8 -*-
2024-02-19 15:21:48 +00:00
# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors
2020-05-29 07:50:55 +00:00
#
2021-09-14 14:37:41 +00:00
# SPDX-License-Identifier: MIT
2020-05-29 07:50:55 +00:00
2017-12-18 19:31:27 +00:00
# coding: utf-8
2019-08-08 13:02:28 +00:00
"""
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
Creates the network topology from a ` ENTSO - E map extract .
< https : / / github . com / PyPSA / GridKit / tree / master / entsoe > ` _ ( March 2022 )
or ` OpenStreetMap data < https : / / www . openstreetmap . org / > ` _ ( Aug 2024 )
as a PyPSA
network .
2019-08-11 09:40:47 +00:00
Relevant Settings
- - - - - - - - - - - - - - - - -
2019-08-11 11:17:36 +00:00
. . code : : yaml
countries :
electricity :
voltages :
lines :
types :
s_max_pu :
under_construction :
2019-11-05 13:29:15 +00:00
2019-08-11 11:17:36 +00:00
links :
p_max_pu :
under_construction :
2019-11-05 13:29:15 +00:00
2019-08-11 11:17:36 +00:00
transformers :
x :
s_nom :
type :
2019-08-13 08:03:46 +00:00
2019-11-05 13:29:15 +00:00
. . seealso : :
2023-04-21 08:41:44 +00:00
Documentation of the configuration file ` ` config / config . yaml ` ` at
2019-08-13 08:03:46 +00:00
: ref : ` snapshots_cf ` , : ref : ` toplevel_cf ` , : ref : ` electricity_cf ` , : ref : ` load_cf ` ,
: ref : ` lines_cf ` , : ref : ` links_cf ` , : ref : ` transformers_cf `
2019-11-05 13:29:15 +00:00
2019-08-11 09:40:47 +00:00
Inputs
- - - - - -
2022-03-03 16:16:23 +00:00
- ` ` data / entsoegridkit ` ` : Extract from the geographical vector data of the online ` ENTSO - E Interactive Map < https : / / www . entsoe . eu / data / map / > ` _ by the ` GridKit < https : / / github . com / martacki / gridkit > ` _ toolkit dating back to March 2022.
2019-08-12 17:01:53 +00:00
- ` ` data / parameter_corrections . yaml ` ` : Corrections for ` ` data / entsoegridkit ` `
2019-08-11 20:34:18 +00:00
- ` ` data / links_p_nom . csv ` ` : confer : ref : ` links `
- ` ` resources / country_shapes . geojson ` ` : confer : ref : ` shapes `
- ` ` resources / offshore_shapes . geojson ` ` : confer : ref : ` shapes `
- ` ` resources / europe_shape . geojson ` ` : confer : ref : ` shapes `
2019-08-11 09:40:47 +00:00
Outputs
- - - - - - -
2019-08-11 20:34:18 +00:00
- ` ` networks / base . nc ` `
2023-03-09 12:28:42 +00:00
. . image : : img / base . png
2019-08-11 20:34:18 +00:00
: scale : 33 %
2024-05-06 06:52:42 +00:00
- ` ` resources / regions_onshore . geojson ` ` :
. . image : : img / regions_onshore . png
: scale : 33 %
- ` ` resources / regions_offshore . geojson ` ` :
. . image : : img / regions_offshore . png
: scale : 33 %
2019-08-11 09:40:47 +00:00
Description
- - - - - - - - - - -
2024-05-06 06:52:42 +00:00
Creates the network topology from an ENTSO - E map extract , and create Voronoi shapes for each bus representing both onshore and offshore regions .
2019-08-08 13:02:28 +00:00
"""
2017-12-18 19:31:27 +00:00
2019-11-28 07:22:52 +00:00
import logging
2024-07-24 13:31:46 +00:00
import warnings
2019-11-28 07:22:52 +00:00
from itertools import product
2018-08-03 09:49:23 +00:00
import geopandas as gpd
2020-09-11 10:40:53 +00:00
import networkx as nx
2017-12-18 19:31:27 +00:00
import numpy as np
import pandas as pd
2020-12-03 18:50:53 +00:00
import pypsa
2018-09-24 18:19:47 +00:00
import shapely
2018-08-03 09:49:23 +00:00
import shapely . prepared
import shapely . wkt
2017-12-18 19:31:27 +00:00
import yaml
2024-05-03 12:50:14 +00:00
from _helpers import REGION_COLS , configure_logging , get_snapshots , set_scenario_config
2024-02-09 12:59:15 +00:00
from packaging . version import Version , parse
2017-12-18 19:31:27 +00:00
from scipy . sparse import csgraph
2024-07-24 13:31:46 +00:00
from scipy . spatial import KDTree
from shapely . geometry import LineString , Point
2017-12-18 19:31:27 +00:00
2024-02-09 12:59:15 +00:00
PD_GE_2_2 = parse ( pd . __version__ ) > = Version ( " 2.2 " )
2020-09-11 10:40:53 +00:00
logger = logging . getLogger ( __name__ )
2017-12-18 19:31:27 +00:00
2018-09-27 16:27:33 +00:00
def _get_oid ( df ) :
2019-02-13 18:03:57 +00:00
if " tags " in df . columns :
2024-08-19 11:33:28 +00:00
return df . tags . str . extract ( r ' " oid " => " ( \ d+) " ' , expand = False )
2019-02-13 18:03:57 +00:00
else :
return pd . Series ( np . nan , df . index )
2018-09-27 16:27:33 +00:00
2020-09-11 10:40:53 +00:00
2018-10-26 14:08:50 +00:00
def _get_country ( df ) :
2019-02-13 18:03:57 +00:00
if " tags " in df . columns :
return df . tags . str . extract ( ' " country " => " ([A-Z] {2} ) " ' , expand = False )
else :
return pd . Series ( np . nan , df . index )
2018-10-26 14:08:50 +00:00
2020-09-11 10:40:53 +00:00
2018-09-24 18:19:47 +00:00
def _find_closest_links ( links , new_links , distance_upper_bound = 1.5 ) :
2022-01-14 07:43:21 +00:00
treecoords = np . asarray (
2022-09-16 13:04:04 +00:00
[
2022-01-14 07:43:21 +00:00
np . asarray ( shapely . wkt . loads ( s ) . coords ) [ [ 0 , - 1 ] ] . flatten ( )
2020-03-31 22:20:32 +00:00
for s in links . geometry
2022-09-16 13:04:04 +00:00
]
2020-03-31 22:20:32 +00:00
)
querycoords = np . vstack (
[ new_links [ [ " x1 " , " y1 " , " x2 " , " y2 " ] ] , new_links [ [ " x2 " , " y2 " , " x1 " , " y1 " ] ] ]
)
2024-07-24 13:31:46 +00:00
tree = KDTree ( treecoords )
2020-03-31 22:20:32 +00:00
dist , ind = tree . query ( querycoords , distance_upper_bound = distance_upper_bound )
found_b = ind < len ( links )
found_i = np . arange ( len ( new_links ) * 2 ) [ found_b ] % len ( new_links )
return (
pd . DataFrame (
dict ( D = dist [ found_b ] , i = links . index [ ind [ found_b ] % len ( links ) ] ) ,
index = new_links . index [ found_i ] ,
2022-09-16 13:04:04 +00:00
)
2020-03-31 22:20:32 +00:00
. sort_values ( by = " D " ) [ lambda ds : ~ ds . index . duplicated ( keep = " first " ) ]
. sort_index ( ) [ " i " ]
2022-09-16 13:04:04 +00:00
)
2018-09-24 18:19:47 +00:00
2020-09-11 10:40:53 +00:00
2024-09-18 14:29:05 +00:00
def _load_buses ( buses , europe_shape , countries , config ) :
2022-01-13 17:54:27 +00:00
buses = (
pd . read_csv (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
buses ,
2022-01-13 17:54:27 +00:00
quotechar = " ' " ,
2021-08-04 16:19:23 +00:00
true_values = [ " t " ] ,
false_values = [ " f " ] ,
2019-03-06 19:40:29 +00:00
dtype = dict ( bus_id = " str " ) ,
)
2017-12-18 19:31:27 +00:00
. set_index ( " bus_id " )
. rename ( columns = dict ( voltage = " v_nom " ) )
2022-09-16 13:04:04 +00:00
)
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
if " station_id " in buses . columns :
buses . drop ( " station_id " , axis = 1 , inplace = True )
2017-12-18 19:31:27 +00:00
buses [ " carrier " ] = buses . pop ( " dc " ) . map ( { True : " DC " , False : " AC " } )
2024-01-31 16:10:08 +00:00
buses [ " under_construction " ] = buses . under_construction . where (
lambda s : s . notnull ( ) , False
) . astype ( bool )
2022-01-13 17:54:27 +00:00
europe_shape = gpd . read_file ( europe_shape ) . loc [ 0 , " geometry " ]
2018-08-03 09:49:23 +00:00
europe_shape_prepped = shapely . prepared . prep ( europe_shape )
buses_in_europe_b = buses [ [ " x " , " y " ] ] . apply (
lambda p : europe_shape_prepped . contains ( Point ( p ) ) , axis = 1
)
2017-12-18 19:31:27 +00:00
2024-09-18 14:29:05 +00:00
buses_in_countries_b = (
buses . country . isin ( countries )
if " country " in buses
else pd . Series ( True , buses . index )
)
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
v_nom_min = min ( config [ " electricity " ] [ " voltages " ] )
v_nom_max = max ( config [ " electricity " ] [ " voltages " ] )
2022-01-13 17:54:27 +00:00
buses_with_v_nom_to_keep_b = (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
( v_nom_min < = buses . v_nom ) & ( buses . v_nom < = v_nom_max )
| ( buses . v_nom . isnull ( ) )
| (
buses . carrier == " DC "
) # Keeping all DC buses from the input dataset independent of voltage (e.g. 150 kV connections)
2022-09-16 13:04:04 +00:00
)
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
logger . info ( f " Removing buses outside of range AC { v_nom_min } - { v_nom_max } V " )
2024-09-18 14:29:05 +00:00
return pd . DataFrame (
buses . loc [ buses_in_europe_b & buses_in_countries_b & buses_with_v_nom_to_keep_b ]
)
2017-12-18 19:31:27 +00:00
2020-09-11 10:40:53 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _load_transformers ( buses , transformers ) :
2022-01-13 17:54:27 +00:00
transformers = pd . read_csv (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
transformers ,
2022-01-13 17:54:27 +00:00
quotechar = " ' " ,
2021-08-04 16:19:23 +00:00
true_values = [ " t " ] ,
false_values = [ " f " ] ,
2017-12-18 19:31:27 +00:00
dtype = dict ( transformer_id = " str " , bus0 = " str " , bus1 = " str " ) ,
) . set_index ( " transformer_id " )
transformers = _remove_dangling_branches ( transformers , buses )
return transformers
2020-09-11 10:40:53 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _load_converters_from_eg ( buses , converters ) :
2022-01-13 17:54:27 +00:00
converters = pd . read_csv (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
converters ,
2022-01-13 17:54:27 +00:00
quotechar = " ' " ,
2021-08-04 16:19:23 +00:00
true_values = [ " t " ] ,
false_values = [ " f " ] ,
2017-12-18 19:31:27 +00:00
dtype = dict ( converter_id = " str " , bus0 = " str " , bus1 = " str " ) ,
) . set_index ( " converter_id " )
converters = _remove_dangling_branches ( converters , buses )
converters [ " carrier " ] = " B2B "
return converters
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _load_converters_from_osm ( buses , converters ) :
converters = pd . read_csv (
converters ,
quotechar = " ' " ,
true_values = [ " t " ] ,
false_values = [ " f " ] ,
dtype = dict ( converter_id = " str " , bus0 = " str " , bus1 = " str " ) ,
) . set_index ( " converter_id " )
converters = _remove_dangling_branches ( converters , buses )
converters [ " carrier " ] = " "
return converters
def _load_links_from_eg ( buses , links ) :
2022-01-13 17:54:27 +00:00
links = pd . read_csv (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
links ,
2022-01-13 17:54:27 +00:00
quotechar = " ' " ,
true_values = [ " t " ] ,
false_values = [ " f " ] ,
2017-12-18 19:31:27 +00:00
dtype = dict ( link_id = " str " , bus0 = " str " , bus1 = " str " , under_construction = " bool " ) ,
) . set_index ( " link_id " )
2022-03-03 16:16:23 +00:00
links [ " length " ] / = 1e3
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
# Skagerrak Link is connected to 132kV bus which is removed in _load_buses.
2022-01-31 15:09:42 +00:00
# Connect to neighboring 380kV bus
2022-03-03 16:16:23 +00:00
links . loc [ links . bus1 == " 6396 " , " bus1 " ] = " 6398 "
2020-06-08 16:13:51 +00:00
2017-12-18 19:31:27 +00:00
links = _remove_dangling_branches ( links , buses )
# Add DC line parameters
links [ " carrier " ] = " DC "
return links
2018-09-24 18:19:47 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _load_links_from_osm ( buses , links ) :
links = pd . read_csv (
links ,
quotechar = " ' " ,
true_values = [ " t " ] ,
false_values = [ " f " ] ,
dtype = dict (
link_id = " str " ,
bus0 = " str " ,
bus1 = " str " ,
voltage = " int " ,
p_nom = " float " ,
) ,
) . set_index ( " link_id " )
links [ " length " ] / = 1e3
links = _remove_dangling_branches ( links , buses )
# Add DC line parameters
links [ " carrier " ] = " DC "
return links
def _load_lines ( buses , lines ) :
2022-01-13 17:54:27 +00:00
lines = (
pd . read_csv (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
lines ,
2022-01-13 17:54:27 +00:00
quotechar = " ' " ,
true_values = [ " t " ] ,
false_values = [ " f " ] ,
2017-12-18 19:31:27 +00:00
dtype = dict (
line_id = " str " ,
bus0 = " str " ,
bus1 = " str " ,
underground = " bool " ,
under_construction = " bool " ,
2022-09-16 13:04:04 +00:00
) ,
2017-12-18 19:31:27 +00:00
)
. set_index ( " line_id " )
. rename ( columns = dict ( voltage = " v_nom " , circuits = " num_parallel " ) )
2022-09-16 13:04:04 +00:00
)
2017-12-18 19:31:27 +00:00
lines [ " length " ] / = 1e3
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
2023-07-05 13:50:57 +00:00
lines [ " carrier " ] = " AC "
2017-12-18 19:31:27 +00:00
lines = _remove_dangling_branches ( lines , buses )
return lines
2020-09-11 10:40:53 +00:00
2022-01-13 17:54:27 +00:00
def _apply_parameter_corrections ( n , parameter_corrections ) :
with open ( parameter_corrections ) as f :
2019-06-05 16:07:36 +00:00
corrections = yaml . safe_load ( f )
2017-12-18 19:31:27 +00:00
2018-08-27 17:13:41 +00:00
if corrections is None :
return
2020-09-11 10:40:53 +00:00
2021-05-25 09:29:47 +00:00
for component , attrs in corrections . items ( ) :
2017-12-18 19:31:27 +00:00
df = n . df ( component )
2018-09-27 16:27:33 +00:00
oid = _get_oid ( df )
2018-07-10 14:34:46 +00:00
if attrs is None :
continue
2021-05-25 09:29:47 +00:00
for attr , repls in attrs . items ( ) :
for i , r in repls . items ( ) :
2017-12-18 19:31:27 +00:00
if i == " oid " :
2018-09-27 16:27:33 +00:00
r = oid . map ( repls [ " oid " ] ) . dropna ( )
2017-12-18 19:31:27 +00:00
elif i == " index " :
r = pd . Series ( repls [ " index " ] )
else :
raise NotImplementedError ( )
2018-08-08 14:28:32 +00:00
inds = r . index . intersection ( df . index )
df . loc [ inds , attr ] = r [ inds ] . astype ( df [ attr ] . dtype )
2017-12-18 19:31:27 +00:00
2020-09-11 10:40:53 +00:00
2023-10-09 14:16:53 +00:00
def _reconnect_crimea ( lines ) :
logger . info ( " Reconnecting Crimea to the Ukrainian grid. " )
lines_to_crimea = pd . DataFrame (
{
" bus0 " : [ " 3065 " , " 3181 " , " 3181 " ] ,
" bus1 " : [ " 3057 " , " 3055 " , " 3057 " ] ,
" v_nom " : [ 300 , 300 , 300 ] ,
" num_parallel " : [ 1 , 1 , 1 ] ,
" length " : [ 140 , 120 , 140 ] ,
" carrier " : [ " AC " , " AC " , " AC " ] ,
" underground " : [ False , False , False ] ,
" under_construction " : [ False , False , False ] ,
} ,
index = [ " Melitopol " , " Liubymivka left " , " Luibymivka right " ] ,
)
return pd . concat ( [ lines , lines_to_crimea ] )
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _set_electrical_parameters_lines_eg ( lines , config ) :
2022-01-13 17:54:27 +00:00
v_noms = config [ " electricity " ] [ " voltages " ]
linetypes = config [ " lines " ] [ " types " ]
2017-12-18 19:31:27 +00:00
for v_nom in v_noms :
lines . loc [ lines [ " v_nom " ] == v_nom , " type " ] = linetypes [ v_nom ]
2022-01-13 17:54:27 +00:00
lines [ " s_max_pu " ] = config [ " lines " ] [ " s_max_pu " ]
2017-12-18 19:31:27 +00:00
return lines
2020-09-11 10:40:53 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _set_electrical_parameters_lines_osm ( lines , config ) :
if lines . empty :
lines [ " type " ] = [ ]
return lines
v_noms = config [ " electricity " ] [ " voltages " ]
linetypes = _get_linetypes_config ( config [ " lines " ] [ " types " ] , v_noms )
lines [ " carrier " ] = " AC "
lines [ " dc " ] = False
lines . loc [ : , " type " ] = lines . v_nom . apply (
lambda x : _get_linetype_by_voltage ( x , linetypes )
)
lines [ " s_max_pu " ] = config [ " lines " ] [ " s_max_pu " ]
return lines
2018-03-14 12:18:26 +00:00
def _set_lines_s_nom_from_linetypes ( n ) :
n . lines [ " s_nom " ] = (
np . sqrt ( 3 )
* n . lines [ " type " ] . map ( n . line_types . i_nom )
* n . lines [ " v_nom " ]
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
* n . lines [ " num_parallel " ]
2018-03-14 12:18:26 +00:00
)
2020-09-11 10:40:53 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _set_electrical_parameters_links_eg ( links , config , links_p_nom ) :
2019-02-13 18:03:57 +00:00
if links . empty :
return links
2022-01-13 17:54:27 +00:00
p_max_pu = config [ " links " ] . get ( " p_max_pu " , 1.0 )
2018-09-03 18:19:45 +00:00
links [ " p_max_pu " ] = p_max_pu
links [ " p_min_pu " ] = - p_max_pu
2017-12-18 19:31:27 +00:00
2022-01-13 17:54:27 +00:00
links_p_nom = pd . read_csv ( links_p_nom )
2020-09-11 13:26:43 +00:00
# filter links that are not in operation anymore
2020-03-31 22:20:32 +00:00
removed_b = links_p_nom . Remarks . str . contains ( " Shut down|Replaced " , na = False )
links_p_nom = links_p_nom [ ~ removed_b ]
2020-09-11 13:26:43 +00:00
# find closest link for all links in links_p_nom
2020-03-31 22:20:32 +00:00
links_p_nom [ " j " ] = _find_closest_links ( links , links_p_nom )
2020-09-11 13:26:43 +00:00
2020-12-03 18:50:53 +00:00
links_p_nom = links_p_nom . groupby ( [ " j " ] , as_index = False ) . agg ( { " Power (MW) " : " sum " } )
2020-09-11 13:26:43 +00:00
2017-12-18 19:31:27 +00:00
p_nom = links_p_nom . dropna ( subset = [ " j " ] ) . set_index ( " j " ) [ " Power (MW) " ]
2020-09-11 13:26:43 +00:00
2018-09-27 16:29:44 +00:00
# Don't update p_nom if it's already set
2018-10-09 13:44:20 +00:00
p_nom_unset = (
p_nom . drop ( links . index [ links . p_nom . notnull ( ) ] , errors = " ignore " )
if " p_nom " in links
else p_nom
2022-09-16 13:04:04 +00:00
)
2018-09-27 16:29:44 +00:00
links . loc [ p_nom_unset . index , " p_nom " ] = p_nom_unset
2017-12-18 19:31:27 +00:00
return links
2020-09-11 10:40:53 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _set_electrical_parameters_links_osm ( links , config ) :
if links . empty :
return links
p_max_pu = config [ " links " ] . get ( " p_max_pu " , 1.0 )
links [ " p_max_pu " ] = p_max_pu
links [ " p_min_pu " ] = - p_max_pu
links [ " carrier " ] = " DC "
links [ " dc " ] = True
return links
2022-01-13 17:54:27 +00:00
def _set_electrical_parameters_converters ( converters , config ) :
p_max_pu = config [ " links " ] . get ( " p_max_pu " , 1.0 )
2018-09-03 18:19:45 +00:00
converters [ " p_max_pu " ] = p_max_pu
converters [ " p_min_pu " ] = - p_max_pu
2018-01-29 21:28:33 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
# if column "p_nom" does not exist, set to 2000
if " p_nom " not in converters :
converters [ " p_nom " ] = 2000
2018-01-29 21:28:33 +00:00
# Converters are combined with links
converters [ " under_construction " ] = False
converters [ " underground " ] = False
return converters
2020-09-11 10:40:53 +00:00
2022-01-13 17:54:27 +00:00
def _set_electrical_parameters_transformers ( transformers , config ) :
config = config [ " transformers " ]
2017-12-18 19:31:27 +00:00
## Add transformer parameters
transformers [ " x " ] = config . get ( " x " , 0.1 )
transformers [ " s_nom " ] = config . get ( " s_nom " , 2000 )
transformers [ " type " ] = config . get ( " type " , " " )
return transformers
2020-09-11 10:40:53 +00:00
2017-12-18 19:31:27 +00:00
def _remove_dangling_branches ( branches , buses ) :
return pd . DataFrame (
branches . loc [ branches . bus0 . isin ( buses . index ) & branches . bus1 . isin ( buses . index ) ]
)
2020-09-11 10:40:53 +00:00
2023-10-09 08:00:10 +00:00
def _remove_unconnected_components ( network , threshold = 6 ) :
2017-12-18 19:31:27 +00:00
_ , labels = csgraph . connected_components ( network . adjacency_matrix ( ) , directed = False )
component = pd . Series ( labels , index = network . buses . index )
component_sizes = component . value_counts ( )
2023-10-09 08:00:10 +00:00
components_to_remove = component_sizes . loc [ component_sizes < threshold ]
2017-12-18 19:31:27 +00:00
logger . info (
2023-10-08 09:20:36 +00:00
f " Removing { len ( components_to_remove ) } unconnected network components with less than { components_to_remove . max ( ) } buses. In total { components_to_remove . sum ( ) } buses. "
2022-09-16 13:04:04 +00:00
)
2017-12-18 19:31:27 +00:00
return network [ component == component_sizes . index [ 0 ] ]
2020-09-11 10:40:53 +00:00
2022-01-13 17:54:27 +00:00
def _set_countries_and_substations ( n , config , country_shapes , offshore_shapes ) :
2018-01-29 21:28:33 +00:00
buses = n . buses
def buses_in_shape ( shape ) :
shape = shapely . prepared . prep ( shape )
return pd . Series (
np . fromiter (
2022-09-16 13:04:04 +00:00
(
2018-01-29 21:28:33 +00:00
shape . contains ( Point ( x , y ) )
for x , y in buses . loc [ : , [ " x " , " y " ] ] . values
) ,
dtype = bool ,
count = len ( buses ) ,
2022-09-16 13:04:04 +00:00
) ,
2018-01-29 21:28:33 +00:00
index = buses . index ,
)
2022-01-13 17:54:27 +00:00
countries = config [ " countries " ]
country_shapes = gpd . read_file ( country_shapes ) . set_index ( " name " ) [ " geometry " ]
2022-06-23 12:25:30 +00:00
# reindexing necessary for supporting empty geo-dataframes
offshore_shapes = gpd . read_file ( offshore_shapes )
offshore_shapes = offshore_shapes . reindex ( columns = [ " name " , " geometry " ] ) . set_index (
" name "
) [ " geometry " ]
2018-10-27 01:34:40 +00:00
substation_b = buses [ " symbol " ] . str . contains (
" substation|converter station " , case = False
)
2018-01-29 21:28:33 +00:00
def prefer_voltage ( x , which ) :
index = x . index
if len ( index ) == 1 :
return pd . Series ( index , index )
key = (
x . index [ 0 ]
if x [ " v_nom " ] . isnull ( ) . all ( )
else getattr ( x [ " v_nom " ] , " idx " + which ) ( )
2022-09-16 13:04:04 +00:00
)
2018-01-29 21:28:33 +00:00
return pd . Series ( key , index )
2024-02-09 12:59:15 +00:00
compat_kws = dict ( include_groups = False ) if PD_GE_2_2 else { }
2018-01-29 21:28:33 +00:00
gb = buses . loc [ substation_b ] . groupby (
[ " x " , " y " ] , as_index = False , group_keys = False , sort = False
)
2024-02-09 12:59:15 +00:00
bus_map_low = gb . apply ( prefer_voltage , " min " , * * compat_kws )
2018-01-29 21:28:33 +00:00
lv_b = ( bus_map_low == bus_map_low . index ) . reindex ( buses . index , fill_value = False )
2024-02-09 12:59:15 +00:00
bus_map_high = gb . apply ( prefer_voltage , " max " , * * compat_kws )
2018-01-29 21:28:33 +00:00
hv_b = ( bus_map_high == bus_map_high . index ) . reindex ( buses . index , fill_value = False )
onshore_b = pd . Series ( False , buses . index )
offshore_b = pd . Series ( False , buses . index )
for country in countries :
onshore_shape = country_shapes [ country ]
onshore_country_b = buses_in_shape ( onshore_shape )
onshore_b | = onshore_country_b
buses . loc [ onshore_country_b , " country " ] = country
2018-10-27 01:34:40 +00:00
if country not in offshore_shapes . index :
continue
2018-01-29 21:28:33 +00:00
offshore_country_b = buses_in_shape ( offshore_shapes [ country ] )
offshore_b | = offshore_country_b
buses . loc [ offshore_country_b , " country " ] = country
2018-09-27 16:25:41 +00:00
# Only accept buses as low-voltage substations (where load is attached), if
# they have at least one connection which is not under_construction
has_connections_b = pd . Series ( False , index = buses . index )
for b , df in product ( ( " bus0 " , " bus1 " ) , ( n . lines , n . links ) ) :
has_connections_b | = ~ df . groupby ( b ) . under_construction . min ( )
2024-02-09 14:43:27 +00:00
buses [ " onshore_bus " ] = onshore_b
2018-09-27 16:25:41 +00:00
buses [ " substation_lv " ] = (
lv_b & onshore_b & ( ~ buses [ " under_construction " ] ) & has_connections_b
2018-02-01 11:27:53 +00:00
)
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
buses [ " substation_off " ] = ( offshore_b | ( hv_b & onshore_b ) ) & (
2018-02-01 11:27:53 +00:00
~ buses [ " under_construction " ]
2022-09-16 13:04:04 +00:00
)
2018-01-29 21:28:33 +00:00
2024-02-29 10:38:21 +00:00
c_nan_b = buses . country . fillna ( " na " ) == " na "
2018-10-26 14:08:50 +00:00
if c_nan_b . sum ( ) > 0 :
c_tag = _get_country ( buses . loc [ c_nan_b ] )
2018-10-27 01:34:40 +00:00
c_tag . loc [ ~ c_tag . isin ( countries ) ] = np . nan
2018-10-26 14:08:50 +00:00
n . buses . loc [ c_nan_b , " country " ] = c_tag
c_tag_nan_b = n . buses . country . isnull ( )
# Nearest country in path length defines country of still homeless buses
# Work-around until commit 705119 lands in pypsa release
n . transformers [ " length " ] = 0.0
graph = n . graph ( weight = " length " )
n . transformers . drop ( " length " , axis = 1 , inplace = True )
for b in n . buses . index [ c_tag_nan_b ] :
df = (
pd . DataFrame (
dict (
pathlength = nx . single_source_dijkstra_path_length (
graph , b , cutoff = 200
)
2022-09-16 13:04:04 +00:00
)
)
2018-10-26 14:08:50 +00:00
. join ( n . buses . country )
. dropna ( )
2022-09-16 13:04:04 +00:00
)
2018-10-26 14:08:50 +00:00
assert (
not df . empty
) , " No buses with defined country within 200km of bus ` {} ` " . format ( b )
n . buses . at [ b , " country " ] = df . loc [ df . pathlength . idxmin ( ) , " country " ]
2022-09-16 13:04:04 +00:00
2018-10-26 14:08:50 +00:00
logger . warning (
" {} buses are not in any country or offshore shape, "
" {} have been assigned from the tag of the entsoe map, "
" the rest from the next bus in terms of pathlength. " . format (
c_nan_b . sum ( ) , c_nan_b . sum ( ) - c_tag_nan_b . sum ( )
2022-09-16 13:04:04 +00:00
)
)
2018-01-29 21:28:33 +00:00
return buses
2020-09-11 10:40:53 +00:00
2018-08-27 12:20:31 +00:00
def _replace_b2b_converter_at_country_border_by_link ( n ) :
# Affects only the B2B converter in Lithuania at the Polish border at the moment
buscntry = n . buses . country
linkcntry = n . links . bus0 . map ( buscntry )
converters_i = n . links . index [
( n . links . carrier == " B2B " ) & ( linkcntry == n . links . bus1 . map ( buscntry ) )
]
def findforeignbus ( G , i ) :
cntry = linkcntry . at [ i ]
for busattr in ( " bus0 " , " bus1 " ) :
b0 = n . links . at [ i , busattr ]
for b1 in G [ b0 ] :
if buscntry [ b1 ] != cntry :
return busattr , b0 , b1
return None , None , None
for i in converters_i :
G = n . graph ( )
busattr , b0 , b1 = findforeignbus ( G , i )
if busattr is not None :
comp , line = next ( iter ( G [ b0 ] [ b1 ] ) )
if comp != " Line " :
2019-11-08 15:46:29 +00:00
logger . warning (
" Unable to replace B2B ` {} ` expected a Line, but found a {} " . format (
2018-08-27 12:20:31 +00:00
i , comp
)
2022-09-16 13:04:04 +00:00
)
2018-08-27 12:20:31 +00:00
continue
n . links . at [ i , busattr ] = b1
n . links . at [ i , " p_nom " ] = min (
n . links . at [ i , " p_nom " ] , n . lines . at [ line , " s_nom " ]
)
n . links . at [ i , " carrier " ] = " DC "
n . links . at [ i , " underwater_fraction " ] = 0.0
n . links . at [ i , " length " ] = n . lines . at [ line , " length " ]
n . remove ( " Line " , line )
n . remove ( " Bus " , b0 )
logger . info (
" Replacing B2B converter ` {} ` together with bus ` {} ` and line ` {} ` by an HVDC tie-line {} - {} " . format (
i , b0 , line , linkcntry . at [ i ] , buscntry . at [ b1 ]
)
2022-09-16 13:04:04 +00:00
)
2018-08-27 12:20:31 +00:00
2020-09-11 10:40:53 +00:00
2022-01-13 17:54:27 +00:00
def _set_links_underwater_fraction ( n , offshore_shapes ) :
2019-02-13 18:03:57 +00:00
if n . links . empty :
return
2019-11-05 13:29:15 +00:00
2019-08-11 14:59:56 +00:00
if not hasattr ( n . links , " geometry " ) :
n . links [ " underwater_fraction " ] = 0.0
else :
2024-07-08 06:29:16 +00:00
offshore_shape = gpd . read_file ( offshore_shapes ) . union_all ( )
2019-08-11 14:59:56 +00:00
links = gpd . GeoSeries ( n . links . geometry . dropna ( ) . map ( shapely . wkt . loads ) )
n . links [ " underwater_fraction " ] = (
links . intersection ( offshore_shape ) . length / links . length
2022-09-16 13:04:04 +00:00
)
2018-08-14 15:01:58 +00:00
2020-09-11 10:40:53 +00:00
2022-01-13 17:54:27 +00:00
def _adjust_capacities_of_under_construction_branches ( n , config ) :
lines_mode = config [ " lines " ] . get ( " under_construction " , " undef " )
2018-08-27 17:13:41 +00:00
if lines_mode == " zero " :
n . lines . loc [ n . lines . under_construction , " num_parallel " ] = 0.0
2019-07-26 09:43:34 +00:00
n . lines . loc [ n . lines . under_construction , " s_nom " ] = 0.0
2018-08-27 17:13:41 +00:00
elif lines_mode == " remove " :
n . mremove ( " Line " , n . lines . index [ n . lines . under_construction ] )
elif lines_mode != " keep " :
2019-11-08 15:46:29 +00:00
logger . warning (
" Unrecognized configuration for `lines: under_construction` = ` {} `. Keeping under construction lines. "
)
2018-08-27 17:13:41 +00:00
2022-01-13 17:54:27 +00:00
links_mode = config [ " links " ] . get ( " under_construction " , " undef " )
2018-08-27 17:13:41 +00:00
if links_mode == " zero " :
n . links . loc [ n . links . under_construction , " p_nom " ] = 0.0
elif links_mode == " remove " :
n . mremove ( " Link " , n . links . index [ n . links . under_construction ] )
elif links_mode != " keep " :
2019-11-08 15:46:29 +00:00
logger . warning (
" Unrecognized configuration for `links: under_construction` = ` {} `. Keeping under construction links. "
)
2018-08-27 17:13:41 +00:00
2019-01-22 09:11:43 +00:00
if lines_mode == " remove " or links_mode == " remove " :
# We might need to remove further unconnected components
n = _remove_unconnected_components ( n )
return n
2024-04-10 15:48:44 +00:00
2024-04-10 15:10:56 +00:00
def _set_shapes ( n , country_shapes , offshore_shapes ) :
# Write the geodataframes country_shapes and offshore_shapes to the network.shapes component
country_shapes = gpd . read_file ( country_shapes ) . rename ( columns = { " name " : " idx " } )
country_shapes [ " type " ] = " country "
offshore_shapes = gpd . read_file ( offshore_shapes ) . rename ( columns = { " name " : " idx " } )
offshore_shapes [ " type " ] = " offshore "
2024-04-11 11:45:02 +00:00
all_shapes = pd . concat ( [ country_shapes , offshore_shapes ] , ignore_index = True )
n . madd (
" Shape " ,
all_shapes . index ,
geometry = all_shapes . geometry ,
idx = all_shapes . idx ,
2024-04-11 14:42:19 +00:00
type = all_shapes [ " type " ] ,
2024-04-11 11:45:02 +00:00
)
2024-04-11 14:26:16 +00:00
2020-09-11 10:40:53 +00:00
2022-01-13 17:54:27 +00:00
def base_network (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
buses ,
converters ,
transformers ,
lines ,
links ,
2022-01-13 17:54:27 +00:00
links_p_nom ,
europe_shape ,
country_shapes ,
offshore_shapes ,
2024-09-18 14:29:05 +00:00
countries ,
2022-01-13 17:54:27 +00:00
parameter_corrections ,
config ,
) :
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
base_network = config [ " electricity " ] . get ( " base_network " )
2024-09-13 12:55:52 +00:00
osm_prebuilt_version = config [ " electricity " ] . get ( " osm-prebuilt-version " )
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
assert base_network in {
" entsoegridkit " ,
" osm-raw " ,
" osm-prebuilt " ,
} , f " base_network must be either ' entsoegridkit ' , ' osm-raw ' or ' osm-prebuilt ' , but got ' { base_network } ' "
if base_network == " entsoegridkit " :
warnings . warn (
" The ' entsoegridkit ' base network is deprecated and will be removed in future versions. Please use ' osm-raw ' or ' osm-prebuilt ' instead. " ,
DeprecationWarning ,
)
2024-09-13 12:55:52 +00:00
logger_str = (
f " Creating base network using { base_network } "
+ ( f " v { osm_prebuilt_version } " if base_network == " osm-prebuilt " else " " )
+ " . "
)
logger . info ( logger_str )
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
2024-09-18 14:29:05 +00:00
buses = _load_buses ( buses , europe_shape , countries , config )
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
transformers = _load_transformers ( buses , transformers )
lines = _load_lines ( buses , lines )
2018-09-24 18:19:47 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
if base_network == " entsoegridkit " :
links = _load_links_from_eg ( buses , links )
converters = _load_converters_from_eg ( buses , converters )
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
# Optionally reconnect Crimea
if ( config [ " lines " ] . get ( " reconnect_crimea " , True ) ) & (
" UA " in config [ " countries " ]
) :
lines = _reconnect_crimea ( lines )
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
# Set electrical parameters of lines and links
lines = _set_electrical_parameters_lines_eg ( lines , config )
links = _set_electrical_parameters_links_eg ( links , config , links_p_nom )
elif base_network in { " osm-prebuilt " , " osm-raw " } :
links = _load_links_from_osm ( buses , links )
converters = _load_converters_from_osm ( buses , converters )
# Set electrical parameters of lines and links
lines = _set_electrical_parameters_lines_osm ( lines , config )
links = _set_electrical_parameters_links_osm ( links , config )
else :
raise ValueError (
" base_network must be either ' entsoegridkit ' , ' osm-raw ' , or ' osm-prebuilt ' "
)
2023-10-09 14:16:53 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
# Set electrical parameters of transformers and converters
2022-01-13 17:54:27 +00:00
transformers = _set_electrical_parameters_transformers ( transformers , config )
converters = _set_electrical_parameters_converters ( converters , config )
2017-12-18 19:31:27 +00:00
n = pypsa . Network ( )
2024-09-13 12:55:52 +00:00
n . name = (
f " PyPSA-Eur ( { base_network } "
+ ( f " v { osm_prebuilt_version } " if base_network == " osm-prebuilt " else " " )
+ " ) "
)
2017-12-18 19:31:27 +00:00
2024-03-14 14:15:56 +00:00
time = get_snapshots ( snakemake . params . snapshots , snakemake . params . drop_leap_day )
n . set_snapshots ( time )
2017-12-18 19:31:27 +00:00
n . import_components_from_dataframe ( buses , " Bus " )
n . import_components_from_dataframe ( lines , " Line " )
n . import_components_from_dataframe ( transformers , " Transformer " )
n . import_components_from_dataframe ( links , " Link " )
n . import_components_from_dataframe ( converters , " Link " )
2018-03-14 12:18:26 +00:00
_set_lines_s_nom_from_linetypes ( n )
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
if config [ " electricity " ] . get ( " base_network " ) == " entsoegridkit " :
_apply_parameter_corrections ( n , parameter_corrections )
2017-12-18 19:31:27 +00:00
2020-08-24 08:33:46 +00:00
n = _remove_unconnected_components ( n )
2022-01-13 17:54:27 +00:00
_set_countries_and_substations ( n , config , country_shapes , offshore_shapes )
2018-01-29 21:28:33 +00:00
2022-01-13 17:54:27 +00:00
_set_links_underwater_fraction ( n , offshore_shapes )
2018-08-14 15:01:58 +00:00
2018-08-27 12:20:31 +00:00
_replace_b2b_converter_at_country_border_by_link ( n )
2022-01-13 17:54:27 +00:00
n = _adjust_capacities_of_under_construction_branches ( n , config )
2018-08-27 17:13:41 +00:00
2024-04-10 15:10:56 +00:00
_set_shapes ( n , country_shapes , offshore_shapes )
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
# Add carriers if they are present in buses.carriers
carriers_in_buses = set ( n . buses . carrier . dropna ( ) . unique ( ) )
carriers = carriers_in_buses . intersection ( { " AC " , " DC " } )
if carriers :
n . madd ( " Carrier " , carriers )
2017-12-18 19:31:27 +00:00
return n
2022-09-16 13:04:04 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
def _get_linetypes_config ( line_types , voltages ) :
"""
Return the dictionary of linetypes for selected voltages . The dictionary is
a subset of the dictionary line_types , whose keys match the selected
voltages .
Parameters
- - - - - - - - - -
line_types : dict
Dictionary of linetypes : keys are nominal voltages and values are linetypes .
voltages : list
List of selected voltages .
Returns
- - - - - - -
Dictionary of linetypes for selected voltages .
"""
# get voltages value that are not available in the line types
vnoms_diff = set ( voltages ) . symmetric_difference ( set ( line_types . keys ( ) ) )
if vnoms_diff :
logger . warning (
f " Voltages { vnoms_diff } not in the { line_types } or { voltages } list. "
)
return { k : v for k , v in line_types . items ( ) if k in voltages }
def _get_linetype_by_voltage ( v_nom , d_linetypes ) :
"""
Return the linetype of a specific line based on its voltage v_nom .
Parameters
- - - - - - - - - -
v_nom : float
The voltage of the line .
d_linetypes : dict
Dictionary of linetypes : keys are nominal voltages and values are linetypes .
Returns
- - - - - - -
The linetype of the line whose nominal voltage is closest to the line voltage .
"""
v_nom_min , line_type_min = min (
d_linetypes . items ( ) ,
key = lambda x : abs ( x [ 0 ] - v_nom ) ,
)
return line_type_min
2024-07-24 13:31:46 +00:00
def voronoi ( points , outline , crs = 4326 ) :
2024-05-03 12:50:14 +00:00
"""
2024-07-24 13:31:46 +00:00
Create Voronoi polygons from a set of points within an outline .
2024-05-03 12:50:14 +00:00
"""
2024-07-24 13:31:46 +00:00
pts = gpd . GeoSeries (
gpd . points_from_xy ( points . x , points . y ) ,
index = points . index ,
crs = crs ,
)
voronoi = pts . voronoi_polygons ( extend_to = outline ) . clip ( outline )
2024-05-03 12:50:14 +00:00
2024-07-24 13:31:46 +00:00
# can be removed with shapely 2.1 where order is preserved
# https://github.com/shapely/shapely/issues/2020
with warnings . catch_warnings ( ) :
warnings . filterwarnings ( " ignore " , category = UserWarning )
pts = gpd . GeoDataFrame ( geometry = pts )
voronoi = gpd . GeoDataFrame ( geometry = voronoi )
joined = gpd . sjoin_nearest ( pts , voronoi , how = " right " )
2024-05-03 12:50:14 +00:00
2024-08-04 14:01:51 +00:00
return joined . dissolve ( by = " Bus " ) . reindex ( points . index ) . squeeze ( )
2024-05-03 12:50:14 +00:00
def build_bus_shapes ( n , country_shapes , offshore_shapes , countries ) :
country_shapes = gpd . read_file ( country_shapes ) . set_index ( " name " ) [ " geometry " ]
offshore_shapes = gpd . read_file ( offshore_shapes )
offshore_shapes = offshore_shapes . reindex ( columns = REGION_COLS ) . set_index ( " name " ) [
" geometry "
]
onshore_regions = [ ]
offshore_regions = [ ]
for country in countries :
c_b = n . buses . country == country
onshore_shape = country_shapes [ country ]
onshore_locs = (
n . buses . loc [ c_b & n . buses . onshore_bus ]
. sort_values (
by = " substation_lv " , ascending = False
) # preference for substations
. drop_duplicates ( subset = [ " x " , " y " ] , keep = " first " ) [ [ " x " , " y " ] ]
)
onshore_regions . append (
gpd . GeoDataFrame (
{
" name " : onshore_locs . index ,
" x " : onshore_locs [ " x " ] ,
" y " : onshore_locs [ " y " ] ,
2024-07-24 13:31:46 +00:00
" geometry " : voronoi ( onshore_locs , onshore_shape ) ,
2024-05-03 12:50:14 +00:00
" country " : country ,
2024-07-08 06:29:16 +00:00
} ,
crs = n . crs ,
2024-05-03 12:50:14 +00:00
)
)
if country not in offshore_shapes . index :
continue
offshore_shape = offshore_shapes [ country ]
offshore_locs = n . buses . loc [ c_b & n . buses . substation_off , [ " x " , " y " ] ]
offshore_regions_c = gpd . GeoDataFrame (
{
" name " : offshore_locs . index ,
" x " : offshore_locs [ " x " ] ,
" y " : offshore_locs [ " y " ] ,
2024-07-24 13:31:46 +00:00
" geometry " : voronoi ( offshore_locs , offshore_shape ) ,
2024-05-03 12:50:14 +00:00
" country " : country ,
2024-07-08 06:29:16 +00:00
} ,
crs = n . crs ,
2024-05-03 12:50:14 +00:00
)
2024-07-08 06:29:16 +00:00
sel = offshore_regions_c . to_crs ( 3035 ) . area > 10 # m2
offshore_regions_c = offshore_regions_c . loc [ sel ]
2024-05-03 12:50:14 +00:00
offshore_regions . append ( offshore_regions_c )
2024-07-08 06:29:16 +00:00
shapes = pd . concat ( onshore_regions , ignore_index = True ) . set_crs ( n . crs )
2024-05-03 12:50:14 +00:00
2024-05-21 13:28:24 +00:00
return onshore_regions , offshore_regions , shapes , offshore_shapes
2024-05-03 12:50:14 +00:00
def append_bus_shapes ( n , shapes , type ) :
"""
Append shapes to the network . If shapes with the same component and type
already exist , they will be removed .
Parameters :
n ( pypsa . Network ) : The network to which the shapes will be appended .
shapes ( geopandas . GeoDataFrame ) : The shapes to be appended .
* * kwargs : Additional keyword arguments used in ` n . madd ` .
Returns :
None
"""
remove = n . shapes . query ( " component == ' Bus ' and type == @type " ) . index
n . mremove ( " Shape " , remove )
offset = n . shapes . index . astype ( int ) . max ( ) + 1 if not n . shapes . empty else 0
shapes = shapes . rename ( lambda x : int ( x ) + offset )
n . madd (
" Shape " ,
shapes . index ,
geometry = shapes . geometry ,
idx = shapes . name ,
component = " Bus " ,
type = type ,
)
2017-12-18 19:31:27 +00:00
if __name__ == " __main__ " :
if " snakemake " not in globals ( ) :
2019-12-09 20:29:15 +00:00
from _helpers import mock_snakemake
2024-04-10 15:48:44 +00:00
2019-12-09 20:29:15 +00:00
snakemake = mock_snakemake ( " base_network " )
2019-11-28 07:22:52 +00:00
configure_logging ( snakemake )
2023-08-15 13:02:41 +00:00
set_scenario_config ( snakemake )
2017-12-18 19:31:27 +00:00
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
countries = snakemake . params . countries
buses = snakemake . input . buses
converters = snakemake . input . converters
transformers = snakemake . input . transformers
lines = snakemake . input . lines
links = snakemake . input . links
europe_shape = snakemake . input . europe_shape
country_shapes = snakemake . input . country_shapes
offshore_shapes = snakemake . input . offshore_shapes
config = snakemake . config
if " links_p_nom " in snakemake . input . keys ( ) :
links_p_nom = snakemake . input . links_p_nom
else :
links_p_nom = None
if " parameter_corrections " in snakemake . input . keys ( ) :
parameter_corrections = snakemake . input . parameter_corrections
else :
parameter_corrections = None
2022-01-24 18:48:26 +00:00
n = base_network (
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
buses ,
converters ,
transformers ,
lines ,
links ,
links_p_nom ,
europe_shape ,
country_shapes ,
offshore_shapes ,
2024-09-18 14:29:05 +00:00
countries ,
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
parameter_corrections ,
config ,
2022-01-24 18:48:26 +00:00
)
2020-09-11 10:40:53 +00:00
2024-05-21 13:28:24 +00:00
onshore_regions , offshore_regions , shapes , offshore_shapes = build_bus_shapes (
2024-05-03 12:50:14 +00:00
n ,
Introducing OpenStreetMap high-voltage grid to PyPSA-Eur (#1079)
* Implemented which uses the overpass API to download power features for individual countries.
* Extended rule by input.
* Bug fixes and improvements to clean_osm_data.py. Added in retrieve_osm_data.py.
* Updated clean_osm_data and retrieve_osm_data to create clean substations.
* Finished clean_osm_data function.
* Added check whether line is a circle. If so, drop it.
* Extended build_electricity.smk by build_osm_network.py
* Added build_osm_network
* Working osm-network-fast
* Bug fixes.
* Finalised and cleaned including docstrings.
* Added try catch to retrieve_osm_data. Allows for parallelisation of downloads.
* Updated cleaning process.
* Set maximum number of threads for retrieving to 4, wrt. fair usage policy and potential request errors.
* Intermediate update on clean_osm_data.py. Added docstrings.
* Bug fix.
* Bug fix.
* Bug fixes in data types out of clean_osm_data
* Significant improvements to retrieve_osm_data, clean_osm_data. Cleaned code. Speed improvements
* Cleaned config.
* Fixes.
* Bug fixes.
* Updated default config
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed overpass from required packages. Not needed anymore.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added links_relations (route = power, frequency = 0) to retrieval. This will change how HVDC links are extracted in the near future.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Work-in-progress clean_osm_data
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added clean links output to clean_osm_data. Script uses OSM relations to retrieve clean HVDC links.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* New code for integrating HVDC links. Using relations. Base network implementation functioning.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed manual line dropping.
* Updated clean script
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reverted Snakefile to default: sync settings
* added prebuilt functionality.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_electricity.smk to work with scenario management.
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed commented-out code.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed bug in pdf export by substituting pdf export with svg.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bug-fix Snakefile
* dropped not needed columns from build_osm_network.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated build_shapes, config.default and clean_osm_data.
* pre-commit changes.
* test
* Added initial prepare_osm_network_release.py script
* Finalised prepare_osm_network_release script to build clean and stable OSM base_network input files.
* Added new rules/development.smk
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Updated clean_osm_data to add substation_centroid to linestrings
* Added osm-prebuilt functionality and zenodo sandbox repository.
* Updated clean_osm_data to geopandas v.1.01
* Made base_network and build_osm_network function more robust for empty links.
* Made base_network and build_osm_network function more robust for empty links.
* Bug fix in base_network. Voltage level null is now kept (relevant e.g. for Corsica)
* Merge with hcanges in upstream PR 1146. Fixing UA and MD.
* Updated Zenodo and fixed prepare_osm_network_release
* Updated osm network release.
* Updated prepare osm network release.
* Updated MD, UA scripts.
* Cleaned determine_availability_matrix_MD_UA.py, removed redundant code
* Bug fixes.
* Bug fixes for UA MD scripts.
* Rename of build script.
* Bug fix: only distribute load to buses with substation.
* Updated zenodo sandbox repository.
* Updated config.default
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated.
* Cleaned config.default.yaml: Related settings grouped together and redundant voltage settings aggregated. Added release notes.
* Updated Zenodo repositories for OSM-prebuilt to offcial publication.
* Updated configtables
* Updated links.csv: Under_construction lines to in commission.
* Updated link 8394 and parameter_corrections: Continuation of North-Sea-Link.
* Major update: fix simplify_network, fix Corsica, updated build_osm_network to include lines overpassing nodes.
* remove config backup
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* Bug fix: Carrier type of all supernodes corrected to 'AC'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated rules and base_network for compatibility with TYNDP projects.
* Updated Zenodo repository and prebuilt network to include 150 kV HVDC connections.
* Removed outdated config backup.
* Implemented all comments from PR #1079. Cleaned up OSM implementation.
* Bug fix: Added all voltages, 200 kV-750 kV, to default config.
* Cleaning and bugfixes.
* Updated Zenodo repository to https://zenodo.org/records/13358976. Added converter voltages, 'underground' property for DC lines/cables, and included Konti-Skan HVDC (DK-SE). Added compatibility with https://github.com/PyPSA/pypsa-eur/pull/1079 and https://github.com/PyPSA/pypsa-eur/pull/1085
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify_network: handle complicated transformer topologies
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* syntax fix
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2024-08-22 13:01:20 +00:00
country_shapes ,
offshore_shapes ,
countries ,
2024-05-03 12:50:14 +00:00
)
shapes . to_file ( snakemake . output . regions_onshore )
2024-08-26 15:16:06 +00:00
# append_bus_shapes(n, shapes, "onshore")
2024-05-03 12:50:14 +00:00
if offshore_regions :
shapes = pd . concat ( offshore_regions , ignore_index = True )
shapes . to_file ( snakemake . output . regions_offshore )
2024-08-26 15:16:06 +00:00
# append_bus_shapes(n, shapes, "offshore")
2024-05-03 12:50:14 +00:00
else :
offshore_shapes . to_frame ( ) . to_file ( snakemake . output . regions_offshore )
2022-06-30 06:39:03 +00:00
n . meta = snakemake . config
2024-05-03 12:50:14 +00:00
n . export_to_netcdf ( snakemake . output . base_network )