Skip to content

Network Building

Scripts for building, simplifying, and clustering the electricity network.


base_network

Creates the network topology from a OpenStreetMap.

Relevant Settings

.. code:: yaml

snapshots:

countries:

electricity:
    voltages:

lines:
    types:
    s_max_pu:
    under_construction:

links:
    p_max_pu:
    p_nom_max:
    under_construction:

transformers:
    x:
    s_nom:
    type:

.. seealso:: Documentation of the configuration file config.yaml at :ref:snapshots_cf, :ref:meta_cf, :ref:electricity_cf, :ref:load_options_cf, :ref:lines_cf, :ref:links_cf, :ref:transformers_cf

Inputs

Outputs

  • networks/base.nc

    .. image:: /img/base.png :width: 33 %

Description

get_country(df)

Extract the two-letter country code from the tags column.

Parameters

df : pd.DataFrame DataFrame that may contain a tags column with OSM tag strings.

Returns

pd.Series Series of ISO 3166-1 alpha-2 country codes, or NaN where absent.

Compute and attach the underwater fraction for each HVDC link.

n : pypsa.Network Network whose links component is updated in-place. fp_offshore_shapes : str Path to the offshore shapes file (GeoPackage or shapefile).

base_network(inputs, base_network_config, countries_config, hvdc_as_lines_config, lines_config, links_config, snapshots_config, transformers_config, voltages_config)

Build the base PyPSA network from OSM-derived component tables.

Loads buses, lines, transformers, and converters from CSV files, assigns electrical parameters, imports all components into a new :class:pypsa.Network, and returns it ready for further processing.

When hvdc_as_lines_config is True, DC lines are imported as PyPSA Line components; otherwise they are modelled as Link components.

Parameters

inputs : snakemake.io.Namedlist Snakemake input paths: osm_buses, osm_lines, osm_transformers, osm_converters, country_shapes, offshore_shapes. base_network_config : dict base_network section of config.yaml. countries_config : list List of ISO 3166-1 alpha-2 country codes to include. hvdc_as_lines_config : bool If True, treat HVDC lines as PyPSA Line components. lines_config : dict lines section of config.yaml. links_config : dict links section of config.yaml. snapshots_config : dict snapshots section passed to :meth:pypsa.Network.set_snapshots. transformers_config : dict transformers section of config.yaml. voltages_config : list Nominal voltages (kV) to retain.

Returns

pypsa.Network Fully assembled base network with buses, lines, links, transformers, converters, country assignments, and underwater fractions.

add_electricity

Adds electrical generators, load and existing hydro storage units to a base network.

Relevant Settings

.. code:: yaml

costs:
    output_currency:

electricity:
    max_hours:
    marginal_cost:
    capital_cost:
    conventional_carriers:
    extendable_carriers:
    include_renewable_capacities_from_OPSD:
    estimate_renewable_capacities_from_capacity_stats:

renewable:
    hydro:
        carriers:
        hydro_max_hours:
        hydro_max_hours_default:
        hydro_capital_cost:

lines:
    length_factor:

.. seealso:: Documentation of the configuration file config.yaml at :ref:costs_cf, :ref:electricity_cf, :ref:load_options_cf, :ref:renewable_cf, :ref:lines_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.
  • data/bundle/hydro_capacities.csv: Hydropower plant store/discharge power capacities, energy storage capacity, and average hourly inflow by country. Not currently used!

    .. image:: /img/hydrocapacities.png

  • data/geth2015_hydro_capacities.csv: alternative to capacities above; not currently used!

  • resources/demand_profiles.csv: a csv file containing the demand profile associated with buses
  • resources/shapes/gadm_shapes.geojson: confer :ref:shapes
  • resources/powerplants.csv: confer :ref:powerplants
  • resources/profile_{}.nc: all technologies in config["renewables"].keys(), confer :ref:renewableprofiles
  • networks/base.nc: confer :ref:base

Outputs

  • networks/elec.nc:

    .. image:: /img/elec.png :width: 75 % :align: center

Description

The rule :mod:add_electricity ties all the different data inputs from the preceding rules together into a detailed PyPSA network that is stored in networks/elec.nc. It includes:

  • today's transmission topology and transfer capacities (in future, optionally including lines which are under construction according to the config settings lines: under_construction and links: under_construction),
  • today's thermal and hydro power generation capacities (for the technologies listed in the config setting electricity: conventional_carriers), and
  • today's load time-series (upsampled in a top-down approach according to population and gross domestic product)

It further adds extendable generators with zero capacity for

  • photovoltaic, onshore and AC- as well as DC-connected offshore wind installations with today's locational, hourly wind and solar capacity factors (but no current capacities),
  • additional open- and combined-cycle gas turbines (if OCGT and/or CCGT is listed in the config setting electricity: extendable_carriers)

load_powerplants(ppl_fn, costs=None, fill_values=None, grouping_years=None)

Load and preprocess powerplant matching data, fill missing datein/dateout, and assign grouping years. Parameters


ppl_fn : str Path to powerplant matching csv file. costs : pd.DataFrame DataFrame containing technology costs. fill_values : dict Dictionary containing default values for lifetime. grouping_years : list List of years to group build years into.

Returns

ppl : pd.DataFrame Power plant list DataFrame.

fill_datein_dateout(ppl, costs, fill_values)

Fill missing datein and dateout values in ppl DataFrame.

Parameters

ppl : pd.DataFrame Dataframe containing power plants. costs : pd.DataFrame DataFrame containing cost assumptions. fill_values : dict Dictionary containing default values for lifetime.

Returns

ppl : pd.DataFrame Power plant list DataFrame with filled missing datein and dateout columns.

attach_load(n, demand_profiles)

Add load profiles to network buses.

Parameters

n: pypsa network

demand_profiles: str Path to csv file of elecric demand time series, e.g. "resources/demand_profiles.csv" Demand profile has snapshots as rows and bus names as columns.

Returns

n : pypsa network Now attached with load time series

get_grouping_year(build_year, grouping_years)

Map build_year to the nearest grouping year bin.

Each build year is assigned to the first grouping year that is greater than or equal to it (i.e. the right edge of its bin).

Example: grouping_years = [1980, 2000, 2010, 2015, 2020] build_year = 2012 → returns 2015 build_year = 2018 → returns 2020

aggregate_ppl_by_bus_carrier_year(ppl)

Aggregate power plants by (bus, carrier, grouping_year).

Creates a new carrier name with grouping year suffix (e.g., "CCGT-2020") and aggregates capacity and other attributes.

Parameters

ppl : pd.DataFrame Power plant DataFrame with columns: bus, carrier, grouping_year, p_nom, efficiency, marginal_cost, datein, dateout and so on.

Returns

pd.DataFrame Aggregated power plants with columns: bus, carrier, carrier_gy, p_nom, efficiency, marginal_cost, build_year, lifetime.

Example

Input: bus carrier grouping_year p_nom bus1 CCGT 2015 100 bus1 CCGT 2015 200 bus1 CCGT 2020 150

Output: bus carrier carrier_gy p_nom bus1 CCGT CCGT-2015 300 bus1 CCGT CCGT-2020 150

aggregate_inflow_by_group(ppl, ppl_grouped, inflow_t)

Aggregate inflow time series by (bus, carrier, grouping_year) groups.

Parameters

ppl : pd.DataFrame Original (ungrouped) power plant DataFrame with columns: bus, carrier, grouping_year. ppl_grouped : pd.DataFrame Aggregated power plant DataFrame with columns: bus, carrier, carrier_gy. inflow_t : pd.DataFrame Inflow time series DataFrame with plant indices as columns.

Returns

pd.DataFrame Aggregated inflow time series with ppl_grouped indices as columns.

get_irena_targets_for_carrier(carrier, estimate_renewable_capacities_config, countries)

Return IRENA installed capacity targets for a given carrier as a Series indexed by country (MW).

The function reads IRENASTAT installed capacity data using the existing estimate_renewable_capacities configuration. Offshore wind is mapped entirely to offwind-ac.

attach_wind_and_solar(n, costs, ppl, input_files, carriers, extendable_carriers, line_length_factor)

Attach wind and solar generators.

Existing capacities are taken from powerplants.csv and spatialized to buses. National capacity gaps with respect to IRENA targets are filled and redistributed uniformly across buses within each country.

Offshore wind is treated entirely as offwind-ac.

Parameters

n : pypsa.Network The PyPSA network to modify. costs : pd.DataFrame DataFrame containing technology costs. ppl : pd.DataFrame Power plant DataFrame. input_files : dict Snakemake input object containing renewable profile files. carriers : set Set of renewable carriers to be added. extendable_carriers : dict Dictionary of extendable carriers for different component types. line_length_factor : float Factor to adjust line lengths for connection cost calculations.

Returns

None

attach_conventional_generators(n, costs, ppl, conventional_carriers, extendable_carriers, renewable_carriers, conventional_config, conventional_inputs)

Add existing conventional generators to the network and extendable conventional generators at all buses.

Parameters

n : pypsa.Network The PyPSA network to modify. costs : pd.DataFrame DataFrame containing technology costs. ppl : pd.DataFrame Power plant DataFrame. conventional_carriers : list List of conventional carriers to be added. extendable_carriers : dict Dictionary of extendable carriers for different component types. renewable_carriers : set Set of renewable carriers. conventional_config : list List of conventional configuration settings. conventional_inputs : dict Dictionary of conventional input parameters.

Returns

None

apply_nuclear_p_max_pu(n, nuclear_p_max_pu)

Apply country-level static nuclear p_max_pu limits based on historical Energy Availability Factor (IAEA, 2022–2024).

  • If country is in CSV: apply p_max_pu
  • If country is NOT in CSV: keep default p_max_pu = 1.0 and warn

attach_hydro(n, costs, ppl, hydro_min_inflow_pu=1.0)

Add existing hydro powerplants to the network as Hydro Storage units, Run-Of-River generators, and Pumped Hydro storage units.

Parameters

n : pypsa.Network The PyPSA network to modify. costs : pd.DataFrame DataFrame containing technology costs. ppl : pd.DataFrame Power plant DataFrame.

Returns

None

attach_existing_batteries(n, costs, ppl, battery_techs, max_hours)

Add existing battery storage units from powerplants.csv to the network.

Currently existing batteries are attached as StorageUnit components on the parent AC bus (see issue #1983 and PR #1990). Revert to a Store+Link representation once clustering supports stores and links.

Parameters

n : pypsa.Network The PyPSA network to modify. costs : pd.DataFrame DataFrame containing technology costs. ppl : pd.DataFrame Power plant DataFrame. battery_techs: dict A dictionary mapping of battery and its technology parameters. max_hours: float Amount of time it takes to fully charge batteries from empty if done at maximum power rate.

Returns

None

add_nice_carrier_names(n, config)

Add nice names and colors to carriers.

Parameters

n : pypsa.Network The PyPSA network to modify. config : dict The configuration dictionary containing plotting settings.

Returns

None

simplify_network

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:busregions
  • resources/regions_offshore.geojson: confer :ref:busregions
  • networks/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 from networks/elec.nc to networks/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:

  1. 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.

  2. 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.

  3. 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.

  4. 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 the cluster_network rule with the function cluster_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.

Simplifies multi-node DC link components into single links between end-points.

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().

n : pypsa.Network The simplified PyPSA network.

drop_isolated_networks(n, threshold)

Find isolated subnetworks in the network and drop those of them which don't have load or have a load value lower than a threshold.

Parameters

iso_code : PyPSA.Network Original network threshold: float Load power used as a threshold to drop isolated nodes

Returns

modified network

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

cluster_network

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:meta_cf, :ref:renewable_cf, :ref:solving_cf, :ref:lines_cf

Inputs

  • resources/regions_onshore_elec_s{simpl}.geojson: confer :ref:simplify
  • resources/regions_offshore_elec_s{simpl}.geojson: confer :ref:simplify
  • resources/busmap_elec_s{simpl}.csv: confer :ref:simplify
  • networks/elec_s{simpl}.nc: confer :ref:simplify
  • data/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 from networks/elec_s{simpl}.nc to networks/elec_s{simpl}_{clusters}.nc;

  • resources/linemap_elec_s{simpl}_{clusters}.csv: Mapping of lines from networks/elec_s{simpl}.nc to networks/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

augmented_line_connections

Guarantees that every bus has at least X-number of connections.

Relevant Settings

.. code:: yaml

.. seealso::

Inputs

  • networks/elec_s{simpl}_{clusters}_pre_augmentation.nc: Input network before augmentation.
  • resources/costs_{year}.csv: Technology cost assumptions.

Outputs

  • networks/elec_s{simpl}_{clusters}.nc: Network with the configured connectivity augmentation applied.

Description

New HVAC connections use country-specific line-type mappings only when enabled and when mappings are available for every configured country. Otherwise, the complete default mapping is used. Availability is evaluated separately for AC and DC mappings.

add_extra_components

Adds extra extendable components to the clustered and simplified network.

Relevant Settings

.. code:: yaml

sector:
    transmission_efficiency:

.. seealso:: Documentation of the configuration file config.yaml at :ref:sector_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.

Outputs

  • networks/elec_s{simpl}_{clusters}_ec.nc:

Description

The rule :mod:add_extra_components attaches additional extendable components to the clustered and simplified network. These can be configured in the config.yaml at electricity: extendable_carriers:. It processes networks/elec_s{simpl}_{clusters}.nc to build networks/elec_s{simpl}_{clusters}_ec.nc, which in contrast to the former (depending on the configuration) contain with zero initial capacity

  • StorageUnits of carrier 'H2' and/or 'battery'. If this option is chosen, every bus is given an extendable StorageUnit of the corresponding carrier. The energy and power capacities are linked through a parameter that specifies the energy capacity as maximum hours at full dispatch power and is configured in electricity: max_hours:. This linkage leads to one investment variable per storage unit. The default max_hours lead to long-term hydrogen and short-term battery storage units.

  • Stores of carrier 'H2' and/or 'battery' in combination with Links. If this option is chosen, the script adds extra buses with corresponding carrier where energy Stores are attached and which are connected to the corresponding power buses via two links, one each for charging and discharging. This leads to three investment variables for the energy capacity, charging and discharging capacity of the storage unit.

get_available_storage_carriers(n, carriers, storage_techs)

Filter and register available storage carriers from a given list.

Parameters

n : pypsa.Network The PyPSA network object to which valid storage carriers will be added. carriers : list of str A list of carrier names to filter and potentially register as storage technologies. storage_techs : dict A dictionary mapping storage carriers to their respective technology parameters.

Returns

list of str A list of storage carriers that are both implemented and available in the network.

attach_stores(n, costs, buses_i, carriers, storage_techs)

Attach stores to the network.

Parameters

n : pypsa.Network The PyPSA network to attach the stores to. costs : pd.DataFrame DataFrame containing the cost data. buses_i : list List of high voltage electricity buses. carriers : list List of extendable energy carriers. storage_techs : dict A dictionary mapping storage carriers to their respective technology parameters.

attach_storageunits(n, costs, buses_i, carriers, max_hours, storage_techs)

Attach storage units to the network.

Parameters

n : pypsa.Network The PyPSA network to attach the storage units to. costs : pd.DataFrame DataFrame containing the cost data. buses_i : list List of high voltage electricity buses. carriers : list List of extendable energy carriers. max_hours : dict Dictionary of maximum hours for storage units. storage_techs : dict A dictionary mapping storage carriers to their respective technology parameters.

attach_advance_csp(n, costs)

Attach advance CHP to the network.

Advance CHP is a hybrid of generation and storage, needing its own workflow

Parameters

n : pypsa.Network The PyPSA network to attach the storage units to. costs : pd.DataFrame DataFrame containing the cost data. cost_name : str Name of the column in the costs DataFrame that represents the capital cost.

attach_hydrogen_pipelines(n, costs, electricity, transmission_efficiency)

Attach hydrogen pipelines to the network.

Parameters

n : pypsa.Network The PyPSA network to attach the hydrogen pipelines to. costs : pd.DataFrame DataFrame containing the cost data. electricity : dict Dictionary containing the electricity parameters. transmission_efficiency : float The efficiency of the hydrogen transmission.

prepare_network

Prepare PyPSA network for solving according to :ref:opts and :ref:ll, such as.

  • adding an annual limit of carbon-dioxide emissions,
  • adding an exogenous price per tonne emissions of carbon-dioxide (or other kinds),
  • setting an N-1 security margin factor for transmission line capacities,
  • specifying an expansion limit on the cost of transmission expansion,
  • specifying an expansion limit on the volume of transmission expansion, and
  • reducing the temporal resolution by averaging over multiple hours or segmenting time series into chunks of varying lengths using tsam.

Relevant Settings

.. code:: yaml

links:

lines:

co2:
    limit:
    base:
    emission_price:
    automatic_emission:
    budget:

electricity:
    max_hours:

.. seealso:: Documentation of the configuration file config.yaml at :ref:co2_cf, :ref:electricity_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.
  • networks/elec_s{simpl}_{clusters}.nc: confer :ref:cluster

Outputs

  • networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc: Complete PyPSA network that will be handed to the solve_network rule.

Description

.. tip:: The rule :mod:prepare_all_networks runs for all scenario s in the configuration file the rule :mod:prepare_network.

emission_extractor(emission_csv, emission_year, country_names)

Extracts CO2 emission values for given country codes from the pre-processed global emission CSV file.

Parameters

emission_csv : str Path to the CSV file produced by build_co2_emissions. The file has columns country_code_a3 (three-letter ISO code), country_code_a2 (two-letter ISO code), country_name (full country name), and year columns named YYYY. emission_year : int or str Year of CO2 emissions. country_names : numpy.ndarray Two letter country codes of analysed countries.

Returns

pd.Series CO2 emission values (in kt CO2) of studied countries for the given year.