First of all, sorry for the late delay after promising for following parts of the practical PID controller. This is going to be a short post as few more parts are going to come up. And in the final post, I will upload the C file and H file for public use along with the documentation.

In this post, I will describe about the derivative part of the controller. From the formula in the first part, it is a derivative of the error that we wants. But in real life situation, usually the sensors data obtain usually are noisy. We can have a simple example here.

Take a function, x(t).

The derivative of the sin function will control the frequency. So if the frequency is high, then the value will create a high value of amplification. If the x(t) signal is the noise, then the derivative will cause very high noise.

Therefore, to solve, I have used the approximation of the derivative component by attenuating the higher frequency components. If you have taken Signal classes, you will learn what is Bode plot (anyway, it is pronounced Bow-Dee). Derivative can be approximated with S and the plot for S is shown in the picture below as the dotted line.

To have the higher frequency attenuated, I have added a low pass filter to the Bode plot appears to be like the solid line in the picture above. The formula in frequency domain used is like the formula below.

This will solve the problem of high frequency noise being amplified. But we will face another problem. This problem have been mentioned in the first part, the derivative kick.

Take the formula above, the derivative of the error include the derivative of the set point and the feedback. Where feedback cannot change instantaneously, the set point can. If the user change from one set point to another surely the derivative is very high.

To solve it? Quite a simple solution, just assume the set point as a constant value and only take the derivative of the feedback like the formula above.

All right. For now it is all talk and no action. Of course the action will have to wait. There are few more posts on this practical PID articles and finally I will share the code on how to implement it. Stay tuned.

Link:

Practical PID Controller Part I

## No comments:

Post a Comment