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
1 change: 1 addition & 0 deletions src/estimator/internal_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ estimator is allocation-free if `model` simulations do not allocate.
julia> estim = InternalModel(LinModel([tf(3, [30, 1]); tf(-2, [5, 1])], 0.5), i_ym=[2])
InternalModel estimator with a sample time Ts = 0.5 s:
├ model: LinModel
├ direct: true
└ dimensions:
├ 1 manipulated inputs u
├ 2 estimated states x̂
Expand Down
6 changes: 6 additions & 0 deletions src/estimator/kalman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ julia> model = LinModel([tf(3, [30, 1]); tf(-2, [5, 1])], 0.5);
julia> estim = SteadyKalmanFilter(model, i_ym=[2], σR=[1], σQint_ym=[0.01])
SteadyKalmanFilter estimator with a sample time Ts = 0.5 s:
├ model: LinModel
├ direct: true
└ dimensions:
├ 1 manipulated inputs u (0 integrating states)
├ 3 estimated states x̂
Expand Down Expand Up @@ -410,6 +411,7 @@ julia> model = LinModel([tf(3, [30, 1]); tf(-2, [5, 1])], 0.5);
julia> estim = KalmanFilter(model, i_ym=[2], σR=[1], σP_0=[100, 100], σQint_ym=[0.01])
KalmanFilter estimator with a sample time Ts = 0.5 s:
├ model: LinModel
├ direct: true
└ dimensions:
├ 1 manipulated inputs u (0 integrating states)
├ 3 estimated states x̂
Expand Down Expand Up @@ -656,6 +658,7 @@ julia> model = NonLinModel((x,u,_,_)->0.1x+u, (x,_,_)->2x, 10.0, 1, 1, 1, solver
julia> estim = UnscentedKalmanFilter(model, σR=[1], nint_ym=[2], σPint_ym_0=[1, 1])
UnscentedKalmanFilter estimator with a sample time Ts = 10.0 s:
├ model: NonLinModel
├ direct: true
└ dimensions:
├ 1 manipulated inputs u (0 integrating states)
├ 3 estimated states x̂
Expand Down Expand Up @@ -1023,6 +1026,7 @@ julia> estim = ExtendedKalmanFilter(model, σQ=[2], σQint_ym=[2], σP_0=[0.1],
ExtendedKalmanFilter estimator with a sample time Ts = 5.0 s:
├ model: NonLinModel
├ jacobian: AutoForwardDiff
├ direct: true
└ dimensions:
├ 1 manipulated inputs u (0 integrating states)
├ 2 estimated states x̂
Expand Down Expand Up @@ -1190,8 +1194,10 @@ function update_estimate!(estim::ExtendedKalmanFilter{NT}, y0m, d0, u0) where NT
return predict_estimate_kf!(estim, u0, d0, F̂)
end

"Print the `jacobian` backend and `direct` flag for [`ExtendedKalmanFilter`](@ref)."
function print_details(io::IO, estim::ExtendedKalmanFilter)
println(io, "├ jacobian: $(backend_str(estim.jacobian))")
println(io, "├ direct: $(estim.direct)")
end

"Set `estim.cov.P̂` to `estim.cov.P̂_0` for the time-varying Kalman Filters."
Expand Down
1 change: 1 addition & 0 deletions src/estimator/luenberger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ julia> model = LinModel([tf(3, [30, 1]); tf(-2, [5, 1])], 0.5);
julia> estim = Luenberger(model, nint_ym=[1, 1], poles=[0.61, 0.62, 0.63, 0.64])
Luenberger estimator with a sample time Ts = 0.5 s:
├ model: LinModel
├ direct: true
└ dimensions:
├ 1 manipulated inputs u (0 integrating states)
├ 4 estimated states x̂
Expand Down
5 changes: 4 additions & 1 deletion src/estimator/manual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,7 @@ update_estimate!(::ManualEstimator, y0m, d0, u0) = nothing
function setstate_cov!(::ManualEstimator, P̂)
isnothing(P̂) || error("ManualEstimator does not compute an estimation covariance matrix P̂.")
return nothing
end
end

"No details for `ManualEstimator`."
print_details(::IO, ::ManualEstimator) = nothing
3 changes: 2 additions & 1 deletion src/estimator/mhe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ function print_details(io::IO, estim::MovingHorizonEstimator)
println(io, "├ optimizer: $(JuMP.solver_name(estim.optim)) ")
print_backends(io, estim, estim.model)
println(io, "├ arrival covariance: $(nameof(typeof(estim.covestim))) ")
println(io, "├ direct: $(estim.direct)")
end

"Print the differentiation backends for `SimModel`."
"Print the differentiation backends of `MovingHorizonEstimator` for `SimModel`."
function print_backends(io::IO, estim::MovingHorizonEstimator, ::SimModel)
println(io, "├ gradient: $(backend_str(estim.gradient))")
println(io, "├ jacobian: $(backend_str(estim.jacobian))")
Expand Down
2 changes: 2 additions & 0 deletions src/estimator/mhe/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s:
├ jacobian: AutoForwardDiff
├ hessian: nothing
├ arrival covariance: UnscentedKalmanFilter
├ direct: true
└ dimensions:
├ 5 estimation steps He
├ 0 slack variable ε (estimation constraints)
Expand Down Expand Up @@ -752,6 +753,7 @@ MovingHorizonEstimator estimator with a sample time Ts = 1.0 s:
├ model: LinModel
├ optimizer: OSQP
├ arrival covariance: KalmanFilter
├ direct: true
└ dimensions:
├ 3 estimation steps He
├ 0 slack variable ε (estimation constraints)
Expand Down
6 changes: 4 additions & 2 deletions src/state_estim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ end
"Return additional dimensions on `estim` if any, for adequate padding with spaces."
get_other_dims(::StateEstimator) = tuple()

"Print additional details of `estim` if any (no details by default)."
print_details(::IO, ::StateEstimator) = nothing
"Print only the `estim.direct` field by default."
function print_details(io::IO, estim::StateEstimator)
println(io, "├ direct: $(estim.direct)")
end

"Print the overall dimensions of the state estimator `estim` with left padding `n`."
function print_estim_dim(io::IO, estim::StateEstimator, n)
Expand Down