Rule simplify_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 ]; 2 [color="0.36 0.6 0.85", label=cluster_network]; 3 [color="0.14 0.6 0.85", fillcolor=gray, label=simplify_network, style=filled]; 3 -> 2; 4 [color="0.61 0.6 0.85", label=add_electricity]; 4 -> 3; 5 [color="0.19 0.6 0.85", label=build_bus_regions]; 5 -> 3; }
Script Documentation¶
Lifts the electrical transmission network to a single configured voltage layer, removes dead ends of the network, and reduces multi-hop HVDC connections to a single link.
Relevant Settings¶
.. code:: yaml
clustering:
simplify:
aggregation_strategies:
costs:
output_currency:
electricity:
base_voltage:
lines:
length_factor:
links:
p_max_pu:
solving:
solver:
name:
.. seealso::
Documentation of the configuration file config.yaml at
:ref:costs_cf, :ref:electricity_cf, :ref:renewable_cf,
:ref:lines_cf, :ref:links_cf, :ref:solving_cf
Inputs¶
resources/costs.csv: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity.resources/regions_onshore.geojson: confer :ref:busregionsresources/regions_offshore.geojson: confer :ref:busregionsnetworks/elec.nc: confer :ref:electricity
Outputs¶
-
resources/regions_onshore_elec_s{simpl}.geojson:.. image:: /img/regions_onshore_elec_s.png :width: 33 %
-
resources/regions_offshore_elec_s{simpl}.geojson:.. image:: /img/regions_offshore_elec_s .png :width: 33 %
-
resources/busmap_elec_s{simpl}.csv: Mapping of buses fromnetworks/elec.nctonetworks/elec_s{simpl}.nc; -
networks/elec_s{simpl}.nc:.. image:: /img/elec_s.png :width: 33 %
Description¶
The rule :mod:simplify_network does up to four things:
-
Create an equivalent transmission network in which all voltage levels are mapped to the configured base-voltage layer by
simplify_network_to_base_voltage(...). Country-specific line-type mappings are used only when enabled and when mappings are available for every configured country. Otherwise, the complete default mapping is used. AC and DC mappings are evaluated separately. -
DC only sub-networks that are connected at only two buses to the AC network are reduced to a single representative link in the function
simplify_links(...). The components attached to buses in between are moved to the nearest endpoint. The grid connection cost of offshore wind generators are added to the capital costs of the generator. -
Stub lines and links, i.e. dead ends of the network, are sequentially removed from the network in the function
remove_stubs(...). Components are moved along. -
Optionally, if an integer were provided for the wildcard
{simpl}(e.g.networks/elec_s500.nc), the network is clustered to this number of clusters with the routines from thecluster_networkrule with the functioncluster_network.cluster(...). This step is usually skipped!
simplify_network_to_base_voltage(n, ac_types, dc_types, base_voltage, use_country_specific_ac_types, use_country_specific_dc_types)
¶
Map all lines to a common voltage while preserving country-specific types.
Each line is assigned the closest available line type for the country of its first bus. Transmission capacity is preserved by recalculating the number of parallel bundles after updating the voltage and line type. Transformers are removed and connected components are moved from their starting bus to their ending bus.
Parameters¶
n : pypsa.Network Network to simplify. ac_types : dict AC line-type mappings by country and nominal voltage. dc_types : dict DC line-type mappings by country and nominal voltage. base_voltage : float Common nominal voltage assigned to buses and lines. use_country_specific_ac_types : bool Whether to use country-specific AC mappings. use_country_specific_dc_types : bool Whether to use country-specific DC mappings.
Returns¶
tuple Simplified network and transformer bus mapping.
simplify_links(n, costs, renewable_config, hvdc_as_lines, config_lines, config_links, output, exclude_carriers=[], aggregation_strategies=dict())
¶
Simplifies multi-node DC link components into single links between end-points.
Parameters¶
n : pypsa.Network The PyPSA network to be simplified. costs : pd.DataFrame DataFrame containing technology costs. renewable_config : dict Configuration dictionary for renewable technologies. hvdc_as_lines : bool Flag indicating whether HVDC lines are treated as lines. config_lines : dict Configuration dictionary for lines. config_links : dict Configuration dictionary for links. output : object Output object containing file paths for saving results. exclude_carriers : list, optional List of carriers to exclude from simplification, by default []. aggregation_strategies : dict, optional Strategies for aggregating components, by default dict().
Returns¶
n : pypsa.Network The simplified PyPSA network.
drop_isolated_networks(n, threshold)
¶
merge_into_network(n, threshold, aggregation_strategies=dict())
¶
Find isolated AC nodes and sub-networks in the network and merge those of them which have load value and a number of buses below than the specified thresholds into a backbone network.
Parameters¶
n : PyPSA.Network Original network threshold : float Load power used as a threshold to merge isolated nodes aggregation_strategies: dictionary Functions to be applied to calculate parameters of the aggregated grid
Returns¶
modified network
merge_isolated_networks(n, threshold, aggregation_strategies=dict())
¶
Find isolated subnetworks in the network and merge those of them which have load value below than a specified threshold into a single isolated node which represents all the remote generation.
Parameters¶
n : PyPSA.Network Original network threshold : float Load power used as a threshold to merge isolated nodes aggregation_strategies: dictionary Functions to be applied to calculate parameters of the aggregated grid
Returns¶
modified network