electrical_neighbours

The central module containing all code dealing with electrical neighbours

class ElectricalNeighbours(dependencies)[source]

Bases: Dataset

Add lines, loads, generation and storage for electrical neighbours

This dataset creates data for modelling the considered foreign countries and writes that data into the database tables that can be read by the eTraGo tool. Neighbouring countries are modelled in a lower spatial resolution, in general one node per country is considered. Defined load timeseries as well as generatrion and storage capacities are connected to these nodes. The nodes are connected by AC and DC transmission lines with the German grid and other neighbouring countries considering the grid topology from ENTSO-E.

Dependencies
Resulting tables
name: str = 'ElectricalNeighbours'
sources: DatasetSources = DatasetSources(tables={'electricity_buses': 'grid.egon_etrago_bus', 'lines': 'grid.egon_etrago_line', 'german_borders': 'boundaries.vg250_sta_union', 'osmtgmod_bus': 'osmtgmod_results.bus_data', 'osmtgmod_branch': 'osmtgmod_results.branch_data'}, files={'tyndp_capacities': 'tyndp/TYNDP-2020-Scenario-Datafile.xlsx.zip', 'tyndp_demand_2030': 'tyndp/Demand_TimeSeries_2030_DistributedEnergy.xlsx', 'tyndp_demand_2040': 'tyndp/Demand_TimeSeries_2040_DistributedEnergy.xlsx'}, urls={})

The sources used by the datasets. Could be tables, files and urls

targets: DatasetTargets = DatasetTargets(tables={'buses': 'grid.egon_etrago_bus', 'lines': 'grid.egon_etrago_line', 'links': 'grid.egon_etrago_link', 'transformers': 'grid.egon_etrago_transformer', 'loads': 'grid.egon_etrago_load', 'load_timeseries': 'grid.egon_etrago_load_timeseries', 'generators': 'grid.egon_etrago_generator', 'generators_timeseries': 'grid.egon_etrago_generator_timeseries', 'storage': 'grid.egon_etrago_storage'}, files={})

The targets created by the datasets. Could be tables and files

version: str = '0.0.14'
buses(scenario, sources, targets)[source]

Insert central buses in foreign countries per scenario

Parameters:
  • sources (dict) – List of dataset sources

  • targets (dict) – List of dataset targets

Returns:

central_buses (geoapndas.GeoDataFrame) – Buses in the center of foreign countries

calc_capacities()[source]

Calculates installed capacities from TYNDP data

Returns:

pandas.DataFrame – Installed capacities per foreign node and energy carrier

central_buses_pypsaeur(sources, scenario)[source]

Returns buses in the middle of foreign countries based on prepared pypsa-eur network

Parameters:

sources (dict) – List of sources

Returns:

pandas.DataFrame – Buses in the center of foreign countries

central_transformer(scenario, sources, targets, central_buses, new_lines)[source]

Connect central foreign buses with different voltage levels

Parameters:
  • sources (dict) – List of dataset sources

  • targets (dict) – List of dataset targets

  • central_buses (geopandas.GeoDataFrame) – Buses in the center of foreign countries

  • new_lines (geopandas.GeoDataFrame) – Lines that connect cross-border lines to central bus per country

Returns:

None.

choose_transformer(s_nom)[source]

Select transformer and parameters from existing data in the grid model

It is assumed that transformers in the foreign countries are not limiting the electricity flow, so the capacitiy s_nom is set to the minimum sum of attached AC-lines. The electrical parameters are set according to already inserted transformers in the grid model for Germany.

Parameters:

s_nom (float) – Minimal sum of nominal power of lines at one side

Returns:

  • int – Selected transformer nominal power

  • float – Selected transformer nominal impedance

cross_border_lines(scenario, sources, targets, central_buses)[source]

Adds lines which connect border-crossing lines from osmtgmod to the central buses in the corresponding neigbouring country

Parameters:
  • sources (dict) – List of dataset sources

  • targets (dict) – List of dataset targets

  • central_buses (geopandas.GeoDataFrame) – Buses in the center of foreign countries

Returns:

new_lines (geopandas.GeoDataFrame) – Lines that connect cross-border lines to central bus per country

entsoe_historic_demand(year_start='20190101', year_end='20200101')[source]
entsoe_historic_generation_capacities(year_start='20190101', year_end='20200101')[source]
entsoe_to_bus_etrago(scenario='status2019')[source]
fill_by_backup_data_from_former_runs(df_sq, file_path, not_retrieved)[source]

Fills missing data from former runs :Parameters: * df_sq (pd.DataFrame)

  • file_path (str, Path)

  • not_retrieved (list)

Returns:

df_sq, not_retrieved

foreign_dc_lines(scenario, sources, targets, central_buses)[source]

Insert DC lines to foreign countries manually

Parameters:
  • sources (dict) – List of dataset sources

  • targets (dict) – List of dataset targets

  • central_buses (geopandas.GeoDataFrame) – Buses in the center of foreign countries

Returns:

None.

get_cross_border_buses(scenario, sources)[source]

Returns buses from osmTGmod which are outside of Germany.

Parameters:

sources (dict) – List of sources

Returns:

geopandas.GeoDataFrame – Electricity buses outside of Germany

get_cross_border_lines(scenario, sources)[source]

Returns lines from osmTGmod which end or start outside of Germany.

Parameters:

sources (dict) – List of sources

Returns:

geopandas.GeoDataFrame – AC-lines outside of Germany

get_entsoe_token()[source]

Check for token in home dir. If not exists, check in working dir

get_foreign_bus_id(scenario)[source]

Calculte the etrago bus id from Nodes of TYNDP based on the geometry

Returns:

pandas.Series – List of mapped node_ids from TYNDP and etragos bus_id

get_map_buses()[source]

Returns a dictonary of foreign regions which are aggregated to another

Returns:

Combination of aggregated regions

grid()[source]

Insert electrical grid compoenents for neighbouring countries

Returns:

None.

insert_generators_sq(scn_name='status2019')[source]

Insert generators for foreign countries based on ENTSO-E data

Parameters:
  • gen_sq (pandas dataframe) – df with all the foreign generators produced by the function entsoe_historic_generation_capacities

  • scn_name (str) – The default is “status2019”.

Returns:

None.

insert_generators_tyndp(capacities)[source]

Insert generators for foreign countries based on TYNDP-data

Parameters:

capacities (pandas.DataFrame) – Installed capacities per foreign node and energy carrier

Returns:

None.

insert_loads_sq(scn_name='status2019')[source]

Copy load timeseries data from entso-e.

Returns:

None.

insert_storage_tyndp(capacities)[source]

Insert storage units for foreign countries based on TYNDP-data

Parameters:

capacities (pandas.DataFrame) – Installed capacities per foreign node and energy carrier

Returns:

None.

insert_storage_units_sq(scn_name='status2019')[source]

Insert storage_units for foreign countries based on ENTSO-E data

Parameters:

scn_name (str) – Scenario to which the foreign storage units will be assigned. The default is “status2019”.

Returns:

None.

lines_between_foreign_countries(scenario, sources, targets, central_buses)[source]
map_carriers_entsoe()[source]

Map carriers from entsoe-data to carriers used in eGon :returns: dict – Carrier from entsoe to eGon

map_carriers_tyndp()[source]

Map carriers from TYNDP-data to carriers used in eGon :returns: dict – Carrier from TYNDP and eGon

renewable_timeseries_pypsaeur(scn_name)[source]
save_entsoe_data(df: DataFrame, file_path: Path)[source]
tyndp_demand()[source]

Copy load timeseries data from TYNDP 2020. According to NEP 2021, the data for 2030 and 2040 is interpolated linearly.

Returns:

None.

tyndp_generation()[source]

Insert data from TYNDP 2020 accordning to NEP 2021 Scenario ‘Distributed Energy’, linear interpolate between 2030 and 2040

Returns:

None.