After searching for algorithm to program the PID, I found out that it is quite simple per se. You just need to have an integrator, a derivation and a proportional value of the error in the desired and actual value.

By the time I saw this, I kept wondering how should I have integrator and derivative in my programming. Only after sometimes that I realize that numerical methods are needed. Numerical methods is actually converts known mathematics to discrete form. Anything can be transformed, integrator, derivative, ordinary differential equation, partial differential equation, matrixs, anything you can name.

Moving on, with the discrete form PID, I put it to test. I was doing a DC motor position control using a simple DC motor and a potentiometer. Turns out, it did not worked out as miraculous as the great PID claimed. The motor was shaky like some earthquake is happening.

The ideal version of PID does not seems to convert well to practical usage. In fact, anything that is ideal or theoretical never can convert well to practical or real world usage. There are more stuff to consider before implementing the PID in a real system. Two of the most common problems are saturation windup and derivative kick.

Stay tuned for the next part.

*Inspiring Creative and Innovative Minds*

Ng Khin Hooi

Faculty of Electrical Engineering

Universiti Teknologi Malaysia

## 3 comments:

yezzaa! .....car park lifting"

If not mistaken for motor position control better just using PD instead PID..

Integral in PID is use to remove steady state error. U have a potential-meter to give feedback for your motor position,that why 'I' is not necessary.

Derivative is use to control the behavior of the system e.g settling time, rise time, overshoot etc. This is the key point to control your motor movement. But if u include 'I' the system become harder to tune. That why your motor shaking.

It is better if u simulate and tuning first the system in Simulink/Matlab then u can predict the best tuning value to get your desired control.

Dear Noraide,

I do agree on the fact that motor position will only need PD instead of PID.

Theoretically, 'I' term is not necessary because of the nature of the motor being an integral. In other words, the motor angular position is an integral of angular velocity.

But in reality, motor it self is non-linear. Too small a voltage will not produce any angular velocity at all. That is why there is an integral term needed.

Another way to solve the problem is to include a speed control in the forward loop gain of the controller. This will makes it more like a PD + PI controller. PD for position, PI for velocity.

About the shaking part, it shaked because I added 'D' term in the loop. As I mention, D term will cause high frequency noise being amplifier. There are at least two source of noise, one in the potentiometer, and another comes from ADC quantization error (http://en.wikipedia.org/wiki/Quantization_error).

On the tuning via Simulink, in my opinion, this method is too theoretical. It is hard to get the exact model for the motor. What is the motor inertial plus the load. What is the damping friction? Not to mention the Kt, Kr, and additional motor specification if a brandless motor was used. What if it was a brushless direct current motor? Unless there is system identification, then only this method can be used.

One of the mistake done during simulation is the lack of saturation in the block. In real world, motor do have saturation value, depending on the motor voltage used for example, 12V or 24V.

In conclusion, theoretical and practical application of PID will vary.

Post a Comment