-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue604 kpis disaggregated #606
base: master
Are you sure you want to change the base?
Changes from all commits
7528147
050da8c
34eda99
8f7f31d
973c9da
c521868
f032705
08a4dfc
995d842
893ce5d
622ae19
f13818a
7df1a1c
3ac058d
af18410
0d0bfee
5a0a545
c5fc249
2fb643e
ae96509
8f29072
c5615b6
8706b2c
4715f36
68f9c41
def70cc
4c9be91
b5b9e9c
7dcec68
c9d92d7
2b735b6
3d040cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,40 @@ def get_core_kpis(self, price_scenario='Constant'): | |
|
||
return ckpi | ||
|
||
def get_kpis_disaggregated(self, price_scenario='Constant'): | ||
'''Return the core KPIs of a test case disaggregated and | ||
with absolute values (not normalized by area or zone) | ||
to see the contributions of each element to each KPI. | ||
|
||
Parameters | ||
---------- | ||
price_scenario : str, optional | ||
Price scenario for cost kpi calculation. | ||
'Constant' or 'Dynamic' or 'HighlyDynamic'. | ||
Default is 'Constant'. | ||
|
||
Returns | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add space before Returns. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
------- | ||
dkpi = dict | ||
Dictionary with the core KPIs disaggregated and | ||
with absolute values. | ||
|
||
''' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add space before '''. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
_ = self.get_core_kpis(price_scenario=price_scenario) | ||
|
||
dkpi = OrderedDict() | ||
dkpi['tdis'] = self.tdis_dict | ||
dkpi['idis'] = self.idis_dict | ||
dkpi['ener'] = self.ener_dict | ||
dkpi['cost'] = self.cost_dict | ||
dkpi['emis'] = self.emis_dict | ||
dkpi['pele'] = self.pele_dict | ||
dkpi['pgas'] = self.pgas_dict | ||
dkpi['pdih'] = self.pdih_dict | ||
|
||
return dkpi | ||
|
||
def get_thermal_discomfort(self): | ||
'''The thermal discomfort is the integral of the deviation | ||
of the temperature with respect to the predefined comfort | ||
|
@@ -333,11 +367,10 @@ def get_energy(self): | |
if 'Power' in source: | ||
for signal in self.case.kpi_json[source]: | ||
pow_data = np.array(self._get_data_from_last_index(signal,self.i_last_ener)) | ||
self.ener_dict[signal] += \ | ||
trapz(pow_data, | ||
self._get_data_from_last_index('time',self.i_last_ener))*2.77778e-7 # Convert to kWh | ||
self.ener_dict_by_source[source+'_'+signal] += \ | ||
self.ener_dict[signal] | ||
integral = trapz(pow_data, | ||
self._get_data_from_last_index('time',self.i_last_ener))*2.77778e-7 # Convert to kWh | ||
self.ener_dict[signal] += integral | ||
self.ener_dict_by_source[source+'_'+signal] += integral | ||
self.ener_tot = self.ener_tot + self.ener_dict[signal]/self.case._get_area() # Normalize total by floor area | ||
|
||
# Assign to case | ||
|
@@ -382,10 +415,10 @@ def get_peak_electricity(self): | |
df_pow_data_all = pd.concat([df_pow_data_all, df_pow_data], axis=1) | ||
df_pow_data_all.index = pd.TimedeltaIndex(df_pow_data_all.index, unit='s') | ||
df_pow_data_all['total_demand'] = df_pow_data_all.sum(axis=1) | ||
df_pow_data_all = df_pow_data_all.resample('15T').mean()/self.case._get_area()/1000. | ||
df_pow_data_all = df_pow_data_all.resample('15T').mean()/1000. | ||
i = df_pow_data_all['total_demand'].idxmax() | ||
peak = df_pow_data_all.loc[i,'total_demand'] | ||
self.pele_tot = peak | ||
self.pele_tot = peak/self.case._get_area() | ||
# Find contributions to peak by each signal | ||
for signal in self.case.kpi_json[source]: | ||
self.pele_dict[signal] = df_pow_data_all.loc[i,signal] | ||
|
@@ -429,10 +462,10 @@ def get_peak_gas(self): | |
df_pow_data_all = pd.concat([df_pow_data_all, df_pow_data], axis=1) | ||
df_pow_data_all.index = pd.TimedeltaIndex(df_pow_data_all.index, unit='s') | ||
df_pow_data_all['total_demand'] = df_pow_data_all.sum(axis=1) | ||
df_pow_data_all = df_pow_data_all.resample('15T').mean()/self.case._get_area()/1000. | ||
df_pow_data_all = df_pow_data_all.resample('15T').mean()/1000. | ||
i = df_pow_data_all['total_demand'].idxmax() | ||
peak = df_pow_data_all.loc[i,'total_demand'] | ||
self.pgas_tot = peak | ||
self.pgas_tot = peak/self.case._get_area() | ||
# Find contributions to peak by each signal | ||
for signal in self.case.kpi_json[source]: | ||
self.pgas_dict[signal] = df_pow_data_all.loc[i,signal] | ||
|
@@ -476,10 +509,10 @@ def get_peak_district_heating(self): | |
df_pow_data_all = pd.concat([df_pow_data_all, df_pow_data], axis=1) | ||
df_pow_data_all.index = pd.TimedeltaIndex(df_pow_data_all.index, unit='s') | ||
df_pow_data_all['total_demand'] = df_pow_data_all.sum(axis=1) | ||
df_pow_data_all = df_pow_data_all.resample('15T').mean()/self.case._get_area()/1000. | ||
df_pow_data_all = df_pow_data_all.resample('15T').mean()/1000. | ||
i = df_pow_data_all['total_demand'].idxmax() | ||
peak = df_pow_data_all.loc[i,'total_demand'] | ||
self.pdih_tot = peak | ||
self.pdih_tot = peak/self.case._get_area() | ||
# Find contributions to peak by each signal | ||
for signal in self.case.kpi_json[source]: | ||
self.pdih_dict[signal] = df_pow_data_all.loc[i,signal] | ||
|
@@ -541,11 +574,10 @@ def get_cost(self, scenario='Constant'): | |
# Calculate costs | ||
for signal in self.case.kpi_json[source]: | ||
pow_data = np.array(self._get_data_from_last_index(signal,self.i_last_cost)) | ||
self.cost_dict[signal] += \ | ||
trapz(np.multiply(source_price_data,pow_data), | ||
integral = trapz(np.multiply(source_price_data,pow_data), | ||
self._get_data_from_last_index('time',self.i_last_cost))*factor | ||
self.cost_dict_by_source[source+'_'+signal] += \ | ||
self.cost_dict[signal] | ||
self.cost_dict[signal] += integral | ||
self.cost_dict_by_source[source+'_'+signal] += integral | ||
self.cost_tot = self.cost_tot + self.cost_dict[signal]/self.case._get_area() # Normalize total by floor area | ||
|
||
# Assign to case | ||
|
@@ -585,11 +617,10 @@ def get_emissions(self): | |
['Emissions'+source]) | ||
for signal in self.case.kpi_json[source]: | ||
pow_data = np.array(self._get_data_from_last_index(signal,self.i_last_emis)) | ||
self.emis_dict[signal] += \ | ||
trapz(np.multiply(source_emissions_data,pow_data), | ||
integral = trapz(np.multiply(source_emissions_data,pow_data), | ||
self._get_data_from_last_index('time',self.i_last_emis))*2.77778e-7 # Convert to kWh | ||
self.emis_dict_by_source[source+'_'+signal] += \ | ||
self.emis_dict[signal] | ||
self.emis_dict[signal] += integral | ||
self.emis_dict_by_source[source+'_'+signal] += integral | ||
self.emis_tot = self.emis_tot + self.emis_dict[signal]/self.case._get_area() # Normalize total by floor area | ||
|
||
# Update last integration index | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.6.0-dev\n", "buildingType": {"uid": "bestest_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.4660775943925745, "emis_tot": 1.6291465071977262, "ener_tot": 9.00349952561408, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.00025517153990852024, "pgas_tot": 0.11798036181564837, "tdis_tot": 18.21783776691252, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} | ||
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.6.0-dev\n", "buildingType": {"uid": "bestest_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.4660775943925745, "emis_tot": 1.6291465071977262, "ener_tot": 9.00349952561408, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181564837, "tdis_tot": 18.21783776691252, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"tdis_tot": 10.866116056527034, "idis_tot": 515.1749482042578, "ener_tot": 2.1905882633882148, "cost_tot": 0.15334117843717504, "emis_tot": 0.438117652677643, "pele_tot": null, "pgas_tot": 0.10097014409038281, "pdih_tot": null, "time_rat": null} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"tdis_tot": 6.044280949869132, "idis_tot": 365.6911873402533, "ener_tot": 3.06717186709752, "cost_tot": 0.613434373419504, "emis_tot": 1.53358593354876, "pele_tot": 0.11118336992336571, "pgas_tot": null, "pdih_tot": null, "time_rat": null} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"tdis": {"TRooAirSou_dTlower_y": 6.861372185606556, "TRooAirSou_dTupper_y": 3.771997257241026, "TRooAirNor_dTlower_y": 8.2055849580535, "TRooAirNor_dTupper_y": 2.893277712152985}, "idis": {"CO2RooAirSou_dIupper_y": 1016.9440316099603, "CO2RooAirNor_dIupper_y": 13.40586479855533}, "ener": {"PHeaNor_y": 22.33656655950071, "PHeaSou_y": 21.475198708263587}, "cost": {"PHeaNor_y": 1.5635596591650494, "PHeaSou_y": 1.503263909578451}, "emis": {"PHeaNor_y": 4.467313311900141, "PHeaSou_y": 4.295039741652719}, "pele": null, "pgas": {"PHeaNor_y": 1.057801489003348, "PHeaSou_y": 0.9616013928043511}, "pdih": null} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"tdis": {"TRooAir_dTlower_y": 5.174733104689715, "TRooAir_dTupper_y": 0.8695478451794166}, "idis": {"CO2RooAir_dIupper_y": 365.6911873402533}, "ener": {"PCoo_y": 2.5790120993548213, "PFan_y": 1.2243750151212227, "PHea_y": 143.38535826054658, "PPum_y": 0.035504245658337034}, "cost": {"PCoo_y": 0.5158024198709642, "PFan_y": 0.2448750030242446, "PHea_y": 28.677071652109316, "PPum_y": 0.007100849131667407}, "emis": {"PCoo_y": 1.2895060496774107, "PFan_y": 0.6121875075606114, "PHea_y": 71.69267913027329, "PPum_y": 0.017752122829168517}, "pele": {"PCoo_y": 0.0, "PFan_y": 0.005231953892668188, "PHea_y": 5.33156980242889, "PPum_y": 0.0}, "pgas": null, "pdih": null} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
keys,value | ||
PCoo_y,0.0 | ||
PFan_y,0.000108999039431 | ||
PHea_y,0.111074370884 | ||
PFan_y,0.00523195389267 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these changing because of a correction on accounting for area or not within the disaggregated dictionary values? Same with pgas_dict_MultiZone.csv. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly, this is due to 08a4dfc. For some reason for peak KPIs we were normalizing with the area at the contributions of each element already which is reflected at the |
||
PHea_y,5.33156980243 | ||
PPum_y,0.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
keys,value | ||
PHeaNor_y,0.0528900744502 | ||
PHeaSou_y,0.0480800696402 | ||
PHeaNor_y,1.057801489 | ||
PHeaSou_y,0.961601392804 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.6.0-dev\n", "buildingType": {"uid": "multizone_residential_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.7911663939870216, "emis_tot": 1.4254044254077105, "ener_tot": 8.140200481262813, "idis_tot": 9114.558476792468, "pdih_tot": null, "pele_tot": 0.0017390231869758264, "pgas_tot": 0.09592720495532532, "tdis_tot": 22.00196096128404, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} | ||
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.6.0-dev\n", "buildingType": {"uid": "multizone_residential_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.7911663939870216, "emis_tot": 1.4254044254077105, "ener_tot": 8.140200481262813, "idis_tot": 9114.558476792468, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.00196096128404, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space before Parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
af18410