# Building model detection related objects

Model detection component synthesis model.`MDModel`

Model detection multiple synthesis model.`MDMModel`

Setup of multiple synthesis models for solving model detection problems.`mdmodset`

Model detection filter object.`MDFilter`

Model detection filter internal form object.`MDFilterIF`

Evaluation of the internal forms of model detection filters.`mdIFeval`

`FaultDetectionTools.MDModel`

— Type`MDModel <: AbstractFDDObject`

Type for component synthesis models employed to solve model detection problems.

If `sysc::MDModel`

is a component synthesis model object, the underlying descriptor system model can be obtained via `sysc.sys`

and the dimensions of the control, disturbance, noise and auxiliary vectors are contained in the integers `sysm.mu`

, `sysm.md`

, `sysm.mw`

and `sysm.ma`

, respectively.

`FaultDetectionTools.MDModel`

— Method`MDModel(sys; mu, md, mw, ma) -> sysc::MDModel`

Build for a linear time-invariant descriptor system `sys = (A-λE,B,C,D)`

a component synthesis model object `sysm::MDModel`

to be used in conjunction with the analysis and synthesis functions of model detection filters.

The resulting synthesis model object `sysc`

contains the component model with partitioned inputs, `sysc.sys = (A-λE,[Bu Bd Bw Bv],C,[Du Dd Dw Dv])`

, where `Bu`

, `Bd`

, `Bw`

and `Bv`

are formed from the successive columns of `B`

and are the input matrices from the control inputs `u`

, disturbance inputs `d`

, noise inputs `w`

and auxiliary inputs `v`

, respectively, and `Du`

, `Dd`

, `Dw`

and `Dv`

are formed from the successive columns of `D`

and are the feedthrough matrices from those inputs. The dimensions of control, disturbance, noise and auxiliary input vectors are contained in `sysm.mu`

, `sysm.md`

, `sysm.mw`

and `sysm.ma`

, respectively.

The information on the partition of the input components in control, disturbance, noise and auxiliary inputs can be specified using the following keyword arguments:

`mu = nu`

specifies the dimension `nu`

of the control input vector `u`

(default: `nu = 0`

)

`md = nd`

specifies the dimension `nd`

of the disturbance input vector `d`

(default: `nd = 0`

)

`mw = nw`

specifies the dimension `nw`

of the noise input vector `w`

(default: `nw = 0`

)

`ma = na`

specifies the dimension `na`

of the auxiliary input vector `v`

(default: `na = 0`

)

`FaultDetectionTools.MDMModel`

— Type`MDMModel <: AbstractFDDObject`

Type for multiple synthesis models employed to solve model detection problems.

If `sysm::MDMModel`

is the multiple synthesis model object, the underlying vector of descriptor system models can be obtained via `sysm.sys`

, the common dimension of the control vectors is contained in the integer `sysm.mu`

, and the dimensions of the disturbance, noise and auxiliary input vectors for the `i`

-th model `sysm.sys[i]`

are contained in the `i`

-th components of the integer vectors `sysm.md`

, `sysm.mw`

and `sysm.ma`

, respectively.

`FaultDetectionTools.MDMModel`

— Method`MDMModel(sys; mu, md, mw, ma) -> sysm::MDMModel`

Build for a vector of linear time-invariant system models `sys`

, with the `i`

-th component model `sys[i] = (Ai-λEi,Bi,Ci,Di)`

, a multiple synthesis model object `sysm::MDMModel`

to be used in conjunction with the analysis and synthesis functions of model detection filters.

The resulting multiple synthesis model object `sysm`

contains the vector `sysm.sys`

of component models with partitioned inputs, with the `i`

-th model `sysm.sys[i] = (Ai-λEi,[Bui Bdi Bwi Bvi],Ci,[Dui Ddi Dwi Dvi])`

, where `Bui`

, `Bdi`

, `Bwi`

and `Bvi`

are formed from the successive columns of `Bi`

and are the input matrices from the control inputs `u`

, disturbance inputs `di`

, noise inputs `wi`

and auxiliary inputs `vi`

, respectively, and `Dui`

, `Ddi`

, `Dwi`

and `Dvi`

are formed from the successive columns of `Di`

and are the feedthrough matrices from those inputs. The dimensions of control, disturbance, noise and auxiliary input vectors are contained in `sysm.mu`

, `sysm.md[i]`

, `sysm.mw[i]`

and `sysm.ma[i]`

, respectively.

If `N`

is the number of component models, the information on the partition of the input components in control, disturbance, noise and auxiliary inputs can be specified using the following keyword arguments:

`mu = nu`

specifies the dimension `nu`

of control input vector `u`

(default: `nu = 0`

)

`md = nd`

specifies the vector `nd`

containing the `N`

dimensions of disturbance input vectors, such that the `i`

-th disturbance vector `di`

has dimension `nd[i]`

(default: `nd = zeros(Int,N)`

)

`mw = nw`

specifies the vector `nw`

containing the `N`

dimensions of noise input vectors, such that the `i`

-th noise vector `wi`

has dimension `nw[i]`

(default: `nw = zeros(Int,N)`

)

`ma = na`

specifies the vector `na`

containing the `N`

dimensions of auxiliary input vectors, such that the `i`

-th auxiliary vector `vi`

has dimension `na[i]`

(default: `na = zeros(Int,N)`

)

`FaultDetectionTools.mdmodset`

— Function`mdmodset(sys; controls, c, disturbances, d, noise, n, aux) -> sysm::MDMModel`

Build for a vector of linear time-invariant system models `sys`

, with the `i`

-th component model `sys[i] = (Ai-λEi,Bi,Ci,Di)`

, a multiple synthesis model object `sysm::MDMModel`

to be used in conjunction with the analysis and synthesis functions of model detection filters.

The information on the partition of the input components in control, disturbance, noise and auxiliary inputs can be specified using the following keyword arguments:

`controls = inpu`

or `c = inpu`

specifies the indices `inpu`

of the control inputs (default: void)

`disturbances = inpd`

or `d = inpd`

specifies the indices or a vector of indices `inpd`

of the disturbance inputs (default: void)

`noise = inpn`

or `noise = inpn`

specifies the indices or a vector of indices `inpn`

of the noise inputs (default: void)

`aux = inpa`

specifies the indices or a vector of indices `inpa`

of the auxiliary inputs (default: void)

The indices of inputs can be specified as integer vectors, integer scalars or integer `UnitRange`

s. For disturbance, noise and auxiliary inputs, vectors of integer vectors or vectors of integer `UnitRange`

s can be used to specify possibly different set of indices for each component model.

The resulting `sysm`

contains the vector `sysm.sys`

of partitioned systems, with the `i`

-th model `sysm.sys[i] = (Ai-λEi,[Bui Bdi Bwi Bvi],Ci,[Dui Ddi Dwi Dvi])`

, where `Bui`

, `Bdi`

, `Bwi`

and `Bvi`

are the input matrices from the control inputs `u`

, disturbance inputs `di`

, noise inputs `wi`

and auxiliary inputs `vi`

, respectively, and `Dui`

, `Ddi`

, `Dwi`

and `Dvi`

are the feedthrough matrices from those inputs. The dimensions of control, disturbance, noise and auxiliary input vectors are contained in `sysm.mu`

, `sysm.md[i]`

, `sysm.mw[i]`

and `sysm.ma[i]`

, respectively.

*Method:* If `Gi(λ)`

is the `p x mi`

transfer function matrix of `sys[i]`

, then the resulting component system `sysm.sys[i]`

has an equivalent input output form `[Gui(λ) Gdi(λ) Gwi(λ) Gvi(λ)]`

, where the following relations define the component matrices: `Gui(λ) = Gi(λ)*Su`

, `Gdi(λ) = Gi(λ)*Sdi`

, `Gwi(λ) = G(λ)*Swi`

, `Gvi(λ) = Gi(λ)*Svi`

, with the selection matrices `Su`

, `Sdi`

, `Swi`

and `Svi`

formed from the columns of the `mi`

-th order identity matrix (note that `Su`

is the same for all component models).

`mdmodset(sysc::Vector{<:MDModel}) -> sysm::MDMModel`

Build for a vector of component synthesis models `sysc`

, a multiple synthesis model object `sysm::MDMModel`

to be used in conjunction with the analysis and synthesis functions of model detection filters.

`FaultDetectionTools.MDFilter`

— Type`MDFilter <: AbstractFDDObject`

Type for model detection filters resulted as solutions of model detection problems.

If `filter::MDFilter`

is the model detection filter object, the underlying `i`

-th descriptor system model can be obtained via `filter.sys[i]`

and the dimensions of the partitioned filter input vectors as `measured outputs`

and `control inputs`

, can be accessed as the integers contained in `filter.ny`

and `filter.mu`

, respectively.

`FaultDetectionTools.MDFilterIF`

— Type`MDFilterIF <: AbstractFDDObject`

Type for the internal form of model detection filters resulted as solutions of model detection problems.

If `filter::MDFilterIF`

is the model detection filter internal form object, the underlying `(i,j)`

-th descriptor system model can be obtained via `filter.sys[i,j]`

and the corresponding dimensions of control, disturbance, fault, noise and auxiliary input vectors are contained in `sysm.mu`

, `sysm.md[j]`

, `sysm.mw[j]`

and `sysm.ma[j]`

, respectively.

`FaultDetectionTools.mdIFeval`

— Function`mdIFeval(sysQ::MDFilter, sysm::MDMModel; minimal = false, atol, atol1 = atol, atol2 = atol, rtol, fast = true) -> sysR::MDFilterIF`

Compute the internal form `sysR`

of the model detection filter `sysQ`

applied to the multiple synthesis model `sysm`

. If the `j`

-th component model `sysm.sys[j]`

has the partitioned transfer function matrix `Gj(λ) = [ Guj(λ) Gdj(λ) Gwj(λ) Gvj(λ) ]`

in accordance with the partitioned system inputs as `controls`

, `disturbances`

, `noise`

and `auxiliary`

inputs, respectively, and `Qi(λ) = [ Qyi(λ) Qui(λ) ]`

is the partitioned transfer function matrix of the `i`

-th filter `sysQ.sys[i]`

in accordance with the partitioned filter inputs as `outputs`

and `controls`

, then the transfer function matrix `Rij(λ)`

corresponding to the (`i`

-th filter,`j`

-th model) pair in the resulting internal form `sysR.sys[i,j]`

is given by

```
Rij(λ) = | Qyi(λ) Qui(λ) | * | Guj(λ) Gdj(λ) Gwj(λ) Gvj(λ) |
| I 0 0 0 |
```

Minimal descriptor realizations are computed if `minimal = true`

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

(default).

The minimal realization computation 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`

, or the SVD-decomposition. The rank decision based on the SVD-decomposition is generally more reliable, but the involved computational effort is higher.

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

is the full order 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`

.