.Modelica_LinearSystems2.ZerosAndPoles.Internal.filter

Information

Syntax

filterFunction = ZerosAndPoles.Internalfilter(
  analogFilter,
  filterType,
  order,
  f_cut,
  gain,
  A_ripple,
  normalized)

Description

This function constructs a ZerosAndPoles transfer function description of low and high pass filters. For more details see also [Tietze2002], pp. 815-852.

Typical frequency responses for the four supported low pass filter types are shown in the next figure (this figure was generated with function Examples.ZerosAndPoles.plotBodeFilter2):

The step responses of the same low pass filters are shown in the next figure, starting from a steady state initial filter with initial input = 0.2:

Obviously, the frequency responses give a somewhat wrong impression of the filter characteristics: Although Butterworth and Chebyshev filters have a significantly steeper magnitude as the CriticalDamping and Bessel filters, the step responses of the latter ones are much better. This means for example, that a CriticalDamping or a Bessel filter should be selected, if a filter is mainly used to make a non-linear inverse model realizable.

Typical frequency responses for the four supported high pass filter types are shown in the next figure (generated with function Examples.ZerosAndPoles.plotBodeFilter3):

The corresponding step responses of these high pass filters are shown in the next figure:

All filters are available in normalized (default) and non-normalized form. In the normalized form, the amplitude of the filter transfer function at the cutoff frequency is 1/sqrt(2) (= 3 dB). Note, when comparing the filters of this function with other software systems, the setting of "normalized" has to be selected appropriately. For example, the signal processing toolbox of Matlab provides the filters in non-normalized form and therefore a comparison makes only sense, if normalized = false is set.

Example

  Types.AnalogFilter analogFilter=Types.AnalogFilter.CriticalDamping;
  Integer order=2;
  Modelica.Units.SI.Frequency f_cut=10;

  ZerosAndPoles zp_filter;

algorithm
  zp_filter=Modelica_LinearSystems2.ZerosAndPoles.Design.filter(
    order=order,
    f_cut=f_cut,
    analogFilter=analogFilter);

// zp_filter = 9530.93/( (p + 97.6265)^2 )

Interface

encapsulated function filter
  import Modelica;
  import Modelica.Utilities.Streams;
  import Modelica_LinearSystems2.Utilities.Types;
  import Modelica_LinearSystems2.ZerosAndPoles;
  import MMath = Modelica.Math;
  input Types.AnalogFilter analogFilter = Types.AnalogFilter.CriticalDamping "Analog filter characteristics (CriticalDamping/Bessel/Butterworth/Chebyshev)";
  input Types.FilterType filterType = Types.FilterType.LowPass "Type of filter (LowPass/HighPass)";
  input Integer order(min = 1) = 2 "Order of filter";
  input Modelica.Units.SI.Frequency f_cut = 1/(2*Modelica.Constants.pi) "Cut-off frequency (default is w_cut = 1 rad/s)";
  input Real gain = 1.0 "Gain (= amplitude of frequency response at zero frequency)";
  input Real A_ripple(unit = "dB") = 0.5 "Pass band ripple for Chebyshev filter (otherwise not used)";
  input Boolean normalized = true "True, if amplitude at f_cut decreases/increases 3 db (for low/high pass filter), otherwise unmodified filter";
  output ZerosAndPoles.Internal.ZerosAndPoles filter(redeclare Real n1[if filterType == Types.FilterType.LowPass then 0 else (if analogFilter == Types.AnalogFilter.CriticalDamping then order else mod(order, 2))], redeclare Real n2[if filterType == Types.FilterType.LowPass then 0 else (if analogFilter == Types.AnalogFilter.CriticalDamping then 0 else integer(order/2)), 2], redeclare Real d1[if analogFilter == Types.AnalogFilter.CriticalDamping then order else mod(order, 2)], redeclare Real d2[if analogFilter == Types.AnalogFilter.CriticalDamping then 0 else integer(order/2), 2]) "Filter transfer function";
end filter;

Generated at 2024-10-14T18:25:21Z by OpenModelicaOpenModelica 1.24.0 using GenerateDoc.mos