Merge pull request #394 from PyPSA/introduce_modularity_clustering

new spatial clustering method: modularity
This commit is contained in:
Fabian Neumann 2022-07-27 09:04:50 +02:00 committed by GitHub
commit 6903c4305e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
,Unit,Values,Description
simplify_network,,,
-- to_substations,bool,"{'true','false'}","Aggregates all nodes without power injection (positive or negative, i.e. demand or generation) to electrically closest ones"
-- algorithm,str,"One of {kmeans, hac}",
-- algorithm,str,"One of {kmeans, hac, modularity}",
-- feature,str,"Str in the format carrier1+carrier2+...+carrierN-X, where CarrierI can be from {solar, onwind, offwind, ror} and X is one of {cap, time}.",
cluster_network
-- algorithm,str,"One of {kmeans, hac}",

Can't render this file because it has a wrong number of fields in line 6.

View File

@ -63,6 +63,8 @@ PyPSA-Eur 0.5.0 (26th July 2022)
renewable potentials on hourly (feature entry ends with `-time`) or annual
(feature entry in config end with `-cap`) values.
* Greedy modularity clustering was introduced. Distance metric is based on electrical distance taking into account the impedance of all transmission lines of the network.
* Techno-economic parameters of technologies (e.g. costs and efficiencies) will
now be retrieved from a separate repository `PyPSA/technology-data
<https://github.com/pypsa/technology-data>`_ that collects assumptions from a

View File

@ -10,7 +10,7 @@ dependencies:
- python>=3.8
- pip
- pypsa>=0.19.1
- pypsa>=0.20
- atlite>=0.2.6
- dask

View File

@ -135,7 +135,8 @@ import seaborn as sns
from functools import reduce
from pypsa.networkclustering import (busmap_by_kmeans, busmap_by_hac, get_clustering_from_busmap)
from pypsa.networkclustering import (busmap_by_kmeans, busmap_by_hac,
busmap_by_greedy_modularity, get_clustering_from_busmap)
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning)
@ -313,6 +314,8 @@ def busmap_for_n_clusters(n, n_clusters, solver_name, focus_weights=None, algori
return prefix + busmap_by_kmeans(n, weight, n_clusters[x.name], buses_i=x.index, **algorithm_kwds)
elif algorithm == "hac":
return prefix + busmap_by_hac(n, n_clusters[x.name], buses_i=x.index, feature=feature.loc[x.index])
elif algorithm == "modularity":
return prefix + busmap_by_greedy_modularity(n, n_clusters[x.name], buses_i=x.index)
else:
raise ValueError(f"`algorithm` must be one of 'kmeans' or 'hac'. Is {algorithm}.")