Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include interest area in AC clustering #662

Open
wants to merge 76 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
6e2a0d5
include exclusion area
CarlosEpia Aug 7, 2023
670ff5e
add plot_carrier to the etrago methods
CarlosEpia Aug 7, 2023
4dac3b1
include engine and session to loaded etrago obj
CarlosEpia Aug 9, 2023
761b503
include function find_buses_area for clustering
CarlosEpia Aug 9, 2023
c4c09c5
merge dev
CarlosEpia Sep 20, 2023
ea86aa0
Simplify adjust_no_electric_network by not creating new buses
CarlosEpia Sep 21, 2023
030f8ec
receive also shapefiles to not clustered area
CarlosEpia Sep 21, 2023
0d78999
Document exclusion_area
CarlosEpia Sep 21, 2023
adccc1f
apply Black
CarlosEpia Sep 21, 2023
75cbf94
use isort
CarlosEpia Sep 21, 2023
8ad8894
merge dev
CarlosEpia Oct 23, 2023
bf2ca6c
Black and delete comments
CarlosEpia Oct 26, 2023
c2436da
Allow importing extnesion scenario, e.g. for lines from NEP
ClaraBuettner Oct 31, 2023
92d6480
Update documentation for scenario_extension
ClaraBuettner Oct 31, 2023
ec5b7f2
merge dev
CarlosEpia Nov 1, 2023
da2ee15
using flake8
CarlosEpia Nov 1, 2023
eee7911
adapt select_elec_network
CarlosEpia Nov 1, 2023
b817a10
include weighting for area
CarlosEpia Nov 1, 2023
80303b7
perform clustering area of interest
CarlosEpia Nov 1, 2023
9703ed0
gas adaptation to cluster interest area
CarlosEpia Nov 1, 2023
b543366
using isort
CarlosEpia Nov 1, 2023
c267178
fix incorrect name
CarlosEpia Nov 1, 2023
33fa5e9
include area of interest in kmeans clustering
CarlosEpia Nov 2, 2023
4acd371
include cluster_exclusion_area in args
CarlosEpia Nov 8, 2023
06e3476
create function include_busmap_area
CarlosEpia Nov 14, 2023
e6beaa6
Merge branch 'features/extendable_lines_from_nep' into hybit
CarlosEpia Nov 28, 2023
ef4db3e
Merge branch 'dev' into hybit
CarlosEpia Mar 14, 2024
6d99955
hot fix DLR
CarlosEpia Mar 22, 2024
033df50
avoid error when no generators
CarlosEpia Mar 22, 2024
3142f15
include busmap_area in general busmap
CarlosEpia Mar 22, 2024
fbaee5a
Revert "delete provisional fixes for status2019 - part2"
CarlosEpia Mar 26, 2024
3a49e19
use network instead of etrago
CarlosEpia Mar 31, 2024
3e8d4fe
move select_elec_network to utilities
CarlosEpia Apr 1, 2024
8bbfff9
keep just lines connecting remaining buses
CarlosEpia Apr 1, 2024
a8d8736
Merge branch 'fixes/#735-gas-clustering-not-working-with-status2019' …
CarlosEpia Apr 1, 2024
d05e051
Using black
CarlosEpia Apr 1, 2024
8704ea1
fix gas clustering when interest_area
CarlosEpia Apr 1, 2024
b327cf0
Make possible to cluster just the interest area
CarlosEpia Apr 4, 2024
0bab5d4
update args and parameters description
CarlosEpia Apr 4, 2024
6dfb1d5
unify interest_area in args
CarlosEpia Apr 21, 2024
8591d81
update args
CarlosEpia Apr 22, 2024
2ff73a1
update args description
CarlosEpia Apr 22, 2024
0cb1fa6
rename cluster_interest_area
CarlosEpia Apr 22, 2024
e8f0fce
include interest area in args json
CarlosEpia Apr 23, 2024
7fa846e
make ehv clustering off again by default
CarlosEpia Apr 23, 2024
34cb40c
Merge branch 'dev' into hybit
CarlosEpia Apr 23, 2024
4b464ff
flake8 fixes
CarlosEpia Apr 23, 2024
05baf9e
Add option to plot interest area
birgits May 5, 2024
47eef90
Drop isolated buses when lines are decomissioned
ClaraBuettner Jun 8, 2024
9edf004
Apply black
ClaraBuettner Jun 8, 2024
45c6be8
Apply black
ClaraBuettner Jun 8, 2024
976759a
create method adjust_before_optimization
CarlosEpia Jun 11, 2024
260a059
Merge branch 'dev' into hybit
CarlosEpia Aug 8, 2024
480f2ec
Merge branch 'dev' into features/extendable_lines_from_nep
ClaraBuettner Aug 16, 2024
e11cf54
Remove extra argument for scn_decomissioing
ClaraBuettner Aug 16, 2024
c8b1a72
Fix flake8 issues
ClaraBuettner Aug 16, 2024
0dff150
Merge branch 'hybit' into features/extendable_lines_from_nep
ClaraBuettner Aug 16, 2024
05c04e9
Apply black
ClaraBuettner Aug 16, 2024
0d9ac96
Fix flake8 issue
ClaraBuettner Aug 16, 2024
52a1022
Apply isort
ClaraBuettner Aug 16, 2024
7da09d5
Merge pull request #746 from openego/features/extendable_lines_from_nep
ClaraBuettner Aug 16, 2024
f932d49
Add import of shapely
ClaraBuettner Aug 16, 2024
1f4f317
Check if type of geom is a geometry entry
ClaraBuettner Aug 16, 2024
fef9990
Add cluster strategy for scn_name
ClaraBuettner Aug 16, 2024
e23dcd7
Drop duplicate HV buses for eHv clustering busmap
ClaraBuettner Aug 19, 2024
0f4e7ab
Add option for negative load shedding at e-Mobility buses
ClaraBuettner Aug 20, 2024
4265a32
Fix bug when there are different scenario names
birgits Aug 20, 2024
cec6836
assign value to n_clusters when apply_on is market_model
CarlosEpia Aug 21, 2024
b4af09f
Delete outdated fix
ClaraBuettner Aug 22, 2024
86e2d8f
Set negative load shedding for ev buses to True by default
ClaraBuettner Aug 23, 2024
57744fc
Merge pull request #759 from openego/fixes/negative-load-shedding-ev
birgits Aug 23, 2024
e23e136
Revert "Set negative load shedding for ev buses to True by default"
CarlosEpia Nov 13, 2024
ec51267
Revert "Add option for negative load shedding at e-Mobility buses"
CarlosEpia Nov 13, 2024
e0bee93
Merge branch 'dev' into hybit
CarlosEpia Nov 14, 2024
067768a
Black
CarlosEpia Nov 14, 2024
b3d7b41
Merge branch 'dev' into hybit
CarlosEpia Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions etrago/analyze/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import tilemapbase

from etrago.execute import import_gen_from_links
from etrago.tools.utilities import find_buses_area

__copyright__ = (
"Flensburg University of Applied Sciences, "
Expand Down Expand Up @@ -2476,6 +2477,8 @@ def plot_grid(
* 'q_flow_max': maximal reactive flows
* 'dlr': energy above nominal capacity
* 'grey': plot all lines and DC links grey colored
* 'interest_area': plot all AC buses inside the interest area larger
than buses outside the interest area

bus_sizes : float, optional
Size of buses. The default is 0.001.
Expand Down Expand Up @@ -2909,6 +2912,22 @@ def plot_grid(
bus_sizes[bus_sizes != "AC"] = 0
bus_sizes[bus_sizes == "AC"] = 1 * bus_scaling
bus_scaling = bus_sizes
elif bus_colors == "interest_area":
bus_scaling = bus_sizes
# only plot AC buses
bus_sizes = pd.Series(
data=network.buses.carrier, index=network.buses.index
)
bus_sizes[bus_sizes != "AC"] = 0
bus_sizes[bus_sizes == "AC"] = 1 * bus_scaling
# only plot buses inside interest area
buses_interest_area = find_buses_area(self, "AC")
buses_outside = [
_ for _ in bus_sizes.index if _ not in buses_interest_area
]
bus_sizes.loc[buses_outside] = bus_sizes.loc[buses_outside] * 0.3
bus_scaling = bus_sizes
bus_colors = coloring()["AC"]
else:
logger.warning("bus_color {} undefined".format(bus_colors))

Expand Down
72 changes: 35 additions & 37 deletions etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
"model_formulation": "kirchhoff", # angles or kirchhoff
"scn_name": "eGon2035", # scenario: eGon2035, eGon100RE or status2019
# Scenario variations:
"scn_extension": None, # None or array of extension scenarios
"scn_decommissioning": None, # None or decommissioning scenario
"scn_extension": ["nep2021_c2035"], # None or array of extension scenarios
# Export options:
"lpfile": False, # save pyomo's lp file: False or /path/to/lpfile.lp
"csv_export": "results", # save results as csv: False or /path/tofolder
Expand All @@ -113,15 +112,17 @@
"extra_functionality": {}, # Choose function name or {}
# Spatial Complexity:
"delete_dispensable_ac_buses": True, # bool. Find and delete expendable buses
"interest_area": False, # False, path to shapefile or list of nuts names of the area that is excluded from the clustering. By default the buses inside remain the same, but the parameter "n_cluster_interest_area" inside "network clustering" defines if it should be clustered to a certain number of buses.
"network_clustering_ehv": {
"active": False, # choose if clustering of HV buses to EHV buses is activated
"busmap": False, # False or path to stored busmap
},
"network_clustering": {
"active": True, # choose if clustering is activated
"method": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra
"n_clusters_AC": 30, # total number of resulting AC nodes (DE+foreign)
"n_clusters_AC": 30, # total number of resulting AC nodes (DE+foreign-interest_area)
"cluster_foreign_AC": False, # take foreign AC buses into account, True or False
"n_cluster_interest_area": False, # False or number of buses.
"method_gas": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra
"n_clusters_gas": 14, # total number of resulting CH4 nodes (DE+foreign)
"cluster_foreign_gas": False, # take foreign CH4 buses into account, True or False
Expand Down Expand Up @@ -263,40 +264,20 @@ def run_etrago(args, json_path):
scn_name : str
Choose your scenario. Currently, there are two different
scenarios: "eGon2035", "eGon100RE". Default: "eGon2035".
scn_extension : None or str
This option does currently not work!
scn_extension : None or list of str

Choose extension-scenarios which will be added to the existing
network container. Data of the extension scenarios are located in
extension-tables (e.g. model_draft.ego_grid_pf_hv_extension_bus)
with the prefix 'extension\_'.
There are three overlay networks:

* 'nep2035_confirmed' includes all planed new lines confirmed by the
Bundesnetzagentur
* 'nep2035_b2' includes all new lines planned by the
Netzentwicklungsplan 2025 in scenario 2035 B2
* 'BE_NO_NEP 2035' includes planned lines to Belgium and Norway and
adds BE and NO as electrical neighbours

network container. In case new lines replace existing ones, these are
dropped from the network. Data of the extension scenarios is located in
extension-tables (e.g. grid.egon_etrago_extension_line)
There are two overlay networks:

* 'nep2021_confirmed' includes all planed new lines confirmed by the
Bundesnetzagentur included in the NEP version 2021
* 'nep2021_c2035' includes all new lines planned by the
Netzentwicklungsplan 2021 in scenario 2035 C
Default: None.
scn_decommissioning : NoneType or str
This option does currently not work!

Choose an extra scenario which includes lines you want to decommission
from the existing network. Data of the decommissioning scenarios are
located in extension-tables
(e.g. model_draft.ego_grid_pf_hv_extension_bus) with the prefix
'decommissioning\_'.
Currently, there are two decommissioning_scenarios which are linked to
extension-scenarios:

* 'nep2035_confirmed' includes all lines that will be replaced in
confirmed projects
* 'nep2035_b2' includes all lines that will be replaced in
NEP-scenario 2035 B2

Default: None.
lpfile : bool or str
State if and where you want to save pyomo's lp file. Options:
False or '/path/tofile.lp'. Default: False.
Expand Down Expand Up @@ -404,6 +385,16 @@ def run_etrago(args, json_path):
connected lines are merged. This reduces the spatial complexity without
losing any accuracy.
Default: True.

interest_area: False, list, string
Area of especial interest that will be not clustered, except when
n_cluster_interest_area is provided. It is by default set to false.
When an interest_area is provided, the given value for n_clusters_AC
will mean the total of AC buses outside the area.The area can be
provided in two ways: list of nuts names e.G.
["Cuxhaven", "Bremerhaven", "Bremen"] or a string with a path to a
shape file (.shp).

network_clustering_ehv : dict
Choose if you want to apply an extra high voltage clustering to the
electrical network.
Expand Down Expand Up @@ -435,12 +426,14 @@ def run_etrago(args, json_path):
* "kmeans": considers geographical locations of buses
* "kmedoids-dijkstra": considers electrical distances between
buses

Default: "kmedoids-dijkstra".
* "n_clusters_AC" : int
* "n_clusters_AC" : int, False
Defines total number of resulting AC nodes including DE and foreign
nodes if `cluster_foreign_AC` is set to True, otherwise only DE
nodes.
nodes. When using the interest_area parameter, n_clusters_AC could
be set to False, which means that only the buses inside the
provided area are clustered.

Default: 30.
* "cluster_foreign_AC" : bool
If set to False, the AC buses outside Germany are not clustered
Expand All @@ -449,13 +442,18 @@ def run_etrago(args, json_path):
as well and included in number of clusters specified through
``'n_clusters_AC'``.
Default: False.

* "n_cluster_interest_area": False, int
Number of buses to cluster all the electrical buses in the area
of interest. Method provided in the arg "method" is used. If
it is set to False, the area of interest is not clustered.
Default: False.
* "method_gas" : str
Method used for gas clustering. You can choose between two
clustering methods:
* "kmeans": considers geographical locations of buses
* "kmedoids-dijkstra": considers 'electrical' distances between
buses

Default: "kmedoids-dijkstra".
* "n_clusters_gas" : int
Defines total number of resulting CH4 nodes including DE and
Expand Down
3 changes: 2 additions & 1 deletion etrago/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"model_formulation": "kirchhoff",
"scn_name": "eGon2035",
"scn_extension": null,
"scn_decommissioning": null,
"lpfile": false,
"csv_export": "results",
"extendable": {
Expand Down Expand Up @@ -62,6 +61,7 @@
"generator_noise": 789456,
"extra_functionality": {},
"delete_dispensable_ac_buses": true,
"interest_area": false,
"network_clustering_ehv": {
"active": false,
"busmap": false
Expand All @@ -71,6 +71,7 @@
"method": "kmedoids-dijkstra",
"n_clusters_AC": 30,
"cluster_foreign_AC": false,
"n_cluster_interest_area": false,
"method_gas": "kmedoids-dijkstra",
"n_clusters_gas": 17,
"cluster_foreign_gas": false,
Expand Down
Loading