Skip to content

Commit 7db4fdd

Browse files
committed
use observability function of ControlSystemsBase
1 parent fceb162 commit 7db4fdd

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/estimator/kalman.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ ones, for ``\mathbf{Ĉ^u, D̂_d^u}``).
9595
``\mathbf{Q}`` of `model`, specified as a standard deviation vector.
9696
- `σR=fill(1,length(i_ym))` : main diagonal of the sensor noise covariance ``\mathbf{R}``
9797
of `model` measured outputs, specified as a standard deviation vector.
98-
- `nint_u=0`: integrator quantity per manipulated inputs (vector) for the
99-
stochastic model, use `nint_u=0` for no integrator.
10098
- `nint_ym=`[`default_nint`](@ref)`(model,i_ym)` : integrator quantity per measured outputs
10199
(vector) for the stochastic model, use `nint_ym=0` for no integrator (see Extended Help).
102100
- `σQ_int=fill(1,sum(nint_ym))` : same than `σQ` but for the stochastic model covariance

src/state_estim.jl

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function augment_model(model::LinModel, As, Cs; verify_obsv=true)
187187
B̂d = [model.Bd; zeros(nxs,nd)]
188188
D̂d = model.Dd
189189
# observability on Ĉ instead of Ĉm, since it would always return false when nym ≠ ny:
190-
if verify_obsv && !isobservable(Â, Ĉ)
190+
if verify_obsv && !observability(Â, Ĉ)[begin]
191191
error("The augmented model is unobservable. You may try to use 0 "*
192192
"integrator on model integrating outputs with nint_ym parameter.")
193193
end
@@ -213,22 +213,14 @@ function default_nint(model::LinModel, i_ym)
213213
As , _ , Cs = stoch_ym2y(model, i_ym, Asm, [], Csm, [])
214214
 , _ , Ĉ = augment_model(model, As, Cs, verify_obsv=false)
215215
# observability on Ĉ instead of Ĉm, since it would always return false when nym ≠ ny
216-
isobservable(Â, Ĉ) || (nint_ym[i] = 0)
216+
isobservable, = observability(Â, Ĉ)
217+
isobservable || (nint_ym[i] = 0)
217218
end
218219
return nint_ym
219220
end
220221
"One integrator per measured outputs by default if `model` is not a [`LinModel`](@ref)."
221222
default_nint(::SimModel, i_ym) = fill(1, length(i_ym))
222223

223-
"""
224-
isobservable(A, C)
225-
226-
Verify if the state-space `A` and `C` matrices of are observable.
227-
228-
Based on the [Popov-Belevitch-Hautus (PBH) test](https://en.wikipedia.org/wiki/Hautus_lemma).
229-
"""
230-
isobservable(A, C) = all(map->rank([λ * I - A; C]) == size(A, 1), eigvals(A)))
231-
232224
@doc raw"""
233225
f̂(estim::StateEstimator, x̂, u, d)
234226

0 commit comments

Comments
 (0)