# Performance evaluation of model detection filters

Computation of the weak structure matrix.`mdspec`

Computation of the strong structure matrix.`mdsspec`

Computation of the distance-matching performace.`mdperf`

Computation of the distance-matching performace to a component model.`mdmatch`

Computation of the noise gaps.`mdgap`

`FaultDetectionTools.mdspec`

— Function` S = mdspec(sysR::MDFilterIF; cdinp = false, atol, atol1 = atol, atol2 = atol, rtol = 0)`

Compute the weak binary structure matrix `S`

of a collection of model detection filters using the model detection filter internal form object `sysR::MDFilterIF`

.

For an `M × N`

array of filters `sysR`

, `S`

is an `M × N`

binary array determined as follows. Let the `(i,j)`

-th component filter `sysR.sys[i,j]`

have the input-output form

` rij = Ruij(λ)*u + Rdij(λ)*dj + Rwij(λ)*wj + Rvij(λ)*vj ,`

with the Laplace- or Z-transformed residual output `rij`

, control inputs `u`

, disturbance inputs `dj`

, noise inputs `wj`

, and auxiliary inputs `vj`

, and with `Ruij(λ)`

, `Rdij(λ)`

, `Rwij(λ)`

and `Rvij(λ)`

, the corresponding transfer function matrices. Then, `S[i,j] = 1`

if `Ruij(λ)`

is nonzero for `cdinp = false`

(default), or if `[Ruij(λs) Rdij(λs)]`

is nonzero for `cdinp = true`

. Otherwise, `S[i,j] = 0`

.

If `(Arij-λErij,Brij,Crij,Drij)`

is the descriptor realization of `sysR.sys[i,j]`

, then the keyword arguments `atol1`

, `atol2`

, and `rtol`

, specify, respectively, the absolute tolerance for the nonzero elements of matrices `Arij`

, `Brij`

, `Crij`

, `Drij`

, the absolute tolerance for the nonzero elements of `Erij`

, and the relative tolerance for the nonzero elements of `Arij`

, `Brij`

, `Crij`

, `Drij`

and `Eirj`

. The default relative tolerance is `nij*ϵ`

, where `ϵ`

is the working *machine epsilon* and `nij`

is the order of the system matrix of `sysR.sys[i,j]`

. The keyword argument `atol`

can be used to simultaneously set `atol1 = atol`

and `atol2 = atol`

.

`FaultDetectionTools.mdsspec`

— Function```
S = mdsspec(sysR::MDFilterIF, freq; cdinp = false, MDGainTol = 0.01,
atol, atol1 = atol, atol2 = atol, rtol = 0, fast = true)
```

Compute, for a given set of real frequencies `freq`

, the strong binary structure matrix `S`

of a collection of model detection filters using the model detection filter internal form object `sysR::MDFilterIF`

.

`freq`

must contain a real frequency value or a vector of `nf`

real frequencies which characterize the classes of persistent control and disturbance signals (default: `freq = 0`

, i.e., characterizing constant signals) and defines the set `Ω`

of complex frequencies which characterize the classes of persistent signals as follows: if `f`

is a real frequency in `freq`

, then the corresponding complex frequency `λ`

in `Ω`

is `λ := im*f`

, for a continuous-time system, or `λ := exp(im*f*abs(Ts))`

, for a discrete-time system with sampling-time `Ts`

.

For an `M × N`

array of filters `sysR`

, `S`

is an `M × N`

binary array determined as follows. Let the `(i,j)`

-th component filter `sysR.sys[i,j]`

have the input-output form

` rij = Ruij(λ)*u + Rdij(λ)*dj + Rwij(λ)*wj + Rvij(λ)*vj ,`

with the Laplace- or Z-transformed residual output `rij`

, control inputs `u`

, disturbance inputs `dj`

, noise inputs `wj`

, and auxiliary inputs `vj`

, and with `Ruij(λ)`

, `Rdij(λ)`

, `Rwij(λ)`

and `Rvij(λ)`

, the corresponding transfer function matrices. Then, `S[i,j] = 1`

if `Ruij(λs)`

is nonzero for any `λs ∈ Ω`

and `cdinp = false`

(default), or if `[Ruij(λs) Rdij(λs)]`

is nonzero for any `λs ∈ Ω`

and `cdinp = true`

. Otherwise, `S[i,j] = 0`

.

`MDGainTol = tol`

specifies an absolute threshold `tol`

for the nonzero magnitudes of the frequency response gains (default: `tol = 0.01`

).

The computation of minimal realizations of individual input-output channels relies on pencil manipulation algorithms, which employ rank determinations based on either the use of rank revealing QR-decomposition with column pivoting, if `fast = true`

(default) or the more reliable SVD-decompositions if `fast = false`

.

If `(Arij-λErij,Brij,Crij,Drij)`

is the descriptor realization of `sysR.sys[i,j]`

, then the keyword arguments `atol1`

, `atol2`

, and `rtol`

, specify, respectively, the absolute tolerance for the nonzero elements of matrices `Arij`

, `Brij`

, `Crij`

, `Drij`

, the absolute tolerance for the nonzero elements of `Erij`

, and the relative tolerance for the nonzero elements of `Arij`

, `Brij`

, `Crij`

, `Drij`

and `Eirj`

. The default relative tolerance is `nij*ϵ`

, where `ϵ`

is the working *machine epsilon* and `nij`

is the order of the system `sysR.sys[i,j]`

. The keyword argument `atol`

can be used to simultaneously set `atol1 = atol`

and `atol2 = atol`

.

`FaultDetectionTools.mdperf`

— Function```
mdperf(sysR::MDFilterIF; MDfreq, cdinp = false, rtolinf = 0.00001,
offset, atol, atol1 = atol, atol2 = atol, rtol = 0, fast = true) -> (mdgain, fpeak)
```

Compute the distance-mapping performance of a collection of model detection filters using the model detection filter internal form object `sysR::MDFilterIF`

. For an `M × N`

array of filters `sysR`

, the `M × N`

arrays of model detection performance gains `mdgain`

and the corresponding peak frequencies `fpeak`

are determined as follows. Let the `(i,j)`

-th component filter `sysR.sys[i,j]`

have the input-output form

` rij = Ruij(λ)*u + Rdij(λ)*dj + Rwij(λ)*wj + Rvij(λ)*vj ,`

with the Laplace- or Z-transformed residual output `rij`

, control inputs `u`

, disturbance inputs `dj`

, noise inputs `wj`

, and auxiliary inputs `vj`

, and with `Ruij(λ)`

, `Rdij(λ)`

, `Rwij(λ)`

and `Rvij(λ)`

, the corresponding transfer function matrices. Then, the `(i,j)`

-th performance gain is evaluated as `mdgain[i,j] = ||Ruij(λ)||∞`

if `cdinp = false`

(default) or `mdgain[i,j] = ||[Ruij(λ) Rdij(λ)]||∞`

if `cdinp = true`

and `fpeak[i,j]`

contains the corresponding peak frequency.

If `MDfreq = ω`

, where `ω`

is a given vector of real frequency values, then each gain `mdgain[i,j]`

represents the maximum of 2-norm pointwise gains evaluated for all frequencies in `ω`

and `fpeak[i,j]`

is the corresponding peak frequency.

The stability boundary offset, `β`

, to be used to assess the finite poles which belong to the boundary of the stability domain can be specified via the keyword parameter `offset = β`

. Accordingly, for a continuous-time system, these are the finite poles having real parts within the interval `[-β,β]`

, while for a discrete-time system, these are the finite pole having moduli within the interval `[1-β,1+β]`

. The default value used for `β`

is `sqrt(ϵ)`

, where `ϵ`

is the working machine precision.

Pencil reduction algorithms are employed to compute the H∞-norms. These algorithms perform rank decisions based on rank revealing QR-decompositions with column pivoting if `fast = true`

(default) or the more reliable SVD-decompositions if `fast = false`

.

If `(Arij-λErij,Brij,Crij,Drij)`

is the descriptor realization of `sysR.sys[i,j]`

, then the keyword arguments `atol1`

, `atol2`

, and `rtol`

, specify, respectively, the absolute tolerance for the nonzero elements of matrices `Arij`

, `Brij`

, `Crij`

, `Drij`

, the absolute tolerance for the nonzero elements of `Erij`

, and the relative tolerance for the nonzero elements of `Arij`

, `Brij`

, `Crij`

, `Drij`

and `Eirj`

. The default relative tolerance is `nij*ϵ`

, where `ϵ`

is the working *machine epsilon* and `nij`

is the order of the system `sysR.sys[i,j]`

. The keyword argument `atol`

can be used to simultaneously set `atol1 = atol`

and `atol2 = atol`

.

The keyword argument `rtolinf = tol`

specifies the relative accuracy `tol`

to be used to compute the infinity norms. The default value used is `tol = 0.00001`

.

`FaultDetectionTools.mdmatch`

— Function`mdmatch(sysQ::MDFilter, sysc::MDModel; MDfreq, minimal = false, rtolinf, offset, atol, atol1 = atol, atol2 = atol, rtol, fast = true) -> (mdgain,fpeak,mind)`

Compute the distance-mapping performance vector `mdgain`

achieved using the model detection filter object `sysQ::MDFilter`

applied to a component model `sysc::MDModel`

, the corresponding vector of peak frequencies `fpeak`

, and the index `mind`

of the component of `mdgain`

for which the minimum gain value is achieved.

If the `i`

-th filter `sysQ.sys[i]`

has the transfer function matrix `Qi(λ)`

and the component model `sysc::MDModel`

has the partitioned transfer function matrix `G(λ) = [Gu(λ) Gd(λ) Gw(λ) Gv(λ)]`

in accordance with the partitioned system inputs as `controls`

, `disturbances`

, `noise`

and `auxiliary`

inputs, respectively, then the distance-mapping performance of the `i`

-th filter applied to the given component model is computed as `mdgain[i] = || Ri(λ) ||∞`

, where `Ri(λ)`

is the corresponding internal form

```
Ri(λ) = Qi(λ) * | Gu(λ) Gd(λ) Gw(λ) Gv(λ) | .
| I 0 0 0 |
```

Minimal descriptor realizations are computed for `Ri(λ)`

if `minimal = true`

and a (possibly) non-minimal realization is determined if `minimal = false`

(default).

The computation of minimal realizations of individual input-output channels relies on pencil manipulation algorithms, which employ rank determinations based on either the use of rank revealing QR-decomposition with column pivoting, if `fast = true`

(default) or the more reliable SVD-decompositions if `fast = false`

.

If `(Ari-λEri,Bri,Cri,Dri)`

is the full order descriptor realization of `Ri(λ)`

, then the keyword arguments `atol1`

, `atol2`

, and `rtol`

, specify, respectively, the absolute tolerance for the nonzero elements of matrices `Ari`

, `Bri`

, `Cri`

, `Dri`

, the absolute tolerance for the nonzero elements of `Eri`

, and the relative tolerance for the nonzero elements of `Ari`

, `Bri`

, `Cri`

, `Dri`

and `Eir`

. The default relative tolerance is `ni*ϵ`

, where `ϵ`

is the working *machine epsilon* and `ni`

is the order of the realitation of `Ri(λ)`

. The keyword argument `atol`

can be used to simultaneously set `atol1 = atol`

and `atol2 = atol`

.

`FaultDetectionTools.mdgap`

— Function```
mdgap(sysR::MDFilterIF; MDfreq, cdinp = false, rtolinf = 0.00001,
offset, atol, atol1 = atol, atol2 = atol, rtol = 0, fast = true) -> (gap, β, γ)
```

Compute the noise gaps performance of a collection of model detection filters using the model detection filter internal form object `sysR::MDFilterIF`

. For an `M × N`

array of filters `sysR`

, let the `(i,j)`

-th component filter `sysR.sys[i,j]`

have the input-output form

` rij = Ruij(λ)*u + Rdij(λ)*dj + Rwij(λ)*wj + Rvij(λ)*vj ,`

with the Laplace- or Z-transformed residual output `rij`

, control inputs `u`

, disturbance inputs `dj`

, noise inputs `wj`

, and auxiliary inputs `vj`

, and with `Ruij(λ)`

, `Rdij(λ)`

, `Rwij(λ)`

and `Rvij(λ)`

, the corresponding transfer function matrices. Then, `gap`

, `β`

and `γ`

are `M`

-dimensional vectors, such that the `i`

-th noise gap is evaluated as `gap[i] = β[i]/γ[i]`

, where `β[i] = min(||Rij(λ)||∞`

for `i`

$\neq$ `j`

) and `γ[i] = ||Rwii(λ)||∞`

. `Rij(λ)`

is defined as `Rij(λ) = Ruij(λ)`

if `cdinp = false`

(default) or `Rij(λ) = [Ruij(λ) Rdij(λ)]`

if `cdinp = true`

.

If `MDfreq = ω`

, where `ω`

is a given vector of real frequency values, then each gain `β[i]`

represents the minimum of the maximum of 2-norm pointwise gains evaluated for all frequencies in `ω`

.

The stability boundary offset, `β`

, to be used to assess the finite poles which belong to the boundary of the stability domain can be specified via the keyword parameter `offset = β`

. Accordingly, for a continuous-time system, these are the finite poles having real parts within the interval `[-β,β]`

, while for a discrete-time system, these are the finite pole having moduli within the interval `[1-β,1+β]`

. The default value used for `β`

is `sqrt(ϵ)`

, where `ϵ`

is the working machine precision.

Pencil reduction algorithms are employed to compute the H∞-norms. These algorithms perform rank decisions based on rank revealing QR-decompositions with column pivoting if `fast = true`

(default) or the more reliable SVD-decompositions if `fast = false`

.

If `(Arij-λErij,Brij,Crij,Drij)`

is the descriptor realization of `sysR.sys[i,j]`

, then the keyword arguments `atol1`

, `atol2`

, and `rtol`

, specify, respectively, the absolute tolerance for the nonzero elements of matrices `Arij`

, `Brij`

, `Crij`

, `Drij`

, the absolute tolerance for the nonzero elements of `Erij`

, and the relative tolerance for the nonzero elements of `Arij`

, `Brij`

, `Crij`

, `Drij`

and `Eirj`

. The default relative tolerance is `nij*ϵ`

, where `ϵ`

is the working *machine epsilon* and `nij`

is the order of the system `sysR.sys[i,j]`

. The keyword argument `atol`

can be used to simultaneously set `atol1 = atol`

and `atol2 = atol`

.

The keyword argument `rtolinf = tol`

specifies the relative accuracy `tol`

to be used to compute the infinity norms. The default value used is `tol = 0.00001`

.