energy_demand package

Subpackages

Submodules

energy_demand.enduse module

Enduse

Contains the Enduse Class. This is the most important class where the change in enduse specific energy demand is simulated depending on scenaric assumptions.

class energy_demand.enduse.Enduse(region_name, data, enduse, sector, fuel, tech_stock, heating_factor_y, cooling_factor_y, fuel_switches, service_switches, fuel_tech_p_by, tech_increased_service, tech_decreased_share, tech_constant_share, installed_tech, sig_param_tech, enduse_overall_change_ey, regional_lp_stock, dw_stock=False, reg_scenario_drivers=None, crit_flat_profile=False)[source]

Bases: object

Enduse Class (Residential, Service and Industry)

For every region and sector, a different instance is generated. In this class, first the change in energy demand is calculated on a yearls temporal scale. Calculations are performed in a cascade (e.g. first reducing climate change induced savings, then substracting further behavioural savings etc.). After yearly calculations, the demand is converted to hourly demand.

Also within this function, the fuel inputs are converted to energy service (short: service) and later on converted back to fuel demand.

Parameters:
  • region_name (str) – Region name
  • data (dict) – Data container
  • enduse (str) – Enduse name
  • sector (str) – Sector name
  • fuel (array) – Yearly fuel data for different fueltypes
  • tech_stock (object) – Technology stock of region
  • heating_factor_y (array) – Distribution of fuel within year to days (yd) (directly correlates with HDD)
  • cooling_factor_y (array) – Distribution of fuel within year to days (yd) (directly correlates with CDD)
  • fuel_switches (list) – Fuel switches
  • service_switches (list) – Service switches
  • fuel_tech_p_by (dict) – Fuel tech assumtions in base year
  • tech_increased_service (dict) – Technologies per enduse with increased service due to scenarios
  • tech_decreased_share (dict) – Technologies per enduse with decreased service due to scenarios
  • tech_constant_share (dict) – Technologies per enduse with constat service
  • installed_tech (dict) – Installed technologes per enduse
  • sig_param_tech (dict) – Sigmoid parameters
  • enduse_overall_change_ey (dict) – Assumptions related to overal change in endyear
  • regional_lp_stock (object) – Load profile stock
  • dw_stock (object,default=False) – Dwelling stock
  • reg_scenario_drivers (bool,default=None) – Scenario drivers per enduse
  • crit_flat_profile (bool,default=False) – Criteria of enduse has a flat shape or not

Note

  • Load profiles are assigned independently of the fueltype, i.e. the same profiles are assumed to hold true across different fueltypes
  • self.fuel_new_y is always overwritten in the cascade of calculations

Warning

Not all enduses have technologies assigned. Load peaks are derived from techstock in case technologies are defined. Otherwise enduse load profiles are used.

adapt_fuel_tech_p_by(fuel_tech_p_by, tech_stock, hybrid_technologies)[source]

Change the fuel share of hybrid technologies for base year depending on assumed electricity consumption

Parameters:
  • fuel_tech_p_by (dict) – Fuel fraction per technology in base year
  • tech_stock (object) – Technology stock
  • hybrid_technologies (list) – List with hybrid technologies

Note

  • Because in case of hybrid technologies the share for fuel is not known of the auxiliry (low-temperature) technology, this share gets calculated.
  • For hybrid technologies, only the fuel share of heat pump must be defined
apply_climate_change(cooling_factor_y, heating_factor_y, assumptions)[source]

Change fuel demand for heat and cooling service depending on changes in HDD and CDD within a region (e.g. climate change induced)

cooling_factor_y : array
Distribution of fuel within year to days (yd) (directly correlates with CDD)
heating_factor_y : array
Distribution of fuel within year to days (yd) (directly correlates with HDD)
assumptions : dict
Assumptions
Returns:Set attribute fuel_new_y
Return type:self.fuel_new_y - array

Note

  • cooling_factor_y and heating_factor_y are based on the sum over the year. Therefore it is assumed that fuel correlates directly with HDD or CDD.
apply_heat_recovery(assumptions, service, crit_dict, base_sim_param)[source]

Reduce heating demand according to assumption on heat reuse

Parameters:
  • assumptions (dict) – Assumptions
  • service (dict or array) – Service of current year
  • crit_dict (str) – Criteria to run function differently
  • base_sim_param (dict) – Base simulation parameters
Returns:

service_reduced – Reduced service after assumption on reuse

Return type:

dict or array

Note

A standard sigmoid diffusion is assumed from base year to end year

apply_scenario_drivers(dw_stock, region_name, data, reg_scenario_drivers, base_sim_param)[source]

The fuel data for every end use are multiplied with respective scenario driver

Parameters:
  • dw_stock (object) – Dwelling stock
  • region_name (str) – Region name
  • data (dict) – Data container
  • reg_scenario_drivers (dict) – Scenario drivers per enduse
  • base_sim_param (dict) – Base simulation parameters
Returns:

Set attribute fuel_new_y.

Return type:

self.fuel_new_y - array

Note

  • If no dwelling specific scenario driver is found, the identical fuel is returned.

    TODO

apply_smart_metering(assumptions, base_sim_param)[source]

Calculate fuel savings depending on smart meter penetration

Parameters:
  • assumptions (dict) – assumptions
  • base_sim_param (dict) – Base simulation parameters
Returns:

Set attribute fuel_new_y. Fuels which are adapted according to smart meter penetration

Return type:

self.fuel_new_y - array

Note

  • The smart meter penetration is assumed with a sigmoid diffusion.
  • In the assumptions the maximum penetration and also the generally fuel savings for each enduse can be defined.
apply_specific_change(assumptions, enduse_overall_change_ey, base_parameters)[source]

Calculates fuel based on assumed overall enduse specific fuel consumption changes

Parameters:
  • assumptions (dict) – assumptions
  • enduse_overall_change_ey (dict) – Assumption of overall change in end year
  • base_parameters (dict) – Base simulation parameters
Returns:

Set attribute fuel_new_y

Return type:

self.fuel_new_y - array

Note

  • Because for enduses where no technology stock is defined (and may consist of many different) technologies, a linear diffusion is suggested to best represent multiple sigmoid efficiency improvements of individual technologies.
  • The changes are assumed across all fueltypes.
  • Either a sigmoid standard diffusion or linear diffusion can be implemented. inear is suggested.
calc_fuel_tech_y(tech_stock, fuel_tech_y, lu_fueltypes, mode_constrained)[source]

Calculate yearl fuel per fueltype (no load profile assigned)

Parameters:
  • tech_stock (object) – Technology stock
  • fuel_tech_y (dict) – Fuel per technology per year
  • lu_fueltypes (dict) – Fueltype look-up
  • mode_constrained (bool) – Running mode
Returns:

fuel_y – Fuel per year per fueltype

Return type:

array

Note

This function can be run in two different modes

calc_fuel_tech_yh(enduse_fuel_tech, tech_stock, load_profiles, lu_fueltypes, mode_constrained)[source]

Iterate fuels for each technology and assign shape yd and yh shape

Parameters:
  • enduse_fuel_tech (dict) – Fuel per technology in enduse
  • tech_stock (object) – Technologies
  • load_profiles (object) – Load profiles
  • lu_fueltypes (dict) – Fuel look-up table
  • mode_constrained (bool) – Mode criteria
Returns:

fuels_yh – Fueltype storing hourly fuel for every fueltype (fueltype, 365, 24)

Return type:

array

calc_peak_tech_dh(enduse_fuel_tech, tech_stock, load_profile)[source]

Calculate peak demand for every fueltype

Parameters:
  • assumptions (array) – Assumptions
  • enduse_fuel_tech (array) – Fuel per enduse and technology
  • tech_stock (data) – Technology stock
  • load_profile (object) – Load profile
Returns:

fuels_peak_dh – Peak values for peak day for every fueltype

Return type:

array

Note

  • This function gets the hourly values of the peak day for every fueltype. The daily fuel is converted to dh for each technology.
  • For some technology types (heat_pump and hybrid) the dh peak day profile is not read in from technology stock but from shape_yh of peak day (hybrid technologies).
classmethod convert_service_to_p(tot_service_yh, service_tech_cy)[source]

Calculate fraction of service for every technology of total service

Parameters:
  • tot_service_yh (array) – Total service yh
  • service_tech_cy (array) – Service per technology
Returns:

service_tech_p – All tecnology services are provided as a fraction of total service

Return type:

dict

Note

Iterate over values in dict and apply calculations

fuel_switch(installed_tech, sig_param_tech, tot_service_h_cy, service_tech, service_fueltype_tech_cy_p, service_fueltype_cy_p, fuel_switches, fuel_tech_p_by, curr_yr)[source]

Calulation of service after considering fuel switch assumptions

Parameters:
  • installed_tech (dict) – Technologies installed
  • sig_param_tech (dict) – Sigmoid diffusion parameters
  • tot_service_h_cy (dict) – Total regional service for every hour for base year
  • service_tech (dict) – Service for every fueltype and technology
  • service_fueltype_tech_cy_p (dict) – Fraction of service per fueltype, technology for current year
  • service_fueltype_cy_p (dict) – Fraction of service per fuyltpe in current year
Returns:

service_tech_after_switch – Containing all service for each technology on a hourly basis

Return type:

dict

Note

  • Based on assumptions about shares of fuels which are switched per enduse to specific technologies, the installed technologies are used to calculate the new service demand after switching fuel shares.

    TODO: MORE INFO

fuel_to_service(fuel_tech_p_by, tech_stock, lu_fueltypes, load_profiles, mode_constrained)[source]

Converts fuel to energy service (1), calcualates contribution service fraction (2)

Parameters:
  • fuel_tech_p_by (dict) – Fuel composition of base year for every fueltype for each enduse (assumtions for national scale)
  • tech_stock (object) – Technology stock of region
  • lu_fueltypes (dict) – Fueltype look-up
  • load_profiles (object) – Load profiles
  • mode_constrained (bool) – Criteria about mode
Returns:

  • tot_service_yh (array) – Total yh energy service per technology for base year (365, 24)
  • service_tech_cy (dict) – Energy service for every fueltype and technology
  • service_tech_p (dict) – Fraction of energy service per technology
  • service_fueltype_tech_p (dict) – Fraction of energy service per fueltype and technology
  • service_fueltype_p (dict) – Fraction of service per fueltype

Note

(1) Calculate energy service of each technology based on assumptions about base year fuel shares of an enduse (fuel_tech_p_by).

(2) The fraction of an invidual technology to which it contributes to total energy service (e.g. how much of total heat service is provided by boiler technology).

  • Efficiency changes of technologis are considered.
  • Energy service = fuel * efficiency
  • This function can be run in two modes, depending on mode_constrained criteria
  • The base year efficiency is taken because the actual service can only be calculated with base year. Otherwise, the service would increase e.g. if technologies would become more efficient. Efficiencies are only considered if converting back to fuel However, the self.fuel_new_y is taken because the actual service was reduced e.g. due to smart meters or temperatur changes
get_crit_switch(fuelswitches, base_parameters, mode_constrained)[source]

Test whether there is a switch (service or fuel)

Parameters:
  • fuelswitches (dict) – All fuel switches
  • base_parameters (float) – Base Arguments
  • mode_constrained (bool) – Mode criteria

Note

If base year, no switches are implemented

classmethod get_enduse_tech(fuel_tech_p_by)[source]

Get all defined technologies of an enduse

Parameters:fuel_tech_p_by (dict) – Percentage of fuel per enduse per technology
Returns:enduse_techs – All technologies (no technolgy is added twice)
Return type:list

Note

All technologies are read out, including those which are potentiall defined in fuel or service switches.

If for an enduse a dummy technology is defined, the technologies of an enduse are set to an empty list.

Warning

For every enduse technologes must either be defined for no fueltype or for all fueltypes

get_lp_stock(non_regional_lp_stock, regional_lp_stock)[source]

Defines the load profile stock depending on enduse. (Get regional or non-regional load profile data)

Parameters:
  • non_regional_lp_stock (object) – Non regional dependent load profiles
  • regional_lp_stock (object) – Regional dependent load profiles
Returns:

load_profiles – Load profile

Return type:

object

Note

Because for some enduses the load profiles depend on the region they are stored in the WeatherRegion Class. One such example is heating. If the enduse is not dependent on the region, the same load profile can be used for all regions

If the enduse depends on regional factors, regional_lp_stock is returned. Otherwise, non-regional load profiles which can be applied for all regions is used (non_regional_lp_stock)

get_peak_day()[source]

Iterate yh and get day with highes fuel (across all fueltypes)

Returns:peak_day_nr – Day with most fuel or service across all fueltypes
Return type:int

Note

  • The day with most fuel across all fueltypes is

considered to be the peak day - The Peak day may change date in a year

get_running_mode(mode_constrained, enduse_space_heating)[source]

Check which mode needs to be run for an enduse

Parameters:
  • mode_constrained (bool) – Criteria of running mode
  • enduse_space_heating (dict) – All heating enduses across all models
Returns:

bool – The return value

Return type:

bool

Note

If ‘crit_mode’ == True, then overall heat is provided to the supply model not specified for technologies. Otherwise, heat demand is supplied per technology

get_service_diffusion(tech_increased_service, sig_param_tech, curr_yr)[source]

Calculate energy service fraction of technologies with increased service

Parameters:
  • tech_increased_service (dict) – All technologies per enduse with increased future service share
  • sig_param_tech (dict) – Sigmoid diffusion parameters
  • curr_yr (dict) – Current year
Returns:

service_tech_cy_p – Share of service per technology of current year

Return type:

dict

service_switch(tot_service_h_cy, service_tech_by_p, tech_increase_service, tech_decrease_service, tech_constant_service, sig_param_tech, curr_yr)[source]

Apply change in service depending on defined service switches

tot_service_h_cy : array
Hourly service of all technologies
service_tech_by_p : dict
Fraction of service per technology
tech_increase_service : dict
Technologies with increased service
tech_decrease_service : dict
Technologies with decreased service
tech_constant_service : dict
Technologies with constant service
sig_param_tech : dict
Sigmoid diffusion parameters
curr_yr : int
Current year
Returns:service_tech_cy – Service per technology in current year after switch
Return type:dict

Note

The service which is fulfilled by new technologies is substracted of the replaced technologies proportionally to the base year distribution of these technologies

service_to_fuel(service_tech, tech_stock, lu_fueltypes, mode_constrained)[source]

Convert yearly energy service to yearly fuel demand

For every technology the service is taken and converted to fuel based on efficiency of current year

The attribute ‘fuel_new_y’ is updated

service_tech : dict
Service per fueltype and technology
tech_stock : object
Technological stock
lu_fueltypes : dict
Fueltype look-up
mode_constrained : bool
Mode running criteria

Note

  • Fuel = Energy service / efficiency
service_to_fuel_per_tech(service_tech, tech_stock, mode_constrained)[source]

Calculate fraction of fuel per technology within fueltype considering current efficiencies

Parameters:
  • service_tech (dict) – Assumptions of share of fuel of base year
  • tech_stock (object) – Technology stock
  • mode_constrained (bool) – Mode criteria
Returns:

fuel_tech – Fuels per technology (the fueltype is given through technology)

Return type:

dict

Note

  • Fuel = Energy service / efficiency

energy_demand.energy_model module

Energy Model

The main function executing all the submodels of the energy demand model

class energy_demand.energy_model.EnergyModel(region_names, data)[source]

Bases: object

EnergyModel of a simulation yearly run

Parameters:
  • region_names (list) – Region names
  • data (dict) – Main data dictionary

Note

  • All submodels are executed here
  • All aggregation functions of the results are exectued here
classmethod create_load_profile_stock(tech_load_profiles, assumptions, sectors)[source]

Assign load profiles which are the same for all regions non_regional_load_profiles

Parameters:
  • tech_load_profiles (dict) – Load profiles
  • assumptions (dict) – Assumptions
  • sectors (dict) – Sectors
Returns:

non_regional_lp_stock – Load profile stock with non regional dependent load profiles

Return type:

object

create_regions(region_names, data, submodel_type)[source]

Create all regions and add them in a list

Parameters:
  • region_names (list) – Regions
  • data (dict) – Data container
  • submodel_type (str) – Type of submodel [rs_submodel, ss_submodel, ...]
classmethod create_weather_regions(weather_regions, data, model_type)[source]

Create all weather regions and calculate

Parameters:
  • weather_region (list) – The name of the Weather Region
  • data (dict) – Data container
  • model_type (str) – Name of model (“e.g. rs_ or ss_)
fuel_aggr(attribute_to_get, nr_of_fueltypes, sector_models, sum_crit, lp_crit, region_name=False)[source]

Collect hourly data from all regions and sum across all fuel types and enduses

Parameters:
  • attribute_to_get (str) – Attribue to summarise
  • nr_of_fueltypes (int) – Number of fueltypes
  • sector_models (list) – Sector models to summarise
  • sum_crit (lp_crit,) – Criteria
  • region_name (str) – Name of region
Returns:

fuels – Summarised fuels

Return type:

array

fuel_regions_fueltype(lookups, region_names)[source]

Collect fuels for every fueltype and region (unconstrained mode). The regions are stored in an array for every timestep

Parameters:
  • lookups (dict) – Lookup container
  • region_names (list) – All region names

Example

{‘final_electricity_demand’: np.array((regions, 8760)), dtype=float}

get_fuel_region_all_models_yh(nr_of_fueltypes, region_name_to_get, sector_models, attribute_to_get)[source]

Summarise fuel yh for a certain region

Parameters:
  • nr_of_fueltypes (int) – Number of fueltypes
  • region_name_to_get (str) – Name of region to read out
  • sector_models (list) – Objectos of submodel runs
  • attribute_to_get (str) – Attribute to get

Note

  • Summing function
classmethod get_fuels_yh(model_object, attribute_to_get)[source]

Assign yh shape for enduses with flat load profiles

Parameters:
  • model_object (dict) – Object of submodel run
  • attribute_to_get (str) – Attribute to read out
Returns:

fuels – Fuels with flat load profile

Return type:

array

Note

  • For enduses where ‘crit_flat_profile’ in Enduse Class is True a flat load profile is generated. Otherwise, the yh as calculated for each enduse is used
get_regional_yh(nr_of_fueltypes, region_name)[source]

Get yh fuel for all fueltype for a specific region of all submodels

Parameters:
  • region_name (str) – Name of region to get attributes
  • nr_of_fueltypes (int) – Number of fueltypes
Returns:

region_fuel_yh – Summed fuel of a region

Return type:

array

Note

  • Summing function
industry_submodel(data, enduses, sectors)[source]

Industry subsector model

Parameters:
  • data (dict) – Data containter
  • enduses (list) – Enduses of industry submodel
  • sectors (list) – Sectors of industry submodel
Returns:

submodules – Submodule objects

Return type:

list

Note

  • The regions and weather_regions gets deleted to save memory
other_submodels()[source]

Other submodel

Returns:submodules – Submodule objects
Return type:list

Note

  • The regions and weather_regions gets deleted to save memory
residential_submodel(data, enduses, sectors=['dummy_sector'])[source]

Create the residential submodules (per enduse and region) and add them to list

Parameters:
  • data (dict) – Data container
  • enduses (list) – All residential enduses
  • sectors (dict, default=['dummy_sector']) – Sectors
Returns:

submodule_list – List with submodules

Return type:

list

Note

  • The regions and weather_regions gets deleted to save memory
service_submodel(data, enduses, sectors)[source]

Create the service submodules per enduse, sector and region and add to list

Parameters:
  • data (dict) – Data container
  • enduses (list) – All residential enduses
  • sectors (list) – Service sectors
Returns:

submodule_list – List with submodules

Return type:

list

Note

  • The regions and weather_regions gets deleted to save memory
sum_enduse_all_regions(attribute_to_get, sector_models)[source]

Summarise an enduse attribute across all regions

Parameters:
  • attribute_to_get (string) – Enduse attribute to summarise
  • sector_models (List) – List with sector models
Returns:

enduse_dict – Summarise enduses across all regions

Return type:

dict

energy_demand.is_model module

Industry Submodel

class energy_demand.is_model.IndustryModel(data, region_obj, enduse, sector)[source]

Bases: object

Industry Submodel

create_enduse(region_obj, data)[source]

Create enduse for industry sector

energy_demand.main module

Energy Demand Model

energy_demand.main.energy_demand_model(data)[source]

Main function of energy demand model to calculate yearly demand

Parameters:data (dict) – Data container
Returns:
  • result_dict (dict) – A nested dictionary containing all data for energy supply model with timesteps for every hour in a year. [fuel_type : region : timestep]
  • model_run_object (dict) – Object of a yearly model run

Note

This function is executed in the wrapper

energy_demand.rs_model module

Residential Submodel

The residential submodule models energy demand for the residential sector.

class energy_demand.rs_model.ResidentialModel(data, region_obj, enduse, sector)[source]

Bases: object

Residential Submodel

create_enduse(region_obj, data)[source]

Create enduse objects and add to list

Parameters:
  • region_obj (object) – Region
  • data (dict) – Data container
Returns:

enduse_object – Object of an enduse

Return type:

dict

energy_demand.ss_model module

Service Submodel

class energy_demand.ss_model.ServiceModel(data, region_obj, enduse, sector)[source]

Bases: object

Service Submodel

create_enduse(region_obj, data)[source]

Create enduse for service sector

Parameters:
  • region_obj (object) – Region
  • data (dict) – Data container
Returns:

enduse_object – Object of an enduse

Return type:

dict

energy_demand.ts_model module

Transportation Submodel

class energy_demand.ts_model.OtherModel(region_obj, enduse)[source]

Bases: object

Other Model

create_enduse()[source]

Create enduse

Module contents

Energy Demand