gas_grid

The module contains code used to insert the methane grid into the database

The central module contains all code dealing with the import of data from SciGRID_gas (IGGIELGN dataset) and inserting the CH4 buses and links into the database for the scenarios eGon2035 and eGon100RE.

The SciGRID_gas data downloaded with download_SciGRID_gas_data() into the folder ./datasets/gas_data/data is also used by other modules.

In this module, only the IGGIELGN_Nodes and IGGIELGN_PipeSegments csv files are used in the function insert_gas_data() that inserts the CH4 buses and links, which for the case of gas represent pipelines, into the database.

class GasNodesAndPipes(dependencies)[source]

Bases: Dataset

Insert the CH4 buses and links into the database.

Insert the CH4 buses and links, which for the case of gas represent pipelines, into the database for the scenarios status2019, eGon2035 and eGon100RE with the functions insert_gas_data() and insert_gas_data_eGon100RE().

Dependencies
Resulting tables
name: str = 'GasNodesAndPipes'
scn_name = 'eGon2035'
sources: DatasetSources = DatasetSources(tables={'scigrid_gas': {'zenodo': {'deposit_id': '4767098', 'basename': 'IGGIELGN', 'zip_name': 'IGGIELGN.zip'}, 'files': {'nodes': 'IGGIELGN_Nodes.csv', 'pipes': 'IGGIELGN_PipeSegments.csv', 'productions': 'IGGIELGN_Productions.csv', 'storages': 'IGGIELGN_Storages.csv', 'lngs': 'IGGIELGN_LNGs.csv'}}}, files={'pipeline_classification': {'path': './data_bundle_egon_data/pipeline_classification_gas/pipeline_classification.csv'}}, urls={})

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

targets: DatasetTargets = DatasetTargets(tables={'buses': 'grid.egon_etrago_bus', 'links': 'grid.egon_etrago_link', 'gas_link': 'grid.egon_etrago_gas_link'}, files={'scigrid_gas_data_dir': {'path': './datasets/gas_data'}})

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

tasks: Tasks = (functools.partial(<function insert_gas_data_status>, scn_name='status2019'), <function insert_gas_data>)

The tasks of this Dataset. A TaskGraph will automatically be converted to Tasks_.

version: str = '0.0.14'
ch4_nodes_number_G(gas_nodes_list)[source]

Return the number of CH4 buses in Germany

Parameters:

gas_nodes_list (pandas.DataFrame) – Dataframe containing the gas nodes in Europe

Returns:

N_ch4_nodes_G (int) – Number of CH4 buses in Germany

define_gas_buses_abroad(scn_name='eGon2035')[source]

Define central CH4 buses in foreign countries for eGon2035

For the scenario eGon2035, define central CH4 buses in foreign countries. The considered foreign countries are the direct neighbouring countries, with the addition of Russia that is considered as a source of fossil CH4. Therefore, the following steps are executed:

  • Definition of the foreign buses with the function central_buses_pypsaeur from the module electrical_neighbours

  • Removal of the superfluous buses in order to have only one bus in each neighbouring country

  • Removal of the irrelevant columns

  • Addition of the missing information: scn_name and carrier

  • Attribution of an id to each bus

Parameters:

scn_name (str) – Name of the scenario

Returns:

gdf_abroad_buses (pandas.DataFrame) – Dataframe containing the gas buses in the neighbouring countries and one in the center of Germany in test mode

define_gas_nodes_list()[source]

Define list of CH4 buses from SciGRID_gas IGGIELGN data

The CH4 nodes are modelled as buses. Therefore the SciGRID_gas nodes are read from the IGGIELGN_Nodes csv file previously downloaded in the function download_SciGRID_gas_data(), corrected (erroneous country), and returned in a dataframe.

Returns:

gas_nodes_list (pandas.DataFrame) – Dataframe containing the gas nodes in Europe

define_gas_pipeline_list(gas_nodes_list, abroad_gas_nodes_list, scn_name='eGon2035')[source]

Define gas pipelines in Germany from SciGRID_gas IGGIELGN data

The gas pipelines, modelled as PyPSA links are read from the IGGIELGN_PipeSegments csv file previously downloded in the function download_SciGRID_gas_data().

The capacities of the pipelines are determined by the correspondance table given by the parameters for the classification of gas pipelines in Electricity, heat, and gas sector data for modeling the German system related to the pipeline diameter given in the SciGRID_gas dataset.

The manual corrections allow to:

  • Delete gas pipelines disconnected of the rest of the gas grid

  • Connect one pipeline (also connected to Norway) disconnected of the rest of the gas grid

  • Correct countries of some erroneous pipelines

Parameters:
  • gas_nodes_list (dataframe) – Dataframe containing the gas nodes in Europe

  • abroad_gas_nodes_list (dataframe) – Dataframe containing the gas buses in the neighbouring countries and one in the center of Germany in test mode

  • scn_name (str) – Name of the scenario

Returns:

gas_pipelines_list (pandas.DataFrame) – Dataframe containing the gas pipelines in Germany

download_SciGRID_gas_data()[source]

Download SciGRID_gas IGGIELGN data from Zenodo

The following data for CH4 is downloaded into the folder ./datasets/gas_data/data:

  • Buses (file IGGIELGN_Nodes.csv),

  • Pipelines (file IGGIELGN_PipeSegments.csv),

  • Productions (file IGGIELGN_Productions.csv),

  • Storages (file IGGIELGN_Storages.csv),

  • LNG terminals (file IGGIELGN_LNGs.csv).

For more information on this data refer, to the SciGRID_gas IGGIELGN documentation.

Returns:

None

insert_CH4_nodes_list(gas_nodes_list, scn_name='eGon2035')[source]

Insert list of German CH4 nodes into the database for a required scenario

Insert the list of German CH4 nodes into the database by executing the following steps:

  • Receive the buses as parameter (from SciGRID_gas IGGIELGN data)

  • Add the missing information: scn_name and carrier

  • Clean the database table grid.egon_etrago_bus of the CH4 buses of the specific scenario in Germany

  • Insert the buses in the table grid.egon_etrago_bus

Parameters:

gas_nodes_list (pandas.DataFrame) – Dataframe containing the gas nodes in Europe

Returns:

None

insert_gas_buses_abroad(scn_name='eGon2035')[source]

Insert CH4 buses in neighbouring countries into database for eGon2035

  • Definition of the CH4 buses abroad with the function define_gas_buses_abroad()

  • Cleaning of the database table grid.egon_etrago_bus of the foreign CH4 buses of the specific scenario (eGon2035)

  • Insertion of the neighbouring buses into the table grid.egon_etrago_bus.

Parameters:

scn_name (str) – Name of the scenario

Returns:

gdf_abroad_buses (dataframe) – Dataframe containing the CH4 buses in the neighbouring countries and one in the center of Germany in test mode

insert_gas_data()[source]

Overall function for importing methane data for all the scenarios in the configuration file.

This function imports the methane data (buses and pipelines) for each required scenario, by executing the following steps:

Returns:

None

insert_gas_data_status(scn_name)[source]

Function to deal with the gas network for the status2019 scenario. For this scenario just one CH4 bus is consider in the center of Germany. Since OCGTs in the foreign countries are modelled as generators and not as links between the gas and electricity sectors, CH4 foreign buses are considered not necessary.

This function does not require any input.

Returns:

None.

insert_gas_pipeline_list(gas_pipelines_list, scn_name='eGon2035')[source]

Insert list of gas pipelines into the database

Receive as argument a list of gas pipelines and insert them into the database after cleaning it.

Parameters:
  • gas_pipelines_list (pandas.DataFrame) – Dataframe containing the gas pipelines in Germany

  • scn_name (str) – Name of the scenario

Returns:

None

remove_isolated_gas_buses(scn_name='eGon2035')[source]

Delete CH4 buses which are disconnected of the CH4 grid for the required scenario

Returns:

None