Skip to content

Commit

Permalink
Switch Fuels functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eggimasv authored and eggimasv committed Mar 13, 2017
1 parent 3e25f00 commit 4c0dd69
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 157 deletions.
215 changes: 153 additions & 62 deletions energy_demand/assumptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
""" This file contains all assumptions of the energy demand model"""
# pylint: disable=I0011,C0321,C0301,C0103, C0325

import numpy as np

import energy_demand.main_functions as mf

def load_assumptions(data):
"""All assumptions
Expand Down Expand Up @@ -32,41 +34,138 @@ def load_assumptions(data):

## Efficiencies residential, base year
eff_by = {
'boiler_A' : 0.7,
'boiler_B' : 0.8,
'boiler_A' : 0.1,
'boiler_B' : 0.3,
'new_tech_A': 0.1,
'tech_A' : 0.5,
'tech_B' : 0.5,
'tech_C': 0.0,
'tech_D' : 0.5,
'tech_E' : 0.5,
'tech_F': 0.0
'tech_F': 0.0,
'boiler_gas': 0.5,
'boiler_oil': 0.5,
'boiler_condensing': 0.5,
'boiler_biomass': 0.5,
'ASHP': 0.5,
'HP_ground_source': 0.5,
'HP_air_source': 0.5,
'HP_gas': 0.5,
'micro_CHP_elec': 0.5,
'micro_CHP_thermal': 0.5
}

# Efficiencies residential, end year
## Efficiencies residential, end year
eff_ey = {
'boiler_A' : 0.7,
'boiler_B' : 0.9,
'new_tech_A': 0.2,
'boiler_A' : 0.9,
'boiler_B' : 0.5,
'new_tech_A': 0.1,
'tech_A' : 0.5,
'tech_B' : 0.5,
'tech_C': 0.0,
'tech_D' : 0.5,
'tech_E' : 0.5,
'tech_F': 0.0
'tech_F': 0.0,
'boiler_gas': 0.5,
'boiler_oil': 0.5,
'boiler_condensing': 0.5,
'boiler_biomass': 0.5,
'ASHP': 0.5,
'HP_ground_source': 0.5,
'HP_air_source': 0.5,
'HP_gas': 0.5,
'micro_CHP_elec': 0.5,
'micro_CHP_thermal': 0.5
}

# Share of fuel types (base year could also be calculated and loaded)
fuel_type_p_by = {'light': {
# -------------
# Fuel Switches assumptions
# -------------

# Technology which is installed for which enduse
tech_install = {'light': 'boiler_A'}

# Technologies used for the different fuel types where the new technology is used
replacement_dict_simple = {'light': {0: 'boiler_B',
1: 'boiler_B',
2: 'boiler_B',
3: 'boiler_B',
4: 'boiler_B',
5: 'boiler_B',
6: 'boiler_B',
7: 'boiler_B'
},
}

# Percentage of fuel types (base year could also be calculated and loaded)
fuel_type_p_by = {'light': {'0' : 0.0,
'1' : 0.7,
'2' : 0.1,
'3' : 0.0,
'4' : 0.0,
'5' : 0.0,
'6' : 0.2
},
'cold': {'0' : 0.0182,
'1' : 0.7633,
'2' : 0.0791,
'3' : 0.0811,
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
},

'wet': {'0' : 0.0182,
'1' : 0.7633,
'2' : 0.0791,
'3' : 0.0811,
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
},
'consumer_electronics': {
'0' : 0.0182,
'1' : 0.7633,
'2' : 0.0791,
'3' : 0.0811,
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
},

'home_computing': {
'0' : 0.0182,
'1' : 0.7633,
'2' : 0.0791,
'3' : 0.0811,
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
},
'cooking': {
'0' : 0.0182,
'1' : 0.7633,
'2' : 0.0791,
'3' : 0.0811,
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
}
}

# Check if base demand is 100 %
#assert p_tech_by['boiler_A'] + p_tech_by['boiler_B'] == 1.0

fuel_type_p_ey = {'light': {
'0' : 0.2,
'1' : 0.3,
'2' : 0.5,
'3' : 0.0,
'4' : 0.0,
'5' : 0.0,
'6' : 0.0
},
'cold': {
'cold': {
'0' : 0.0182,
'1' : 0.7633,
'2' : 0.0791,
Expand All @@ -75,6 +174,15 @@ def load_assumptions(data):
'5' : 0.0581,
'6' : 0.0
},
'cooking': {
'0' : 0.2,
'1' : 0.3,
'2' : 0.4,
'3' : 0.0,
'4' : 0.0,
'5' : 0.0,
'6' : 0.0
},
'wet': {
'0' : 0.0182,
'1' : 0.7633,
Expand Down Expand Up @@ -113,22 +221,29 @@ def load_assumptions(data):
}
}

# Check if base demand is 100 %
#assert p_tech_by['boiler_A'] + p_tech_by['boiler_B'] == 1.0


# Convert to array
for i in fuel_type_p_by:
a = fuel_type_p_by[i].items()
a = list(a)
fuel_type_p_by[i] = np.array(a, dtype=float)
fuel_type_p_by = mf.convert_to_array(fuel_type_p_by)
fuel_type_p_ey = mf.convert_to_array(fuel_type_p_ey)


fuel_type_p_ey = {'light': {
'0' : 0.2,
'1' : 0.3,
'2' : 0.4,
'3' : 0.0,
'4' : 0.0,
'5' : 0.0,
'6' : 0.0
},


# ----------------------------------
# Technologes for different uses
# ----------------------------------
technologies_enduse_by = {'light': {
0: 'boiler_A',
1: 'boiler_A',
2: 'boiler_A',
3: 'boiler_A',
4: 'boiler_A',
5: 'boiler_A',
6: 'boiler_A',
7: 'boiler_A'},
'cold': {
'0' : 0.0182,
'1' : 0.7633,
Expand Down Expand Up @@ -185,32 +300,9 @@ def load_assumptions(data):
}
}

# Convert to array
for i in fuel_type_p_ey:
a = fuel_type_p_ey[i].items()
a = list(a)
fuel_type_p_ey[i] = np.array(a, dtype=float)

'''fuel_type_p_by = {
'space_heating_solid' : 0.0182,
'space_heating_gas' : 0.7633,
'space_heating_elec' : 0.0791,
'space_heating_oil' : 0.0811,
'space_heating_HEATSOLD' : 0.0,
'space_heating_renew' : 0.0581,
'space_heating_hydro' : 0.0,
}
fuel_type_p_ey = {
'space_heating_solid' : 0.0182,
'space_heating_gas' : 0.7633,
'space_heating_elec' : 0.0791,
'space_heating_oil' : 0.0811,
'space_heating_HEATSOLD' : 0.0,
'space_heating_renew' : 0.0581,
'space_heating_hydro' : 0.0,
}
'''





# ----------------------------------
Expand All @@ -220,6 +312,7 @@ def load_assumptions(data):
# p_tech_ey : Share of technology in the end year

# Residential, base year
'''
p_tech_by = {
'boiler_A' : 0.5,
'boiler_B' : 0.5,
Expand All @@ -233,29 +326,27 @@ def load_assumptions(data):
tech_saturation_year = {
'new_tech_A': 2017
}


# Check if 100 %
assert p_tech_by['boiler_A'] + p_tech_by['boiler_B'] == 1.0

'''
# Residential, end year
p_tech_ey = {
'''p_tech_ey = {
'boiler_A' : 0.4,
'boiler_B' : 0.5,
'new_tech_A' : 0.1
}

'''

# Add dictionaries to assumptions
assump_dict['eff_by'] = eff_by
assump_dict['eff_ey'] = eff_ey
assump_dict['p_tech_by'] = p_tech_by
assump_dict['p_tech_ey'] = p_tech_ey
assump_dict['tech_market_year'] = tech_market_year
assump_dict['tech_saturation_year'] = tech_saturation_year
#assump_dict['p_tech_by'] = p_tech_by
#assump_dict['p_tech_ey'] = p_tech_ey
#assump_dict['tech_market_year'] = tech_market_year
#assump_dict['tech_saturation_year'] = tech_saturation_year
assump_dict['fuel_type_p_by'] = fuel_type_p_by
assump_dict['fuel_type_p_ey'] = fuel_type_p_ey

assump_dict['replacement_dict_simple'] = replacement_dict_simple
assump_dict['tech_install'] = tech_install

# ============================================================
# Assumptions Residential Building Stock
Expand Down
9 changes: 4 additions & 5 deletions energy_demand/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def energy_demand_model(data, assumptions, data_ext):

'glob_var': {'base_year': 2015,
'current_year': 2016,
'end_year': 2016
'end_year': 2020
},
}

Expand All @@ -135,15 +135,14 @@ def energy_demand_model(data, assumptions, data_ext):

# Load assumptions
assumptions_model_run = assumpt.load_assumptions(base_data)
#print(assumptions_model_run)

# Generate virtual building stock over whole simulatin period
__building_stock = bg.resid_build_stock(base_data, assumptions_model_run, data_external)
#__building_stock = bg.resid_build_stock(base_data, assumptions_model_run, data_external)

# Generate technological stock over whole simulation period
base_tech_stock_resid = ts.resid_tech_stock("REG A", 2015, assumptions_model_run, data_external)
#base_tech_stock_resid = ts.resid_tech_stock(2015, assumptions_model_run, data_external)

neu = ts.resid_tech_stock("REG A", 2016, assumptions_model_run, data_external)
#neu = ts.resid_tech_stock(2016, assumptions_model_run, data_external)


'''print(base.__dict__)
Expand Down
9 changes: 9 additions & 0 deletions energy_demand/main_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,15 @@ def write_to_csv_will(reesult_dict, reg_lu):
#with open(path, 'w') as outfile:
# yaml.dump(yaml_list, outfile, default_flow_style=False)

def convert_to_array(fuel_type_p_ey):
"""Convert dictionary to array"""
for i in fuel_type_p_ey:
a = fuel_type_p_ey[i].items()
a = list(a)
fuel_type_p_ey[i] = np.array(a, dtype=float)
return fuel_type_p_ey


'''
def calc_daily_load_factor(daily_loads):
"""Calculates load factor of a day
Expand Down

0 comments on commit 4c0dd69

Please sign in to comment.