I want to place a first order filter on the Derivative term of my PID
however I am not sure the best way to do this.
Would anyone be able to lend a hand.
Best Regards
shane

Beware though, it is very noise sensitive.

Walter.

Sorry, I answered the wrong question

Walter

Walter

On 12 Nov 2003 16:56:03 -0800, snipped-for-privacy@hotmail.com (Shane Hingst)
wrote:

The easiest way to filter the Derivative term is to control the sampling rate. All discrete implementations of the Derivative term are intrinsically filtered by the sample rate. Changes that occur in less time than the sample rate are simply not detected. If you want to maintain a high sample rate for the Proportional term, then go ahead, but artificially lower the sample rate for the Derivative term by using every n-th sample to calculate the Derivative term. This is approximately the same thing as starting with a fast-sampled Derivative term and applying a first-order filter.

-Robert Scott Ypsilanti, Michigan (Reply through newsgroups, not by direct e-mail, as automatic reply address is fake.)

The easiest way to filter the Derivative term is to control the sampling rate. All discrete implementations of the Derivative term are intrinsically filtered by the sample rate. Changes that occur in less time than the sample rate are simply not detected. If you want to maintain a high sample rate for the Proportional term, then go ahead, but artificially lower the sample rate for the Derivative term by using every n-th sample to calculate the Derivative term. This is approximately the same thing as starting with a fast-sampled Derivative term and applying a first-order filter.

-Robert Scott Ypsilanti, Michigan (Reply through newsgroups, not by direct e-mail, as automatic reply address is fake.)

Subsampling the signal does reduce gain, but it will also alias noise components into your derivative, so unless you do some anti-aliasing before you subsample then the only noise reduction that you get is from dividing by a greater sampling interval. You can do better by implementing a derivative that acts like a cascade of a simple derivative with a 1st-order low-pass filter:

xdot = (input - state) * (1 - pole) / sampling interval state = state + (xnow - state) * (1 - pole)

The "pole" in the equations above is the location of the z-domain pole for the filter. For filtering frequencies less than about 1/10th your sampling rate you can use

pole = 1 - 2

In practice you'll have to tune the pole location just as you would any other element of the controller. You'll want to increase the filtering (by setting pole closer to 1) for noisier input data, and decrease it (by setting pole closer to 0) for faster operation. Generally as you increase the derivative gain you'll be increasing the frequency at which the derivative signal needs to be effective and you'll have to increase the frequency by decreasing the pole value.

I agree. The "textbook solution" for the derivative part is

U_d(s) = T_d s / (1 + T_f s) E(s)

where U = U_p + U_i + U_d. "Normally", T_f = alpha*T_d where alpha could be e.g. 10 (5-10 my textbook says).

I guess this is more or less what you suggest.

Lars

writes:

--- snip ---

Yes, I'm pretty much giving the discrete-time filter that matches the continuous-time filter that your textbook is defining. The rule for T_f is a bit obscure your definition, I don't see it connected to any physical meaning. What you really want is to place the time constant of your differentiator filter (T_f) to be well below the design settling time of your system.

Of course the meaning of "well below" depends strongly on the system you're controlling...

--- snip ---

Yes, I'm pretty much giving the discrete-time filter that matches the continuous-time filter that your textbook is defining. The rule for T_f is a bit obscure your definition, I don't see it connected to any physical meaning. What you really want is to place the time constant of your differentiator filter (T_f) to be well below the design settling time of your system.

Of course the meaning of "well below" depends strongly on the system you're controlling...

before

by

derivative

sampling

(by

I don't think the (1-pole) term should be in the xdot calculation

rate(n) = exp(-sPole

zPole = exp(-sPole*T)

The filter pole should be about 10 to16 times faster ( corner frequency should be16 times higher or time constant should be 16 times shorter). The rate can be then mulitplied by the derivative gain.

-- snip --

for

sampling

-- snip --

The

My equations (once you correct for the fact that "xnow" and "input" are the same thing) match your equations except that your equations add one time-sample delay and require that you remember both the previous input value__ _and_ __the state of the filter -- do the z transform of each, work out
the math, and you'll see. So if you use my form for it then you do need the
(1-pole) term.

for

sampling

-- snip --

The

My equations (once you correct for the fact that "xnow" and "input" are the same thing) match your equations except that your equations add one time-sample delay and require that you remember both the previous input value

Derivative control best helps processes that have substantial inertia and
are relatively insusceptible to change.

If the process to which you want to add derivative control is so unstable that the measured variable changes rapidly, it's probably a poor candidate for derivative control in the first place. There may be other control techniques that, if used, would improve controllability. Perhaps just tweaking the proportional and integral responses would do the job.

If the process to which you want to add derivative control is so unstable that the measured variable changes rapidly, it's probably a poor candidate for derivative control in the first place. There may be other control techniques that, if used, would improve controllability. Perhaps just tweaking the proportional and integral responses would do the job.

--

Shane Hingst < snipped-for-privacy@hotmail.com> wrote in message...

: I want to place a first order filter on the Derivative term of my PID

Shane Hingst < snipped-for-privacy@hotmail.com> wrote in message...

: I want to place a first order filter on the Derivative term of my PID

Click to see the full signature.

### STK65020 Wanted!!!!

- - previous thread in ⧑ Industrial Control Group

### Drive Shaft Structural Characteristics

- - newest thread in ⧑ Industrial Control Group

### Special Issue "Advances in Nikola Tesla Technologies in the 21st Century"

- - the site's newest thread. Posted in ⏚ Electrical Engineering