.

# The PID Algorithm and DRate

When tuning systems with the PID algorithm, it is useful to understand the DRate parameter. In Motion Console, DRate is found in the Filter Summary window.

### What is DRate?

DRate is a derivative averaging method. The PID derivative term is applied to the velocity that is measured over the last n samples where, n = DRate +1. DRate can only be set in integer values. DRate defaults to 0 when loading new firmware. In order to conserve computational horsepower and memory, DRate is limited to a maximum of 7.

The derivative is applied to the measured velocity over a number of samples. It is not applied to the average velocity during that period. Therefore, a change in DRate influences the effective gain of Kd (derivative term).

Since the dervivative term can be measured over several samples, some aliasing factors can also have an effect. These effects can be seen in the plot below. Notice the comb filtering effect in the amplitude response and the associated phase distortion.

### What are the effects of DRate?

The plot above shows that an increase in DRate will increase the effective Kd at frequencies far below the Nyquist Frequency (1/2 sample rate). The effective increase in Kd at low frequencies will be:

(DRate + 1) * Kd without drate = effective Kd

DRate has the effect of changing the sample rate for the derivative term. This has two effects:

 A comb filtering effect occurs at high sample rates. This consists of two effects:        - Notches in the amplitude response of the control algorithm that are dependent          on the DRate value.        - Distortions in the phase response that correspond to the notches. Because of the comb filtering effect, there is an effective cap in Kd gain that is relatively the same regardless of DRate.

The gain of DRate at very high frequencies (near the Nyquist frequency) will be lower than the gain if you raised Kd to an equivalent level (equivalent Kd = Kd * (Drate + 1)). Notice that the peak derivative gain in all DRate cases above is the same.

### When should I use DRate?

DRate can be valuable when you do not have the option of using post filters due to some environmental or design constraint.

DRate can also be useful on systems with low resolution and relatively high phase lag (ex: small, low-performance motors and drives). However, the effects of DRate can be misleading. For example, if a notch caused by DRate lines up with a peak in your system, DRate can actually cancel out this peak. However, this is most likely accomplished by accident. Even though you may be able to simulate DRate effectively, it can be difficult to analyze. Because of all the notches and phase gyrations, the effect of DRate is rarely ideal for a given system. In most cases, it is better to use a post filter rather than DRate because a post filter is more flexible.

 Legal Notice  |  Tech Email  |  Feedback        Copyright © 2001-2021 Motion Engineering