From 75281471314bc868438068e4786c4db3f6a9254f Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 13:25:07 +0100 Subject: [PATCH 01/28] Add method to get KPIs disaggregated. --- kpis/kpi_calculator.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/kpis/kpi_calculator.py b/kpis/kpi_calculator.py index a86cbf8e4..1defea9a8 100644 --- a/kpis/kpi_calculator.py +++ b/kpis/kpi_calculator.py @@ -215,6 +215,37 @@ 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 + ------- + dkpi = dict + Dictionary with the core KPIs disaggregated and + with absolute values. + ''' + + _ = 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 From 050da8caad41e677f4098f7e882820fbb44c432f Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 13:33:56 +0100 Subject: [PATCH 02/28] Interface to get_kpis_disaggregated at testcase.py --- testcase.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/testcase.py b/testcase.py index 20ee4f183..b12b6b3e3 100644 --- a/testcase.py +++ b/testcase.py @@ -789,6 +789,50 @@ def get_kpis(self): return status, message, payload + def get_kpis_disaggregated(self): + '''Returns KPIs disaggregated and with absolute values. + Requires standard sensor signals. + + Parameters + ---------- + None + + Returns + ------- + status: int + Indicates whether a request for querying the KPIs has been completed. + If 200, the KPIs were successfully queried. + If 500, an internal error occured. + message: str + Includes detailed debugging information + payload : dict + Dictionary containing KPIs disaggregated and with absolute values. + {:} + Returns None if error during calculation. + + ''' + + status = 200 + message = "Queried disaggregated KPIs successfully." + try: + # Set correct price scenario for cost + if self.scenario['electricity_price'] == 'constant': + price_scenario = 'Constant' + elif self.scenario['electricity_price'] == 'dynamic': + price_scenario = 'Dynamic' + elif self.scenario['electricity_price'] == 'highly_dynamic': + price_scenario = 'HighlyDynamic' + # Calculate the disaggregated kpis + payload = self.cal.get_kpis_disaggregated(price_scenario=price_scenario) + except: + payload = None + status = 500 + message = "Failed to query disaggregated KPIs: {}".format(traceback.format_exc()) + logging.error(message) + logging.info(message) + + return status, message, payload + def get_forecast_points(self): '''Returns a dictionary of available forecast points and their meta-data. From 34eda9982053f45263e4d702ed45b1ead99125c1 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 13:43:15 +0100 Subject: [PATCH 03/28] Implement Rest API call. --- restapi.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/restapi.py b/restapi.py index 50f6655c1..5f89f1643 100644 --- a/restapi.py +++ b/restapi.py @@ -191,6 +191,13 @@ def get(self): status, message, payload = case.get_kpis() return construct(status, message, payload) +class KPI_Disaggregated(Resource): + '''Interface to test case KPIs disaggregated and with absolute values.''' + + def get(self): + '''GET request to receive KPIs disaggregated and with absolute values.''' + status, message, payload = case.get_kpis_disaggregated() + return construct(status, message, payload) class Forecast(Resource): '''Interface to test case forecast data.''' @@ -267,6 +274,7 @@ def post(self): api.add_resource(Forecast_Points, '/forecast_points') api.add_resource(Results, '/results') api.add_resource(KPI, '/kpi') +api.add_resource(KPI_Disaggregated, '/kpi_disaggregated') api.add_resource(Forecast, '/forecast') api.add_resource(Scenario, '/scenario') api.add_resource(Name, '/name') From 8f7f31db94efa9af0e547ad2e3012c2156d562f5 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 15:34:13 +0000 Subject: [PATCH 04/28] Add check for getting all core KPIs. --- testing/test_kpis.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testing/test_kpis.py b/testing/test_kpis.py index 1fac92732..dc32adbbc 100644 --- a/testing/test_kpis.py +++ b/testing/test_kpis.py @@ -262,6 +262,21 @@ def test_change_scenario_with_warmup(self): # Check results self._perform_test(self.case.cost_tot, self.case.cost_dict, 'cost_warmup_highly_dynamic') + def test_get_kpis(self): + '''Check for getting all core KPIs. + + ''' + + # Reset kpi calculator + self.cal.initialize() + + # Calculate all core KPIs + ckpis = self.cal.get_core_kpis() + + # Check results + ref_filepath = os.path.join(utilities.get_root_path(), 'testing', 'references', 'kpis', 'all_ckpis_{0}.csv'.format(self.name)) + self.compare_ref_json(ckpis, ref_filepath) + def _perform_test(self, tot, dictionary, label): '''Common function for performing the tests. From 973c9da0757008658d5cdb0eca2672425071fd20 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 15:34:39 +0000 Subject: [PATCH 05/28] Add check for getting all KPIs disaggregated. --- testing/test_kpis.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testing/test_kpis.py b/testing/test_kpis.py index dc32adbbc..d8695f103 100644 --- a/testing/test_kpis.py +++ b/testing/test_kpis.py @@ -277,6 +277,21 @@ def test_get_kpis(self): ref_filepath = os.path.join(utilities.get_root_path(), 'testing', 'references', 'kpis', 'all_ckpis_{0}.csv'.format(self.name)) self.compare_ref_json(ckpis, ref_filepath) + def test_get_kpis_disaggregated(self): + '''Check for getting all core KPIs in a disaggregated format. + + ''' + + # Reset kpi calculator + self.cal.initialize() + + # Calculate all core KPIs + dkpis = self.cal.get_kpis_disaggregated() + + # Check disaggregated results + ref_filepath = os.path.join(utilities.get_root_path(), 'testing', 'references', 'kpis', 'all_dkpis_{0}.csv'.format(self.name)) + self.compare_ref_json(dkpis, ref_filepath) + def _perform_test(self, tot, dictionary, label): '''Common function for performing the tests. From c5218683a84ddddeda3f12b56d53fb3891d62535 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 15:35:12 +0000 Subject: [PATCH 06/28] Add reference results for new tests. --- testing/references/kpis/all_ckpis_MultiZone.csv | 1 + testing/references/kpis/all_ckpis_SingleZone.csv | 1 + testing/references/kpis/all_dkpis_MultiZone.csv | 1 + testing/references/kpis/all_dkpis_SingleZone.csv | 1 + 4 files changed, 4 insertions(+) create mode 100644 testing/references/kpis/all_ckpis_MultiZone.csv create mode 100644 testing/references/kpis/all_ckpis_SingleZone.csv create mode 100644 testing/references/kpis/all_dkpis_MultiZone.csv create mode 100644 testing/references/kpis/all_dkpis_SingleZone.csv diff --git a/testing/references/kpis/all_ckpis_MultiZone.csv b/testing/references/kpis/all_ckpis_MultiZone.csv new file mode 100644 index 000000000..ad66cae11 --- /dev/null +++ b/testing/references/kpis/all_ckpis_MultiZone.csv @@ -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.10097014409038282, "pdih_tot": null, "time_rat": null} \ No newline at end of file diff --git a/testing/references/kpis/all_ckpis_SingleZone.csv b/testing/references/kpis/all_ckpis_SingleZone.csv new file mode 100644 index 000000000..440199b2f --- /dev/null +++ b/testing/references/kpis/all_ckpis_SingleZone.csv @@ -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.11118336992336572, "pgas_tot": null, "pdih_tot": null, "time_rat": null} \ No newline at end of file diff --git a/testing/references/kpis/all_dkpis_MultiZone.csv b/testing/references/kpis/all_dkpis_MultiZone.csv new file mode 100644 index 000000000..71634c74e --- /dev/null +++ b/testing/references/kpis/all_dkpis_MultiZone.csv @@ -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": 0.052890074450167406, "PHeaSou_y": 0.048080069640217556}, "pdih": null} \ No newline at end of file diff --git a/testing/references/kpis/all_dkpis_SingleZone.csv b/testing/references/kpis/all_dkpis_SingleZone.csv new file mode 100644 index 000000000..0a9dbcbc0 --- /dev/null +++ b/testing/references/kpis/all_dkpis_SingleZone.csv @@ -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.00010899903943058726, "PHea_y": 0.11107437088393521, "PPum_y": 0.0}, "pgas": null, "pdih": null} \ No newline at end of file From f032705eaa2547ccdb666f79669595abc1d7534f Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 15:52:12 +0000 Subject: [PATCH 07/28] Calculate integral separately not to add up when computing by source. If called multiple times, xxxx_dict_by_source used to increase even when the test case is not moving forward because it was calculated from xxxx_dict instead of using the _get_data_from_last_index method. --- kpis/kpi_calculator.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/kpis/kpi_calculator.py b/kpis/kpi_calculator.py index 1defea9a8..12406bd6f 100644 --- a/kpis/kpi_calculator.py +++ b/kpis/kpi_calculator.py @@ -364,11 +364,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 @@ -572,11 +571,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 @@ -616,11 +614,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 From 08a4dfcea7ed883b841559f642dfd6b18b677b05 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 17:11:49 +0000 Subject: [PATCH 08/28] Normalize peak power only for peak_tot, not for peak_dict. --- kpis/kpi_calculator.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kpis/kpi_calculator.py b/kpis/kpi_calculator.py index 12406bd6f..5fdd5c506 100644 --- a/kpis/kpi_calculator.py +++ b/kpis/kpi_calculator.py @@ -412,10 +412,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] @@ -459,10 +459,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] @@ -506,10 +506,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] From 995d8429ab864fc21aaf939e454f0f2641a1a88a Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 17:13:07 +0000 Subject: [PATCH 09/28] Update xxxx_dict references due to peak KPIs normalized only at xxxx_tot. Notice that this does not affect to the xxxx_tot results. --- testing/references/kpis/all_ckpis_MultiZone.csv | 2 +- testing/references/kpis/all_ckpis_SingleZone.csv | 2 +- testing/references/kpis/all_dkpis_MultiZone.csv | 2 +- testing/references/kpis/all_dkpis_SingleZone.csv | 2 +- testing/references/kpis/pele_dict_SingleZone.csv | 4 ++-- testing/references/kpis/pgas_dict_MultiZone.csv | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/testing/references/kpis/all_ckpis_MultiZone.csv b/testing/references/kpis/all_ckpis_MultiZone.csv index ad66cae11..0a2794d7e 100644 --- a/testing/references/kpis/all_ckpis_MultiZone.csv +++ b/testing/references/kpis/all_ckpis_MultiZone.csv @@ -1 +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.10097014409038282, "pdih_tot": null, "time_rat": null} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/testing/references/kpis/all_ckpis_SingleZone.csv b/testing/references/kpis/all_ckpis_SingleZone.csv index 440199b2f..f15d06a2e 100644 --- a/testing/references/kpis/all_ckpis_SingleZone.csv +++ b/testing/references/kpis/all_ckpis_SingleZone.csv @@ -1 +1 @@ -{"tdis_tot": 6.044280949869132, "idis_tot": 365.6911873402533, "ener_tot": 3.06717186709752, "cost_tot": 0.613434373419504, "emis_tot": 1.53358593354876, "pele_tot": 0.11118336992336572, "pgas_tot": null, "pdih_tot": null, "time_rat": null} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/testing/references/kpis/all_dkpis_MultiZone.csv b/testing/references/kpis/all_dkpis_MultiZone.csv index 71634c74e..90d03775b 100644 --- a/testing/references/kpis/all_dkpis_MultiZone.csv +++ b/testing/references/kpis/all_dkpis_MultiZone.csv @@ -1 +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": 0.052890074450167406, "PHeaSou_y": 0.048080069640217556}, "pdih": null} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/testing/references/kpis/all_dkpis_SingleZone.csv b/testing/references/kpis/all_dkpis_SingleZone.csv index 0a9dbcbc0..d8524a17c 100644 --- a/testing/references/kpis/all_dkpis_SingleZone.csv +++ b/testing/references/kpis/all_dkpis_SingleZone.csv @@ -1 +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.00010899903943058726, "PHea_y": 0.11107437088393521, "PPum_y": 0.0}, "pgas": null, "pdih": null} \ No newline at end of file +{"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} \ No newline at end of file diff --git a/testing/references/kpis/pele_dict_SingleZone.csv b/testing/references/kpis/pele_dict_SingleZone.csv index 3521a3477..38e467ed1 100644 --- a/testing/references/kpis/pele_dict_SingleZone.csv +++ b/testing/references/kpis/pele_dict_SingleZone.csv @@ -1,5 +1,5 @@ keys,value PCoo_y,0.0 -PFan_y,0.000108999039431 -PHea_y,0.111074370884 +PFan_y,0.00523195389267 +PHea_y,5.33156980243 PPum_y,0.0 diff --git a/testing/references/kpis/pgas_dict_MultiZone.csv b/testing/references/kpis/pgas_dict_MultiZone.csv index efdef174c..23a9b4be7 100644 --- a/testing/references/kpis/pgas_dict_MultiZone.csv +++ b/testing/references/kpis/pgas_dict_MultiZone.csv @@ -1,3 +1,3 @@ keys,value -PHeaNor_y,0.0528900744502 -PHeaSou_y,0.0480800696402 +PHeaNor_y,1.057801489 +PHeaSou_y,0.961601392804 From 893ce5d6e5db0bf0fff29fcffde17aaf62dfa45a Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 17:22:57 +0000 Subject: [PATCH 10/28] Describe new method in releasenotes.md. --- releasenotes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/releasenotes.md b/releasenotes.md index 63efc8f08..693142115 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -9,6 +9,7 @@ Released on xx/xx/xxxx. - Add materials for RLEM23 workshop at ``docs/workshops/RlemWorkshop_20231112``. This is for [#585](https://github.com/ibpsa/project1-boptest/issues/585). - Change JModelica docker container address in ``testing/Dockerfile``. This is for [#590](https://github.com/ibpsa/project1-boptest/issues/590). - Specify the Python version (3.7) used for building the wrapper to execute the example JavaScript controllers in the unit test. This is for [#594](https://github.com/ibpsa/project1-boptest/issues/594). +- Implement method to get disaggregated KPIs with absolute values. This enables to make a more comprehensive analysis of which elements are contributing to each KPI. This is for [#604](https://github.com/ibpsa/project1-boptest/issues/604). ## BOPTEST v0.5.0 From 622ae1918d2c9f2ab69b9ff3d38cba2abc1c3b4f Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 11 Jan 2024 17:29:19 +0000 Subject: [PATCH 11/28] Add kpi_disaggregated to README.md. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a86e8af93..27ac048bb 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Example RESTful interaction: | Receive control signal point names (u) and metadata. | GET ``inputs`` | | Receive test result data for the given point names between the start and final time in seconds. | PUT ``results`` with required arguments ``point_names=``, ``start_time=``, ``final_time=``| | Receive test KPIs. | GET ``kpi`` | +| Receive test KPIs disaggregated and in absolute values. | GET ``kpi_disaggregated`` | | Receive test case name. | GET ``name`` | | Receive boundary condition forecast from current communication step for the given point names for the horizon and at the interval in seconds. | PUT ``forecast`` with required arguments ``point_names=``, ``horizon=``, ``interval=``| | Receive boundary condition forecast available point names and metadata. | GET ``forecast_points`` | From f13818a929d34243d7a5fdbd09a05765b35634de Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 12 Jan 2024 17:49:06 +0100 Subject: [PATCH 12/28] Update refs for numerical differences. --- testing/references/bestest_hydronic/submit.json | 2 +- testing/references/testcase3/submit.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/references/bestest_hydronic/submit.json b/testing/references/bestest_hydronic/submit.json index 61bad9e12..bd357424e 100644 --- a/testing/references/bestest_hydronic/submit.json +++ b/testing/references/bestest_hydronic/submit.json @@ -1 +1 @@ -{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.5.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.5.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"}]}} \ No newline at end of file diff --git a/testing/references/testcase3/submit.json b/testing/references/testcase3/submit.json index d29cdde99..a89ee4e81 100644 --- a/testing/references/testcase3/submit.json +++ b/testing/references/testcase3/submit.json @@ -1 +1 @@ -{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.5.0-dev\n", "buildingType": {"uid": "testcase3"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.9674593335412667, "emis_tot": 2.7641695244036195, "ener_tot": 13.820847622018096, "idis_tot": 3606.22674562425, "pdih_tot": null, "pele_tot": null, "pgas_tot": 0.12017492256526957, "tdis_tot": 443.7163025810678, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "test_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.5.0-dev\n", "buildingType": {"uid": "testcase3"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.9674593335412667, "emis_tot": 2.7641695244036195, "ener_tot": 13.820847622018096, "idis_tot": 3606.22674562425, "pdih_tot": null, "pele_tot": null, "pgas_tot": 0.12017492256526958, "tdis_tot": 443.7163025810678, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "test_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} \ No newline at end of file From 3ac058d6ba97017499c89aacd095433cb8179ee0 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 22 Mar 2024 09:57:32 +0100 Subject: [PATCH 13/28] Add release note. --- releasenotes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes.md b/releasenotes.md index 9aaaba341..c079fd7aa 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -18,7 +18,7 @@ Released on xx/xx/xxxx. - Fix unit tests for possible false passes in certain test cases. This is for [#620](https://github.com/ibpsa/project1-boptest/issues/620). - Add ``activate`` control inputs to all test case documentation and update ``get_html_IO.py`` to print one file with all inputs, outputs, and forecasts. This is for [#555](https://github.com/ibpsa/project1-boptest/issues/555). - Add storing of scenario result trajectories, kpis, and test information to simulation directory within test case docker container. This is for [#626](https://github.com/ibpsa/project1-boptest/issues/626). - +- Implement method to get disaggregated KPIs with absolute values. This enables to make a more comprehensive analysis of which elements are contributing to each KPI. This is for [#604](https://github.com/ibpsa/project1-boptest/issues/604). ## BOPTEST v0.5.0 From af184105210937676139aeabbce8e1f684bcb83d Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 22 Mar 2024 10:05:04 +0100 Subject: [PATCH 14/28] Run pre-commit --- kpis/kpi_calculator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kpis/kpi_calculator.py b/kpis/kpi_calculator.py index 5fdd5c506..54b3fc43c 100644 --- a/kpis/kpi_calculator.py +++ b/kpis/kpi_calculator.py @@ -216,9 +216,10 @@ 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. + '''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 @@ -228,7 +229,7 @@ def get_kpis_disaggregated(self, price_scenario='Constant'): Returns ------- dkpi = dict - Dictionary with the core KPIs disaggregated and + Dictionary with the core KPIs disaggregated and with absolute values. ''' @@ -236,7 +237,7 @@ def get_kpis_disaggregated(self, price_scenario='Constant'): dkpi = OrderedDict() dkpi['tdis'] = self.tdis_dict - dkpi['idis'] = self.idis_dict + dkpi['idis'] = self.idis_dict dkpi['ener'] = self.ener_dict dkpi['cost'] = self.cost_dict dkpi['emis'] = self.emis_dict From 0d0bfeedffad0b4103d2dd67bcb0a9e853cc7817 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 22 Mar 2024 10:06:21 +0100 Subject: [PATCH 15/28] Add space before returns. --- kpis/kpi_calculator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kpis/kpi_calculator.py b/kpis/kpi_calculator.py index 54b3fc43c..58e0ad5e3 100644 --- a/kpis/kpi_calculator.py +++ b/kpis/kpi_calculator.py @@ -226,6 +226,7 @@ def get_kpis_disaggregated(self, price_scenario='Constant'): Price scenario for cost kpi calculation. 'Constant' or 'Dynamic' or 'HighlyDynamic'. Default is 'Constant'. + Returns ------- dkpi = dict From 5a0a5451a738fcc855f4b108565a2b0a2207f072 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 22 Mar 2024 10:10:35 +0100 Subject: [PATCH 16/28] Add space before end of docstring. --- kpis/kpi_calculator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kpis/kpi_calculator.py b/kpis/kpi_calculator.py index 58e0ad5e3..60e2d6ac5 100644 --- a/kpis/kpi_calculator.py +++ b/kpis/kpi_calculator.py @@ -232,6 +232,7 @@ def get_kpis_disaggregated(self, price_scenario='Constant'): dkpi = dict Dictionary with the core KPIs disaggregated and with absolute values. + ''' _ = self.get_core_kpis(price_scenario=price_scenario) From c5fc24978c0183932c50251e99a717e51e2d419d Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 22 Mar 2024 10:15:28 +0100 Subject: [PATCH 17/28] Be more specific in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23b497807..bb22c903d 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Example RESTful interaction: | Receive control signal point names (u) and metadata. | GET ``inputs`` | | Receive test result data for the given point names between the start and final time in seconds. | PUT ``results`` with required arguments ``point_names=``, ``start_time=``, ``final_time=``| | Receive test KPIs. | GET ``kpi`` | -| Receive test KPIs disaggregated and in absolute values. | GET ``kpi_disaggregated`` | +| Receive test KPIs disaggregated into contributing components (e.g. each equipment or zone) ...| GET ``kpi_disaggregated`` | | Receive test case name. | GET ``name`` | | Receive boundary condition forecast from current communication step for the given point names for the horizon and at the interval in seconds. | PUT ``forecast`` with required arguments ``point_names=``, ``horizon=``, ``interval=``| | Receive boundary condition forecast available point names and metadata. | GET ``forecast_points`` | From ae9650995f17478ce0fa10a12d19fb64caccec39 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 7 Jun 2024 15:06:34 +0200 Subject: [PATCH 18/28] Move contribution to v0.6.0-dev. --- releasenotes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes.md b/releasenotes.md index 7c80e782d..8f598f51b 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -9,6 +9,7 @@ Released on xx/xx/xxxx. - Update pyfmi version from 2.11 to 2.12 and miniconda version from py310_23.1.0-1-Linux-x86_64 to py310_24.3.0-0-Linux-x86_64. This is for [#643](https://github.com/ibpsa/project1-boptest/issues/643). - Remove support and unit testing of example python controllers using Python 2. This is for [#634](https://github.com/ibpsa/project1-boptest/issues/634). - Add a warning message upon test case compilation in ``data/data_manager.py`` that is displayed if any of the weather variables in ``data/categories.json`` is not in ``/resources/weather.csv``. This is for [#500](https://github.com/ibpsa/project1-boptest/issues/500). +- Implement method to get disaggregated KPIs with absolute values. This enables to make a more comprehensive analysis of which elements are contributing to each KPI. This is for [#604](https://github.com/ibpsa/project1-boptest/issues/604). ## BOPTEST v0.6.0 @@ -28,7 +29,6 @@ Released on 04/03/2024. - Fix unit tests for possible false passes in certain test cases. This is for [#620](https://github.com/ibpsa/project1-boptest/issues/620). - Add ``activate`` control inputs to all test case documentation and update ``get_html_IO.py`` to print one file with all inputs, outputs, and forecasts. This is for [#555](https://github.com/ibpsa/project1-boptest/issues/555). - Add storing of scenario result trajectories, kpis, and test information to simulation directory within test case docker container. This is for [#626](https://github.com/ibpsa/project1-boptest/issues/626). -- Implement method to get disaggregated KPIs with absolute values. This enables to make a more comprehensive analysis of which elements are contributing to each KPI. This is for [#604](https://github.com/ibpsa/project1-boptest/issues/604). ## BOPTEST v0.5.0 From 8f29072eb78d65945ff60110ba3cc74cf9fc09c0 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 7 Jun 2024 17:18:23 +0200 Subject: [PATCH 19/28] Add section in the design guide describing disaggregation. --- docs/design/source/core_kpi.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/design/source/core_kpi.rst b/docs/design/source/core_kpi.rst index b51dacdb2..72be58e08 100644 --- a/docs/design/source/core_kpi.rst +++ b/docs/design/source/core_kpi.rst @@ -227,6 +227,27 @@ Maximum allowed capital cost relies on the BOPTEST user, who can use the objective quantification of this KPI to take the decision. +Core KPIs disaggregation +--------------------------- + +The main purpose of the core KPIs is to enable benchmarking across different controllers. +That is the why these KPIs are provided in an aggregated format with all contributions +from each source added up to a unique value which is normlized by floor area or number of zones. +Returning a unique value facilitates comparisons between controllers. +However, there may be some cases where getting all contributions from each source separately +could be useful to gain insights and anlyze results. +We might be interested, for example, in what is the specific contribution of a pump and +a heat pump to the overal energy use of a building to decide whether we can +neglect the pump operation in our controller logic. + +The GET ´´kpi_disaggregated´´ API call gives this information as it returns the value of the core +KPIs disaggregated by the contribution of each source element. +The returned results are in absolute values, that is, they are not normalized by floor area or +by number of zones. +In the case of peak power KPIs it should be noted that what is returned is the contribution of +each element to the total peak when it is reached (instead of providing the peak power of each +individual element separately). + Calculation Module --------------------- From c5615b649a768cf404d937faa4a7c721923f1d87 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 13 Jun 2024 17:13:36 +0200 Subject: [PATCH 20/28] Change reference for numerical difference in pgas_tot. Changed from 'pgas_tot': 0.12017492256526957 to 'pgas_tot': 0.12017492256526958 --- testing/references/testcase3/submit.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/references/testcase3/submit.json b/testing/references/testcase3/submit.json index 81b3ebed4..2272860cd 100644 --- a/testing/references/testcase3/submit.json +++ b/testing/references/testcase3/submit.json @@ -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": "testcase3"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.9674593335412667, "emis_tot": 2.7641695244036195, "ener_tot": 13.820847622018096, "idis_tot": 3606.22674562425, "pdih_tot": null, "pele_tot": null, "pgas_tot": 0.12017492256526957, "tdis_tot": 443.7163025810678, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "test_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": "testcase3"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "forecastParameters": {}, "isShared": true, "kpis": {"cost_tot": 0.9674593335412667, "emis_tot": 2.7641695244036195, "ener_tot": 13.820847622018096, "idis_tot": 3606.22674562425, "pdih_tot": null, "pele_tot": null, "pgas_tot": 0.12017492256526958, "tdis_tot": 443.7163025810678, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "test_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} From 8706b2c699a4f49fe0cb7c20bb26b610ec298d00 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 13 Jun 2024 17:30:52 +0200 Subject: [PATCH 21/28] Change for numerical differences in submit references for bestest hydronic. --- testing/references/bestest_hydronic/submit.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/references/bestest_hydronic/submit.json b/testing/references/bestest_hydronic/submit.json index d8bc463af..d6f386f73 100644 --- a/testing/references/bestest_hydronic/submit.json +++ b/testing/references/bestest_hydronic/submit.json @@ -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.4660775413827701, "emis_tot": 1.6291463144464133, "ener_tot": 9.003498461160175, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181736055, "tdis_tot": 18.21778358894349, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} From 4715f3637378049fedfaacedeb9ea59cd9aa52d9 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 13 Jun 2024 18:48:03 +0200 Subject: [PATCH 22/28] Change for numerical differences in submit references for multizone_residential_hydronic. --- testing/references/multizone_residential_hydronic/submit.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/references/multizone_residential_hydronic/submit.json b/testing/references/multizone_residential_hydronic/submit.json index fd37a4837..1c3e5d488 100644 --- a/testing/references/multizone_residential_hydronic/submit.json +++ b/testing/references/multizone_residential_hydronic/submit.json @@ -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.7913863472036952, "emis_tot": 1.4258380608955639, "ener_tot": 8.1426015175411, "idis_tot": 9114.594263675232, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.003164637028615, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} From 68f9c41eed351290ad040c86a53aeec2ed086463 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 14 Jun 2024 14:12:29 +0200 Subject: [PATCH 23/28] Use assertEqual to show numerical differences. --- testing/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/utilities.py b/testing/utilities.py index 639cfc6c9..e8b3436c1 100644 --- a/testing/utilities.py +++ b/testing/utilities.py @@ -214,7 +214,7 @@ def compare_ref_json(self, json_test, ref_filepath): # If reference exists, check it with open(ref_filepath, 'r') as f: json_ref = json.load(f) - self.assertTrue(json_test==json_ref, 'json_test:\n{0}\ndoes not equal\njson_ref:\n{1}'.format(json_test, json_ref)) + self.assertEqual(json_test,json_ref, 'json_test:\n{0}\ndoes not equal\njson_ref:\n{1}'.format(json_test, json_ref)) else: # Otherwise, save as reference with open(ref_filepath, 'w') as f: From def70cc6d4f5b9f5fcc12c83b32561686f9ec67e Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Sat, 15 Jun 2024 09:31:38 +0200 Subject: [PATCH 24/28] Update refs for numerical diffs. --- testing/references/bestest_hydronic/submit.json | 2 +- testing/references/multizone_residential_hydronic/submit.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/references/bestest_hydronic/submit.json b/testing/references/bestest_hydronic/submit.json index d6f386f73..9fe35b0f0 100644 --- a/testing/references/bestest_hydronic/submit.json +++ b/testing/references/bestest_hydronic/submit.json @@ -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.4660775413827701, "emis_tot": 1.6291463144464133, "ener_tot": 9.003498461160175, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181736055, "tdis_tot": 18.21778358894349, "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.4660775413827701, "emis_tot": 1.6291465071977262, "ener_tot": 9.003498461160175, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181736055, "tdis_tot": 18.21778358894349, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} diff --git a/testing/references/multizone_residential_hydronic/submit.json b/testing/references/multizone_residential_hydronic/submit.json index 1c3e5d488..eda5898b4 100644 --- a/testing/references/multizone_residential_hydronic/submit.json +++ b/testing/references/multizone_residential_hydronic/submit.json @@ -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.7913863472036952, "emis_tot": 1.4258380608955639, "ener_tot": 8.1426015175411, "idis_tot": 9114.594263675232, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.003164637028615, "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.425404425407, "ener_tot": 8.1426015175411, "idis_tot": 9114.594263675232, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.003164637028615, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} From 4c9be912164b83c11b27898e0776b03ed25fb559 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Sat, 15 Jun 2024 16:46:48 +0200 Subject: [PATCH 25/28] Allow unlimited diff output. --- testing/utilities.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing/utilities.py b/testing/utilities.py index e8b3436c1..4508182a8 100644 --- a/testing/utilities.py +++ b/testing/utilities.py @@ -209,6 +209,9 @@ def compare_ref_json(self, json_test, ref_filepath): ''' + # Allow unlimited diff output + self.maxDiff = None + # Perform test if os.path.exists(ref_filepath): # If reference exists, check it From b5b9e9c22bcdfa21365d849bcf0e9053620c8139 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Sat, 15 Jun 2024 16:49:58 +0200 Subject: [PATCH 26/28] Update ref for numerical diff in multizon_residential_hydronic. --- testing/references/multizone_residential_hydronic/submit.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/references/multizone_residential_hydronic/submit.json b/testing/references/multizone_residential_hydronic/submit.json index eda5898b4..1f52605a8 100644 --- a/testing/references/multizone_residential_hydronic/submit.json +++ b/testing/references/multizone_residential_hydronic/submit.json @@ -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.425404425407, "ener_tot": 8.1426015175411, "idis_tot": 9114.594263675232, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.003164637028615, "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.425404425407, "ener_tot": 8.140200481262813, "idis_tot": 9114.594263675232, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.003164637028615, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} From 7dcec682e9a19a78ff6f9e25ab073d8fa0390128 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Fri, 26 Jul 2024 11:57:31 +0200 Subject: [PATCH 27/28] Update bestest_hydronic/submit.json for numerical differences. --- testing/references/bestest_hydronic/submit.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/references/bestest_hydronic/submit.json b/testing/references/bestest_hydronic/submit.json index 9fe35b0f0..d6f386f73 100644 --- a/testing/references/bestest_hydronic/submit.json +++ b/testing/references/bestest_hydronic/submit.json @@ -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.4660775413827701, "emis_tot": 1.6291465071977262, "ener_tot": 9.003498461160175, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181736055, "tdis_tot": 18.21778358894349, "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.4660775413827701, "emis_tot": 1.6291463144464133, "ener_tot": 9.003498461160175, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181736055, "tdis_tot": 18.21778358894349, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}} From 2b735b618c670e9af572a8250d2d09e9863bf983 Mon Sep 17 00:00:00 2001 From: Javier Arroyo Date: Thu, 8 Aug 2024 12:36:30 +0200 Subject: [PATCH 28/28] Update for numerical differences. --- testing/references/bestest_hydronic/submit.json | 2 +- testing/references/multizone_residential_hydronic/submit.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/references/bestest_hydronic/submit.json b/testing/references/bestest_hydronic/submit.json index d6f386f73..aff0c3a99 100644 --- a/testing/references/bestest_hydronic/submit.json +++ b/testing/references/bestest_hydronic/submit.json @@ -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.4660775413827701, "emis_tot": 1.6291463144464133, "ener_tot": 9.003498461160175, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.0002551715399085203, "pgas_tot": 0.11798036181736055, "tdis_tot": 18.21778358894349, "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"}]}} diff --git a/testing/references/multizone_residential_hydronic/submit.json b/testing/references/multizone_residential_hydronic/submit.json index 1f52605a8..d23d689b4 100644 --- a/testing/references/multizone_residential_hydronic/submit.json +++ b/testing/references/multizone_residential_hydronic/submit.json @@ -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.425404425407, "ener_tot": 8.140200481262813, "idis_tot": 9114.594263675232, "pdih_tot": null, "pele_tot": 0.0017390231869758262, "pgas_tot": 0.09592720495532533, "tdis_tot": 22.003164637028615, "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"}]}}