From 615796fc7988522da3755c775f4f40f8d734c065 Mon Sep 17 00:00:00 2001 From: MBaranskiEBC Date: Fri, 26 Jul 2019 09:28:31 +0200 Subject: [PATCH] * Removing outdated comments --- pyDMPC/ControlFramework/Init.py | 14 +++++++------- pyDMPC/ControlFramework/Subsystem.py | 19 +------------------ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/pyDMPC/ControlFramework/Init.py b/pyDMPC/ControlFramework/Init.py index 450dc72..8d565c6 100644 --- a/pyDMPC/ControlFramework/Init.py +++ b/pyDMPC/ControlFramework/Init.py @@ -1,8 +1,8 @@ # Global paths -glob_lib_paths = [r'C:\Git\pyDMPC\pyDMPC\ModelicaModels\ModelicaModels', - r'C:\Git\modelica-buildings\Buildings', - r'C:\Git\AixLib\AixLib'] -glob_res_path = r'C:\TEMP\Dymola' +glob_lib_paths = [r'D:\Git\pyDMPC\pyDMPC\ModelicaModels\ModelicaModels', + r'D:\Git\modelica-buildings\Buildings', + r'D:\Git\AixLib-master\AixLib'] +glob_res_path = r'D:\dymola' glob_dym_path = r'C:\Program Files\Dymola 2018 FD01\Modelica\Library\python_interface\dymola.egg' # Working directory @@ -14,7 +14,7 @@ contr_sys_typ = "Modelica" ads_id = '5.59.199.202.1.1' ads_port = 851 -name_fmu = 'pyDMPCFMU_AHU.fmu' +name_fmu = r'ModelicaModels_ControlledSystems_ControlledSystemBoundaries.fmu' orig_fmu_path = glob_res_path + '\\' + name_fmu dest_fmu_path = glob_res_path + '\\' + name_wkdir + '\\' + name_fmu time_incr = 120 @@ -84,7 +84,7 @@ lib_paths.append(glob_lib_paths) res_path.append(glob_res_path + "\\" + name_wkdir) dym_path.append(glob_dym_path) -mod_path.append(r'C:\TEMP\Dymola\heater') +mod_path.append(r'D:\dymola\heater') command_names.append(["valveHeater"]) command_variables.append(["decisionVariables.table[1,2]"]) commands.append(range(0,105,5)) @@ -113,7 +113,7 @@ lib_paths.append(glob_lib_paths) res_path.append(glob_res_path + "\\" + name_wkdir) dym_path.append(glob_dym_path) -mod_path.append(r'C:\TEMP\Dymola\cooler') +mod_path.append(r'D:\dymola\cooler') command_names.append(["valveCooler"]) command_variables.append(["decisionVariables.table[1,2]"]) commands.append(range(0,105,5)) diff --git a/pyDMPC/ControlFramework/Subsystem.py b/pyDMPC/ControlFramework/Subsystem.py index b9c3f83..0b955df 100644 --- a/pyDMPC/ControlFramework/Subsystem.py +++ b/pyDMPC/ControlFramework/Subsystem.py @@ -183,10 +183,6 @@ def interp_minimize(self, interp): results = self.predict(inp, [com]) outputs.append(results) costs.append(self.calc_cost(com, results[-1][-1])) - #print(f"{self.name}: {results[-1][-1]} - {costs[-1]}") - #print(f"{self.name}: {self.cost_rec}") - #print(f"Results: {results[-1][-1]}") - #print(f"Costs: {costs[-1]}") min_ind = costs.index(min(costs)) @@ -204,9 +200,6 @@ def interp_minimize(self, interp): for pts in self.traj_points: traj_costs.append((pts - set_point)**2) - #print("set_point: " + str(set_point)) - #print("traj_costs: " + str(traj_costs)) - self.traj_points.insert(self.traj_points[0] - 1.) traj_costs.insert(traj_costs[0] * 5) self.traj_points.append(self.traj_points[-1] + 1) @@ -228,13 +221,11 @@ def interp_minimize(self, interp): if len(inputs) >= 2: if interp: - #self.coup_vars_send = it.interp1d(inputs, opt_outputs, - # fill_value = "extrapolate") + self.coup_vars_send = opt_outputs self.command_send = it.interp1d(inputs, opt_command, fill_value = (100,100), bounds_error = False) else: - #print("self.coup_vars_send: " + str(self.coup_vars_send)) self.coup_vars_send = opt_outputs self.command_send = opt_command @@ -242,17 +233,10 @@ def interp_minimize(self, interp): self.coup_vars_send = opt_outputs[0] self.command_send = opt_command[0] - #print(f"{self.name}: {self.command_send}") - #time.sleep(2) - #print(f"Cost: {self.cost_send}") - def calc_cost(self, command, outputs): import scipy.interpolate cost = self.cost_fac[0] * command - #print(f"Cost after the 1st step: {cost}") - - #print(f"Received cost: {self.cost_rec}") if self.cost_rec != [] and self.cost_rec != [[]]: for c in self.cost_rec: @@ -263,7 +247,6 @@ def calc_cost(self, command, outputs): cost += self.cost_fac[1] * c[0] else: cost += self.cost_fac[1] * c - #print(f"Cost after the 2nd step: {cost}") if self.model.states.set_points != []: