|
Re: PID Control algorithm(to control PWM Duty Cycle based on Current)
Realizing if you put 3 controls engineers in a room you will get 4 different way to do tuning. One way to empirically tune a PID.
1) with the Ki & Kd gains set at 0. increase the Kp until the process value, PV, (in your case current) starts to oscillate. Do not confuse noise with oscillation, although the more noise the slower your PID will have to be. Kp will never get you to the set point unless you add a manual offset to the output. Set Kp to about half of that.
2)keeping Kp set to the value in step 1, Do the same to Ki. This will give you starting values that you can tweak to your hearts content.
3)Kd stands for destabling. Most of the time I leave it at 0. But on some systems it can be useful. Start small & work up.
4)Test your tuning by making a step change to set point and watch how it responds. Over tuned will oscillate wildly. Under tuned, it will slowly reach set point with out any over shoot. Classically tuned it will over shoot and then settle on set point with decreasing oscillation.
|