Skip to content

Commit 24a5afc

Browse files
committed
wip: debug MHE with nint_u option
1 parent 9de2b15 commit 24a5afc

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/estimator/mhe/construct.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ function get_optim_functions(
13641364
end
13651365
function Jfunc(Z̃arg::Vararg{T, N}) where {N, T<:Real}
13661366
update_objective!(J, ∇J, Z̃_∇J, Z̃arg)
1367+
@show J
13671368
return J[]::T
13681369
end
13691370
∇Jfunc! = function (∇Jarg::AbstractVector{T}, Z̃arg::Vararg{T, N}) where {N, T<:Real}

src/estimator/mhe/execute.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ function optim_objective!(estim::MovingHorizonEstimator{NT}) where NT<:Real
398398
isfinite(J_0) || (Z̃s = [ϵ_0; estim.x̂0arr_old; zeros(NT, nŵ*estim.He)])
399399
JuMP.set_start_value.(Z̃var, Z̃s)
400400
# ------- solve optimization problem --------------
401+
println("optimizing!")
401402
try
402403
JuMP.optimize!(optim)
403404
catch err
@@ -434,9 +435,11 @@ function optim_objective!(estim::MovingHorizonEstimator{NT}) where NT<:Real
434435
end
435436
# --------- update estimate -----------------------
436437
estim.Ŵ[1:nŵ*Nk] .= @views estim.Z̃[nx̃+1:nx̃+nŵ*Nk] # update Ŵ with optimum for warm-start
438+
println("solved, needs to call predict! one more time.")
437439
V̂, X̂0 = predict!(V̂, X̂0, û0, k0, ŷ0, estim, model, estim.Z̃)
438440
x̂0next = @views X̂0[end-nx̂+1:end]
439441
estim.x̂0 .= x̂0next
442+
@show estim.Ŵ[1:nŵ*Nk]
440443
return estim.
441444
end
442445

@@ -597,6 +600,10 @@ function predict!(V̂, X̂0, û0, k0, ŷ0, estim::MovingHorizonEstimator, mode
597600
x̂0 = x̂0next
598601
end
599602
end
603+
if eltype(X̂0) == Float64
604+
@show X̂0
605+
@show
606+
end
600607
return V̂, X̂0
601608
end
602609

0 commit comments

Comments
 (0)