Rule cluster_network¶
Workflow Diagram
See the complete workflow in the repository.
digraph snakemake_dag { graph [bgcolor=white, margin=0, size="8,5" ]; node [fontname=sans, fontsize=10, penwidth=2, shape=box, style=rounded ]; edge [color=grey, penwidth=2 ]; 1 [color="0.50 0.6 0.85", label=prepare_network]; 2 [color="0.36 0.6 0.85", fillcolor=gray, label=cluster_network, style=filled]; 2 -> 1; 3 [color="0.14 0.6 0.85", label=simplify_network]; 3 -> 2; }
Script Documentation¶
Creates networks clustered to {cluster} number of zones with aggregated
buses, generators and transmission corridors.
Relevant Settings¶
.. code:: yaml
clustering:
aggregation_strategies:
focus_weights:
solving:
solver:
name:
lines:
length_factor:
.. seealso::
Documentation of the configuration file config.yaml at
:ref:toplevel_cf, :ref:renewable_cf, :ref:solving_cf, :ref:lines_cf
Inputs¶
resources/regions_onshore_elec_s{simpl}.geojson: confer :ref:simplifyresources/regions_offshore_elec_s{simpl}.geojson: confer :ref:simplifyresources/busmap_elec_s{simpl}.csv: confer :ref:simplifynetworks/elec_s{simpl}.nc: confer :ref:simplifydata/custom_busmap_elec_s{simpl}_{clusters}.csv: optional input
Outputs¶
-
resources/regions_onshore_elec_s{simpl}_{clusters}.geojson:.. image:: /img/regions_onshore_elec_s_X.png :width: 33 %
-
resources/regions_offshore_elec_s{simpl}_{clusters}.geojson:.. image:: /img/regions_offshore_elec_s_X.png :width: 33 %
-
resources/busmap_elec_s{simpl}_{clusters}.csv: Mapping of buses fromnetworks/elec_s{simpl}.nctonetworks/elec_s{simpl}_{clusters}.nc; resources/linemap_elec_s{simpl}_{clusters}.csv: Mapping of lines fromnetworks/elec_s{simpl}.nctonetworks/elec_s{simpl}_{clusters}.nc;-
networks/elec_s{simpl}_{clusters}.nc:.. image:: /img/elec_s_X.png :width: 40 %
Description¶
.. note::
**Why is clustering used both in** ``simplify_network`` **and** ``cluster_network`` **?**
Consider for example a network ``networks/elec_s100_50.nc`` in which
``simplify_network`` clusters the network to 100 buses and in a second
step ``cluster_network``` reduces it down to 50 buses.
In preliminary tests, it turns out, that the principal effect of
changing spatial resolution is actually only partially due to the
transmission network. It is more important to differentiate between
wind generators with higher capacity factors from those with lower
capacity factors, i.e. to have a higher spatial resolution in the
renewable generation than in the number of buses.
The two-step clustering allows to study this effect by looking at
networks like ``networks/elec_s100_50m.nc``. Note the additional
``m`` in the ``{cluster}`` wildcard. So in the example network
there are still up to 100 different wind generators.
In combination these two features allow you to study the spatial
resolution of the transmission network separately from the
spatial resolution of renewable generators.
**Is it possible to run the model without the** ``simplify_network`` **rule?**
No, the network clustering methods in the PyPSA module
`pypsa.clustering.spatial <https://github.com/PyPSA/PyPSA/blob/master/pypsa/networkclustering.py>`_
do not work reliably with multiple voltage levels and transformers.
.. tip::
The rule :mod:cluster_all_networks runs
for all scenario s in the configuration file
the rule :mod:cluster_network.
Exemplary unsolved network clustered to 512 nodes:
.. image:: /img/elec_s_512.png :width: 40 % :align: center
Exemplary unsolved network clustered to 256 nodes:
.. image:: /img/elec_s_256.png :width: 40 % :align: center
Exemplary unsolved network clustered to 128 nodes:
.. image:: /img/elec_s_128.png :width: 40 % :align: center
Exemplary unsolved network clustered to 37 nodes:
.. image:: /img/elec_s_37.png :width: 40 % :align: center
distribute_clusters(inputs, build_shape_options, country_list, distribution_cluster, n, n_clusters, focus_weights=None, solver_name=None)
¶
Determine the number of clusters per country.
groupby_bus_carrier(network, aggregation_strategies, exclude_carriers=[])
¶
Group generators and storage units by (bus, carrier).
Parameters¶
network : pypsa.Network The PyPSA network to modify in-place. aggregation_strategies : dict Aggregation strategies for different columns. exclude_carriers : list, optional List of carriers to exclude from grouping, by default [].
Returns¶
None