Skip to content

Commit 1cb38ee

Browse files
committed
debug test LinModel construction with delays
1 parent 71a9849 commit 1cb38ee

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

docs/src/manual/linmpc.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,23 @@ incorporate feedforward compensation in the controller. The new plant model is:
192192
\end{bmatrix}
193193
```
194194

195-
We construct a new [`LinModel`](@ref) that includes the measured disturbance
195+
We need to construct a new [`LinModel`](@ref) that includes the measured disturbance
196196
``\mathbf{d} = [u_l]`` and the operating point ``\mathbf{d_{op}} = [10]``:
197197

198198
```@example 1
199199
sys_ff = [sys sys[1:2, 2]]
200200
model_ff = setop!(LinModel(sys_ff, Ts, i_d=[3]), uop=[10, 10], yop=[50, 30], dop=[10])
201+
```
202+
203+
A [`LinMPC`](@ref) controller is constructed on this model:
204+
205+
```@example 1
201206
mpc_ff = LinMPC(model_ff, Hp=15, Hc=2, Mwt=[1, 1], Nwt=[0.1, 0.1])
202207
mpc_ff = setconstraint!(mpc_ff, ymin=[45, -Inf])
203208
```
204209

205-
Also, a new test function that feeds the measured disturbance ``\mathbf{d}`` to the
206-
controller is defined:
210+
A new test function that feeds the measured disturbance ``\mathbf{d}`` to the controller is
211+
also required:
207212

208213
```@example 1
209214
function test_mpc_ff(mpc_ff, model)

test/test_sim_model.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ Gss2 = c2d(sys_ss[:,1:2], 0.5Ts, :zoh)
5656
@test linmodel5.dop [20]
5757

5858
linmodel6 = LinModel([delay(4) delay(4)]*sys,Ts,i_d=[3])
59-
@test linmodel6.nx == 6
60-
@test sum(eigvals(linmodel6.A) .≈ 0) == 2
59+
@test linmodel6.nx == 3
60+
@test sum(eigvals(linmodel6.A) .≈ 0) == 1
6161

6262
linmodel7 = LinModel(
6363
ss(diagm( .1: .1: .3), I(3), diagm( .4: .1: .6), 0, 1.0),

0 commit comments

Comments
 (0)