Skip to content

Commit 3030601

Browse files
committed
changed: NonLinModel handling of new D0 in MHE
1 parent 20512dd commit 3030601

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/estimator/mhe/execute.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ function predict_mhe!(V̂, X̂0, û0, k, ŷ0, estim::MovingHorizonEstimator, m
751751
nu, nd, nx̂, nŵ, nym = model.nu, model.nd, estim.nx̂, estim.nx̂, estim.nym
752752
nx̃ =+ nx̂
753753
x̂0 = @views Z̃[nx̃-nx̂+1:nx̃]
754-
if estim.direct
754+
if estim.direct # p = 0
755755
ŷ0next = ŷ0
756756
d0 = @views estim.D0[1:nd]
757757
for j=1:Nk
@@ -767,11 +767,11 @@ function predict_mhe!(V̂, X̂0, û0, k, ŷ0, estim::MovingHorizonEstimator, m
767767
V̂[(1 + nym*(j-1)):(nym*j)] .= y0nextm .- ŷ0nextm
768768
x̂0, d0 = x̂0next, d0next
769769
end
770-
else
770+
else # p = 1
771771
for j=1:Nk
772772
y0m = @views estim.Y0m[(1 + nym * (j-1)):(nym*j)]
773-
d0 = @views estim.D0[ (1 + nd * (j-1)):(nd*j)]
774773
u0 = @views estim.U0[ (1 + nu * (j-1)):(nu*j)]
774+
d0 = @views estim.D0[ (1 + nd*j):(nd*(j+1))] # 1st one is d(k-Nk), not used
775775
= @views Z̃[(1 + nx̃ + nŵ*(j-1)):(nx̃ + nŵ*j)]
776776
ĥ!(ŷ0, estim, model, x̂0, d0)
777777
ŷ0m = @views ŷ0[estim.i_ym]

0 commit comments

Comments
 (0)