Skip to content

Commit

Permalink
Fix - Updated optimization tests to improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
davidusb-geek committed Jan 3, 2024
1 parent 2faa8dc commit a230614
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/test_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,47 @@ def test_perform_dayahead_forecast_optim(self):
self.assertTrue(table.columns[1]=='Cost Totals')
# Check status
self.assertTrue('optim_status' in self.opt_res_dayahead.columns)
# Test treat_def_as_semi_cont and set_def_constant constraints
self.optim_conf.update({'treat_def_as_semi_cont': [True, True]})
self.optim_conf.update({'set_def_constant': [True, True]})
self.opt = optimization(self.retrieve_hass_conf, self.optim_conf, self.plant_conf,
self.fcst.var_load_cost, self.fcst.var_prod_price,
self.costfun, root, logger)
self.opt_res_dayahead = self.opt.perform_dayahead_forecast_optim(
self.df_input_data_dayahead, self.P_PV_forecast, self.P_load_forecast)
self.assertTrue(self.opt.optim_status == 'Optimal')
self.optim_conf.update({'treat_def_as_semi_cont': [False, True]})
self.optim_conf.update({'set_def_constant': [True, True]})
self.opt = optimization(self.retrieve_hass_conf, self.optim_conf, self.plant_conf,
self.fcst.var_load_cost, self.fcst.var_prod_price,
self.costfun, root, logger)
self.opt_res_dayahead = self.opt.perform_dayahead_forecast_optim(
self.df_input_data_dayahead, self.P_PV_forecast, self.P_load_forecast)
self.assertTrue(self.opt.optim_status == 'Optimal')
self.optim_conf.update({'treat_def_as_semi_cont': [False, True]})
self.optim_conf.update({'set_def_constant': [False, True]})
self.opt = optimization(self.retrieve_hass_conf, self.optim_conf, self.plant_conf,
self.fcst.var_load_cost, self.fcst.var_prod_price,
self.costfun, root, logger)
self.opt_res_dayahead = self.opt.perform_dayahead_forecast_optim(
self.df_input_data_dayahead, self.P_PV_forecast, self.P_load_forecast)
self.assertTrue(self.opt.optim_status == 'Optimal')
self.optim_conf.update({'treat_def_as_semi_cont': [False, False]})
self.optim_conf.update({'set_def_constant': [False, True]})
self.opt = optimization(self.retrieve_hass_conf, self.optim_conf, self.plant_conf,
self.fcst.var_load_cost, self.fcst.var_prod_price,
self.costfun, root, logger)
self.opt_res_dayahead = self.opt.perform_dayahead_forecast_optim(
self.df_input_data_dayahead, self.P_PV_forecast, self.P_load_forecast)
self.assertTrue(self.opt.optim_status == 'Optimal')
self.optim_conf.update({'treat_def_as_semi_cont': [False, False]})
self.optim_conf.update({'set_def_constant': [False, False]})
self.opt = optimization(self.retrieve_hass_conf, self.optim_conf, self.plant_conf,
self.fcst.var_load_cost, self.fcst.var_prod_price,
self.costfun, root, logger)
self.opt_res_dayahead = self.opt.perform_dayahead_forecast_optim(
self.df_input_data_dayahead, self.P_PV_forecast, self.P_load_forecast)
self.assertTrue(self.opt.optim_status == 'Optimal')

def test_perform_dayahead_forecast_optim_costfun_selfconso(self):
costfun = 'self-consumption'
Expand Down

0 comments on commit a230614

Please sign in to comment.