Documentation

# Filtered Derivative (Discrete or Continuous)

Discrete-time or continuous-time filtered derivative

• Library:
• Simscape / Electrical / Control / General Control

## Description

The Filtered Derivative (Discrete or Continuous) block implements a filtered derivative in conformance with IEEE 421.5-2016[1].

You can switch between continuous and discrete implementations of the derivative using the Sample time parameter.

### Equations

#### Continuous

To configure the filtered derivative for continuous time, set the Sample time property to `0`. This representation is equivalent to the continuous transfer function:

`$G\left(s\right)=\frac{Ks}{Ts+1},$`

where:

• K is the gain.

• T is the time constant.

From the preceding transfer function, the derivative defining equations are:

`$\left\{\begin{array}{c}\stackrel{˙}{x}\left(t\right)=\frac{1}{T}\left(Ku\left(t\right)-x\left(t\right)\right)\\ y\left(t\right)=\frac{1}{T}\left(Ku\left(t\right)-x\left(t\right)\right)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}x\left(0\right)={u}_{0},\text{\hspace{0.17em}}y\left(0\right)=0,$`

where:

• u is the block input.

• x is the state.

• y is the block output.

• t is the simulation time.

• u0 is the initial input to the block.

#### Discrete

To configure the filtered derivative for discrete time, set the Sample time property to a positive, nonzero value, or to `-1` to inherit the sample time from an upstream block. The discrete representation is equivalent to the transfer function:

`$\left(\frac{K}{T}\right)\frac{z-1}{z+{T}_{s}/T-1},$`

where:

• K is the gain.

• T is the time constant.

• Ts is the sample time.

From the discrete transfer function, the derivative equations are defined using the forward Euler method:

`$\left\{\begin{array}{c}x\left(n+1\right)=\left(1-\frac{{T}_{s}}{T}\right)x\left(n\right)+\left(\frac{{T}_{s}}{T}\right)u\left(n\right)\\ y\left(n\right)=\frac{K}{T}\left(u\left(n\right)-x\left(n\right)\right)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}x\left(0\right)={u}_{0},\text{\hspace{0.17em}}y\left(0\right)=0,$`

where:

• u is the block input.

• x is the block state.

• y is the block output.

• n is the simulation time step.

• u0 is the initial input to the block.

### Initial Conditions

The block sets the state initial condition to the initial input, making the initial output zero.

### Limiting the Output

Limit the filtered derivative output by setting the Upper saturation limit and Lower saturation limit parameters to finite values.

Unlike other common blocks given in IEEE 421.5-2016, there is no difference between the windup and anti-windup saturation methods for the filtered derivative. The output can respond immediately to a reversal of the input sign when the output is saturated.

## Ports

### Input

expand all

Filtered derivative input signal. The block uses the input initial value to determine the state initial value.

Data Types: `single` | `double`

### Output

expand all

Filtered derivative output signal.

Data Types: `single` | `double`

## Parameters

expand all

Filtered derivative gain.

Filtered derivative time constant. For acceptable accuracy, set this value at least 10 times greater than the Sample time.

Filtered derivative upper output limit. Set this to `inf` for an unsaturated upper limit.

Filtered derivative lower output limit. Set this to `-inf` for an unsaturated lower limit.

Minimum acceptable sample time to time constant ratio. As the sample time approaches the time constant, the accuracy of the block decreases. Use this parameter to set the tolerance of this ratio.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? (Simulink) and Specify Sample Time (Simulink).

For inherited discrete-time operation, specify `-1`. For discrete-time operation, specify a positive integer. For continuous-time operation, specify `0`.

For acceptable accuracy, set this value at least 10 times smaller than the Time constant parameter.

If this block is in a masked subsystem, or other variant subsystem that allows either continuous and discrete operation, promote the sample time parameter. Promoting the sample time parameter ensures correct switching between the continuous and discrete implementations of the block. For more information, see Promote Parameter to Mask (Simulink).

## References

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