Skip to content

Commit 69aa822

Browse files
committed
Merge branch 'main' into Ipopt_VectorNonlinearOracle
2 parents 4a29183 + 5fde281 commit 69aa822

File tree

3 files changed

+12
-34
lines changed

3 files changed

+12
-34
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelPredictiveControl"
22
uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c"
33
authors = ["Francis Gagnon"]
4-
version = "1.11.0"
4+
version = "1.11.1"
55

66
[deps]
77
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"

src/model/linmodel.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,15 @@ LinModel with a sample time Ts = 0.1 s:
135135
state-space representation.
136136
137137
It is assumed that ``\mathbf{D_u=0}`` (or `sys` is strictly proper) since otherwise the
138-
resulting discrete controller is acausal by definition. Indeed, all discrete controllers
139-
(1) sample an output ``\mathbf{y}(k)`` from the plant, (2) computes an action
140-
``\mathbf{u}(k)`` and (3) apply the action on the plant. There is a causality paradox
141-
if ``\mathbf{u}(k)`` impacts ``\mathbf{y}(k)`` even before computing it.
138+
resulting discrete controller would be acausal in its implementation (≠ mathematical
139+
causality). Indeed, at each sampling instant `k`, the predictive controller will:
140+
141+
1. sample an output ``\mathbf{y}(k)`` from the plant
142+
2. computes an action ``\mathbf{u}(k)`` and
143+
3. apply the action on the plant.
144+
145+
There is a causality paradox if ``\mathbf{u}(k)`` impacts ``\mathbf{y}(k)`` even before
146+
computing it.
142147
"""
143148
function LinModel(
144149
sys::StateSpace{E, NT},

src/precompile.jl

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,14 @@ mpc_im.estim()
1313
u = mpc_im([55, 30])
1414
sim!(mpc_im, 2)
1515

16-
mpc_kf = setconstraint!(LinMPC(KalmanFilter(model)), ymin=[45, -Inf])
16+
transcription = MultipleShooting()
17+
mpc_kf = setconstraint!(LinMPC(KalmanFilter(model); transcription), ymin=[45, -Inf])
1718
initstate!(mpc_kf, model.uop, model())
1819
preparestate!(mpc_kf, [55, 30])
1920
mpc_kf.estim()
2021
u = mpc_kf([55, 30])
2122
sim!(mpc_kf, 2, [55, 30])
2223

23-
transcription = MultipleShooting()
24-
mpc_lo = setconstraint!(LinMPC(Luenberger(model); transcription), ymin=[45, -Inf])
25-
initstate!(mpc_lo, model.uop, model())
26-
preparestate!(mpc_lo, [55, 30])
27-
mpc_lo.estim()
28-
u = mpc_lo([55, 30])
29-
sim!(mpc_lo, 2, [55, 30])
30-
31-
mpc_ukf = setconstraint!(LinMPC(UnscentedKalmanFilter(model)), ymin=[45, -Inf])
32-
initstate!(mpc_ukf, model.uop, model())
33-
preparestate!(mpc_ukf, [55, 30])
34-
mpc_ukf.estim()
35-
u = mpc_ukf([55, 3])
36-
sim!(mpc_ukf, 2, [55, 30])
37-
38-
mpc_ekf = setconstraint!(LinMPC(ExtendedKalmanFilter(model)), ymin=[45, -Inf])
39-
initstate!(mpc_ekf, model.uop, model())
40-
preparestate!(mpc_ekf, [55, 30])
41-
mpc_ekf.estim()
42-
u = mpc_ekf([55, 30])
43-
sim!(mpc_ekf, 2, [55, 30])
44-
4524
mpc_skf = setconstraint!(LinMPC(SteadyKalmanFilter(model)), ymin=[45, -Inf])
4625
initstate!(mpc_skf, model.uop, model())
4726
preparestate!(mpc_skf, [55, 30])
@@ -98,12 +77,6 @@ nlmodel = setop!(
9877
uop=[10, 10], yop=[50, 30]
9978
)
10079
y = nlmodel()
101-
nmpc_im = setconstraint!(NonLinMPC(InternalModel(nlmodel), Hp=10, Cwt=Inf), ymin=[45, -Inf])
102-
initstate!(nmpc_im, nlmodel.uop, y)
103-
preparestate!(nmpc_im, [55, 30])
104-
nmpc_im.estim()
105-
u = nmpc_im([55, 30])
106-
sim!(nmpc_im, 2, [55, 30])
10780

10881
transcription = MultipleShooting(f_threads=true)
10982
nmpc_ukf = setconstraint!(NonLinMPC(

0 commit comments

Comments
 (0)