Skip to content

Commit

Permalink
* Removing outdated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MBaranskiEBC committed Jul 26, 2019
1 parent e11e65c commit 615796f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
14 changes: 7 additions & 7 deletions pyDMPC/ControlFramework/Init.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
19 changes: 1 addition & 18 deletions pyDMPC/ControlFramework/Subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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)
Expand All @@ -228,31 +221,22 @@ 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

else:
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:
Expand All @@ -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 != []:
Expand Down

0 comments on commit 615796f

Please sign in to comment.