Discrete or continuous-time low-pass filter

Expand All on Page

**Libraries:**

Simscape / Electrical / Controls / General Controls

## Description

IsLow-pass filter (discrete or continuous)block implements a low-pass filter according to IEEE 421.5-2016^{[1]}. In the standard, the filter is referred to as a simple time constant.

You can switch between continuous and discrete implementation of the integrator using the**sample time**Parameter.

### equations

**Continually**

To set the continuous time filter, set the**sample time**property to`0`

. This representation corresponds to the continuous transfer function:

$$\mathrm{GRAMM}(S)=\frac{k}{TS+1},$$

Wo:

*k*is the gain of the filter.*T*is the time constant of the filter.

From the previous transfer function, the equations that define the filter are:

$$\{\begin{array}{c}\dot{X}(T)=\frac{1}{T}\left(k\mathrm{Tu}(T)-X(T)\right)\\ j(T)=X(T)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}j(0)=X(0)=k{\mathrm{Tu}}_{0},$$

Wo:

*Tu*is filter input.*X*is the condition of the filter.*j*is the output of the filter.*T*is the simulation time.*Tu*is the initial input for the block._{0}

**Discreet**

To configure the discrete time filter, configure the**sample time**-Property to a positive non-zero value or on`-1`

to inherit the sample time from a previous block. The discrete representation corresponds to the transfer function:

$$\mathrm{GRAMM}(z)=k\frac{({T}_{S}/T){z}^{-1}}{1+({T}_{S}/T-1){z}^{-1}},$$

Wo:

*k*is the gain of the filter.*T*is the time constant of the filter.*T*is the filter sampling time._{S}

Starting from the discrete transfer function, the filter equations are defined by the direct Euler method:

$$\{\begin{array}{c}X(\mathrm{Norte}+1)=\left(1-\frac{{T}_{S}}{T}\right)X(\mathrm{Norte})+k\left(\frac{{T}_{S}}{T}\right)\mathrm{Tu}(\mathrm{Norte})\\ j(\mathrm{Norte})=X(\mathrm{Norte})\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}j(0)=X(0)=k{\mathrm{Tu}}_{0},$$

Wo:

*Tu*is the input of the filter.*X*is the condition of the filter.*j*is the output of the filter.*Norte*is the simulation time step.*Tu*is the initial input for the block._{0}

### initial conditions

To specify the initial conditions for this block, set**initialization**A:

`Inherited from block input`

— The block sets the initial output state and conditions to the initial input.`Specify as a parameter`

— The block sets the initial condition of the state to the value of**initial state**.

### Limitation of the integral

Choose**Upper limit of saturation**j**Lower limit of saturation**Parameter to use anti-windup saturation method.

The anti-windup technique limits the state of the integrator between the lower saturation limit*A*and upper saturation limit*B*:

$$A<=X<=B\text{\hspace{0.17em}}.$$

Because the state is clipped, the output can respond immediately to an input sign reversal when the integral saturates. This block diagram shows the implementation of the anti-windup saturation method in the filter.

This block does not provide a saturation accounting method. To use the windup saturation method, set the**Upper limit of saturation**Parameter a`inf`

, Is**Lower limit of saturation**Parameter a`-inf`

and append asaturationblock at the exit.

### Bypass filter dynamics

Set the time constant to a value less than or equal to the sample time to ignore filter dynamics. If omitted, the block feeds the gain-scaled input directly to the output:

$$T\le {T}_{S}\to j=k\mathrm{Tu}$$

In the continuous case, the sampling time and the time constant must be zero.

## examples

open model

open model

open model

## ports

### Entry

expand all

**Tu**—filter input

Vector

Low-pass filter input signal. The block uses the initial input value to determine the initial value of the state.

**Type of data:**`einzel`

|`double`

### Production

expand all

**j**—filter output

Vector

low pass filter output.

**Type of data:**`einzel`

|`double`

## Parameter

expand all

**Win**—filter gain

`1`

(Default) | positive number

Gain of the low-pass filter.

**constant time**—filter time constant

`1`

(Default) | positive number

Time constant of the low-pass filter. Set this value to less than in the discrete implementation**sample time**to bypass the dynamics of the filter.

**Upper limit of saturation**—state cap

`inf`

(Default) | Real number

Upper state limit of the low-pass filter. Set this`inf`

for an unsaturated upper limit or to a finite value to avoid upper unwinding of the filter's integrator.

**Lower limit of saturation**—lower state border

`-inf`

(Default) | Real number

Lower state limit of the low-pass filter. Set this`-inf`

for an unsaturated lower bound, or to a finite value to avoid a slight reduction in the filter integrator.

**initialization**—Specification of the initial state

`Inherited from block input`

(Standard) |`Specify as a parameter`

Give the initial state condition for this block. For more information, seeinitial conditions.

**initial state**—initial state

`0`

(Default) | Real number

initial state of the block.

#### dependencies

To enable this parameter, set**initialization**A`Specify as a parameter`

.

**Sample Time (-1 for Legacy)**—block sampling time

`-1`

(Standard) |`0`

| positive Skala

Time between consecutive executions of blocks. During execution, the block generates output and updates its internal state as necessary. For more information, seeWhat is trial period?jSpecify probationary period.

For legacy discrete-time operation, set this parameter to`-1`

. Set this parameter to a positive integer for discrete-time operation. Set this parameter to for continuous timed operation`0`

.

If this block is in a masked subsystem or subsystem variant that supports switching between continuous and discrete operation, promote this parameter to ensure correct switching between continuous and discrete implementation of the block. For more information, seeFoster block parameters in a skin.

## references

[1]*IEEE Recommended Practice for Excitation System Models for Power System Stability Studies.*IEEE-Standard 421.5-2016. Piscataway, NJ: IEEE-SA, 2016.

## advanced skills

### C/C++ code generation

Generate C and C++ code with Simulink® CoderTM.

## history

**Introduced in R2017b**

## See also

### blocks

- Filtered derivative (discrete or continuous)|Lead lag (discrete or continuous)|Washed (discreetly or continuously)|Integrator (discrete or continuous)|Wrapped-state integrator (discrete or continuous)

## ComandoMATLAB

You clicked a link that corresponds to this MATLAB command:

Run the command by typing it in the MATLAB command window. Web browsers do not support MATLAB commands.

Select a site to get translated content where available and view local events and offers. Depending on your location, we recommend you select the following:.

You can also select a website from the list below:

### America

- Latin America(Spanish)
- You have(English)
- USA(English)

### Europa

- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- Spain(Spanish)
- Finland(English)
- France(French)
- Ireland(English)
- Italy(Italian)
- Luxemburg(English)

- Netherlands(English)
- Norway(English)
- Austria(Deutsch)
- Portugal(English)
- Sweden(English)
- Swiss
- Deutsch
- English
- French

- Great Britain(English)

### Pacific Asia

- Australia(English)
- If(English)
- New Zealand(English)
- porcelain
- Japan(Japanese)
- Korea(Korean)

Contact your local office