ibpsa / project1-boptest

Building Optimization Performance Tests
Other
101 stars 66 forks source link

Problems with example from readme #631

Closed JanMarcoRuizdeVargas closed 4 months ago

JanMarcoRuizdeVargas commented 4 months ago

Hi, when I run the example from the readme (with localhost and I removed testcase argument) I get the following error:

ReferenceError Traceback (most recent call last) Cell In[5], line 8 5 url = 'http://127.0.0.1:5000/' 7 # Decide the state-action space of your test case ----> 8 env = BoptestGymEnv( 9 url = url, 10 # testcase = 'bestest_hydronic_heat_pump', 11 actions = ['oveHeaPumY_u'], 12 observations = {'time':(0,604800), 13 'reaTZon_y':(280.,310.), 14 'TDryBul':(265,303), 15 'HDirNor':(0,862), 16 'InternalGainsRad[1]':(0,219), 17 'PriceElectricPowerHighlyDynamic':(-0.4,0.4), 18 'LowerSetp[1]':(280.,310.), 19 'UpperSetp[1]':(280.,310.)}, 20 predictive_period = 243600, 21 regressive_period = 63600, 22 random_start_time = True, 23 max_episode_length = 243600, 24 warmup_period = 243600, 25 step_period = 3600) 27 # Normalize observations and discretize action space 28 env = NormalizedObservationWrapper(env)

File ~/code_development/boptest_playground/project1-boptest-gym/boptestGymEnv.py:191, in BoptestGymEnv.init(self, url, actions, observations, reward, max_episode_length, random_start_time, excluding_periods, regressive_period, predictive_period, start_time, warmup_period, scenario, step_period, render_episodes, log_dir) 189 for obs in self.observations: 190 if not (obs=='time' or obs in self.all_measurement_vars.keys() or obs in self.all_predictive_vars.keys()): --> 191 raise ReferenceError(\ 192 '"{0}" does not belong to neither the set of '\ 193 'test case measurements nor to the set of '\ 194 'forecasted variables. \n'\ 195 'Set of measurements: \n{1}\n'\ 196 'Set of forecasting variables: \n{2}'.format(obs, 197 list(self.all_measurement_vars.keys()), 198 list(self.all_predictive_vars.keys()) )) 200 # observations = measurements + predictions 201 self.measurement_vars = [obs for obs in self.observations if (obs in self.all_measurement_vars)]

ReferenceError: "reaTZon_y" does not belong to neither the set of test case measurements nor to the set of forecasted variables. Set of measurements: ['fcu_reaFloSup_y', 'fcu_reaPCoo_y', 'fcu_reaPFan_y', 'fcu_reaPHea_y', 'zon_reaCO2RooAir_y', 'zon_reaPLig_y', 'zon_reaPPlu_y', 'zon_reaTRooAir_y', 'zon_weaSta_reaWeaCeiHei_y', 'zon_weaSta_reaWeaCloTim_y', 'zon_weaSta_reaWeaHDifHor_y', 'zon_weaSta_reaWeaHDirNor_y', 'zon_weaSta_reaWeaHGloHor_y', 'zon_weaSta_reaWeaHHorIR_y', 'zon_weaSta_reaWeaLat_y', 'zon_weaSta_reaWeaLon_y', 'zon_weaSta_reaWeaNOpa_y', 'zon_weaSta_reaWeaNTot_y', 'zon_weaSta_reaWeaPAtm_y', 'zon_weaSta_reaWeaRelHum_y', 'zon_weaSta_reaWeaSolAlt_y', 'zon_weaSta_reaWeaSolDec_y', 'zon_weaSta_reaWeaSolHouAng_y', 'zon_weaSta_reaWeaSolTim_y', 'zon_weaSta_reaWeaSolZen_y', 'zon_weaSta_reaWeaTBlaSky_y', 'zon_weaSta_reaWeaTDewPoi_y', 'zon_weaSta_reaWeaTDryBul_y', 'zon_weaSta_reaWeaTWetBul_y', 'zon_weaSta_reaWeaWinDir_y', 'zon_weaSta_reaWeaWinSpe_y'] Set of forecasting variables: ['EmissionsElectricPower', 'EmissionsGasPower', 'HDifHor', 'HDirNor', 'HGloHor', 'HHorIR', 'InternalGainsCon[1]', 'InternalGainsLat[1]', 'InternalGainsRad[1]', 'LowerSetp[1]', 'Occupancy[1]', 'PriceElectricPowerConstant', 'PriceElectricPowerDynamic', 'PriceElectricPowerHighlyDynamic', 'PriceGasPower', 'TBlaSky', 'TDewPoi', 'TDryBul', 'TWetBul', 'UpperCO2[1]', 'UpperSetp[1]', 'ceiHei', 'cloTim', 'lat', 'lon', 'nOpa', 'nTot', 'pAtm', 'relHum', 'solAlt', 'solDec', 'solHouAng', 'solTim', 'solZen', 'winDir', 'winSpe']

When I replace reaTZon_y with fcu_reaFloSup_y, I get another error


ReferenceError Traceback (most recent call last) Cell In[5], line 8 5 url = 'http://127.0.0.1:5000/' 7 # Decide the state-action space of your test case ----> 8 env = BoptestGymEnv( 9 url = url, 10 # testcase = 'bestest_hydronic_heat_pump', 11 actions = ['oveHeaPumY_u'], 12 observations = {'time':(0,604800), 13 'reaTZon_y':(280.,310.), 14 'TDryBul':(265,303), 15 'HDirNor':(0,862), 16 'InternalGainsRad[1]':(0,219), 17 'PriceElectricPowerHighlyDynamic':(-0.4,0.4), 18 'LowerSetp[1]':(280.,310.), 19 'UpperSetp[1]':(280.,310.)}, 20 predictive_period = 243600, 21 regressive_period = 63600, 22 random_start_time = True, 23 max_episode_length = 243600, 24 warmup_period = 243600, 25 step_period = 3600) 27 # Normalize observations and discretize action space 28 env = NormalizedObservationWrapper(env)

File ~/code_development/boptest_playground/project1-boptest-gym/boptestGymEnv.py:191, in BoptestGymEnv.init(self, url, actions, observations, reward, max_episode_length, random_start_time, excluding_periods, regressive_period, predictive_period, start_time, warmup_period, scenario, step_period, render_episodes, log_dir) 189 for obs in self.observations: 190 if not (obs=='time' or obs in self.all_measurement_vars.keys() or obs in self.all_predictive_vars.keys()): --> 191 raise ReferenceError(\ 192 '"{0}" does not belong to neither the set of '\ 193 'test case measurements nor to the set of '\ 194 'forecasted variables. \n'\ 195 'Set of measurements: \n{1}\n'\ 196 'Set of forecasting variables: \n{2}'.format(obs, 197 list(self.all_measurement_vars.keys()), 198 list(self.all_predictive_vars.keys()) )) 200 # observations = measurements + predictions 201 self.measurement_vars = [obs for obs in self.observations if (obs in self.all_measurement_vars)]

ReferenceError: "reaTZon_y" does not belong to neither the set of test case measurements nor to the set of forecasted variables. Set of measurements: ['fcu_reaFloSup_y', 'fcu_reaPCoo_y', 'fcu_reaPFan_y', 'fcu_reaPHea_y', 'zon_reaCO2RooAir_y', 'zon_reaPLig_y', 'zon_reaPPlu_y', 'zon_reaTRooAir_y', 'zon_weaSta_reaWeaCeiHei_y', 'zon_weaSta_reaWeaCloTim_y', 'zon_weaSta_reaWeaHDifHor_y', 'zon_weaSta_reaWeaHDirNor_y', 'zon_weaSta_reaWeaHGloHor_y', 'zon_weaSta_reaWeaHHorIR_y', 'zon_weaSta_reaWeaLat_y', 'zon_weaSta_reaWeaLon_y', 'zon_weaSta_reaWeaNOpa_y', 'zon_weaSta_reaWeaNTot_y', 'zon_weaSta_reaWeaPAtm_y', 'zon_weaSta_reaWeaRelHum_y', 'zon_weaSta_reaWeaSolAlt_y', 'zon_weaSta_reaWeaSolDec_y', 'zon_weaSta_reaWeaSolHouAng_y', 'zon_weaSta_reaWeaSolTim_y', 'zon_weaSta_reaWeaSolZen_y', 'zon_weaSta_reaWeaTBlaSky_y', 'zon_weaSta_reaWeaTDewPoi_y', 'zon_weaSta_reaWeaTDryBul_y', 'zon_weaSta_reaWeaTWetBul_y', 'zon_weaSta_reaWeaWinDir_y', 'zon_weaSta_reaWeaWinSpe_y'] Set of forecasting variables: ['EmissionsElectricPower', 'EmissionsGasPower', 'HDifHor', 'HDirNor', 'HGloHor', 'HHorIR', 'InternalGainsCon[1]', 'InternalGainsLat[1]', 'InternalGainsRad[1]', 'LowerSetp[1]', 'Occupancy[1]', 'PriceElectricPowerConstant', 'PriceElectricPowerDynamic', 'PriceElectricPowerHighlyDynamic', 'PriceGasPower', 'TBlaSky', 'TDewPoi', 'TDryBul', 'TWetBul', 'UpperCO2[1]', 'UpperSetp[1]', 'ceiHei', 'cloTim', 'lat', 'lon', 'nOpa', 'nTot', 'pAtm', 'relHum', 'solAlt', 'solDec', 'solHouAng', 'solTim', 'solZen', 'winDir', 'winSpe']

ReferenceError Traceback (most recent call last) Cell In[8], line 8 5 url = 'http://127.0.0.1:5000/' 7 # Decide the state-action space of your test case ----> 8 env = BoptestGymEnv( 9 url = url, 10 # testcase = 'bestest_hydronic_heat_pump', 11 actions = ['oveHeaPumY_u'], 12 observations = {'time':(0,604800), 13 'fcu_reaFloSup_y':(280.,310.), 14 'TDryBul':(265,303), 15 'HDirNor':(0,862), 16 'InternalGainsRad[1]':(0,219), 17 'PriceElectricPowerHighlyDynamic':(-0.4,0.4), 18 'LowerSetp[1]':(280.,310.), 19 'UpperSetp[1]':(280.,310.)}, 20 predictive_period = 243600, 21 regressive_period = 63600, 22 random_start_time = True, 23 max_episode_length = 243600, 24 warmup_period = 243600, 25 step_period = 3600) 27 # Normalize observations and discretize action space 28 env = NormalizedObservationWrapper(env)

File ~/code_development/boptest_playground/project1-boptest-gym/boptestGymEnv.py:295, in BoptestGymEnv.init(self, url, actions, observations, reward, max_episode_length, random_start_time, excluding_periods, regressive_period, predictive_period, start_time, warmup_period, scenario, step_period, render_episodes, log_dir) 293 for act in self.actions: 294 if not (act in self.all_input_vars.keys()): --> 295 raise ReferenceError(\ 296 '"{0}" does not belong to the set of inputs to this '\ 297 'emulator model. \n'\ 298 'Set of inputs: \n{1}\n'.format(act, list(self.all_input_vars.keys()) )) 300 # Parse minimum and maximum values for actions 301 self.lower_act_bounds = []

ReferenceError: "oveHeaPumY_u" does not belong to the set of inputs to this emulator model. Set of inputs: ['con_oveTSetCoo_activate', 'con_oveTSetCoo_u', 'con_oveTSetHea_activate', 'con_oveTSetHea_u', 'fcu_oveFan_activate', 'fcu_oveFan_u', 'fcu_oveTSup_activate', 'fcu_oveTSup_u']

When I replace oveHeaPumY_u with con_oveTSetHea_u, it works.

Not sure if I did something wrong or the codebase changed and the example needs to be updated.

dhblum commented 4 months ago

This seems to be an issue related to use of boptest-gym, the code for which I don't know as well. Maybe @javiarrobas can help.

But my suspicion is that you are deploying the bestest_air test case (since you say you deploy without specification of the TESTCASE variable and by default bestest_air is set), but your boptest-gym instance is expecting that you deployed the bestest_hydronic_heat_pump test case. So there's a read/write/forecast point naming mismatch.

JanMarcoRuizdeVargas commented 4 months ago

You are exactly right, that was a silly mistake from my side. Thanks for the help!

dhblum commented 4 months ago

Great, glad we found the issue.