diff --git a/docs/src/manual/mtk.md b/docs/src/manual/mtk.md index 003186637..7f8bf37ce 100644 --- a/docs/src/manual/mtk.md +++ b/docs/src/manual/mtk.md @@ -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() @@ -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() diff --git a/src/estimator/mhe/execute.jl b/src/estimator/mhe/execute.jl index 92b067f02..643daf67a 100644 --- a/src/estimator/mhe/execute.jl +++ b/src/estimator/mhe/execute.jl @@ -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̄}`` @@ -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`` @@ -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 @@ -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̄] diff --git a/test/2_test_state_estim.jl b/test/2_test_state_estim.jl index c66ae6d62..236a98b23 100644 --- a/test/2_test_state_estim.jl +++ b/test/2_test_state_estim.jl @@ -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])