Skip to content

Commit

Permalink
* Add individual prediction horizons for each subsystem, #33.
Browse files Browse the repository at this point in the history
  • Loading branch information
MBaranskiEBC committed May 17, 2019
1 parent f2421b3 commit 9847bbc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pyDMPC/ControlFramework/Init.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
T_set = []
Q_set = []
variation = []
pred_hor = []

""" Subsystems """
#Ground_long
Expand All @@ -142,6 +143,7 @@
T_set.append(285)
Q_set.append(2200)
variation.append(False)
pred_hor.append(3*365*24*86400.0)

## Ground_short
#name.append('Field_short')
Expand Down Expand Up @@ -177,4 +179,5 @@
cost_par.append("decisionVariables.y[1]")
T_set.append(295)
Q_set.append(0)
variation.append(True)
variation.append(True)
pred_hor.append(5*3600)
4 changes: 2 additions & 2 deletions pyDMPC/ControlFramework/Objective_Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def Obj(values_DVs, BC, s):
simStat = dymola.simulateExtendedModel(
problem=s._model_path,
startTime=Init.start_time,
stopTime=Init.stop_time,
stopTime=s.stop_time,
outputInterval=Init.incr,
method="Dassl",
tolerance=Init.tol,
Expand All @@ -132,7 +132,7 @@ def Obj(values_DVs, BC, s):
simStat = dymola.simulateExtendedModel(
problem=s._model_path,
startTime=Init.start_time,
stopTime=Init.stop_time,
stopTime=s.stop_time,
outputInterval=Init.incr,
method="Dassl",
tolerance=Init.tol,
Expand Down
3 changes: 2 additions & 1 deletion pyDMPC/ControlFramework/Subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, name, position,
bounds_DVs,model_path, names_BCs,
num_VarsOut, names_DVs,
output_vars, initial_names, IDs_initial_values,IDs_inputs,cost_par,
T_set,Q_set,variation, type_subSyst=None):
T_set,Q_set,variation,pred_hor,type_subSyst=None):
self._name = name
self._type_subSyst = type_subSyst
self._num_DVs = num_DVs
Expand All @@ -42,6 +42,7 @@ def __init__(self, name, position,
self.T_set = T_set
self.Q_set = Q_set
self.variation = variation
self.pred_hor = pred_hor


def GetNeighbour(self, neighbour_name):
Expand Down
1 change: 1 addition & 0 deletions pyDMPC/ControlFramework/System.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def GenerateSubSys(self):
Init.T_set[i],
Init.Q_set[i],
Init.variation[i],
Init.pred_hor[i],
Init.type_subSyst[i])
)
subsystems.sort(key = lambda x: x.position)
Expand Down

0 comments on commit 9847bbc

Please sign in to comment.