-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstate_estim.jl
More file actions
49 lines (40 loc) · 1.66 KB
/
Copy pathstate_estim.jl
File metadata and controls
49 lines (40 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@doc raw"""
Abstract supertype of all state estimators.
---
(estim::StateEstimator)(d=[]) -> ŷ
Functor allowing callable `StateEstimator` object as an alias for [`evaloutput`](@ref).
# Examples
```jldoctest
julia> kf = KalmanFilter(setop!(LinModel(tf(3, [10, 1]), 2), yop=[20]), direct=false);
julia> ŷ = kf()
1-element Vector{Float64}:
20.0
```
"""
abstract type StateEstimator{NT<:Real} end
const IntVectorOrInt = Union{Int, Vector{Int}}
include("estimator/construct.jl")
include("estimator/execute.jl")
include("estimator/kalman.jl")
include("estimator/luenberger.jl")
include("estimator/mhe.jl")
include("estimator/internal_model.jl")
include("estimator/manual.jl")
function Base.show(io::IO, estim::StateEstimator)
nu, nd = estim.model.nu, estim.model.nd
nx̂, nym, nyu = estim.nx̂, estim.nym, estim.nyu
n = maximum(ndigits.((nu, nx̂, nym, nyu, nd))) + 1
println(io, "$(nameof(typeof(estim))) estimator with a sample time "*
"Ts = $(estim.model.Ts) s, $(nameof(typeof(estim.model))) and:")
print_estim_dim(io, estim, n)
end
"Print the overall dimensions of the state estimator `estim` with left padding `n`."
function print_estim_dim(io::IO, estim::StateEstimator, n)
nu, nd = estim.model.nu, estim.model.nd
nx̂, nym, nyu = estim.nx̂, estim.nym, estim.nyu
println(io, "$(lpad(nu, n)) manipulated inputs u ($(sum(estim.nint_u)) integrating states)")
println(io, "$(lpad(nx̂, n)) estimated states x̂")
println(io, "$(lpad(nym, n)) measured outputs ym ($(sum(estim.nint_ym)) integrating states)")
println(io, "$(lpad(nyu, n)) unmeasured outputs yu")
print(io, "$(lpad(nd, n)) measured disturbances d")
end