etrago.network module

Define class Etrago

class etrago.network.Etrago(args=None, csv_folder_name=None, ignore_standard_types=False, json_path=None, name='', **kwargs)[source]

Bases: object

Object containing pypsa.Network including the transmission grid, not electric sectors, input parameters and optimization results.

Parameters:
  • args (dict) – Dictionary including all input parameters.

  • csv_folder_name (string) – Name of folder from which to import CSVs of network data.

  • name (string, default "") – Network name.

  • ignore_standard_types (boolean, default False) – If True, do not read in PyPSA standard types into standard types DataFrames.

  • kwargs – Any remaining attributes to set

Return type:

None

Examples

Methods

add_ch4_h2_correspondence()

Method adding the database table grid.egon_etrago_ch4_h2 to self.

add_missing_components()

Add a missing transformer at Heizkraftwerk Nord in Munich and a missing transformer in Stuttgart.

add_redispatch_generators(...)

Add components and parameters to model redispatch with costs

add_simplified_distribution_grids()

Adds simplified distrubution grids to each HV/MV substation in the transmission grid model.

adjust_CH4_gen_carriers()

Precise the carrier for the generators with CH4 carrier

adjust_PtH2_model([apply_on])

Adjust the modelling of electrolyzer with waste-heat and O2-utilisation.

adjust_chp_model([apply_on])

Adjust the modelling of chp plants in foreign countries for eGon100RE

adjust_network()

Function that adjusts the network imported from the database according to given input-parameters.

bev_flexibility_potential(buses, snapshots)

Calculate shifting potential of electric vehicles

build_market_model([unit_commitment])

Builds market model based on imported network from eTraGo

build_network_from_db()

Function that imports transmission grid from chosen database

buses_by_country([apply_on])

Find buses of foreign countries using coordinates and return them as Pandas Series

calc_ac_export()

Calculate the balance of electricity exports and imports over AC lines

calc_ac_export_per_country()

Calculate the balance of electricity exports and imports over AC lines per country

calc_dc_export()

Calculate the balance of electricity exports and imports over DC lines

calc_dc_export_per_country()

Calculate the balance of electricity exports and imports over DC lines per country

calc_results()

Function that calculates main results of grid optimization and adds them to Etrago object.

check_args()

Function that checks the consistency of etragos input parameters.

convert_capital_costs()

Convert capital_costs to fit to considered timesteps

crossborder_capacity()

Adjust interconnector capacties.

decommissioning(**kwargs)

Function that removes components in a decommissioning-scenario from the existing network container.

demand_side_management(buses, snapshots[, ...])

Calculate shifting potential of demand side management

drop_sectors(drop_carriers)

Manually drop secors from network.

ehv_clustering()

Cluster the network based on Extra High Voltage (EHV) grid.

export_to_csv(path)

Write calculation results to csv-files in path.

extendable([grid_max_D, grid_max_abs_D, ...])

Function that sets selected components extendable.

extension(**kwargs)

Function that adds an additional network to the existing network container.

filter_links_by_carrier(carrier[, like])

foreign_links()

Change transmission technology of foreign lines from AC to DC (links).

geolocation_buses([apply_on])

If geopandas is installed: Use geometries of buses x/y(lon/lat) and polygons of countries from RenpassGisParameterRegion in order to locate the buses

german_network()

Cut out all network components in Germany

get_args_setting([jsonpath])

Get and open json file with scenaio settings of eTraGo args.

get_clustering_data(path)

Import the final busmap and the initial buses, lines and links

heat_stores(buses, snapshots[, agg, used, ...])

Calculate shifting potential (and usage) of heat stores

hydrogen_stores(buses, snapshots[, agg, ...])

Calculate shifting potential (and usage) of heat stores

levelize_abroad_inland_parameters()

The method levelize the techno-economic parameters of inland and abroad components of the same carrier.

load_shedding([temporal_disaggregation, ...])

Implement load shedding in existing network to identify feasibility problems

lopf()

Functions that runs lopf according to arguments.

manual_fixes_datamodel()

Apply temporal fixes to the data model until a new egon-data run is there

optimize()

Run optimization of dispatch and grid and storage expansion based on arguments

pf_post_lopf()

Function that runs pf_post_lopf according to arguments.

plot_carrier([carrier_links, carrier_buses, ...])

plot_clusters([carrier, save_path, ...])

plot_curtailment([carrier, filename])

Plot curtailment of selected carrier

plot_flexibility_usage(flexibility[, agg, ...])

Plots temporal distribution of potential and usage for flexibilities

plot_gas_generation([t_resolution, save_path])

Plots timeseries data for gas generation

plot_gas_summary([t_resolution, stacked, ...])

Plots timeseries data for gas loads (and generation)

plot_grid(line_colors[, bus_sizes, ...])

Function that plots etrago.network and results for lines and buses

plot_h2_generation([t_resolution, save_path])

Plots timeseries data for H2 generation

plot_h2_summary([t_resolution, stacked, ...])

Plots timeseries data for H2 loads (and generation)

plot_heat_loads([t_resolution, save_path])

Plots timeseries data for heat loads

plot_heat_summary([t_resolution, stacked, ...])

Plots timeseries data for heat generation (and demand)

plot_residual_load([gen_carrier, load_carrier])

Plots residual load summed of all exisiting buses.

plot_stacked_gen([bus, resolution, filename])

Plot stacked sum of generation grouped by carrier type

plot_storage_soc_sorted([filename])

Plots the soc (state-pf-charge) of extendable storages

plot_voltage([boundaries])

Plot voltage at buses as hexbin

set_branch_capacity()

Set branch capacity factor of lines and transformers, different factors for HV (110kV) and eHV (220kV, 380kV).

set_line_costs([cost110, cost220, cost380, ...])

Set capital costs for extendable lines in respect to PyPSA [€/MVA]

set_q_foreign_loads(cos_phi)

Set reative power timeseries of loads in neighbouring countries

set_q_national_loads(cos_phi)

Set q component of national loads based on the p component and cos_phi

set_random_noise([sigma])

Sets random noise to marginal cost of each generator.

set_trafo_costs([cost110_220, cost110_380, ...])

Set capital costs for extendable transformers in respect to PyPSA [€/MVA]

skip_snapshots()

Conducts the downsapling to every n-th snapshot.

snapshot_clustering()

Function to call the snapshot clustering function with the respecting method and settings.

spatial_clustering()

Main method for running spatial clustering on the electrical network.

spatial_clustering_gas()

Performs spatial clustering on the gas network using either K-means or K-medoids-Dijkstra algorithm.

system_costs_germany([electricity_only])

Calculte system costs for Germany

temporal_disaggregation()

Function running the tempral disaggregation meaning the optimization of dispatch in the temporally fully resolved network; therfore, the problem is reduced to smaller subproblems by slicing the whole considered time span while keeping inforation on the state of charge of storage units and stores to ensure compatibility and to reproduce saisonality.

update_busmap(new_busmap)

Update busmap after any clustering process

dc_lines

delete_irrelevant_oneports

grid_optimization

market_optimization

post_contingency_analysis

sclopf

spatial_disaggregation

get_args_setting(jsonpath='scenario_setting.json')

Get and open json file with scenaio settings of eTraGo args. The settings includes all eTraGo specific settings of arguments and parameters for a reproducible calculation.

Parameters:

json_file (str) – Default: scenario_setting.json Name of scenario setting json file

Returns:

args – Dictionary of json file

Return type:

dict

check_args()

Function that checks the consistency of etragos input parameters.

Parameters:

etrago (:class:`etrago.Etrago) – Overall container of eTraGo

Return type:

None.

geolocation_buses(apply_on='grid_model')

If geopandas is installed: Use geometries of buses x/y(lon/lat) and polygons of countries from RenpassGisParameterRegion in order to locate the buses

Else: Use coordinats of buses to locate foreign buses, which is less accurate.

TODO: Why not alway use geopandas??

Parameters:
  • etrago (etrago.Etrago) – Transmission grid object

  • apply_on (str) – State if this function is applied on the grid_model or the market_model. The market_model options can only be used if the method type is “market_grid”.

add_missing_components()

Add a missing transformer at Heizkraftwerk Nord in Munich and a missing transformer in Stuttgart.

Parameters:

network (:class:`pypsa.Network) – Overall container of PyPSA

Returns:

network – Overall container of PyPSA

Return type:

:class:`pypsa.Network

load_shedding(temporal_disaggregation=False, negative_load_shedding=['Li_ion'], **kwargs)

Implement load shedding in existing network to identify feasibility problems

Parameters:
  • network (:class:`pypsa.Network) – Overall container of PyPSA

  • temporal_disaggregation (bool) – It is set to False by default.

  • negative_load_shedding (False, list) – Define if generators for negative load shedding will be created. It is set to False by default. When activated supply a list of carriers e.g. [“AC”, “Li_ion”]

Return type:

None.

set_random_noise(sigma=0.01)

Sets random noise to marginal cost of each generator.

Parameters:
  • etrago (:class:`etrago.Etrago) – Transmission grid object

  • seed (int) – seed number, needed to reproduce results

  • sigma (float) – Default: 0.01 standard deviation, small values reduce impact on dispatch but might lead to numerical instability

set_q_national_loads(cos_phi)

Set q component of national loads based on the p component and cos_phi

Parameters:
  • network (pypsa.Network) – Overall container of PyPSA

  • cos_phi (float) – Choose ration of active and reactive power of foreign loads

Returns:

network – Overall container of PyPSA

Return type:

pypsa.Network

set_q_foreign_loads(cos_phi)

Set reative power timeseries of loads in neighbouring countries

Parameters:
  • etrago (:class:`etrago.Etrago) – Transmission grid object

  • cos_phi (float) – Choose ration of active and reactive power of foreign loads

Return type:

None

Change transmission technology of foreign lines from AC to DC (links).

Parameters:

network (:class:`pypsa.Network) – Overall container of PyPSA

Returns:

network – Overall container of PyPSA

Return type:

:class:`pypsa.Network

crossborder_capacity()

Adjust interconnector capacties.

Parameters:
  • network (:class:`pypsa.Network) – Overall container of PyPSA

  • method (string) – Method of correction. Options are ‘ntc_acer’ and ‘thermal_acer’. ‘ntc_acer’ corrects all capacities according to values published by the ACER in 2016. ‘thermal_acer’ corrects certain capacities where our dataset most likely overestimates the thermal capacity.

convert_capital_costs()

Convert capital_costs to fit to considered timesteps

Parameters:

etrago (:class:`etrago.Etrago) – Transmission grid object

extendable(grid_max_D=None, grid_max_abs_D={'110': {'circuits': 2, 'i': 1020, 'wires': 4}, '220': {'circuits': 4, 'i': 1020, 'wires': 4}, '380': {'circuits': 4, 'i': 1020, 'wires': 4}, 'dc': 0}, grid_max_foreign=4, grid_max_abs_foreign=None)

Function that sets selected components extendable.

Parameters:
  • grid_max_D (int, optional) – Upper bounds for electrical grid expansion relative to existing capacity. The default is None.

  • grid_max_abs_D (dict, optional) – Absolute upper bounds for electrical grid expansion in Germany.

  • grid_max_foreign (int, optional) – Upper bounds for expansion of electrical foreign lines relative to the existing capacity. The default is 4.

  • grid_max_abs_foreign (dict, optional) – Absolute upper bounds for expansion of foreign electrical grid. The default is None.

Return type:

None.

extension(**kwargs)

Function that adds an additional network to the existing network container. The new network can include every PyPSA-component (e.g. buses, lines, links). To connect it to the existing network, transformers are needed.

All components and its timeseries of the additional scenario need to be inserted in the fitting ‘model_draft.ego_grid_pf_hv_extension_’ table. The scn_name in the tables have to be labled with ‘extension_’ + scn_name (e.g. ‘extension_nep2035’).

Until now, the tables include three additional scenarios: ‘nep2035_confirmed’: all new lines and needed transformers planed in the ‘Netzentwicklungsplan 2035’ (NEP2035) that have been confirmed by the Bundesnetzagentur (BNetzA)

‘nep2035_b2’: all new lines and needed transformers planned in the NEP 2035 in the scenario 2035 B2

‘BE_NO_NEP 2035’: DC-lines and transformers to connect the upcomming electrical-neighbours Belgium and Norway Generation, loads and its timeseries in Belgium and Norway for scenario ‘NEP 2035’

Parameters:
  • network – The existing network container (e.g. scenario ‘NEP 2035’)

  • session – session-data

  • overlay_scn_name – Name of the additional scenario (WITHOUT ‘extension_’)

  • start_snapshot

  • end_snapshot – Simulation time

Return type:

Network container including existing and additional network

set_branch_capacity()

Set branch capacity factor of lines and transformers, different factors for HV (110kV) and eHV (220kV, 380kV).

Parameters:

etrago (:class:`etrago.Etrago) – Transmission grid object

decommissioning(**kwargs)

Function that removes components in a decommissioning-scenario from the existing network container. Currently, only lines can be decommissioned.

All components of the decommissioning scenario need to be inserted in the fitting ‘model_draft.ego_grid_pf_hv_extension_’ table. The scn_name in the tables have to be labled with ‘decommissioning_’ + scn_name (e.g. ‘decommissioning_nep2035’).

Parameters:
  • network – The existing network container (e.g. scenario ‘NEP 2035’)

  • session – session-data

  • overlay_scn_name – Name of the decommissioning scenario

Return type:

Network container including decommissioning

add_ch4_h2_correspondence()

Method adding the database table grid.egon_etrago_ch4_h2 to self. It contains the mapping from H2 buses to their corresponding CH4 buses.

spatial_clustering()

Main method for running spatial clustering on the electrical network. Allows for clustering based on k-means and k-medoids dijkstra.

Parameters:

self – The object pointer for an Etrago object containing all relevant parameters and data

Return type:

None

spatial_clustering_gas()

Performs spatial clustering on the gas network using either K-means or K-medoids-Dijkstra algorithm. Updates the network topology by aggregating buses and links, and then performs postprocessing to finalize the changes.

Return type:

None

Raises:

ValueError – If the selected method is not “kmeans” or “kmedoids-dijkstra”.:

skip_snapshots()

Conducts the downsapling to every n-th snapshot.

Return type:

None.

ehv_clustering()

Cluster the network based on Extra High Voltage (EHV) grid.

If ‘active’ in the network_clustering_ehv argument is True, the function clusters the network based on the EHV grid.

Parameters:

self (Etrago object pointer) – The object pointer for an Etrago object.

Return type:

None

snapshot_clustering()

Function to call the snapshot clustering function with the respecting method and settings.

Raises:

ValueError – When calling a non-available function.

Return type:

None.

add_redispatch_generators(factor_redispatch_cost, management_cost, time_depended_cost, fre_mangement_fee)

Add components and parameters to model redispatch with costs

This function currently assumes that the market_model includes all generators and links for the spatial resolution of the grid optimization

Return type:

None.

build_market_model(unit_commitment=False)

Builds market model based on imported network from eTraGo

  • import market regions from file or database

  • Cluster network to market regions

– consider marginal cost incl. generator noise when grouoping electrical

generation capacities

Return type:

None.

grid_optimization(factor_redispatch_cost=1, management_cost=0, time_depended_cost=True, fre_mangement_fee=0)
market_optimization()
lopf()

Functions that runs lopf according to arguments.

Return type:

None.

optimize()

Run optimization of dispatch and grid and storage expansion based on arguments

Return type:

None.

temporal_disaggregation()

Function running the tempral disaggregation meaning the optimization of dispatch in the temporally fully resolved network; therfore, the problem is reduced to smaller subproblems by slicing the whole considered time span while keeping inforation on the state of charge of storage units and stores to ensure compatibility and to reproduce saisonality.

Return type:

None.

pf_post_lopf()

Function that runs pf_post_lopf according to arguments.

Return type:

None.

spatial_disaggregation()
calc_results()

Function that calculates main results of grid optimization and adds them to Etrago object.

Return type:

None.

calc_ac_export()

Calculate the balance of electricity exports and imports over AC lines

Returns:

Balance of electricity export in MWh (if negative: import from Germany)

Return type:

float

calc_ac_export_per_country()

Calculate the balance of electricity exports and imports over AC lines per country

Returns:

Balance of electricity exchange in TWh (if > 0: export from Germany)

Return type:

float

calc_dc_export()

Calculate the balance of electricity exports and imports over DC lines

Returns:

Balance of electricity exchange in MWh (if > 0: export from Germany)

Return type:

float

calc_dc_export_per_country()

Calculate the balance of electricity exports and imports over DC lines per country

Returns:

Balance of electricity exchange in TWh (if > 0: export from Germany)

Return type:

float

export_to_csv(path)

Write calculation results to csv-files in path.

Parameters:
  • network (pypsa.Network) – Overall container of PyPSA

  • args (dict) – Contains calculation settings of appl.py

  • path (str or False or None) – Choose path for csv-files. Specify “”, False or None to not do anything.

Return type:

None

Parameters:
  • carrier (list or str) – name of the carriers of interest. Can be a list of carriers or single sting.

  • like (bool, optional) – When like set to True, the links with carrier names that includes the carrier(s) supplied are returned, Not just exact matches. The default is True.

Returns:

df – Dataframe that contains just links with carriers of the types given in the argument carrier.

Return type:

pandas.DataFrame object

german_network()

Cut out all network components in Germany

Returns:

new_network – Network with all components in Germany

Return type:

pypsa.Network

set_line_costs(cost110=230, cost220=290, cost380=85, costDC=375)

Set capital costs for extendable lines in respect to PyPSA [€/MVA]

Parameters:
  • network (:class:`pypsa.Network) – Overall container of PyPSA

  • args (dict) – containing settings from appl.py

  • cost110 – capital costs per km for 110kV lines and cables default: 230€/MVA/km, source: costs for extra circuit in dena Verteilnetzstudie, p. 146)

  • cost220 – capital costs per km for 220kV lines and cables default: 280€/MVA/km, source: costs for extra circuit in NEP 2025, capactity from most used 220 kV lines in model

  • cost380 – capital costs per km for 380kV lines and cables default: 85€/MVA/km, source: costs for extra circuit in NEP 2025, capactity from most used 380 kV lines in NEP

  • costDC – capital costs per km for DC-lines default: 375€/MVA/km, source: costs for DC transmission line in NEP 2035

set_trafo_costs(cost110_220=7500, cost110_380=17333, cost220_380=14166)

Set capital costs for extendable transformers in respect to PyPSA [€/MVA]

Parameters:
  • network (:class:`pypsa.Network) – Overall container of PyPSA

  • cost110_220 – capital costs for 110/220kV transformer default: 7500€/MVA, source: costs for extra trafo in dena Verteilnetzstudie, p. 146; S of trafo used in osmTGmod

  • cost110_380 – capital costs for 110/380kV transformer default: 17333€/MVA, source: NEP 2025

  • cost220_380 – capital costs for 220/380kV transformer default: 14166€/MVA, source: NEP 2025

system_costs_germany(electricity_only=False)

Calculte system costs for Germany

Returns:

  • marginal_cost (float) – Marginal costs for dispatch in Germany

  • invest_cost (float) – Annualized investment costs for components in Germany

  • import_costs (float) – Costs for energy imported to Germany minus costs for exports

drop_sectors(drop_carriers)

Manually drop secors from network. Makes sure the network can be calculated without the dropped sectors.

Parameters:

drop_carriers (array) – List of sectors that will be dropped. e.g. [‘dsm’, ‘CH4’, ‘H2_saltcavern’, ‘H2_grid’, ‘central_heat’, ‘rural_heat’, ‘central_heat_store’, ‘rural_heat_store’, ‘Li ion’] means everything but AC

Return type:

None.

buses_by_country(apply_on='grid_model')

Find buses of foreign countries using coordinates and return them as Pandas Series

Parameters:
  • self (Etrago object) – Overall container of PyPSA

  • apply_on (str) – State if this function is applied on the grid_model or the market_model. The market_model options can only be used if the method type is “market_grid”.

Return type:

None

update_busmap(new_busmap)

Update busmap after any clustering process

Parameters:

new_busmap (dictionary) – busmap used to clusted the network.

Return type:

None.

plot_residual_load(gen_carrier=['wind_onshore', 'wind_offshore', 'solar', 'solar_rooftop'], load_carrier=['AC'])

Plots residual load summed of all exisiting buses.

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • gen_carrier (list of str, optional) – List of generator carrier types whose generation is considered and subtracted from the load.

  • load_carrier (list of str, optional) – List of load carrier types included in the load summation.

Return type:

None.

plot_stacked_gen(bus=None, resolution='GW', filename=None)

Plot stacked sum of generation grouped by carrier type

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • bus (string) – Plot all generators at one specific bus. If none, sum is calulated for all buses

  • resolution (string) – Unit for y-axis. Can be either GW/MW/KW

Return type:

None.

plot_curtailment(carrier='solar', filename=None)

Plot curtailment of selected carrier

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • carrier (str) – Plot curtailemt of this carrier

  • filename (str or None) – Save figure in this direction

Return type:

None.

plot_voltage(boundaries=[])

Plot voltage at buses as hexbin

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • boundaries (list of 2 values, setting the lower and upper bound of colorbar)

Return type:

None.

plot_storage_soc_sorted(filename=None)

Plots the soc (state-pf-charge) of extendable storages

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • filename (path to folder)

Return type:

None.

plot_grid(line_colors, bus_sizes=1e-05, bus_colors='grey', timesteps=range(0, 2), osm=False, boundaries=None, filename=None, apply_on='grid_model', ext_min=0.1, ext_width=False, legend_entries='all', scaling_store_expansion=False, geographical_boundaries=[-2.5, 16, 46.8, 58])

Function that plots etrago.network and results for lines and buses

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • line_colors (str) –

    Set static line color or attribute to plot e.g. ‘expansion_abs’ Current options:

    • ’line_loading’: mean line loading in p.u. in selected timesteps

    • ’v_nom’: nominal voltage of lines

    • ’expansion_abs’: absolute network expansion in MVA

    • ’expansion_rel’: network expansion in p.u. of existing capacity

    • ’q_flow_max’: maximal reactive flows

    • ’dlr’: energy above nominal capacity

    • ’grey’: plot all lines and DC links grey colored

  • bus_sizes (float, optional) – Size of buses. The default is 0.001.

  • bus_colors (str, optional) –

    Set static bus color or attribute to plot. The default is ‘grey’. Current options:

    • ’nodal_production_balance’: net producer/consumer in selected

      time steps

    • ’storage_expansion’: storage expansion per bus and technology

    • ’storage_distribution’: installed storage units per bus

    • ’h2_battery_storage_expansion’: storage expansion per bus and

      technology for underground and overground H2 and batteries.

    • ’gen_dist’: dispatch per carrier in selected timesteps

    • ’ramp_up’: re-dispatch up per carrier in selected timesteps

    • ’ramp_down’: re-dispatch down per carrier in selected timesteps

    • ’PowerToH2’: location and sizes of electrolyzers

    • ’flexibility_usage’: use of DSM and BEV charger

    • ’PowerToH2_correlation’: indication of degree of correlation to

    market or nodal price of electrolyzers

  • timesteps (array, optional) – Timesteps consideredd in time depended plots. The default is range(2).

  • osm (bool or dict, e.g. {'x': [1,20], 'y': [47, 56], 'zoom' : 6}) –

    If not False, osm is set as background with the following settings as dict:

    • ’x’: array of two floats, x axis boundaries (lat)

    • ’y’: array of two floats, y axis boundaries (long)

    • ’zoom’ : resolution of osm. The default is False.

  • boundaries (array) – Set fixed boundaries of heatmap axis. The default is None.

  • filename (str or None) – Save figure in this direction. The default is None.

  • apply_on (str, optional) – Choose which network is plotted. The available networks depend on your settings. The default is ‘grid_model’

  • ext_min (float) – Choose minimum relative line extension shown in plot in p.u..

  • ext_width (float or bool) – Choose if line_width respects line extension. Turn off with ‘False’ or set linear factor to decremise extension line_width. The default is False.

  • legend_entries (list, optional) – Set the legends for buses to be plotted. The default is ‘all’.

  • scaling_store_expansion (dict, optional) – Set scaling values to be used per technology for the plots storage_expansion and h2_battery_storage_expansion. The default is False, it could be assinged like this: {“H2”: 50, “heat”: 0.1, “battery”: 10}

  • geographical_boundaries (list, optional) – Set georaphical boundaries for the plots. This parameter is overwritten when osm is used. The default is [-2.5, 16, 46.8, 58]

Return type:

None.

plot_clusters(carrier='AC', save_path=False, transmission_lines=False, gas_pipelines=False)
Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • carrier (str, optional) – This variable set the carrier of the buses that will be plotted. The default is “AC”.

  • cartopy (bool, optional) – Set it to True when cartopy is installed and the map is supposed to include country’s boundaries and bodies of water

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

  • transmission_lines (bool, optional) – The default is False. Define if the original transmission lines are plotted or not.

  • gas_pipelines (bool, optional) – The default is False. Define if the original gas pipelines are plotted or not.

Return type:

None.

plot_carrier(carrier_links=['AC'], carrier_buses=['AC'], apply_on='grid_model')
Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • network (:class:`pypsa.Network) – Overall container of PyPSA

  • carrier_links (list) – List of links to be plotted. The default is [“AC”].

  • carrier_buses (list) – List of buses to be plotted. The default is [“AC”].

  • cartopy (bool, optional) – Provide data about the availability of Cartopy. The default is True.

Return type:

None.

plot_gas_generation(t_resolution='20H', save_path=False)

Plots timeseries data for gas generation

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • t_resolution (str, optional) – sets the resampling rate of timeseries data to allow for smoother line plots

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

Return type:

None.

plot_gas_summary(t_resolution='20H', stacked=True, save_path=False)

Plots timeseries data for gas loads (and generation)

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • t_resolution (str, optional) – sets the resampling rate of timeseries data to allow for smoother line plots

  • stacked (bool, optional) – If True all TS data will be shown as stacked area plot. Total gas generation will then also be plotted to check for matching demand and generation.

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

Return type:

None.

plot_h2_generation(t_resolution='20H', save_path=False)

Plots timeseries data for H2 generation

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • t_resolution (str, optional) – sets the resampling rate of timeseries data to allow for smoother line plots

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

Return type:

None.

plot_h2_summary(t_resolution='20H', stacked=True, save_path=False)

Plots timeseries data for H2 loads (and generation)

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • t_resolution (str, optional) – sets the resampling rate of timeseries data to allow for smoother line plots

  • stacked (bool, optional) – If True all TS data will be shown as stacked area plot. Total H2 generation will then also be plotted to check for matching demand and generation.

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

Return type:

None.

plot_heat_loads(t_resolution='20H', save_path=False)

Plots timeseries data for heat loads

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • t_resolution (str, optional) – sets the resampling rate of timeseries data to allow for smoother line plots

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

Return type:

None.

plot_heat_summary(t_resolution='20H', stacked=True, save_path=False)

Plots timeseries data for heat generation (and demand)

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • t_resolution (str, optional) – sets the resampling rate of timeseries data to allow for smoother line plots

  • stacked (bool, optional) – If True all TS data will be shown as stacked area plot. Total heat demand will then also be plotted to check for matching generation and demand.

  • save_path (bool, optional) – Path to save the generated plot. The default is False.

Return type:

None.

plot_flexibility_usage(flexibility, agg='5h', snapshots=[], buses=[], pre_path=None, apply_on='grid_model')

Plots temporal distribution of potential and usage for flexibilities

Parameters:
  • self (:class:`Etrago) – Overall container of Etrago

  • flexibility (str) – Name of flexibility option.

  • agg (str, optional) – Temporal resolution. The default is “5h”.

  • snapshots (list, optional) – Considered snapshots, if empty all are considered. The default is [].

  • buses (list, optional) – Considered components at AC buses, if empty all are considered. The default is [].

  • pre_path (str, optional) – State of and where you want to store the figure. The default is None.

  • apply_on (str, optional) – Choose which network is plotted. The available networks depend on your settings. The default is ‘grid_model’

Return type:

None.

demand_side_management(buses, snapshots, agg='5h', used=False, apply_on='grid_model')

Calculate shifting potential of demand side management

Parameters:
  • buses (array) – List of electricity buses.

  • snapshots (array) – List of snapshots.

  • agg (str, optional) – Temporal resolution. The default is ‘5h’.

  • used (boolean, optional) – State if usage should be included in the results. The default is False.

  • apply_on (str, optional) – Choose which network is plotted. The available networks depend on your settings. The default is ‘grid_model’

Returns:

df – Shifting potential (and usage) of power (MW) and energy (MWh)

Return type:

pandas.DataFrame

bev_flexibility_potential(buses, snapshots, agg='5h', used=False, apply_on='grid_model')

Calculate shifting potential of electric vehicles

Parameters:
  • buses (array) – List of electricity buses.

  • snapshots (array) – List of snapshots.

  • agg (str, optional) – Temporal resolution. The default is ‘5h’.

  • used (boolean, optional) – State if usage should be included in the results. The default is False.

  • apply_on (str, optional) – Choose which network is plotted. The available networks depend on your settings. The default is ‘grid_model’

Returns:

df – Shifting potential (and usage) of power (MW) and energy (MWh)

Return type:

pandas.DataFrame

heat_stores(buses, snapshots, agg='5h', used=False, apply_on='grid_model')

Calculate shifting potential (and usage) of heat stores

Parameters:
  • buses (array) – List of electricity buses.

  • snapshots (array) – List of snapshots.

  • agg (str, optional) – Temporal resolution. The default is ‘5h’.

  • used (boolean, optional) – State if usage should be included in the results. The default is False.

  • apply_on (str, optional) – Choose which network is plotted. The available networks depend on your settings. The default is ‘grid_model’

Returns:

df – Shifting potential (and usage) of power (MW) and energy (MWh)

Return type:

pandas.DataFrame

hydrogen_stores(buses, snapshots, agg='5h', used=False, apply_on='grid_model')

Calculate shifting potential (and usage) of heat stores

Parameters:
  • buses (array) – List of electricity buses.

  • snapshots (array) – List of snapshots.

  • agg (str, optional) – Temporal resolution. The default is ‘5h’.

  • used (boolean, optional) – State if usage should be included in the results. The default is False.

  • apply_on (str, optional) – Choose which network is plotted. The available networks depend on your settings. The default is ‘grid_model’

Returns:

df – Shifting potential (and usage) of power (MW) and energy (MWh)

Return type:

pandas.DataFrame

delete_irrelevant_oneports()
get_clustering_data(path)

Import the final busmap and the initial buses, lines and links

Parameters:

path (str) – Name of folder from which to import CSVs of network data.

Return type:

None

adjust_CH4_gen_carriers()

Precise the carrier for the generators with CH4 carrier

For the eGon2035 scenario, the generators with carrier CH4 represent the prodution od biogas and methan. In the data model, these two differents types are differenciated only by the marginal cost of the generator. This function introduces a carrier distion (CH4_biogas and CH4_NG) in order to avoid the clustering of these two types of generator together and facilitate the contraint applying differently to each of them.

manual_fixes_datamodel()

Apply temporal fixes to the data model until a new egon-data run is there

Parameters:

etrago (:class:`Etrago) – Overall container of Etrago

Return type:

None.

post_contingency_analysis(branch_outages, n_process=4)
sclopf(n_process=4, delta=0.01, n_overload=0, post_lopf=False, div_ext_lines=False)
adjust_PtH2_model(apply_on='pre_market_model')

Adjust the modelling of electrolyzer with waste-heat and O2-utilisation. The method creates a multiple-link-model out of the single links from the dataset (power_to_H2-, PtH2_waste_heat-, PtH2_O2-links) for each location where coupling-product usage is possible. The resulting model consists of a multiple link, additional buses and stores for waste_heat and O2-utilisation, and the connection link to the final heat- and O2-Bus.

Parameters:
  • etrago (:class:`Etrago) – Overall container of Etrago

  • apply_on (str)

Returns:

network

Return type:

PyPSA network

adjust_chp_model(apply_on='pre_market_model')

Adjust the modelling of chp plants in foreign countries for eGon100RE

Parameters:
  • etrago (:class:`Etrago) – Overall container of Etrago

  • apply_on (str)

Returns:

network

Return type:

PyPSA network

levelize_abroad_inland_parameters()

The method levelize the techno-economic parameters of inland and abroad components of the same carrier. Thus, the favoring of one component is avoided just based on the parameters. The differences in the parameters of the input dataset are caused by a updated source used for the pypsa_eur network and different assumed interest_rates. All necessary parameters of the foreign components are adjusted to the values of the inland components.

Parameters:

etrago (:class:`Etrago) – Overall container of Etrago

Return type:

None

add_simplified_distribution_grids()

Adds simplified distrubution grids to each HV/MV substation in the transmission grid model. Load, generation and storage units are connected to the corresponding grid level based on not-aggregated egon-data results.

Return type:

None.

dc_lines()[source]
build_network_from_db()[source]

Function that imports transmission grid from chosen database

Return type:

None.

adjust_network()[source]

Function that adjusts the network imported from the database according to given input-parameters.

Return type:

None.