Sorsogon Step 1.e Micro-level Non-Residential model¶
In [1]:
import datetime; print(datetime.datetime.now())
2018-03-15 13:52:18.424295
Notebook abstract
A simple micro-level building stock model. The consumption model defined for the building stock works in theory exactly like the other micro level consumption model. The difference between this model and the income, electricity and water demand models is that we don’t have a micro-level consumption data set in order to extract regression coefficients. In order to define a consumption model we use predefine building typologies.
Compile building level data¶
In [2]:
from smum._scripts.sqm_data import get_pop_data, get_sqm_data
In [3]:
census_file = 'data/benchmarks_year_bias.csv'
In [4]:
pop_data_1 = get_pop_data(census_file, sqm_nonres_mean = 800)
nr_data = get_sqm_data()
pop_data = get_pop_data(
census_file,
sqm_nonres_mean = nr_data.loc[:, 'sqm'].mean(),
)
pop_data_3 = get_pop_data(census_file, sqm_nonres_mean = 500)
/usr/lib/python3.6/site-packages/pandas-0.22.0-py3.6-linux-x86_64.egg/pandas/util/_decorators.py:118: FutureWarning: The `sheetname` keyword is deprecated, use `sheet_name` instead
return func(*args, **kwargs)
In [5]:
benchmarks = pop_data.loc[:,['sqm_nonres', 'num_nonres']]
benchmarks.columns = ['BuildingSqm', 'pop']
In [6]:
kwh_2016 = 6.52 * 1000000
In [7]:
pb_kwh = kwh_2016 / benchmarks.loc[2016, 'BuildingSqm']
pb_kwh_sqm = benchmarks.loc[:, 'pop'].mul(pb_kwh)
benchmarks.insert(1, 'BuildingKwh', pb_kwh_sqm)
In [8]:
benchmarks.loc[2016, 'NonRElectricity'] = kwh_2016
In [9]:
benchmarks.head()
Out[9]:
BuildingSqm | BuildingKwh | pop | NonRElectricity | |
---|---|---|---|---|
2010 | 68716.843636 | 9989.175844 | 111.0 | NaN |
2011 | 69223.535896 | 10079.168419 | 112.0 | NaN |
2012 | 69772.846840 | 10169.160994 | 113.0 | NaN |
2013 | 70361.528759 | 10259.153569 | 114.0 | NaN |
2014 | 71001.761591 | 10349.146145 | 115.0 | NaN |
In [10]:
benchmarks.to_csv('data/benchmarks_nonresidential.csv')
In [11]:
from smum._scripts.sqm_data import plot_nr
plot_nr(pop_data_1, pop_data, pop_data_3, nr_data)
Prior non-residential model¶
In [12]:
from smum._scripts.sqm_data import get_count_data
import pandas as pd
count_data = get_count_data()
count_data = count_data.div(count_data.sum())
/usr/lib/python3.6/site-packages/pandas-0.22.0-py3.6-linux-x86_64.egg/pandas/util/_decorators.py:118: FutureWarning: The `sheetname` keyword is deprecated, use `sheet_name` instead
return func(*args, **kwargs)
In [13]:
nrb_elec = pd.DataFrame(columns=['co_mu', 'co_sd', 'p', 'dis', 'lb', 'ub'])
nrb_elec.loc['BuildingSqm', 'co_mu'] = ",".join([str(i) for i in nr_data['sqm']])
nrb_elec.loc['BuildingSqm', 'co_sd'] = ",".join([str(i) for i in nr_data['sqm_sd']])
nrb_elec.loc['BuildingKwh', 'co_mu'] = ",".join([str(i) for i in nr_data['kwh']])
nrb_elec.loc['BuildingKwh', 'co_sd'] = ",".join([str(i) for i in nr_data['kwh_sd']])
nrb_elec.loc[:, 'p'] = ",".join([str(i) for i in count_data['counts']])
nrb_elec.loc['BuildingSqm', 'dis'] = "Deterministic;n;Categorical"
nrb_elec.loc['BuildingKwh', 'dis'] = "Deterministic;BuildingSqm;Categorical"
In [14]:
nrb_elec.to_csv('data/table_elec_nr.csv')
In [15]:
nrb_elec.loc['BuildingSqm', 'dis'] = "Normal;n;Categorical"
nrb_elec.to_csv('data/test_elec_nr_normal.csv')
In [16]:
nrb_elec
Out[16]:
co_mu | co_sd | p | dis | lb | ub | |
---|---|---|---|---|---|---|
BuildingSqm | 719.5871280224214,312.5947515174914,1165.99458... | 45.93150475011659,27.88881729659839,510.591052... | 0.06084986413783436,0.09160606304100238,0.0106... | Normal;n;Categorical | NaN | NaN |
BuildingKwh | 262,631,592,316,293,233,296,137,243 | 135.8105297832241,649.5509987676103,344.818792... | 0.06084986413783436,0.09160606304100238,0.0106... | Deterministic;BuildingSqm;Categorical | NaN | NaN |