Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/manual/mtk.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function generate_f_h_mtk(model, inputs, outputs, disturbances=nothing)
f_ip_with_d(ẋ, x, u, p, nothing, d)
catch err
if err isa MethodError
error("NonLinModel does not support a time argument t in the f "*
error("NonLinModel(DAE) does not support a time argument t in the f "*
"function, see the constructor docstring for a workaround.")
else
rethrow()
Expand All @@ -68,7 +68,7 @@ function generate_f_h_mtk(model, inputs, outputs, disturbances=nothing)
h_ip_with_d(y, x, u_nothing, p, nothing, d)
catch err
if err isa MethodError
error("NonLinModel only support strictly proper systems (no "*
error("This package only support strictly proper systems (no "*
"manipulated input argument u in the output function h)")
else
rethrow()
Expand Down
17 changes: 11 additions & 6 deletions src/estimator/mhe/execute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ following fields:
- `:ε` or *`:epsilon`* : optimal slack variable, ``ε``
- `:X̂` or *`:Xhat`* : optimal estimated states over ``N_k``, ``\mathbf{X̂}``
- `:x̂` or *`:xhat`* : optimal estimated state, ``\mathbf{x̂}_k(k+p)``
- `:Â` or *`:Ahat`* : optimal estimated algebraic variables over ``N_k``, ``\mathbf{Â}``
- `:Â` or *`:Ahat`* : optimal estimated algebraic variables over ``N_k`` (left limits), ``\mathbf{Â}``
- `:â` or *`:ahat`* : optimal estimated algebraic variable (left limit), ``\mathbf{â}(k+p)``
- `:V̂` or *`:Vhat`* : optimal estimated sensor noise over ``N_k``, ``\mathbf{V̂}``
- `:P̄` or *`:Pbar`* : estimation error covariance at arrival, ``\mathbf{P̄}``
- `:x̄` or *`:xbar`* : optimal estimation error at arrival, ``\mathbf{x̄}``
Expand All @@ -113,8 +114,8 @@ following fields:
- `:D` : measured disturbances over ``N_k+1``, ``\mathbf{D}``
- `:sol` : solution summary of the optimizer for printing

For [`NonLinModel`](@ref) or under custom nonlinear inequality constraints (`nc>0`), it also
includes the following fields:
For non-[`LinModel`](@ref) or under custom nonlinear inequality constraints (`nc>0`), it
also includes the following fields:

- `:∇J` or *`:nablaJ`* : optimal gradient of the objective function, ``\mathbf{\nabla} J``
- `:∇²J` or *`:nabla2J`* : optimal Hessian of the objective function, ``\mathbf{\nabla^2}J``
Expand Down Expand Up @@ -176,18 +177,20 @@ function getinfo(estim::MovingHorizonEstimator{NT}) where NT<:Real
end
D[end-nd+1:end] .+= model.dop
x̂arr .+= estim.x̂op
Â, âarr = Â0, â0arr # no operating points on the algebraic variable
info[:Ŵ] = Ŵ[1:nŵ*Nk]
info[:ε] = getslack(estim, Z̃)
info[:X̂] = X̂[1:nx̂*Nk]
info[:Â] = Â0[1:na*Nk]
info[:x̂] = estim.x̂0 .+ estim.x̂op
info[:x̂] = X̂[(1+nx̂*Nk-nx̂):(nx̂*Nk)]
info[:Â] = Â[1:na*Nk]
info[:â] = Â[(1+na*Nk-na):(na*Nk)]
info[:V̂] = V̂[1:nym*Nk]
info[:P̄] = estim.P̂arr_old
info[:x̄] = x̄
info[:Ŷ] = Ŷ[1:ny*Nk]
info[:Ŷm] = Ŷ[vec(estim.i_ym .+ ny.*(0:Nk-1)')]
info[:x̂arr] = x̂arr
info[:âarr] = â0arr
info[:âarr] = âarr
info[:J] = J
info[:Ym] = Ym
info[:U] = U
Expand All @@ -199,7 +202,9 @@ function getinfo(estim::MovingHorizonEstimator{NT}) where NT<:Real
info[:ahatarr] = info[:âarr]
info[:epsilon] = info[:ε]
info[:Xhat] = info[:X̂]
info[:xhat] = info[:x̂]
info[:Ahat] = info[:Â]
info[:ahat] = info[:â]
info[:Vhat] = info[:V̂]
info[:Pbar] = info[:P̄]
info[:xbar] = info[:x̄]
Expand Down
3 changes: 3 additions & 0 deletions test/2_test_state_estim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,10 @@ end
preparestate!(mhe, [0], [0])
info = getinfo(mhe)
@test info[:x̂] ≈ x̂ atol=1e-5
@test info[:xhat] ≈ x̂ atol=1e-5
@test info[:Ŷ][end] ≈ 0 atol=1e-5
@test info[:â] ≈ [0.0] atol=1e-5
@test info[:ahat] ≈ [0.0] atol=1e-5
for i in 1:40
preparestate!(mhe, [0], [0])
updatestate!(mhe, [3.0], [0], [0])
Expand Down
Loading