GenericFilter

This block is a configurable filter, which supports several filter types, such as low-pass, high-pass, lag or lead, notch or a custom configured type in either continuous-time or discrete-time.

Discretization

The supported discretization methods are:

  • Tustin

  • Matched pole-zero

Note

Once the filter is implemented the discretization method cannot be changed.

Configuration

The required filter is selected via the FilterType signal. Thereafter, the chosen filter is configured via the Parameters[0-4] signals.

Note

The FilterType signal of the GenericFilter differs from the FilterType property of the filter. The first selects the required configuration in the generic filter, while the latter distinguishes the GenericFilter implementation from other filters (such as the integrator or PIDLowPass).

If no suitable filter type is available, then the filter parameters can manually be set in either continuous-time or discrete-time by using the filter type SecondOrderGenericS or SecondOrderGenericZ respectively.

Note

The state of the filter (i.e. its memory) can be cleared by resetting the filter based upon another signal. Refer to the documentation of the processing block that implements the generic filter to see how this is configured.

The table below shows the possible options for FilterType, the corresponding transfer function and how Parameter[0-4] are used to configure the filter. All frequencies are specified in Hertz.

GenericFilter-TransferFunctions

Filter type

Transfer function

Parameter0

Parameter1

Parameter2

Parameter3

Parameter4

Pass-through

\(1\)

N/A

N/A

N/A

N/A

N/A

1st order low pass

\(\frac{a}{\frac{1}{2 \pi f}s +1}\)

Gain \(a\)

Frequency \(f\)

N/A

N/A

N/A

2nd order low pass

\(\frac{a(2 \pi f)^2}{s^2+4 \pi fbs + (2 \pi f)^2}\)

Gain \(a\)

Frequency \(f\)

Damping \(b\)

N/A

N/A

1st order high pass

\(\frac{a s}{s+2 \pi f}\)

Gain \(a\)

Frequency \(f\)

N/A

N/A

N/A

2nd order high pass

\(\frac{as^2}{s^2+4 \pi fbs + (2 \pi f)^2}\)

Gain \(a\)

Frequency \(f\)

Damping \(b\)

N/A

N/A

1st order lag or lead

\(a \frac{\frac{1}{2 \pi f_1}s+1}{\frac{1}{2 \pi f_2}s+1}\)

Gain \(a\)

Pole frequency \(f_2\)

N/A

Zero frequency \(f_1\)

N/A

2nd order notch

\(a \frac{ \left( \frac{1}{2 \pi f_1}s \right) ^2+\frac{2b_1}{2 \pi f_1}s+1}{ \left( \frac{1}{2 \pi f_2}s \right) ^2+\frac{2b_2}{2 \pi f_2}s+1}\)

Gain \(a\)

Pole frequency \(f_2\)

Pole damping \(b_2\)

Zero frequency \(f_1\)

Zero damping \(b_1\)

2nd order generic z

\(\frac{B_0+B_1 z^{-1}+B_2 z^{-2}}{1+A_1 z^{-1}+A_2 z^{-2}}\)

B0

B1

B2

A1

A2

2nd order generic s

\(\frac{B_0 s^2+B_1 s+B_2}{s^2+A_1 s+A_2}\)

B0

B1

B2

A1

A2

Attention

Some combinations of parameters yield invalid filter configurations. For example, a FirstOrderLowPass filter with a cut-off frequency of zero leads to a division by zero. Such filter configuration is not allowed and will result in an error.

Parameter sets

The required signals to update the filter via a parameter set are shown in the table below.

GenericFilter-parameterset

Added parameters

Applied parameters

Parameter0

ParameterB0

Parameter1

ParameterB1

Parameter2

ParameterB2

Parameter3

ParameterA1

Parameter4

ParameterA2

Type

Total: 6

Total: 5

Note

The number of applied parameters should be used to determine the size of a parameter set.

See also

GenericFilter

Documentation of GenericFilter block in the PMP Simulink® toolbox.