def opt_control_minCost(self): # Instantiate optimization problem self.opt_problem = optimization.Optimization(self.mpc, optimization.EnergyCostMin, optimization.JModelica, self.target_variable, constraint_data = self.constraints.data, add_objective = self.slack_var ) print("%%%%%%%%%%%%%%%----Starting Optimization of Control ---%%%%%%%%%%%%%") self.opt_options = {} self.opt_options['blocking_factors'] = [1]*10 self.opt_problem.set_optimization_options(self.opt_options) self.opt_problem.optimize(self.opt_start,self.opt_end, price_data = self.price.data, rho = self.rho.data, addobj = self.addobj.data ) print("----Optimization stats----") print(self.opt_problem.get_optimization_statistics()) print("----Optimization outcome----") self.opt_controlseq = self.opt_problem.Model.control_data # dictionary with mpcpy-timeseries variables of controls store_namespace('opt_control_mincost_'+self.building,self.opt_controlseq)
def opt_control_minDRCost(self): # Instantiate optimization problem self.opt_problem = optimization.Optimization(self.mpc, optimization.DRCostMin, optimization.JModelica, self.target_variable, constraint_data = self.constraints.data, add_objective = self.slack_var ) print("%%%%%%%%%%%%%%%----Starting Optimization of Control ---%%%%%%%%%%%%%") self.opt_options = {} self.opt_options['IPOPT_options']={} self.opt_options['IPOPT_options']['obj_scaling_factor'] = 100 self.opt_options['n_cp'] = 1 self.opt_problem.set_optimization_options(self.opt_options) self.opt_problem.optimize(self.opt_start,self.opt_end, price_data = self.price.data, ref_profile = self.ref_profile.data, flex_cost = self.flex_cost.data, rho = self.rho.data, addobj = self.addobj.data ) print("----Optimization stats----") print(self.opt_problem.get_optimization_statistics()) print("----Optimization outcome----") self.opt_controlseq = self.opt_problem.Model.control_data # dictionary with mpcpy-timeseries variables of controls store_namespace('opt_control_DRcost_'+self.building,self.opt_controlseq)
def opt_control_minEnergy(self): # Instantiate optimization problem self.opt_problem = optimization.Optimization(self.mpc, optimization.EnergyMin, optimization.JModelica, self.target_variable, constraint_data = self.constraints.data ) self.opt_options = {} self.opt_options['blocking_factors'] = [1]*10 self.opt_problem.set_optimization_options(self.opt_options) #self.opt_problem print("%%%%%%%%%%%%%%%----Starting Optimization of Control ---%%%%%%%%%%%%%") self.opt_problem.optimize(self.opt_start,self.opt_end,res_control_step=self.meas_sampl) print("----Optimization stats----") print(self.opt_problem.get_optimization_statistics()) print("----Optimization outcome----") self.opt_controlseq = self.opt_problem.Model.control_data # dictionary with mpcpy-timeseries variables of controls print(self.opt_controlseq) store_namespace('opt_control_minenergy_'+self.building,self.opt_controlseq)