Skip to content

Commit 7233a58

Browse files
committed
added: :â / :ahat field in getinfo(mhe)
It's the analog of `:x̂` / `:xhat` but for the algebraic variable. More precisely, the algebraic variables are at the left limit of the sampling instants. This is the convention in this package (see Extended Help of any `CollocationMethod` for info on this). They are used to compute the predicted outputs `ŷ` over the estimation window.
1 parent f5746b2 commit 7233a58

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎src/estimator/mhe/execute.jl‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ following fields:
9999
- `:ε` or *`:epsilon`* : optimal slack variable, ``ε``
100100
- `:X̂` or *`:Xhat`* : optimal estimated states over ``N_k``, ``\mathbf{X̂}``
101101
- `:x̂` or *`:xhat`* : optimal estimated state, ``\mathbf{x̂}_k(k+p)``
102-
- `:Â` or *`:Ahat`* : optimal estimated algebraic variables over ``N_k``, ``\mathbf{Â}``
102+
- `:Â` or *`:Ahat`* : optimal estimated algebraic variables over ``N_k`` (left limits), ``\mathbf{Â}``
103+
- `:â` or *`:ahat`* : optimal estimated algebraic variable (left limit), ``\mathbf{â}(k+p)``
103104
- `:V̂` or *`:Vhat`* : optimal estimated sensor noise over ``N_k``, ``\mathbf{V̂}``
104105
- `:P̄` or *`:Pbar`* : estimation error covariance at arrival, ``\mathbf{P̄}``
105106
- `:x̄` or *`:xbar`* : optimal estimation error at arrival, ``\mathbf{x̄}``
@@ -113,8 +114,8 @@ following fields:
113114
- `:D` : measured disturbances over ``N_k+1``, ``\mathbf{D}``
114115
- `:sol` : solution summary of the optimizer for printing
115116
116-
For [`NonLinModel`](@ref) or under custom nonlinear inequality constraints (`nc>0`), it also
117-
includes the following fields:
117+
For non-[`LinModel`](@ref) or under custom nonlinear inequality constraints (`nc>0`), it
118+
also includes the following fields:
118119
119120
- `:∇J` or *`:nablaJ`* : optimal gradient of the objective function, ``\mathbf{\nabla} J``
120121
- `:∇²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
176177
end
177178
D[end-nd+1:end] .+= model.dop
178179
x̂arr .+= estim.x̂op
180+
Â, âarr = Â0, â0arr # no operating points on the algebraic variable
179181
info[:Ŵ] = Ŵ[1:nŵ*Nk]
180182
info[:ε] = getslack(estim, Z̃)
181183
info[:X̂] = X̂[1:nx̂*Nk]
182-
info[:Â] = Â0[1:na*Nk]
183-
info[:x̂] = estim.x̂0 .+ estim.x̂op
184+
info[:x̂] = X̂[(1+nx̂*Nk-nx̂):(nx̂*Nk)]
185+
info[:Â] = Â[1:na*Nk]
186+
info[:â] = Â[(1+na*Nk-na):(na*Nk)]
184187
info[:V̂] = V̂[1:nym*Nk]
185188
info[:P̄] = estim.P̂arr_old
186189
info[:x̄] = x̄
187190
info[:Ŷ] = Ŷ[1:ny*Nk]
188191
info[:Ŷm] = Ŷ[vec(estim.i_ym .+ ny.*(0:Nk-1)')]
189192
info[:x̂arr] = x̂arr
190-
info[:âarr] = â0arr
193+
info[:âarr] = âarr
191194
info[:J] = J
192195
info[:Ym] = Ym
193196
info[:U] = U
@@ -199,7 +202,9 @@ function getinfo(estim::MovingHorizonEstimator{NT}) where NT<:Real
199202
info[:ahatarr] = info[:âarr]
200203
info[:epsilon] = info[:ε]
201204
info[:Xhat] = info[:X̂]
205+
info[:xhat] = info[:x̂]
202206
info[:Ahat] = info[:Â]
207+
info[:ahat] = info[:â]
203208
info[:Vhat] = info[:V̂]
204209
info[:Pbar] = info[:P̄]
205210
info[:xbar] = info[:x̄]

0 commit comments

Comments
 (0)