Skip to content

Commit 1e6f2ab

Browse files
committed
debug : copy xhatd vector before computing the predictions
1 parent 37a3b10 commit 1e6f2ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/controller/nonlinmpc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ end
296296

297297
function evalŶ(mpc, model, x̂d, d0, D̂0, U0::Vector{T}) where {T}
298298
Ŷd0 = Vector{T}(undef, model.ny*mpc.Hp)
299-
x̂d::Vector{T} = x̂d
299+
x̂d::Vector{T} = copy(x̂d)
300300
for j=1:mpc.Hp
301301
u0 = U0[(1 + model.nu*(j-1)):(model.nu*j)]
302302
x̂d[:] = model.f(x̂d, u0, d0)
303303
d0 = D̂0[(1 + model.nd*(j-1)):(model.nd*j)]
304304
Ŷd0[(1 + model.ny*(j-1)):(model.ny*j)] = model.h(x̂d, d0)
305305
end
306-
return Ŷd0 + mpc.F
306+
return Ŷd0 + mpc.F # mpc.F = Yop + Ŷs
307307
end
308308

309309
"""

0 commit comments

Comments
 (0)