individual_heating

The central module containing all code dealing with individual heat supply.

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

The determination of the minimum required heat pump capacity for pypsa-eur-sec takes place in the dataset ‘HeatPumpsPypsaEurSec’. The goal is to ensure that the heat pump capacities determined in pypsa-eur-sec are large enough to serve the heat demand of individual buildings after the desaggregation from a few nodes in pypsa-eur-sec to the individual buildings. To determine minimum required heat pump capacity per building the buildings heat peak load in the eGon100RE scenario is used (as pypsa-eur-sec serves as the scenario generator for the eGon100RE scenario; see determine_minimum_hp_capacity_per_building() for information on how minimum required heat pump capacity is determined). As the heat peak load is not previously determined, it is as well done in the course of this task. Further, as determining heat peak load requires heat load profiles of the buildings to be set up, this task is also utilised to set up heat load profiles of all buildings with heat pumps within a grid in the eGon100RE scenario used in eTraGo. The resulting data is stored in separate tables respectively a csv file:

  • input-pypsa-eur-sec/minimum_hp_capacity_mv_grid_100RE.csv:
    This csv file contains minimum required heat pump capacity per MV grid in MW as input for pypsa-eur-sec. It is created within export_min_cap_to_csv().
  • demand.egon_etrago_timeseries_individual_heating:
    This table contains aggregated heat load profiles of all buildings with heat pumps within an MV grid in the eGon100RE scenario used in eTraGo. It is created within individual_heating_per_mv_grid_tables().
  • demand.egon_building_heat_peak_loads:
    Mapping of peak heat demand and buildings including cell_id, building, area and peak load. This table is created in delete_heat_peak_loads_100RE().

The desaggregation of heat pump capcacities to individual buildings takes place in two separate datasets: ‘HeatPumps2035’ for eGon2035 scenario and ‘HeatPumps2050’ for eGon100RE. It is done separately because for one reason in case of the eGon100RE scenario the minimum required heat pump capacity per building can directly be determined using the heat peak load per building determined in the dataset ‘HeatPumpsPypsaEurSec’, whereas heat peak load data does not yet exist for the eGon2035 scenario. Another reason is, that in case of the eGon100RE scenario all buildings with individual heating have a heat pump whereas in the eGon2035 scenario buildings are randomly selected until the installed heat pump capacity per MV grid is met. All other buildings with individual heating but no heat pump are assigned a gas boiler.

In the ‘HeatPumps2035’ dataset the following things are done. First, the building’s heat peak load in the eGon2035 scenario is determined for sizing the heat pumps. To this end, heat load profiles per building are set up. Using the heat peak load per building the minimum required heat pump capacity per building is determined (see determine_minimum_hp_capacity_per_building()). Afterwards, the total heat pump capacity per MV grid is desaggregated to individual buildings in the MV grid, wherefore buildings are randomly chosen until the MV grid’s total heat pump capacity is reached (see determine_buildings_with_hp_in_mv_grid()). Buildings with PV rooftop plants are more likely to be assigned a heat pump. In case the minimum heat pump capacity of all chosen buildings is smaller than the total heat pump capacity of the MV grid but adding another building would exceed the total heat pump capacity of the MV grid, the remaining capacity is distributed to all buildings with heat pumps proportionally to the size of their respective minimum heat pump capacity. Therefore, the heat pump capacity of a building can be larger than the minimum required heat pump capacity. The generated heat load profiles per building are in a last step utilised to set up heat load profiles of all buildings with heat pumps within a grid as well as for all buildings with a gas boiler (i.e. all buildings with decentral heating system minus buildings with heat pump) needed in eTraGo. The resulting data is stored in the following tables:

  • demand.egon_hp_capacity_buildings:
    This table contains the heat pump capacity of all buildings with a heat pump. It is created within delete_hp_capacity_2035().
  • demand.egon_etrago_timeseries_individual_heating:
    This table contains aggregated heat load profiles of all buildings with heat pumps within an MV grid as well as of all buildings with gas boilers within an MV grid in the eGon100RE scenario used in eTraGo. It is created within individual_heating_per_mv_grid_tables().
  • demand.egon_building_heat_peak_loads:
    Mapping of heat demand time series and buildings including cell_id, building, area and peak load. This table is created in delete_heat_peak_loads_2035().

In the ‘HeatPumps2050’ dataset the total heat pump capacity in each MV grid can be directly desaggregated to individual buildings, as the building’s heat peak load was already determined in the ‘HeatPumpsPypsaEurSec’ dataset. Also in contrast to the ‘HeatPumps2035’ dataset, all buildings with decentral heating system are assigned a heat pump, wherefore no random sampling of buildings needs to be conducted. The resulting data is stored in the following table:

  • demand.egon_hp_capacity_buildings:
    This table contains the heat pump capacity of all buildings with a heat pump. It is created within delete_hp_capacity_2035().

The following datasets from the database are mainly used for creation:

  • boundaries.egon_map_zensus_grid_districts:
  • boundaries.egon_map_zensus_district_heating_areas:
  • demand.egon_peta_heat:
    Table of annual heat load demand for residential and cts at census cell level from peta5.
  • demand.egon_heat_timeseries_selected_profiles:
  • demand.egon_heat_idp_pool:
  • demand.egon_daily_heat_demand_per_climate_zone:
  • boundaries.egon_map_zensus_mvgd_buildings:
    A final mapping table including all buildings used for residential and cts, heat and electricity timeseries. Including census cells, mvgd bus_id, building type (osm or synthetic)
  • supply.egon_individual_heating:
  • demand.egon_cts_heat_demand_building_share:
    Table including the mv substation heat profile share of all selected cts buildings for scenario eGon2035 and eGon100RE. This table is created within cts_heat()

What is the goal?

The goal is threefold. Primarily, heat pump capacity of individual buildings is determined as it is necessary for distribution grid analysis. Secondly, as heat demand profiles need to be set up during the process, the heat demand profiles of all buildings with individual heat pumps respectively gas boilers per MV grid are set up to be used in eTraGo. Thirdly, minimum heat pump capacity is determined as input for pypsa-eur-sec to avoid that heat pump capacity per building is too little to meet the heat demand after desaggregation to individual buildings.

What is the challenge?

The main challenge lies in the set up of heat demand profiles per building in aggregate_residential_and_cts_profiles() as it takes alot of time and in grids with a high number of buildings requires alot of RAM. Both runtime and RAM usage needed to be improved several times. To speed up the process, tasks are set up to run in parallel. This currently leads to alot of connections being opened and at a certain point to a runtime error due to too many open connections.

What are central assumptions during the data processing?

Central assumption for determining minimum heat pump capacity and desaggregating heat pump capacity to individual buildings is that the required heat pump capacity is determined using an approach from the network development plan (pp.46-47) (see determine_minimum_hp_capacity_per_building()). There, the heat pump capacity is determined by multiplying the heat peak demand of the building by a minimum assumed COP of 1.7 and a flexibility factor of 24/18, taking into account that power supply of heat pumps can be interrupted for up to six hours by the local distribution grid operator. Another central assumption is, that buildings with PV rooftop plants are more likely to have a heat pump than other buildings (see determine_buildings_with_hp_in_mv_grid() for details)

Drawbacks and limitations of the data

In the eGon2035 scenario buildings with heat pumps are selected randomly with a higher probability for a heat pump for buildings with PV rooftop (see determine_buildings_with_hp_in_mv_grid() for details). Another limitation may be the sizing of the heat pumps, as in the eGon2035 scenario their size rigidly depends on the heat peak load and a fixed flexibility factor. During the coldest days of the year, heat pump flexibility strongly depends on this assumption and cannot be dynamically enlarged to provide more flexibility (or only slightly through larger heat storage units).

Notes

This module docstring is rather a dataset documentation. Once, a decision is made in … the content of this module docstring needs to be moved to docs attribute of the respective dataset class.

class BuildingHeatPeakLoads(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

building_id
peak_load_in_w
scenario
sector
class EgonEtragoTimeseriesIndividualHeating(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

bus_id
carrier
dist_aggregated_mw
scenario
class EgonHpCapacityBuildings(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

building_id
hp_capacity
scenario
class HeatPumps2035(dependencies)[source]

Bases: egon.data.datasets.Dataset

class HeatPumps2050(dependencies)[source]

Bases: egon.data.datasets.Dataset

class HeatPumpsPypsaEurSec(dependencies)[source]

Bases: egon.data.datasets.Dataset

adapt_numpy_float64(numpy_float64)[source]
adapt_numpy_int64(numpy_int64)[source]
aggregate_residential_and_cts_profiles(mvgd, scenario)[source]

Gets residential and CTS heat demand profiles per building and aggregates them.

Parameters:
  • mvgd (int) – MV grid ID.
  • scenario (str) – Possible options are eGon2035 or eGon100RE.
Returns:

pd.DataFrame – Table of demand profile per building. Column names are building IDs and index is hour of the year as int (0-8759).

calc_residential_heat_profiles_per_mvgd(mvgd, scenario)[source]

Gets residential heat profiles per building in MV grid for either eGon2035 or eGon100RE scenario.

Parameters:
  • mvgd (int) – MV grid ID.
  • scenario (str) – Possible options are eGon2035 or eGon100RE.
Returns:

pd.DataFrame

Heat demand profiles of buildings. Columns are:
  • zensus_population_id : int
    Zensus cell ID building is in.
  • building_id : int
    ID of building.
  • day_of_year : int
    Day of the year (1 - 365).
  • hour : int
    Hour of the day (1 - 24).
  • demand_ts : float
    Building’s residential heat demand in MW, for specified hour of the year (specified through columns day_of_year and hour).

cascade_heat_supply_indiv(scenario, distribution_level, plotting=True)[source]

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.

Parameters:
  • scenario (str) – Name of scenario
  • plotting (bool, optional) – Choose if individual heating supply is plotted. The default is True.
Returns:

resulting_capacities (pandas.DataFrame) – List of plants per mv grid

cascade_per_technology(heat_per_mv, technologies, scenario, distribution_level, max_size_individual_chp=0.05)[source]

Add plants for individual heat. Currently only on mv grid district level.

Parameters:
  • mv_grid_districts (geopandas.geodataframe.GeoDataFrame) – MV grid districts including the heat demand
  • technologies (pandas.DataFrame) – List of supply technologies and their parameters
  • scenario (str) – Name of the scenario
  • max_size_individual_chp (float) – Maximum capacity of an individual chp in MW
Returns:

  • mv_grid_districts (geopandas.geodataframe.GeoDataFrame) – MV grid district which need additional individual heat supply
  • technologies (pandas.DataFrame) – List of supply technologies and their parameters
  • append_df (pandas.DataFrame) – List of plants per mv grid for the selected technology

catch_missing_buidings(buildings_decentral_heating, peak_load)[source]

Check for missing buildings and reduce the list of buildings with decentral heating if no peak loads available. This should only happen in case of cutout SH

Parameters:
  • buildings_decentral_heating (list(int)) – Array or list of buildings with decentral heating
  • peak_load (pd.Series) – Peak loads of all building within the mvgd
delete_heat_peak_loads_100RE()[source]

Remove all heat peak loads for eGon100RE.

delete_heat_peak_loads_2035()[source]

Remove all heat peak loads for eGon2035.

delete_hp_capacity(scenario)[source]

Remove all hp capacities for the selected scenario

Parameters:scenario (string) – Either eGon2035 or eGon100RE
delete_hp_capacity_100RE()[source]

Remove all hp capacities for the selected eGon100RE

delete_hp_capacity_2035()[source]

Remove all hp capacities for the selected eGon2035

delete_mvgd_ts(scenario)[source]

Remove all hp capacities for the selected scenario

Parameters:scenario (string) – Either eGon2035 or eGon100RE
delete_mvgd_ts_100RE()[source]

Remove all mvgd ts for the selected eGon100RE

delete_mvgd_ts_2035()[source]

Remove all mvgd ts for the selected eGon2035

delete_pypsa_eur_sec_csv_file()[source]

Delete pypsa eur sec minimum heat pump capacity csv before new run

desaggregate_hp_capacity(min_hp_cap_per_building, hp_cap_mv_grid)[source]

Desaggregates the required total heat pump capacity to buildings.

All buildings are previously assigned a minimum required heat pump capacity. If the total heat pump capacity exceeds this, larger heat pumps are assigned.

Parameters:
  • min_hp_cap_per_building (pd.Series) –

    Pandas series with minimum required heat pump capacity per building

    in MW.

  • hp_cap_mv_grid (float) – Total heat pump capacity in MW in given MV grid.

Returns:

pd.Series – Pandas series with heat pump capacity per building in MW.

determine_buildings_with_hp_in_mv_grid(hp_cap_mv_grid, min_hp_cap_per_building)[source]

Distributes given total heat pump capacity to buildings based on their peak heat demand.

Parameters:
  • hp_cap_mv_grid (float) – Total heat pump capacity in MW in given MV grid.

  • min_hp_cap_per_building (pd.Series) –

    Pandas series with minimum required heat pump capacity per building

    in MW.

Returns:

pd.Index(int) – Building IDs (as int) of buildings to get heat demand time series for.

determine_hp_cap_buildings_eGon100RE()[source]

Main function to determine HP capacity per building in eGon100RE scenario.

determine_hp_cap_buildings_eGon100RE_per_mvgd(mv_grid_id)[source]

Determines HP capacity per building in eGon100RE scenario.

In eGon100RE scenario all buildings without district heating get a heat pump.

Returns:pd.Series – Pandas series with heat pump capacity per building in MW.
determine_hp_cap_buildings_eGon2035_per_mvgd(mv_grid_id, peak_heat_demand, building_ids)[source]

Determines which buildings in the MV grid will have a HP (buildings with PV rooftop are more likely to be assigned) in the eGon2035 scenario, as well as their respective HP capacity in MW.

Parameters:
  • mv_grid_id (int) – ID of MV grid.
  • peak_heat_demand (pd.Series) – Series with peak heat demand per building in MW. Index contains the building ID.
  • building_ids (pd.Index(int)) – Building IDs (as int) of buildings with decentral heating system in given MV grid.
determine_hp_cap_peak_load_mvgd_ts_2035(mvgd_ids)[source]

Main function to determine HP capacity per building in eGon2035 scenario. Further, creates heat demand time series for all buildings with heat pumps in MV grid, as well as for all buildings with gas boilers, used in eTraGo.

Parameters:mvgd_ids (list(int)) – List of MV grid IDs to determine data for.
determine_hp_cap_peak_load_mvgd_ts_pypsa_eur_sec(mvgd_ids)[source]

Main function to determine minimum required HP capacity in MV for pypsa-eur-sec. Further, creates heat demand time series for all buildings with heat pumps in MV grid in eGon100RE scenario, used in eTraGo.

Parameters:mvgd_ids (list(int)) – List of MV grid IDs to determine data for.
determine_min_hp_cap_buildings_pypsa_eur_sec(peak_heat_demand, building_ids)[source]

Determines minimum required HP capacity in MV grid in MW as input for pypsa-eur-sec.

Parameters:
  • peak_heat_demand (pd.Series) – Series with peak heat demand per building in MW. Index contains the building ID.
  • building_ids (pd.Index(int)) – Building IDs (as int) of buildings with decentral heating system in given MV grid.
Returns:

float – Minimum required HP capacity in MV grid in MW.

determine_minimum_hp_capacity_per_building(peak_heat_demand, flexibility_factor=1.3333333333333333, cop=1.7)[source]

Determines minimum required heat pump capacity.

Parameters:
  • peak_heat_demand (pd.Series) – Series with peak heat demand per building in MW. Index contains the building ID.
  • flexibility_factor (float) – Factor to overdimension the heat pump to allow for some flexible dispatch in times of high heat demand. Per default, a factor of 24/18 is used, to take into account
Returns:

pd.Series – Pandas series with minimum required heat pump capacity per building in MW.

export_min_cap_to_csv(df_hp_min_cap_mv_grid_pypsa_eur_sec)[source]

Export minimum capacity of heat pumps for pypsa eur sec to csv

export_to_db(df_peak_loads_db, df_heat_mvgd_ts_db, drop=False)[source]

Function to export the collected results of all MVGDs per bulk to DB.

Parameters
df_peak_loads_db : pd.DataFrame
Table of building peak loads of all MVGDs per bulk
df_heat_mvgd_ts_db : pd.DataFrame
Table of all aggregated MVGD profiles per bulk
drop : boolean
Drop and recreate table if True
get_buildings_with_decentral_heat_demand_in_mv_grid(mvgd, scenario)[source]

Returns building IDs of buildings with decentral heat demand in given MV grid.

As cells with district heating differ between scenarios, this is also depending on the scenario. CTS and residential have to be retrieved seperatly as some residential buildings only have electricity but no heat demand. This does not occure in CTS.

Parameters:
  • mvgd (int) – ID of MV grid.
  • scenario (str) – Name of scenario. Can be either “eGon2035” or “eGon100RE”.
Returns:

pd.Index(int) – Building IDs (as int) of buildings with decentral heating system in given MV grid. Type is pandas Index to avoid errors later on when it is used in a query.

get_cts_buildings_with_decentral_heat_demand_in_mv_grid(scenario, mv_grid_id)[source]

Returns building IDs of buildings with decentral CTS heat demand in given MV grid.

As cells with district heating differ between scenarios, this is also depending on the scenario.

Parameters:
  • scenario (str) – Name of scenario. Can be either “eGon2035” or “eGon100RE”.
  • mv_grid_id (int) – ID of MV grid.
Returns:

pd.Index(int) – Building IDs (as int) of buildings with decentral heating system in given MV grid. Type is pandas Index to avoid errors later on when it is used in a query.

get_daily_demand_share(mvgd)[source]

per census cell :Parameters: mvgd (int) – MVGD id

Returns:df_daily_demand_share (pd.DataFrame) – Daily annual demand share per cencus cell. Columns of the dataframe are zensus_population_id, day_of_year and daily_demand_share.
get_daily_profiles(profile_ids)[source]
Parameters:profile_ids (list(int)) – daily heat profile ID’s
Returns:df_profiles (pd.DataFrame) – Residential daily heat profiles. Columns of the dataframe are idp, house, temperature_class and hour.
get_heat_peak_demand_per_building(scenario, building_ids)[source]
get_peta_demand(mvgd, scenario)[source]

Retrieve annual peta heat demand for residential buildings for either eGon2035 or eGon100RE scenario.

Parameters:
  • mvgd (int) – MV grid ID.
  • scenario (str) – Possible options are eGon2035 or eGon100RE
Returns:

df_peta_demand (pd.DataFrame) – Annual residential heat demand per building and scenario. Columns of the dataframe are zensus_population_id and demand.

get_residential_buildings_with_decentral_heat_demand_in_mv_grid(scenario, mv_grid_id)[source]

Returns building IDs of buildings with decentral residential heat demand in given MV grid.

As cells with district heating differ between scenarios, this is also depending on the scenario.

Parameters:
  • scenario (str) – Name of scenario. Can be either “eGon2035” or “eGon100RE”.
  • mv_grid_id (int) – ID of MV grid.
Returns:

pd.Index(int) – Building IDs (as int) of buildings with decentral heating system in given MV grid. Type is pandas Index to avoid errors later on when it is used in a query.

get_residential_heat_profile_ids(mvgd)[source]

Retrieve 365 daily heat profiles ids per residential building and selected mvgd.

Parameters:mvgd (int) – ID of MVGD
Returns:df_profiles_ids (pd.DataFrame) – Residential daily heat profile ID’s per building. Columns of the dataframe are zensus_population_id, building_id, selected_idp_profiles, buildings and day_of_year.
get_total_heat_pump_capacity_of_mv_grid(scenario, mv_grid_id)[source]

Returns total heat pump capacity per grid that was previously defined (by NEP or pypsa-eur-sec).

Parameters:
  • scenario (str) – Name of scenario. Can be either “eGon2035” or “eGon100RE”.
  • mv_grid_id (int) – ID of MV grid.
Returns:

float – Total heat pump capacity in MW in given MV grid.

get_zensus_cells_with_decentral_heat_demand_in_mv_grid(scenario, mv_grid_id)[source]

Returns zensus cell IDs with decentral heating systems in given MV grid.

As cells with district heating differ between scenarios, this is also depending on the scenario.

Parameters:
  • scenario (str) – Name of scenario. Can be either “eGon2035” or “eGon100RE”.
  • mv_grid_id (int) – ID of MV grid.
Returns:

pd.Index(int) – Zensus cell IDs (as int) of buildings with decentral heating systems in given MV grid. Type is pandas Index to avoid errors later on when it is used in a query.

plot_heat_supply(resulting_capacities)[source]
split_mvgds_into_bulks(n, max_n, func)[source]

Generic function to split task into multiple parallel tasks, dividing the number of MVGDs into even bulks.

Parameters:
  • n (int) – Number of bulk
  • max_n (int) – Maximum number of bulks
  • func (function) – The funnction which is then called with the list of MVGD as parameter.