diff --git a/src/egon/data/datasets/DSM_cts_ind.py b/src/egon/data/datasets/DSM_cts_ind.py index a74ae11da..abad1b823 100644 --- a/src/egon/data/datasets/DSM_cts_ind.py +++ b/src/egon/data/datasets/DSM_cts_ind.py @@ -5,7 +5,7 @@ The sum of the individual time series is a more accurate value than the aggregated time series used so far and should replace it in the future. Since the deviations are relatively small, a tolerance is currently accepted in the -sanity checks. See [#1120](https://github.com/openego/eGon-data/issues/1120) +sanity checks. See `#1120 `_ for updates. """ from sqlalchemy import ARRAY, Column, Float, Integer, String @@ -210,6 +210,7 @@ def cts_data_import(cts_cool_vent_ac_share): """ Import CTS data necessary to identify DSM-potential. + Parameters ---------- cts_share: float Share of cooling, ventilation and AC in CTS demand @@ -251,7 +252,9 @@ def cts_data_import(cts_cool_vent_ac_share): def ind_osm_data_import(ind_vent_cool_share): """ Import industry data per osm-area necessary to identify DSM-potential. - ---------- + + Parameters + ---------- ind_share: float Share of considered application in industry demand """ @@ -287,7 +290,9 @@ def ind_osm_data_import(ind_vent_cool_share): def ind_osm_data_import_individual(ind_vent_cool_share): """ Import industry data per osm-area necessary to identify DSM-potential. - ---------- + + Parameters + ---------- ind_share: float Share of considered application in industry demand """ @@ -323,7 +328,9 @@ def ind_osm_data_import_individual(ind_vent_cool_share): def ind_sites_vent_data_import(ind_vent_share, wz): """ Import industry sites necessary to identify DSM-potential. - ---------- + + Parameters + ---------- ind_vent_share: float Share of considered application in industry demand wz: int @@ -360,7 +367,9 @@ def ind_sites_vent_data_import(ind_vent_share, wz): def ind_sites_vent_data_import_individual(ind_vent_share, wz): """ Import industry sites necessary to identify DSM-potential. - ---------- + + Parameters + ---------- ind_vent_share: float Share of considered application in industry demand wz: int @@ -520,9 +529,10 @@ def ind_sites_data_import(): def calculate_potentials(s_flex, s_util, s_inc, s_dec, delta_t, dsm): """ Calculate DSM-potential per bus using the methods by Heitkoetter et. al.: - https://doi.org/10.1016/j.adapen.2020.100001 + https://doi.org/10.1016/j.adapen.2020.100001 + Parameters - ---------- + ---------- s_flex: float Feasability factor to account for socio-technical restrictions s_util: float @@ -615,8 +625,9 @@ def create_dsm_components( ): """ Create components representing DSM. + Parameters - ---------- + ---------- con : Connection to database p_max: DataFrame @@ -990,8 +1001,8 @@ def delete_dsm_entries(carrier): new ones. Parameters - ---------- - carrier: str + ---------- + carrier: str Remark in column 'carrier' identifying DSM-potential """ @@ -1059,14 +1070,15 @@ def dsm_cts_ind( ): """ Execute methodology to create and implement components for DSM considering + a) CTS per osm-area: combined potentials of cooling, ventilation and air - conditioning + conditioning b) Industry per osm-are: combined potentials of cooling and ventilation c) Industrial Sites: potentials of ventilation in sites of - "Wirtschaftszweig" (WZ) 23 + "Wirtschaftszweig" (WZ) 23 d) Industrial Sites: potentials of sites specified by subsectors - identified by Schmidt (https://zenodo.org/record/3613767#.YTsGwVtCRhG): - Paper, Recycled Paper, Pulp, Cement + identified by Schmidt (https://zenodo.org/record/3613767#.YTsGwVtCRhG): + Paper, Recycled Paper, Pulp, Cement Modelled using the methods by Heitkoetter et. al.: https://doi.org/10.1016/j.adapen.2020.100001 @@ -1374,14 +1386,15 @@ def dsm_cts_ind_individual( ): """ Execute methodology to create and implement components for DSM considering + a) CTS per osm-area: combined potentials of cooling, ventilation and air - conditioning + conditioning b) Industry per osm-are: combined potentials of cooling and ventilation c) Industrial Sites: potentials of ventilation in sites of - "Wirtschaftszweig" (WZ) 23 + "Wirtschaftszweig" (WZ) 23 d) Industrial Sites: potentials of sites specified by subsectors - identified by Schmidt (https://zenodo.org/record/3613767#.YTsGwVtCRhG): - Paper, Recycled Paper, Pulp, Cement + identified by Schmidt (https://zenodo.org/record/3613767#.YTsGwVtCRhG): + Paper, Recycled Paper, Pulp, Cement Modelled using the methods by Heitkoetter et. al.: https://doi.org/10.1016/j.adapen.2020.100001 diff --git a/src/egon/data/datasets/ch4_prod.py b/src/egon/data/datasets/ch4_prod.py index 786d879ea..8cf775d25 100755 --- a/src/egon/data/datasets/ch4_prod.py +++ b/src/egon/data/datasets/ch4_prod.py @@ -287,25 +287,26 @@ def import_gas_generators(scn_name="eGon2035"): To insert the gas production units into the database, the following steps are followed: - * cleaning of the database table grid.egon_etrago_generator of the - CH4 generators of the specific scenario (eGon2035), - * call of the functions :py:func:`load_NG_generators` and - :py:func:`load_biogas_generators` that respectively return - dataframes containing the natural- an bio-gas production units - in Germany, - * attribution of the bus_id to which each generator is connected - (call the function :func:`assign_gas_bus_id ` - from :py:mod:`egon.data.db `), - * aggregation of the CH4 productions with same properties at the - same bus. The properties that should be the same in order that - different generators are aggregated are: - * scenario - * carrier - * marginal cost: this parameter differentiates the natural gas - generators from the biogas generators, - * addition of the missing columns: scn_name, carrier and - generator_id, - * insertion of the generators into the database. + * cleaning of the database table grid.egon_etrago_generator of the + CH4 generators of the specific scenario (eGon2035), + * call of the functions :py:func:`load_NG_generators` and + :py:func:`load_biogas_generators` that respectively return + dataframes containing the natural- an bio-gas production units + in Germany, + * attribution of the bus_id to which each generator is connected + (call the function :func:`assign_gas_bus_id ` + from :py:mod:`egon.data.db `), + * aggregation of the CH4 productions with same properties at the + same bus. The properties that should be the same in order that + different generators are aggregated are: + + * scenario + * carrier + * marginal cost: this parameter differentiates the natural gas + generators from the biogas generators, + * addition of the missing columns: scn_name, carrier and + generator_id, + * insertion of the generators into the database. Parameters ---------- diff --git a/src/egon/data/datasets/ch4_storages.py b/src/egon/data/datasets/ch4_storages.py index 18e1db935..d6003b6d3 100755 --- a/src/egon/data/datasets/ch4_storages.py +++ b/src/egon/data/datasets/ch4_storages.py @@ -271,15 +271,16 @@ def insert_ch4_stores(scn_name): Insert non extendable gas stores for specific scenario in Germany by executing the following steps: - * Clean the database. - * For CH4 stores, call the functions - :py:func:`import_installed_ch4_storages` to get the CH4 - cavern stores and :py:func:`import_ch4_grid_capacity` to - get the CH4 stores modelling the storage capacity of the - grid. - * Aggregate the stores attached to the same bus. - * Add the missing columns: store_id, scn_name, carrier, e_cyclic. - * Insert the stores into the database. + + * Clean the database. + * For CH4 stores, call the functions + :py:func:`import_installed_ch4_storages` to get the CH4 + cavern stores and :py:func:`import_ch4_grid_capacity` to + get the CH4 stores modelling the storage capacity of the + grid. + * Aggregate the stores attached to the same bus. + * Add the missing columns: store_id, scn_name, carrier, e_cyclic. + * Insert the stores into the database. Parameters ---------- @@ -302,12 +303,12 @@ def insert_ch4_stores(scn_name): # Clean table db.execute_sql( f""" - DELETE FROM {target['stores']['schema']}.{target['stores']['table']} + DELETE FROM {target['stores']['schema']}.{target['stores']['table']} WHERE "carrier" = 'CH4' AND scn_name = '{scn_name}' AND bus IN ( SELECT bus_id FROM {source['buses']['schema']}.{source['buses']['table']} - WHERE scn_name = '{scn_name}' + WHERE scn_name = '{scn_name}' AND country = 'DE' ); """ diff --git a/src/egon/data/datasets/district_heating_areas/__init__.py b/src/egon/data/datasets/district_heating_areas/__init__.py index 660692443..690078a05 100644 --- a/src/egon/data/datasets/district_heating_areas/__init__.py +++ b/src/egon/data/datasets/district_heating_areas/__init__.py @@ -353,14 +353,6 @@ def area_grouping( join: geopandas.geodataframe.GeoDataFrame cell polygons with area id - Notes - ----- - None - - TODO - ---- - - """ buffer_distance = distance + 1 diff --git a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py index 5579c0998..c15518bc5 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/cts_buildings.py @@ -143,44 +143,43 @@ class CtsDemandBuildings(Dataset): *Resulting tables* * :py:class:`openstreetmap.osm_buildings_synthetic ` is extended - * :py:class:`openstreetmap.egon_cts_buildings is created + * :py:class:`openstreetmap.egon_cts_buildings ` is created * :py:class:`demand.egon_cts_electricity_demand_building_share ` is created * :py:class:`demand.egon_cts_heat_demand_building_share ` is created * :py:class:`demand.egon_building_electricity_peak_loads ` is extended * :py:class:`boundaries.egon_map_zensus_mvgd_buildings ` is extended. - **The following datasets from the database are mainly used for creation:** * `openstreetmap.osm_buildings_filtered`: - Table of OSM-buildings filtered by tags to selecting residential and cts - buildings only. + Table of OSM-buildings filtered by tags to selecting residential and cts + buildings only. * `openstreetmap.osm_amenities_shops_filtered`: - Table of OSM-amenities filtered by tags to select cts only. + Table of OSM-amenities filtered by tags to select cts only. * `openstreetmap.osm_amenities_not_in_buildings_filtered`: - Table of amenities which do not intersect with any building from - `openstreetmap.osm_buildings_filtered` + Table of amenities which do not intersect with any building from + `openstreetmap.osm_buildings_filtered` * `openstreetmap.osm_buildings_synthetic`: - Table of synthetic residential buildings + Table of synthetic residential buildings * `boundaries.egon_map_zensus_buildings_filtered_all`: - Mapping table of census cells and buildings filtered even if population - in census cell = 0. + Mapping table of census cells and buildings filtered even if population + in census cell = 0. * `demand.egon_demandregio_zensus_electricity`: - Table of annual electricity load demand for residential and cts at census - cell level. Residential load demand is derived from aggregated residential - building profiles. DemandRegio CTS load demand at NUTS3 is distributed to - census cells linearly to heat demand from peta5. + Table of annual electricity load demand for residential and cts at census + cell level. Residential load demand is derived from aggregated residential + building profiles. DemandRegio CTS load demand at NUTS3 is distributed to + census cells linearly to heat demand from peta5. * `demand.egon_peta_heat`: - Table of annual heat load demand for residential and cts at census cell - level from peta5. + Table of annual heat load demand for residential and cts at census cell + level from peta5. * `demand.egon_etrago_electricity_cts`: - Scaled cts electricity time series for every MV substation. Derived from - DemandRegio SLP for selected economic sectors at nuts3. Scaled with annual - demand from `demand.egon_demandregio_zensus_electricity` + Scaled cts electricity time series for every MV substation. Derived from + DemandRegio SLP for selected economic sectors at nuts3. Scaled with annual + demand from `demand.egon_demandregio_zensus_electricity` * `demand.egon_etrago_heat_cts`: - Scaled cts heat time series for every MV substation. Derived from - DemandRegio SLP Gas for selected economic sectors at nuts3. Scaled with - annual demand from `demand.egon_peta_heat`. + Scaled cts heat time series for every MV substation. Derived from + DemandRegio SLP Gas for selected economic sectors at nuts3. Scaled with + annual demand from `demand.egon_peta_heat`. **What is the challenge?** @@ -1166,7 +1165,7 @@ def cts_buildings(): building nor amenity is available, random synthetic buildings are generated. The demand share is stored in the database. - Note: + Note ----- Cells with CTS demand, amenities and buildings do not change within the scenarios, only the demand itself. Therefore scenario eGon2035 diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py index 581f8fdd4..fd873baca 100755 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_buildings.py @@ -651,8 +651,8 @@ def map_houseprofiles_to_buildings(): buildings and supplementary data as well as the mapping table is stored in the db. - Tables: - ---------- + **Tables** + synthetic_buildings: schema: openstreetmap tablename: osm_buildings_synthetic @@ -661,8 +661,6 @@ def map_houseprofiles_to_buildings(): schema: demand tablename: egon_household_electricity_profile_of_buildings - Notes - ----- """ # egon_map_zensus_buildings_residential = Table( @@ -833,8 +831,7 @@ class setup(Dataset): * As this dataset uses the load profile assignment at census cell level conducted in hh_profiles.py, also check drawbacks and limitations in that module. - Example Query - ---------------- + **Example Query** * Get a list with number of houses, households and household types per census cell diff --git a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py index 6598e7695..e2166cec1 100644 --- a/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py +++ b/src/egon/data/datasets/electricity_demand_timeseries/hh_profiles.py @@ -137,6 +137,7 @@ class HouseholdDemands(Dataset): (see :func:`get_iee_hh_demand_profiles_raw`) * Spatial information about people living in households by Zensus 2011 at federal state level + * Type of household (family status) * Age * Number of people @@ -165,6 +166,7 @@ class HouseholdDemands(Dataset): * Spatial information about people living in households by zensus (2011) at federal state NUTS1 level `df_zensus` is aggregated to be compatible to IEE household profile specifications. + * exclude kids and reduce to adults and seniors * group as defined in `HH_TYPES` * convert data from people living in households to number of households @@ -217,6 +219,7 @@ class HouseholdDemands(Dataset): specific population value. *Helper functions* + * To access the DB, select specific profiles at various aggregation levels use :py:func:`get_hh_profiles_from_db` * To access the DB, select specific profiles at various aggregation levels @@ -447,7 +450,7 @@ def get_census_households_nuts1_raw(): * Choose table code: "1000A-3016" with title "Personen: Alter (11 Altersklassen) - Größe des privaten Haushalts - Typ des privaten Haushalts (nach Familien/Lebensform)" - - Change setting "GEOLK1" to "Bundesländer (16)" + * Change setting "GEOLK1" to "Bundesländer (16)" Data would be available in higher resolution ("Landkreise und kreisfreie Städte (412)"), but only after registration. @@ -1135,15 +1138,27 @@ def refine_census_data_at_cell_level( IEE profiles specifications. To do this, proportionate allocation is applied at nuts1 level and within household type clusters. - .. csv-table:: Mapping table - :header: "characteristics_code", "characteristics_text", "mapping" - - "1", "Einpersonenhaushalte (Singlehaushalte)", "SR; SO" - "2", "Paare ohne Kind(er)", "PR; PO" - "3", "Paare mit Kind(ern)", "P1; P2; P3" - "4", "Alleinerziehende Elternteile", "SK" - "5", "Mehrpersonenhaushalte ohne Kernfamilie", "OR; OO" - + .. list-table:: Mapping table + :header-rows: 1 + + * - characteristics_code + - characteristics_text + - mapping + * - 1 + - Einpersonenhaushalte (Singlehaushalte) + - SR; SO + * - 2 + - Paare ohne Kind(er) + - PR; PO + * - 3 + - Paare mit Kind(ern) + - P1; P2; P3 + * - 4 + - Alleinerziehende Elternteile + - SK + * - 5 + - Mehrpersonenhaushalte ohne Kernfamilie + - OR; OO Parameters ---------- diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py index 95744835b..64096febb 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/db_classes.py @@ -31,8 +31,8 @@ class EgonEvPool(Base): Each row is one EV, uniquely defined by either (`ev_id`) or (`rs7_id`, `type`, `simbev_id`). - Columns - ------- + **Columns** + ev_id: Unique id of EV rs7_id: @@ -73,8 +73,8 @@ class EgonEvTrip(Base): Each row is one event of a specific electric vehicle which is uniquely defined by `rs7_id`, `ev_id` and `event_id`. - Columns - ------- + **Columns** + scenario: Scenario event_id: diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index 3496a4a9e..8a9fa5e78 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -2,13 +2,16 @@ Generate timeseries for eTraGo and pypsa-eur-sec Call order - * generate_model_data_eGon2035() / generate_model_data_eGon100RE() - * generate_model_data() - * generate_model_data_grid_district() - * load_evs_trips() - * data_preprocessing() - * generate_load_time_series() - * write_model_data_to_db() +* generate_model_data_eGon2035() / generate_model_data_eGon100RE() + + * generate_model_data() + + * generate_model_data_grid_district() + + * load_evs_trips() + * data_preprocessing() + * generate_load_time_series() + * write_model_data_to_db() Notes ----- @@ -23,6 +26,7 @@ linearly extrapolated based upon https://nationale-leitstelle.de/wp-content/pdf/broschuere-lis-2025-2030-final.pdf (p.92): + * eGon2035: home=0.8, work=1.0 * eGon100RE: home=1.0, work=1.0 """ diff --git a/src/egon/data/datasets/fill_etrago_gen.py b/src/egon/data/datasets/fill_etrago_gen.py index cae8fff4f..a7c3533a0 100644 --- a/src/egon/data/datasets/fill_etrago_gen.py +++ b/src/egon/data/datasets/fill_etrago_gen.py @@ -21,9 +21,9 @@ class Egon_etrago_gen(Dataset): *Resulting tables* * :py:class:`grid.egon_etrago_generator - ` is extended + ` is extended * :py:class:`grid.egon_etrago_generator_timeseries - ` is filled + ` is filled """ #: diff --git a/src/egon/data/datasets/gas_grid.py b/src/egon/data/datasets/gas_grid.py index 6fc3c18bd..f4338b41a 100755 --- a/src/egon/data/datasets/gas_grid.py +++ b/src/egon/data/datasets/gas_grid.py @@ -3,7 +3,7 @@ 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 +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 :py:func:`download_SciGRID_gas_data` @@ -77,11 +77,12 @@ def download_SciGRID_gas_data(): 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). + + * 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 `_. @@ -198,11 +199,12 @@ def insert_CH4_nodes_list(gas_nodes_list): 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 (eGon2035) in Germany - * Insert the buses in the table grid.egon_etrago_bus + + * 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 (eGon2035) in Germany + * Insert the buses in the table grid.egon_etrago_bus Parameters ---------- @@ -299,18 +301,19 @@ def define_gas_buses_abroad(scn_name="eGon2035"): 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 + 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 - :py:func:`central_buses_egon100 ` from - the module :py:mod:`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 + + * Definition of the foreign buses with the function + :py:func:`central_buses_egon100 ` from + the module :py:mod:`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 ---------- @@ -396,11 +399,11 @@ def insert_gas_buses_abroad(scn_name="eGon2035"): """ Insert CH4 buses in neighbouring countries into database for eGon2035 - * Definition of the CH4 buses abroad with the function - :py:func:`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. + * Definition of the CH4 buses abroad with the function + :py:func:`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 ---------- @@ -458,10 +461,11 @@ def define_gas_pipeline_list( 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 + + * 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 ---------- @@ -827,7 +831,7 @@ def insert_gas_pipeline_list(gas_pipelines_list, scn_name="eGon2035"): Dataframe containing the gas pipelines in Germany scn_name : str Name of the scenario - + Returns ------- None @@ -917,16 +921,17 @@ def insert_gas_data(): This function imports the methane data (buses and pipelines) for eGon2035, by executing the following steps: - * Download the SciGRID_gas datasets with the function :py:func:`download_SciGRID_gas_data` - * Define CH4 buses with the function :py:func:`define_gas_nodes_list` - * Insert the CH4 buses in Germany into the database with the - function :py:func:`insert_CH4_nodes_list` - * Insert the CH4 buses abroad into the database with the function - :py:func:`insert_gas_buses_abroad` - * Insert the CH4 links representing the CH4 pipeline into the - database with the function :py:func:`insert_gas_pipeline_list` - * Remove the isolated CH4 buses directly from the database using - the function :py:func:`remove_isolated_gas_buses` + + * Download the SciGRID_gas datasets with the function :py:func:`download_SciGRID_gas_data` + * Define CH4 buses with the function :py:func:`define_gas_nodes_list` + * Insert the CH4 buses in Germany into the database with the + function :py:func:`insert_CH4_nodes_list` + * Insert the CH4 buses abroad into the database with the function + :py:func:`insert_gas_buses_abroad` + * Insert the CH4 links representing the CH4 pipeline into the + database with the function :py:func:`insert_gas_pipeline_list` + * Remove the isolated CH4 buses directly from the database using + the function :py:func:`remove_isolated_gas_buses` Returns ------- diff --git a/src/egon/data/datasets/gas_neighbours/eGon100RE.py b/src/egon/data/datasets/gas_neighbours/eGon100RE.py index 16d6f8ff2..451d3b131 100755 --- a/src/egon/data/datasets/gas_neighbours/eGon100RE.py +++ b/src/egon/data/datasets/gas_neighbours/eGon100RE.py @@ -6,12 +6,13 @@ Dependecies (pipeline) ====================== - * :dataset: PypsaEurSec, GasNodesandPipes, HydrogenBusEtrago, - ElectricalNeighbours + +* :dataset: PypsaEurSec, GasNodesandPipes, HydrogenBusEtrago, ElectricalNeighbours Resulting tables ================ - * grid.egon_etrago_link is completed + +* grid.egon_etrago_link is completed """ @@ -43,22 +44,23 @@ def insert_gas_neigbours_eGon100RE(): This function insert the cross border pipelines for H2 and CH4, exclusively between Germany and its neighbouring countries, for eGon100RE in the database by executing the following steps: - * call of the function - :py:func:`define_DE_crossbording_pipes_geom_eGon100RE`, that - defines the cross border pipelines (H2 and CH4) between - Germany and its neighbouring countries - * call of the function - :py:func:`read_DE_crossbordering_cap_from_pes`, that calculates - the cross border total exchange capactities for H2 and CH4 - between Germany and its neighbouring countries based on the - pypsa-eur-sec results - * call of the function - :py:func:`calculate_crossbordering_gas_grid_capacities_eGon100RE`, - that attributes to each cross border pipeline (H2 and CH4) - between Germany and its neighbouring countries its capacity - * insertion of the H2 and CH4 pipelines between Germany and its - neighbouring countries in the database with function - :py:func:`insert_gas_grid_capacities` + + * call of the function + :py:func:`define_DE_crossbording_pipes_geom_eGon100RE`, that + defines the cross border pipelines (H2 and CH4) between + Germany and its neighbouring countries + * call of the function + :py:func:`read_DE_crossbordering_cap_from_pes`, that calculates + the cross border total exchange capactities for H2 and CH4 + between Germany and its neighbouring countries based on the + pypsa-eur-sec results + * call of the function + :py:func:`calculate_crossbordering_gas_grid_capacities_eGon100RE`, + that attributes to each cross border pipeline (H2 and CH4) + between Germany and its neighbouring countries its capacity + * insertion of the H2 and CH4 pipelines between Germany and its + neighbouring countries in the database with function + :py:func:`insert_gas_grid_capacities` Returns ------- @@ -117,29 +119,29 @@ def define_DE_crossbording_pipes_geom_eGon100RE(scn_name="eGon100RE"): f""" SELECT * FROM grid.egon_etrago_link WHERE ("bus0" IN ( - SELECT bus_id FROM + SELECT bus_id FROM {sources['buses']['schema']}.{sources['buses']['table']} WHERE country != 'DE' AND country != 'RU' AND carrier = 'CH4' AND scn_name = 'eGon2035') - AND "bus1" IN (SELECT bus_id FROM + AND "bus1" IN (SELECT bus_id FROM {sources['buses']['schema']}.{sources['buses']['table']} WHERE country = 'DE' - AND carrier = 'CH4' + AND carrier = 'CH4' AND scn_name = 'eGon2035')) OR ("bus0" IN ( - SELECT bus_id FROM + SELECT bus_id FROM {sources['buses']['schema']}.{sources['buses']['table']} WHERE country = 'DE' AND carrier = 'CH4' AND scn_name = 'eGon2035') AND "bus1" IN ( - SELECT bus_id FROM + SELECT bus_id FROM {sources['buses']['schema']}.{sources['buses']['table']} WHERE country != 'DE' AND country != 'RU' - AND carrier = 'CH4' + AND carrier = 'CH4' AND scn_name = 'eGon2035')) AND scn_name = 'eGon2035' AND carrier = 'CH4' diff --git a/src/egon/data/datasets/gas_neighbours/eGon2035.py b/src/egon/data/datasets/gas_neighbours/eGon2035.py index c488657b2..30ae1b345 100755 --- a/src/egon/data/datasets/gas_neighbours/eGon2035.py +++ b/src/egon/data/datasets/gas_neighbours/eGon2035.py @@ -621,9 +621,10 @@ def import_ch4_demandTS(): Import from the PyPSA-eur-sec run the time series of residential rural heat per neighbor country. This time series is used to calculate: - * the global (yearly) heat demand of Norway - (that will be supplied by CH4) - * the normalized CH4 hourly resolved demand profile + + * the global (yearly) heat demand of Norway + (that will be supplied by CH4) + * the normalized CH4 hourly resolved demand profile Returns ------- @@ -1420,21 +1421,24 @@ def tyndp_gas_demand(): Insert CH4 and H2 demands abroad for eGon2035 by executing the following steps: - * CH4 - * Calculation of the global CH4 demand in Norway and the - CH4 demand profile by executing the function - :py:func:`import_ch4_demandTS` - * Calculation of the global CH4 demands by executing the - function :py:func:`calc_global_ch4_demand` - * Insertion of the CH4 loads and their associated time - series in the database by executing the function - :py:func:`insert_ch4_demand` - * H2 - * Calculation of the global power demand abroad linked - to H2 production by executing the function - :py:func:`calc_global_power_to_h2_demand` - * Insertion of these loads in the database by executing the - function :py:func:`insert_power_to_h2_demand` + + * CH4 + + * Calculation of the global CH4 demand in Norway and the + CH4 demand profile by executing the function + :py:func:`import_ch4_demandTS` + * Calculation of the global CH4 demands by executing the + function :py:func:`calc_global_ch4_demand` + * Insertion of the CH4 loads and their associated time + series in the database by executing the function + :py:func:`insert_ch4_demand` + * H2 + + * Calculation of the global power demand abroad linked + to H2 production by executing the function + :py:func:`calc_global_power_to_h2_demand` + * Insertion of these loads in the database by executing the + function :py:func:`insert_power_to_h2_demand` Returns ------- diff --git a/src/egon/data/datasets/heat_demand_timeseries/__init__.py b/src/egon/data/datasets/heat_demand_timeseries/__init__.py index 3a8414a1b..f094c9329 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/__init__.py +++ b/src/egon/data/datasets/heat_demand_timeseries/__init__.py @@ -1073,10 +1073,11 @@ class HeatTimeSeries(Dataset): Time series for residential buildings are created based on a variety of synthetical created individual demand profiles that are part of :py:class:`DataBundle `. This method is desribed within the functions and in this publication: - C. Büttner, J. Amme, J. Endres, A. Malla, B. Schachler, I. Cußmann, - Open modeling of electricity and heat demand curves for all - residential buildings in Germany, Energy Informatics 5 (1) (2022) 21. - doi:10.1186/s42162-022-00201-y. + + C. Büttner, J. Amme, J. Endres, A. Malla, B. Schachler, I. Cußmann, + Open modeling of electricity and heat demand curves for all + residential buildings in Germany, Energy Informatics 5 (1) (2022) 21. + doi:10.1186/s42162-022-00201-y. *Dependencies* diff --git a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py index d3294ad15..7f6128f73 100644 --- a/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py +++ b/src/egon/data/datasets/heat_demand_timeseries/idp_pool.py @@ -94,13 +94,13 @@ def temperature_classes(): def idp_pool_generator(): """ - Description: Create List of Dataframes for each temperature class for each household stock + Create List of Dataframes for each temperature class for each household stock - Returns - ------- - TYPE list - List of dataframes with each element representing a dataframe - for every combination of household stock and temperature class + Returns + ------- + list + List of dataframes with each element representing a dataframe + for every combination of household stock and temperature class """ path = os.path.join( @@ -364,8 +364,8 @@ def create(): def annual_demand_generator(): """ - Description: Create dataframe with annual demand and household count for each zensus cell + Returns ------- demand_count: pandas.DataFrame @@ -389,14 +389,14 @@ def annual_demand_generator(): house_count_MFH = db.select_dataframe( """ - - SELECT cell_id as zensus_population_id, COUNT(*) as number FROM + + SELECT cell_id as zensus_population_id, COUNT(*) as number FROM ( SELECT cell_id, COUNT(*), building_id FROM demand.egon_household_electricity_profile_of_buildings GROUP BY (cell_id, building_id) ) a - + WHERE a.count >1 GROUP BY cell_id """, @@ -405,13 +405,13 @@ def annual_demand_generator(): house_count_SFH = db.select_dataframe( """ - - SELECT cell_id as zensus_population_id, COUNT(*) as number FROM + + SELECT cell_id as zensus_population_id, COUNT(*) as number FROM ( SELECT cell_id, COUNT(*), building_id FROM demand.egon_household_electricity_profile_of_buildings GROUP BY (cell_id, building_id) - ) a + ) a WHERE a.count = 1 GROUP BY cell_id """, @@ -525,13 +525,13 @@ def select(): result_SFH["building_id"] = ( db.select_dataframe( """ - - SELECT cell_id as zensus_population_id, building_id FROM + + SELECT cell_id as zensus_population_id, building_id FROM ( SELECT cell_id, COUNT(*), building_id FROM demand.egon_household_electricity_profile_of_buildings GROUP BY (cell_id, building_id) - ) a + ) a WHERE a.count = 1 """, index_col="zensus_population_id", @@ -557,13 +557,13 @@ def select(): result_MFH["building_id"] = ( db.select_dataframe( """ - - SELECT cell_id as zensus_population_id, building_id FROM + + SELECT cell_id as zensus_population_id, building_id FROM ( SELECT cell_id, COUNT(*), building_id FROM demand.egon_household_electricity_profile_of_buildings GROUP BY (cell_id, building_id) - ) a + ) a WHERE a.count > 1 """, index_col="zensus_population_id", @@ -593,13 +593,13 @@ def select(): "building_id": ( db.select_dataframe( """ - - SELECT cell_id as zensus_population_id, building_id FROM + + SELECT cell_id as zensus_population_id, building_id FROM ( SELECT cell_id, COUNT(*), building_id FROM demand.egon_household_electricity_profile_of_buildings GROUP BY (cell_id, building_id) - ) a + ) a WHERE a.count = 1 """, index_col="zensus_population_id", @@ -645,13 +645,13 @@ def select(): "building_id": ( db.select_dataframe( """ - - SELECT cell_id as zensus_population_id, building_id FROM + + SELECT cell_id as zensus_population_id, building_id FROM ( SELECT cell_id, COUNT(*), building_id FROM demand.egon_household_electricity_profile_of_buildings GROUP BY (cell_id, building_id) - ) a + ) a WHERE a.count > 1 """, index_col="zensus_population_id", diff --git a/src/egon/data/datasets/heat_supply/individual_heating.py b/src/egon/data/datasets/heat_supply/individual_heating.py index 13f19d29a..d6de64775 100644 --- a/src/egon/data/datasets/heat_supply/individual_heating.py +++ b/src/egon/data/datasets/heat_supply/individual_heating.py @@ -2,7 +2,7 @@ The following main things are done in this module: -* ... +* ?? * Desaggregation of heat pump capacities to individual buildings * Determination of minimum required heat pump capacity for pypsa-eur-sec @@ -542,12 +542,12 @@ def cascade_per_technology( def cascade_heat_supply_indiv(scenario, distribution_level, plotting=True): """Assigns supply strategy for individual heating in four steps. - 1.) all small scale CHP are connected. - 2.) If the supply can not meet the heat demand, solar thermal collectors - are attached. This is not implemented yet, since individual - solar thermal plants are not considered in eGon2035 scenario. - 3.) If this is not suitable, the mv grid is also supplied by heat pumps. - 4.) The last option are individual gas boilers. + 1. all small scale CHP are connected. + 2. If the supply can not meet the heat demand, solar thermal collectors + are attached. This is not implemented yet, since individual + solar thermal plants are not considered in eGon2035 scenario. + 3. If this is not suitable, the mv grid is also supplied by heat pumps. + 4. The last option are individual gas boilers. Parameters ---------- @@ -1610,7 +1610,7 @@ def export_to_db(df_peak_loads_db, df_heat_mvgd_ts_db, drop=False): """ Function to export the collected results of all MVGDs per bulk to DB. - Parameters + Parameters ---------- df_peak_loads_db : pd.DataFrame Table of building peak loads of all MVGDs per bulk diff --git a/src/egon/data/datasets/hydrogen_etrago/__init__.py b/src/egon/data/datasets/hydrogen_etrago/__init__.py index 5ca7162dd..aa3efbff9 100755 --- a/src/egon/data/datasets/hydrogen_etrago/__init__.py +++ b/src/egon/data/datasets/hydrogen_etrago/__init__.py @@ -80,14 +80,15 @@ class HydrogenStoreEtrago(Dataset): Insert the H2 stores in Germany into the database for the scenarios eGon2035 and eGon100RE: - * H2 overground stores or steel tanks at each H2_grid bus with the - function :py:func:`insert_H2_overground_storage ` - for the scenario eGon2035, - * H2 underground stores or saltcavern stores at each H2_saltcavern - bus with the function :py:func:`insert_H2_saltcavern_storage ` - for the scenario eGon2035, - * H2 stores (overground and underground) for the scenario eGon100RE - with the function :py:func:`insert_H2_storage_eGon100RE `. + + * H2 overground stores or steel tanks at each H2_grid bus with the + function :py:func:`insert_H2_overground_storage ` + for the scenario eGon2035, + * H2 underground stores or saltcavern stores at each H2_saltcavern + bus with the function :py:func:`insert_H2_saltcavern_storage ` + for the scenario eGon2035, + * H2 stores (overground and underground) for the scenario eGon100RE + with the function :py:func:`insert_H2_storage_eGon100RE `. *Dependencies* * :py:class:`SaltcavernData ` diff --git a/src/egon/data/datasets/hydrogen_etrago/bus.py b/src/egon/data/datasets/hydrogen_etrago/bus.py index c83bcd910..73a105c16 100755 --- a/src/egon/data/datasets/hydrogen_etrago/bus.py +++ b/src/egon/data/datasets/hydrogen_etrago/bus.py @@ -6,11 +6,12 @@ The H2 buses in the neighbouring countries (only present in eGon100RE) are defined in :py:mod:`pypsaeursec `. In both scenarios, there are two types of H2 buses in Germany: - * H2_grid buses: defined in :py:func:`insert_H2_buses_from_CH4_grid`; - these buses are located at the places of the CH4 buses. - * H2_saltcavern buses: defined in :py:func:`insert_H2_buses_from_saltcavern`; - these buses are located at the intersection of AC buses and - potential H2 saltcaverns. + +* H2_grid buses: defined in :py:func:`insert_H2_buses_from_CH4_grid`; + these buses are located at the places of the CH4 buses. +* H2_saltcavern buses: defined in :py:func:`insert_H2_buses_from_saltcavern`; + these buses are located at the intersection of AC buses and + potential H2 saltcaverns. """ @@ -29,15 +30,15 @@ def insert_hydrogen_buses(scenario="eGon2035"): Insert hydrogen buses into the database (in etrago table) Hydrogen buses are inserted into the database using the functions: - * :py:func:`insert_H2_buses_from_CH4_grid` for H2_grid buses - * :py:func:`insert_H2_buses_from_saltcavern` for the H2_saltcavern - buses + + * :py:func:`insert_H2_buses_from_CH4_grid` for H2_grid buses + * :py:func:`insert_H2_buses_from_saltcavern` for the H2_saltcavern buses Parameters ---------- scenario : str, optional Name of the scenario, the default is 'eGon2035'. - + Returns ------- None @@ -150,11 +151,11 @@ def insert_H2_buses_from_CH4_grid(gdf, carrier, target, scn_name): Target schema and table information. scn_name : str Name of the scenario. - + Returns ------- None - + """ # Connect to local database engine = db.engine() @@ -190,11 +191,11 @@ def insert_H2_buses_from_CH4_grid(gdf, carrier, target, scn_name): def insert_hydrogen_buses_eGon100RE(): """Copy H2 buses from the eGon2035 to the eGon100RE scenario. - + Returns ------- - None - + None + """ copy_and_modify_buses( "eGon2035", "eGon100RE", {"carrier": ["H2_grid", "H2_saltcavern"]}, diff --git a/src/egon/data/datasets/hydrogen_etrago/h2_grid.py b/src/egon/data/datasets/hydrogen_etrago/h2_grid.py index ff0776d26..760894fd4 100755 --- a/src/egon/data/datasets/hydrogen_etrago/h2_grid.py +++ b/src/egon/data/datasets/hydrogen_etrago/h2_grid.py @@ -2,12 +2,14 @@ The central module containing all code dealing with the H2 grid in eGon100RE The H2 grid, present only in eGon100RE, is composed of two parts: + * a fixed part with the same topology as the CH4 grid and with carrier 'H2_retrofit' corresponding to the retrofitted share of the CH4 grid into a hydrogen grid, * an extendable part with carrier 'H2_gridextension', linking each H2_salcavern bus to the closest H2_grid bus: this part has no capacity (p_nom = 0) but it can be extended. + As for the CH4 grid, the H2 pipelines are modelled by PyPSA links. """ @@ -25,24 +27,25 @@ def insert_h2_pipelines(): Insert hydrogen grid (H2 links) into the database for eGon100RE. Insert the H2 grid by executing the following steps: - * Copy the CH4 links in Germany from eGon2035 - * Overwrite the followings columns: - * bus0 and bus1 using the grid.egon_etrago_ch4_h2 table - * carrier, scn_name - * p_nom: the value attributed there corresponds to the share - of p_nom of the specific pipeline that could be retrofited into - H2 pipeline. This share is the same for every pipeline and is - calculated in the PyPSA-eur-sec run. - * Create new extendable pipelines to link the existing grid to the - H2_saltcavern buses - * Clean database - * Attribute link_id to the links - * Insert into the database + + * Copy the CH4 links in Germany from eGon2035 + * Overwrite the followings columns: + + * bus0 and bus1 using the grid.egon_etrago_ch4_h2 table + * carrier, scn_name + * p_nom: the value attributed there corresponds to the share + of p_nom of the specific pipeline that could be retrofited into + H2 pipeline. This share is the same for every pipeline and is + calculated in the PyPSA-eur-sec run. + * Create new extendable pipelines to link the existing grid to the + H2_saltcavern buses + * Clean database + * Attribute link_id to the links + * Insert into the database Returns ------- None - """ H2_buses = db.select_geodataframe( diff --git a/src/egon/data/datasets/hydrogen_etrago/h2_to_ch4.py b/src/egon/data/datasets/hydrogen_etrago/h2_to_ch4.py index 6c26caea6..21202cc87 100755 --- a/src/egon/data/datasets/hydrogen_etrago/h2_to_ch4.py +++ b/src/egon/data/datasets/hydrogen_etrago/h2_to_ch4.py @@ -5,11 +5,11 @@ In this module the functions used to define and insert the links between H2 and CH4 buses into the database are to be found. These links are modelling: - * Methanisation (carrier name: 'H2_to_CH4'): technology to produce CH4 - from H2 - * H2_feedin: Injection of H2 into the CH4 grid - * Steam Methane Reaction (SMR, carrier name: 'CH4_to_H2'): techonology - to produce CH4 from H2 + +* Methanisation (carrier name: 'H2_to_CH4'): technology to produce CH4 from H2 +* H2_feedin: Injection of H2 into the CH4 grid +* Steam Methane Reaction (SMR, carrier name: 'CH4_to_H2'): techonology + to produce CH4 from H2 """ diff --git a/src/egon/data/datasets/hydrogen_etrago/power_to_h2.py b/src/egon/data/datasets/hydrogen_etrago/power_to_h2.py index 78e4a09b0..d5745617f 100755 --- a/src/egon/data/datasets/hydrogen_etrago/power_to_h2.py +++ b/src/egon/data/datasets/hydrogen_etrago/power_to_h2.py @@ -2,13 +2,12 @@ """ Module containing the definition of the AC grid to H2 links -In this module the functions used to define and insert the links +In this module the functions used to define and insert the links between H2 and AC buses into the database are to be found. These links are modelling: - * Electrolysis (carrier name: 'power_to_H2'): technology to produce H2 - from AC - * Fuel cells (carrier name: 'H2_to_power'): techonology to produce - power from H2 + +* Electrolysis (carrier name: 'power_to_H2'): technology to produce H2 from AC +* Fuel cells (carrier name: 'H2_to_power'): techonology to produce power from H2 """ from geoalchemy2.types import Geometry @@ -232,11 +231,11 @@ def map_buses(scn_name): def insert_power_to_h2_to_power_eGon100RE(): """Copy H2/power links from the eGon2035 to the eGon100RE scenario. - + Returns ------- None - + """ copy_and_modify_links( "eGon2035", "eGon100RE", ["H2_to_power", "power_to_H2"], "gas" diff --git a/src/egon/data/datasets/hydrogen_etrago/storage.py b/src/egon/data/datasets/hydrogen_etrago/storage.py index c85013d23..209cbb80c 100755 --- a/src/egon/data/datasets/hydrogen_etrago/storage.py +++ b/src/egon/data/datasets/hydrogen_etrago/storage.py @@ -3,11 +3,13 @@ This module contains the functions used to insert the two types of H2 store potentials in Germany: - * H2 overground stores (carrier: 'H2_overground'): steel tanks at - every H2_grid bus - * H2 underground stores (carrier: 'H2_underground'): saltcavern store - at every H2_saltcavern bus. - NB: the saltcavern locations define the H2_saltcavern buses locations. + +* H2 overground stores (carrier: 'H2_overground'): steel tanks at + every H2_grid bus +* H2 underground stores (carrier: 'H2_underground'): saltcavern store + at every H2_saltcavern bus. + NB: the saltcavern locations define the H2_saltcavern buses locations. + All these stores are modelled as extendable PyPSA stores. """ @@ -25,7 +27,7 @@ def insert_H2_overground_storage(scn_name="eGon2035"): Insert H2_overground stores into the database. Insert extendable H2_overground stores (steel tanks) at each H2_grid - bus. + bus. Returns ------- @@ -95,7 +97,7 @@ def insert_H2_saltcavern_storage(scn_name="eGon2035"): Insert extendable H2_underground stores (saltcavern potentials) at every H2_saltcavern bus. - + Returns ------- None @@ -379,11 +381,11 @@ def calculate_and_map_saltcavern_storage_potential(): def write_saltcavern_potential(): """Write saltcavern potentials into the database - + Returns ------- None - + """ potential_areas = calculate_and_map_saltcavern_storage_potential() @@ -401,11 +403,11 @@ def write_saltcavern_potential(): def insert_H2_storage_eGon100RE(): """Copy H2 storage from the eGon2035 to the eGon100RE scenario. - + Returns ------- None - + """ copy_and_modify_stores( "eGon2035", "eGon100RE", ["H2_underground", "H2_overground"], "gas" diff --git a/src/egon/data/datasets/industrial_gas_demand.py b/src/egon/data/datasets/industrial_gas_demand.py index d57ccfcba..bb54b083c 100755 --- a/src/egon/data/datasets/industrial_gas_demand.py +++ b/src/egon/data/datasets/industrial_gas_demand.py @@ -440,22 +440,24 @@ def insert_industrial_gas_demand_egon100RE(): previously downloaded in :py:func:`download_industrial_gas_demand` are adapted by executing the following steps: - * Clean the database with the function :py:func:`delete_old_entries` - * Read and prepare the CH4 and the H2 industrial demands and their - associated time series in Germany with the function :py:func:`read_and_process_demand` - * Identify and adjust the total industrial CH4 and H2 loads for Germany - generated by PyPSA-Eur-Sec - * For CH4, the time series used is the one from H2, because - the industrial CH4 demand in the opendata.ffe database is 0 - * In test mode, the total values are obtained by - evaluating the share of H2 demand in the test region - (NUTS1: DEF, Schleswig-Holstein) with respect to the H2 - demand in full Germany model (NUTS0: DE). This task has been - outsourced to save processing cost. - * Aggregate the demands with the same properties at the same gas bus - * Insert the loads into the database by executing :py:func:`insert_new_entries` - * Insert the time series associated to the loads into the database - by executing :py:func:`insert_industrial_gas_demand_time_series` + * Clean the database with the function :py:func:`delete_old_entries` + * Read and prepare the CH4 and the H2 industrial demands and their + associated time series in Germany with the function :py:func:`read_and_process_demand` + * Identify and adjust the total industrial CH4 and H2 loads for Germany + generated by PyPSA-Eur-Sec + + * For CH4, the time series used is the one from H2, because + the industrial CH4 demand in the opendata.ffe database is 0 + * In test mode, the total values are obtained by + evaluating the share of H2 demand in the test region + (NUTS1: DEF, Schleswig-Holstein) with respect to the H2 + demand in full Germany model (NUTS0: DE). This task has been + outsourced to save processing cost. + + * Aggregate the demands with the same properties at the same gas bus + * Insert the loads into the database by executing :py:func:`insert_new_entries` + * Insert the time series associated to the loads into the database + by executing :py:func:`insert_industrial_gas_demand_time_series` Returns ------- diff --git a/src/egon/data/datasets/mv_grid_districts.py b/src/egon/data/datasets/mv_grid_districts.py index d13e5fb5d..c968e6b5b 100644 --- a/src/egon/data/datasets/mv_grid_districts.py +++ b/src/egon/data/datasets/mv_grid_districts.py @@ -773,11 +773,11 @@ def define_mv_grid_districts(): is organized in three steps: 1. :func:`substations_in_municipalities`: The number of substations - located inside each municipality is calculated. + located inside each municipality is calculated. 2. :func:`split_multi_substation_municipalities`: The municipalities with - >1 substation inside are split by Voronoi polygons around substations. + >1 substation inside are split by Voronoi polygons around substations. 3. :func:`merge_polygons_to_grid_district`: All polygons are merged such - that one polygon has exactly one single substation inside. + that one polygon has exactly one single substation inside. Finally, intermediate tables used for storing data temporarily are deleted. """ diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 39f68ad40..f7d70c13f 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -63,31 +63,31 @@ class PowerPlants(Dataset): *Dependencies* * :py:class:`Chp ` * :py:class:`CtsElectricityDemand - ` + ` * :py:class:`HouseholdElectricityDemand - ` + ` * :py:class:`mastr_data ` * :py:func:`define_mv_grid_districts - ` + ` * :py:class:`RePotentialAreas - ` + ` * :py:class:`ZensusVg250 - ` + ` * :py:class:`ScenarioCapacities - ` + ` * :py:class:`ScenarioParameters - ` + ` * :py:func:`Setup ` * :py:class:`substation_extraction - ` + ` * :py:class:`Vg250MvGridDistricts - ` + ` * :py:class:`ZensusMvGridDistricts - ` + ` *Resulting tables* * :py:class:`supply.egon_power_plants - ` is filled + ` is filled """ diff --git a/src/egon/data/datasets/power_plants/mastr.py b/src/egon/data/datasets/power_plants/mastr.py index 225c7c685..8bfa90a17 100644 --- a/src/egon/data/datasets/power_plants/mastr.py +++ b/src/egon/data/datasets/power_plants/mastr.py @@ -10,6 +10,7 @@ * hydro plants: table `supply.egon_power_plants_hydro` Handling of empty source data in MaStr dump: + * `voltage_level`: inferred based on nominal power (`capacity`) using the ranges from https://redmine.iks.cs.ovgu.de/oe/projects/ego-n/wiki/Definition_of_thresholds_for_voltage_level_assignment @@ -55,6 +56,7 @@ def isfloat(num: str): """ Determine if string can be converted to float. + Parameters ----------- num : str @@ -76,6 +78,7 @@ def zip_and_municipality_from_standort( ) -> tuple[str, bool]: """ Get zip code and municipality from Standort string split into a list. + Parameters ----------- standort : str @@ -125,7 +128,7 @@ def infer_voltage_level( ----------- units_gdf : geopandas.GeoDataFrame GeoDataFrame containing units with voltage levels from MaStR - Returnsunits_gdf: gpd.GeoDataFrame + Returns ------- geopandas.GeoDataFrame GeoDataFrame containing units all having assigned a voltage level. diff --git a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py index 07c43489d..e12b848b7 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop_buildings.py @@ -261,6 +261,7 @@ def add_ags_to_gens( ) -> gpd.GeoDataFrame: """ Add information about AGS ID to generators. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -285,6 +286,7 @@ def drop_gens_outside_muns( ) -> gpd.GeoDataFrame: """ Drop all generators outside of municipalities. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -311,6 +313,7 @@ def load_mastr_data(): """Read PV rooftop data from MaStR CSV Note: the source will be replaced as soon as the MaStR data is available in DB. + Returns ------- geopandas.GeoDataFrame @@ -359,6 +362,7 @@ def osm_buildings( ) -> gpd.GeoDataFrame: """ Read OSM buildings data from eGo^n Database. + Parameters ----------- to_crs : pyproj.crs.crs.CRS @@ -386,6 +390,7 @@ def synthetic_buildings( ) -> gpd.GeoDataFrame: """ Read synthetic buildings data from eGo^n Database. + Parameters ----------- to_crs : pyproj.crs.crs.CRS @@ -414,6 +419,7 @@ def add_ags_to_buildings( ) -> gpd.GeoDataFrame: """ Add information about AGS ID to buildings. + Parameters ----------- buildings_gdf : geopandas.GeoDataFrame @@ -438,6 +444,7 @@ def drop_buildings_outside_muns( ) -> gpd.GeoDataFrame: """ Drop all buildings outside of municipalities. + Parameters ----------- buildings_gdf : geopandas.GeoDataFrame @@ -598,6 +605,7 @@ def sort_and_qcut_df( """ Determine the quantile of a given attribute in a (Geo)DataFrame. Sort the (Geo)DataFrame in ascending order for the given attribute. + Parameters ----------- df : pandas.DataFrame or geopandas.GeoDataFrame @@ -634,6 +642,7 @@ def allocate_pv( buildings than generators within a given AGS. Primarily generators are distributed with the same qunatile as the buildings. Multiple assignment is excluded. + Parameters ----------- q_mastr_gdf : geopandas.GeoDataFrame @@ -750,6 +759,7 @@ def frame_to_numeric( ) -> pd.DataFrame | gpd.GeoDataFrame: """ Try to convert all columns of a DataFrame to numeric ignoring errors. + Parameters ---------- df : pandas.DataFrame or geopandas.GeoDataFrame @@ -855,6 +865,7 @@ def allocate_to_buildings( ) -> tuple[gpd.GeoDataFrame, gpd.GeoDataFrame]: """ Allocate status quo pv rooftop generators to buildings. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -889,6 +900,7 @@ def grid_districts( """ Load mv grid district geo data from eGo^n Database as geopandas.GeoDataFrame. + Parameters ----------- epsg : int @@ -922,6 +934,7 @@ def scenario_data( ) -> pd.DataFrame: """ Get scenario capacity data from eGo^n Database. + Parameters ----------- carrier : str @@ -989,6 +1002,7 @@ class Vg250Lan(Base): def federal_state_data(to_crs: CRS) -> gpd.GeoDataFrame: """ Get feder state data from eGo^n Database. + Parameters ----------- to_crs : pyproj.crs.crs.CRS @@ -1019,6 +1033,7 @@ def overlay_grid_districts_with_counties( ) -> gpd.GeoDataFrame: """ Calculate the intersections of mv grid districts and counties. + Parameters ----------- mv_grid_district_gdf : gpd.GeoDataFrame @@ -1054,6 +1069,7 @@ def add_overlay_id_to_buildings( ) -> gpd.GeoDataFrame: """ Add information about overlay ID to buildings. + Parameters ----------- buildings_gdf : geopandas.GeoDataFrame @@ -1086,6 +1102,7 @@ def drop_buildings_outside_grids( ) -> gpd.GeoDataFrame: """ Drop all buildings outside of grid areas. + Parameters ----------- buildings_gdf : geopandas.GeoDataFrame @@ -1144,6 +1161,7 @@ def determine_end_of_life_gens( ) -> gpd.GeoDataFrame: """ Determine if an old PV system has reached its end of life. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -1239,6 +1257,7 @@ def calculate_building_load_factor( ) -> gpd.GeoDataFrame: """ Calculate the roof load factor from existing PV systems. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -1273,6 +1292,7 @@ def get_probability_for_property( """ Calculate the probability of the different options of a property of the existing PV plants. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -1322,6 +1342,7 @@ def probabilities( """ Calculate the probability of the different options of properties of the existing PV plants. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -1425,6 +1446,7 @@ def mean_load_factor_per_cap_range( """ Calculate the mean roof load factor per capacity range from existing PV plants. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -1469,6 +1491,7 @@ def building_area_range_per_cap_range( Estimate normal building area range per capacity range. Calculate the mean roof load factor per capacity range from existing PV plants. + Parameters ----------- mastr_gdf : geopandas.GeoDataFrame @@ -1555,6 +1578,7 @@ def desaggregate_pv_in_mv_grid( ) -> gpd.GeoDataFrame: """ Desaggregate PV capacity on buildings within a given grid district. + Parameters ----------- buildings_gdf : geopandas.GeoDataFrame @@ -1872,6 +1896,7 @@ def add_buildings_meta_data( ) -> gpd.GeoDataFrame: """ Randomly add additional metadata to desaggregated PV plants. + Parameters ----------- buildings_gdf : geopandas.GeoDataFrame @@ -1929,6 +1954,7 @@ def add_commissioning_date( ): """ Randomly and linear add start-up date to new pv generators. + Parameters ---------- buildings_gdf : geopandas.GeoDataFrame @@ -1963,6 +1989,7 @@ def allocate_scenarios( ): """ Desaggregate and allocate scenario pv rooftop ramp-ups onto buildings. + Parameters ---------- mastr_gdf : geopandas.GeoDataFrame diff --git a/src/egon/data/datasets/sanity_checks.py b/src/egon/data/datasets/sanity_checks.py index aae4702fa..7dba8093c 100755 --- a/src/egon/data/datasets/sanity_checks.py +++ b/src/egon/data/datasets/sanity_checks.py @@ -835,9 +835,10 @@ def sanitycheck_emobility_mit(): Checks data integrity for eGon2035, eGon2035_lowflex and eGon100RE scenario using assertions: - 1. Allocated EV numbers and EVs allocated to grid districts - 2. Trip data (original inout data from simBEV) - 3. Model data in eTraGo PF tables (grid.egon_etrago_*) + + 1. Allocated EV numbers and EVs allocated to grid districts + 2. Trip data (original inout data from simBEV) + 3. Model data in eTraGo PF tables (grid.egon_etrago_*) Parameters ---------- @@ -1437,10 +1438,11 @@ def sanity_check_gas_buses(scn): Returns print statements as sanity checks for the CH4, H2_grid and H2_saltcavern buses. - * For all of them, it is checked if they are not isolated. - * For the grid buses, the deviation is calculated between the - number of gas grid buses in the database and the original - Scigrid_gas number of gas buses in Germany. + + * For all of them, it is checked if they are not isolated. + * For the grid buses, the deviation is calculated between the + number of gas grid buses in the database and the original + Scigrid_gas number of gas buses in Germany. Parameters ---------- @@ -1534,13 +1536,15 @@ def sanity_check_CH4_stores(scn): Returns print statements as sanity checks for the CH4 stores capacity in Germany. The deviation is calculated between: + * the sum of the capacities of the stores with carrier 'CH4' in the database (for one scenario) and * the sum of: - * the capacity the gas grid allocated to CH4 (total capacity - in eGon2035 and capacity reduced the share of the grid - allocated to H2 in eGon100RE) - * the total capacity of the CH4 stores in Germany (source: GIE) + + * the capacity the gas grid allocated to CH4 (total capacity + in eGon2035 and capacity reduced the share of the grid + allocated to H2 in eGon100RE) + * the total capacity of the CH4 stores in Germany (source: GIE) Parameters ---------- @@ -1592,13 +1596,15 @@ def sanity_check_H2_saltcavern_stores(scn): Returns print as sanity checks for the H2 saltcavern potential storage capacity in Germany. The deviation is calculated between: - * the sum of the of the H2 saltcavern potential storage capacity - (e_nom_max) in the database and - * the sum of the H2 saltcavern potential storage capacity - assumed to be the ratio of the areas of 500 m radius around - substations in each german federal state and the estimated - total hydrogen storage potential of the corresponding federal - state (data from InSpEE-DS report). + + * the sum of the of the H2 saltcavern potential storage capacity + (e_nom_max) in the database and + * the sum of the H2 saltcavern potential storage capacity + assumed to be the ratio of the areas of 500 m radius around + substations in each german federal state and the estimated + total hydrogen storage potential of the corresponding federal + state (data from InSpEE-DS report). + This test works also in test mode. Parameters @@ -1932,6 +1938,7 @@ def etrago_eGon2035_gas_DE(): Returns print statements as sanity checks for the gas sector in the eGon2035 scenario for the following components in Germany: + * Buses: with the function :py:func:`sanity_check_gas_buses` * Loads: for the carriers 'CH4_for_industry' and 'H2_for_industry' the deviation is calculated between the sum of the loads in the @@ -1944,16 +1951,18 @@ def etrago_eGon2035_gas_DE(): data) * Stores: deviations for stores with following carriers are calculated: + * 'CH4': with the function :py:func:`sanity_check_CH4_stores` * 'H2_underground': with the function :py:func:`sanity_check_H2_saltcavern_stores` * One-port components (loads, generators, stores): verification that they are all connected to a bus present in the data base with the function :py:func:`sanity_check_gas_one_port` * Links: verification: - * that the gas links are all connected to buses present in - the data base with the function :py:func:`sanity_check_gas_links` - * of the capacity of the gas grid with the function - :py:func:`sanity_check_CH4_grid` + + * that the gas links are all connected to buses present in + the data base with the function :py:func:`sanity_check_gas_links` + * of the capacity of the gas grid with the function + :py:func:`sanity_check_CH4_grid` """ scn = "eGon2035" @@ -2110,6 +2119,7 @@ def etrago_eGon2035_gas_abroad(): Returns print statements as sanity checks for the gas sector in the eGon2035 scenario for the following components in Germany: + * Buses * Loads: for the carriers 'CH4' and 'H2_for_industry' the deviation is calculated between the sum of the loads in the diff --git a/src/egon/data/datasets/storages/home_batteries.py b/src/egon/data/datasets/storages/home_batteries.py index 40d19c1ea..9191aedb2 100644 --- a/src/egon/data/datasets/storages/home_batteries.py +++ b/src/egon/data/datasets/storages/home_batteries.py @@ -5,6 +5,7 @@ depending on pv rooftop system size. **Contents of this module** + * Creation of DB tables * Allocate given home battery capacity per mv grid to buildings with pv rooftop systems. The sizing of the home battery system depends on the size of the