Skip to content

Commit

Permalink
Implemented scenario drivers for esidential model. V2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
eggimasv authored and eggimasv committed Mar 14, 2017
1 parent 725faf4 commit 3f65206
Show file tree
Hide file tree
Showing 12 changed files with 538 additions and 353 deletions.
16 changes: 8 additions & 8 deletions data/residential_model/data_residential_by_fuel_end_uses.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fuel_id,light,cold,wet,consumer_electronics,home_computing,cooking
0,0,0,0,0,0,0
1,0,0,0,0,0,0
2,1002,1037,1306,1838,549,1138
3,0,0,0,0,0,0
4,0,0,0,0,0,0
5,0,0,0,0,0,0
6,0,0,0,0,0,0
fuel_id,light,cold,wet,consumer_electronics,home_computing,cooking,heating
0,0,0,0,0,0,0,100
1,0,0,0,0,0,0,100
2,1002,1037,1306,1838,549,1138,0
3,0,0,0,0,0,0,100
4,0,0,0,0,0,0,100
5,0,0,0,0,0,0,0
6,0,0,0,0,0,0,0
10 changes: 5 additions & 5 deletions data/residential_model/lookup_day_type.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DAYTYP_ID,day_typ
0,Weekd_day
1,Weekend
2,Coldest
3,Warmest
daytype_id,day_typ
0,weekd_day
1,weeknd
2,coldest
3,warmest
22 changes: 20 additions & 2 deletions energy_demand/assumptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,16 @@ def load_assumptions(data):
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
}
},
'heating': {
'0' : 0.2,
'1' : 0.3,
'2' : 0.5,
'3' : 0.0,
'4' : 0.0,
'5' : 0.0,
'6' : 0.0
}
}

# Check if base demand is 100 %
Expand Down Expand Up @@ -219,7 +228,16 @@ def load_assumptions(data):
'4' : 0.0,
'5' : 0.0581,
'6' : 0.0
}
},
'heating': {
'0' : 0.2,
'1' : 0.3,
'2' : 0.5,
'3' : 0.0,
'4' : 0.0,
'5' : 0.0,
'6' : 0.0
}
}

# Check if base demand is 100 %
Expand Down
14 changes: 11 additions & 3 deletions energy_demand/building_stock_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, sim_y, coordinates, dwtype, house_id, age, pop, floorarea, HD
self.pop = pop
self.floorarea = floorarea
self.HDD = get_HDD_based_on_int_temp(sim_y, assumptions, HDD) # Get internal temperature depending on assumptions of sim_year
#self.HOUSEHOLDINCOME?

def scenario_driver_water_heating(self):
"""calc scenario driver with population and heat loss coefficient"""
Expand All @@ -56,6 +57,7 @@ def get_HDD_based_on_int_temp(sim_y, assumptions, HDD):
#int_temp_sim_y = get_internal_temperature(sim_y)
#HDD = recalculate_hitchens(int_temp_sim_y)
HDD = "tbd"
HDD = 999
# Recalcuulate heating degree days based on internal temperature change
# Hitchins Formula
return HDD
Expand Down Expand Up @@ -108,6 +110,12 @@ def __init__(self, region_ID, dwellings):
self.region_ID = region_ID
self.dwellings = dwellings

# Execute functions of stock
self.pop = self.get_tot_pop()
self.sd_water_heating = self.get_sum_scenario_driver_water_heating()
self.sd_heating = self.get_sum_scenario_driver_space_heating()
self.sd_lighting = self.get_sum_scenario_driver_lighting()

def get_tot_pop(self):
"""Get total population of all dwellings"""
totpop = 0
Expand All @@ -119,21 +127,21 @@ def get_sum_scenario_driver_water_heating(self):
"""Sum all scenario driver for water heating"""
sum_driver = 0
for dwelling in self.dwellings:
sum_driver += dwelling.scenario_driver_water_heating
sum_driver += dwelling.scenario_driver_water_heating()
return sum_driver

def get_sum_scenario_driver_space_heating(self):
"""Sum all scenario driver for space heating"""
sum_driver = 0
for dwelling in self.dwellings:
sum_driver += dwelling.scenario_driver_space_heating
sum_driver += dwelling.scenario_driver_space_heating()
return sum_driver

def get_sum_scenario_driver_lighting(self):
"""Sum all scenario driver for lighting heating"""
sum_driver = 0
for dwelling in self.dwellings:
sum_driver += dwelling.scenario_driver_lighting
sum_driver += dwelling.scenario_driver_lighting()
return sum_driver

def calc_floorarea_pp(reg_floorarea, reg_pop_by, glob_var, assump_final_diff_floorarea_pp):
Expand Down
14 changes: 7 additions & 7 deletions energy_demand/building_stock_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ def resid_build_stock(data, assumptions, data_ext):
for reg_id in reg_lu:

# Base year data of region
floorarea_by = data['reg_floorarea'][reg_id] # Read in floor area of base year
pop_by = data_ext['population'][base_year][reg_id] # Read in population
floorarea_pp_by = floorarea_by / pop_by # Floor area per person [m2/person]
floorarea_by = data['reg_floorarea'][reg_id] # Read in floor area of base year
pop_by = data_ext['population'][base_year][reg_id] # Read in population
floorarea_pp_by = floorarea_by / pop_by # Floor area per person [m2/person]

# Iterate simulation year
for sim_y in sim_period:

# Calculate new necessary floor area of simulation year
floorarea_pp_sy = data_floorarea_pp[reg_id][sim_y] # Get floor area per person of sim_yr
tot_floorarea_sy = floorarea_pp_sy * data_ext['population'][sim_y][reg_id] # floor area per person simulation year * population of simulation year in region
floorarea_pp_sy = data_floorarea_pp[reg_id][sim_y] # Get floor area per person of sim_yr
tot_floorarea_sy = floorarea_pp_sy * data_ext['population'][sim_y][reg_id] # Floor area per person simulation year * population of simulation year in region
new_floorarea_sim_year = tot_floorarea_sy - floorarea_by # tot new floor area - area base year

# Only calculate changing
Expand Down Expand Up @@ -159,14 +159,14 @@ def generate_dw_existing(uniqueID, sim_y, dw_lu, floorarea_p, floorarea_by, dwty
# Iterate dwelling types
for dw in dw_lu:
dw_type_id, dw_type_name = dw, dw_lu[dw]
dw_type_floorarea = floorarea_p[dw_type_name] * floorarea_by # Floor area of existing buildlings
dw_type_floorarea = floorarea_p[dw_type_name] * floorarea_by # Floor area of existing buildlings

# Distribute according to age
for dwtype_age_id in dwtype_age_distr_by:
age_class_p = dwtype_age_distr_by[dwtype_age_id] / 100 # Percent of dw of age class

# Floor area of dwelling_class_age
dw_type_age_class_floorarea = dw_type_floorarea * age_class_p # Distribute proportionally floor area
dw_type_age_class_floorarea = dw_type_floorarea * age_class_p # Distribute proportionally floor area
control_floorarea += dw_type_age_class_floorarea

# Pop
Expand Down
42 changes: 42 additions & 0 deletions energy_demand/data_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
""" new load profile generator """
import numpy as np
import os
import csv
import main_functions as mf
from datetime import date
import unittest
import matplotlib.pyplot as plt
import data_loader_functions as df

def generate_data(data, run_data_collection):
""" This function loads all that which does not neet to be run every time"""
base_year_load_data = 2015

if run_data_collection == False:
# TODO
# Read in dumped csv files
return data

# --------------
# HES data
# --------------
# Generate generic load profiles (shapes) for all electricity appliances from HES data [ % ]
hes_data, hes_y_peak, _ = df.read_hes_data(data)
year_raw_values_hes = df.assign_hes_data_to_year(data, hes_data, base_year_load_data)

# Load shape for all end_uses
for i in data['data_residential_by_fuel_end_uses']:
end_use = i # End use read from avaialble fuels...
data = df.get_hes_end_uses_shape(data, hes_data, year_raw_values_hes, hes_y_peak, _, end_use)

# Dump created end_use_dictionaries into txt files #TODO

# ----------------------------
# Residential Gas demand ()
# Daily shapes taken from Robert Sansom
# Yearly peak from CSWV
# ----------------------------
end_use = 'heating'
data = df.shape_residential_heating_gas(data, end_use)

return data

0 comments on commit 3f65206

Please sign in to comment.