From 4b6199de42d8547c35b4b35dec482ab23ffb55b3 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 9 Feb 2024 15:43:27 +0100 Subject: [PATCH 1/2] create a bus for every unique coordinate, not only substations (closes #699) --- rules/postprocess.smk | 6 +++--- scripts/base_network.py | 1 + scripts/build_bus_regions.py | 8 +++++++- scripts/simplify_network.py | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rules/postprocess.smk b/rules/postprocess.smk index 18d65c16..98b90fd1 100644 --- a/rules/postprocess.smk +++ b/rules/postprocess.smk @@ -45,7 +45,7 @@ if config["foresight"] != "perfect": ( LOGS + "plot_power_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log" - ) + ), benchmark: ( BENCHMARKS @@ -74,7 +74,7 @@ if config["foresight"] != "perfect": ( LOGS + "plot_hydrogen_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log" - ) + ), benchmark: ( BENCHMARKS @@ -102,7 +102,7 @@ if config["foresight"] != "perfect": ( LOGS + "plot_gas_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log" - ) + ), benchmark: ( BENCHMARKS diff --git a/scripts/base_network.py b/scripts/base_network.py index 1de3ef96..684ca613 100644 --- a/scripts/base_network.py +++ b/scripts/base_network.py @@ -555,6 +555,7 @@ def _set_countries_and_substations(n, config, country_shapes, offshore_shapes): for b, df in product(("bus0", "bus1"), (n.lines, n.links)): has_connections_b |= ~df.groupby(b).under_construction.min() + buses["onshore_bus"] = onshore_b buses["substation_lv"] = ( lv_b & onshore_b & (~buses["under_construction"]) & has_connections_b ) diff --git a/scripts/build_bus_regions.py b/scripts/build_bus_regions.py index a6500bb0..f9bf287e 100644 --- a/scripts/build_bus_regions.py +++ b/scripts/build_bus_regions.py @@ -135,7 +135,13 @@ if __name__ == "__main__": c_b = n.buses.country == country onshore_shape = country_shapes[country] - onshore_locs = n.buses.loc[c_b & n.buses.substation_lv, ["x", "y"]] + 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( { diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 31bc8f4e..cc4ff4f6 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -611,6 +611,7 @@ if __name__ == "__main__": "symbol", "tags", "under_construction", + "onshore_bus", "substation_lv", "substation_off", "geometry", From c22e47cd58e46b98fb591e5d951652518257e61a Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 16 Feb 2024 12:07:37 +0100 Subject: [PATCH 2/2] add release note --- doc/release_notes.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index cab8229a..08ec9dd5 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -10,6 +10,11 @@ Release Notes Upcoming Release ================ +* Regions are assigned to all buses with unique coordinates in the network with + a preference given to substations. Previously, only substations had assigned + regions, but this could lead to issues when a high spatial resolution was + applied. + * The default configuration ``config/config.default.yaml`` is now automatically used as a base configuration file and no longer copied to ``config/config.yaml`` on first use. The file ``config/config.yaml`` should be