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
- class BuildingHeatPeakLoads(**kwargs)[source]
Bases:
BaseClass definition of table demand.egon_building_heat_peak_loads.
Table with peak heat demand of residential and CTS heat demand combined for each building.
- building_id
- peak_load_in_w
- scenario
- sector
- class EgonEtragoTimeseriesIndividualHeating(**kwargs)[source]
Bases:
BaseClass definition of table 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 for the different scenarios. The data is used in eTraGo.
- bus_id
- carrier
- dist_aggregated_mw
- scenario
- class EgonHpCapacityBuildings(**kwargs)[source]
Bases:
BaseClass definition of table demand.egon_hp_capacity_buildings.
This table contains the heat pump capacity of all buildings with a heat pump.
- building_id
- hp_capacity
- scenario
- class HeatPumps2035(dependencies)[source]
Bases:
DatasetClass for desaggregation of heat pump capcacities per MV grid district to individual buildings for eGon2035 scenario.
The heat pump capacity per MV grid district is disaggregated to buildings with individual heating based on the buildings heat peak demand. The buildings are chosen randomly until the target capacity per MV grid district is reached. Buildings with PV rooftop have a higher probability to be assigned a heat pump. As the building’s heat peak load is not previously determined, it is as well done in this dataset. 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 aggregated 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.
For more information see data documentation on Individual heat pumps.
Heat pump capacity per building in the eGon100RE scenario is set up in a separate dataset,
HeatPumps2050, as for one reason in case of the eGon100RE scenario the minimum required heat pump capacity per building can directly be determined using the peak heat demand per building determined in the datasetHeatPumpsPypsaEurSec, whereas peak heat demand 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.- Dependencies
HeatPumpsPypsaEurSec
- Resulting tables
demand.egon_hp_capacity_buildingsis created (if it doesn’t yet exist) and filleddemand.egon_etrago_timeseries_individual_heatingis created (if it doesn’t yet exist) and filleddemand.egon_building_heat_peak_loadsis created (if it doesn’t yet exist) and filled
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 desaggregating the heat pump capacity to individual buildings is that heat pumps can be dimensioned using an approach from the network development plan that uses the building’s peak heat demand and a fixed COP (see data documentation on Individual heat pumps). 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
The heat demand profiles used here to determine the heat peak load have very few very high peaks that lead to large heat pump capacities. This should be solved somehow. Cutting off the peak is not possible, as the time series of each building is not saved but generated on the fly. Also, just using smaller heat pumps would lead to infeasibilities in eDisGo.
- name: str = 'HeatPumps2035'
- version: str = '0.0.3'
- class HeatPumps2050(dependencies)[source]
Bases:
DatasetClass for desaggregation of heat pump capcacities per MV grid district to individual buildings for eGon100RE scenario.
Optimised heat pump capacity from PyPSA-EUR run is disaggregated to all buildings with individual heating (as heat pumps are the only option for individual heating in the eGon100RE scenario) based on buildings heat peak demand. The heat peak demand per building does in this dataset, in contrast to the
HeatPumps2035dataset, not need to be determined, as it was already determined in thePypsaEurSecdataset.For more information see data documentation on Individual heat pumps.
Heat pump capacity per building for the eGon2035 scenario is set up in a separate dataset,
HeatPumps2035. See there for further information as to why.- Dependencies
PypsaEurSecHeatPumpsPypsaEurSec
- Resulting tables
demand.egon_hp_capacity_buildingsis created (if it doesn’t yet exist) and filled
What are central assumptions during the data processing?
Central assumption for desaggregating the heat pump capacity to individual buildings is that heat pumps can be dimensioned using an approach from the network development plan that uses the building’s peak heat demand and a fixed COP (see data documentation on Individual heat pumps).
Drawbacks and limitations of the data
The heat demand profiles used here to determine the heat peak load have very few very high peaks that lead to large heat pump capacities. This should be solved somehow. Cutting off the peak is not possible, as the time series of each building is not saved but generated on the fly. Also, just using smaller heat pumps would lead to infeasibilities in eDisGo.
- name: str = 'HeatPumps2050'
- version: str = '0.0.4'
- class HeatPumpsPypsaEur(dependencies)[source]
Bases:
DatasetClass to determine minimum heat pump capcacities per building for the PyPSA-EUR run.
The goal is to ensure that the heat pump capacities determined in PyPSA-EUR are sufficient to serve the heat demand of individual buildings after the desaggregation from a few nodes in PyPSA-EUR to the individual buildings. As the heat peak load is not previously determined, it is as well done in this dataset. 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.
For more information see data documentation on Individual heat pumps.
- Dependencies
- Resulting tables
input-pypsa-eur-sec/minimum_hp_capacity_mv_grid_100RE.csv file is created, containing the minimum required heat pump capacity per MV grid in MW as input for PyPSA-EUR (created within
export_min_cap_to_csv())demand.egon_etrago_timeseries_individual_heatingis created and filleddemand.egon_building_heat_peak_loadsis created and filled
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 the minimum required heat pump capacity is that heat pumps can be dimensioned using an approach from the network development plan that uses the building’s peak heat demand and a fixed COP (see data documentation on Individual heat pumps).
Drawbacks and limitations of the data
The heat demand profiles used here to determine the heat peak load have very few very high peaks that lead to large heat pump capacities. This should be solved somehow. Cutting off the peak is not possible, as the time series of each building is not saved but generated on the fly. Also, just using smaller heat pumps would lead to infeasibilities in eDisGo.
- name: str = 'HeatPumpsPypsaEurSec'
- version: str = '0.0.4'
- 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_idint
Zensus cell ID building is in.
- building_idint
ID of building.
- day_of_yearint
Day of the year (1 - 365).
- hourint
Hour of the day (1 - 24).
- demand_tsfloat
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.
If this is not suitable, the mv grid is also supplied by heat pumps.
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_hp_capacity(scenario)[source]
Remove all hp capacities for the selected scenario
- Parameters:
scenario (string) – Either eGon2035 or eGon100RE
- delete_hp_capacity_status_quo(scenario)[source]
Remove all hp capacities for the selected status quo
- delete_mvgd_ts(scenario)[source]
Remove all hp capacities for the selected scenario
- Parameters:
scenario (string) – Either eGon2035 or eGon100RE
- 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_pvbased_per_mvgd(scenario, 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(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_hp_cap_peak_load_mvgd_ts_status_quo(mvgd_ids, scenario)[source]
Main function to determine HP capacity per building in status quo 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_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.
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_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.
- split_mvgds_into_bulks(n, max_n, func, scenario=None)[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.