This is my first year using PID and I have found that most people use two different methods of manual tuning and I am just wondering what are benefits/drawbacks or if 1 is better than the other or whatever there is to know. These are the 2 methods I found, with my understanding of them.
Method 1: Set Kp, Ki, and Kd, to 0. Then slowly increase Kp until oscillation. Once it reaches oscillation set Kp to half that value. Then increase Ki slowly to get rid of any steady state error. Then increase Kd to speed it up.
Method 2: Set Kp, Ki, and Kd to 0. Slowly increase Kp until oscillation. Once it reaches oscillation, increase Kd until the oscillation goes away. Once the oscillation goes away, increase Kp until it re-oscillates, then increase Kd until it goes away. Repeat that cycle until no amount of Kd will take away the oscillation. Then increase Ki if necessary to take away steady state error.
Trying the first method and getting ok results, but still quite a bit of error.
Here is a copy/paste from one of my team’s log entries on tuning a turn PID using a gyroscope. The method may work on other plants (systems) as well. Its a very quick method, but will not yield perfect results. Actually, the second method you yourself mentioned is usually effective.
I will warn you, depending on what this PID is for you might need another 2-8 hours to start tuning from scratch. I hope you are prepared for an all nighter tomorrow or tonight. Otherwise, continue with the method you are already using if that is working for you even in part, because you are probably closer to reasonably accurate results. Best of luck.
@Ashwun Gupta Thank you! I think am going to try the second method I mentioned since I have a good 10 hours at least to work…
@josh_siegel At least part of your Method 1 doesn’t make sense. Increasing Kd won’t speed your PID up, rather to the contrary - Kd is slowing down the approach more close to the target value
Kd helps avoid oscillations by braking earlier if you’re getting to the target too fast.
So your Method 1 would be more like increase Kp until oscillation, then increase Kd until it stops oscillation.
Throw in some Ki for the steady state, then do one or two more rounds of increasing Kp and Kd to make your PID faster.
@nenik what you described wrong with method 1 is what method 2 is. Thank you for letting me know about the derivative! I was way off lol.
yes good catch. kD will slow you down. @josh_siegel Remember, D is the instantaneous rate of change in the error so as you begin to accelerate and approach the target, the current error is much less than the previous error. This results in a negative value for kD* (currentError - prevError) and therefore reducing motor speeds and applying a “break”.
Zeigler nichols is not that far from Method 1 and is faster. You should wait until critical oscillation. Meaning when it stops settling down.
Then you can apply zeigler nichols formulas. You need to log data to get the time period of oscillation for the i and d constants.
Should not take you more than an hour. Maybe half an hour. Start with the arm down at the floor, and set the target to the height you want. Start the program. Log the data. Keep going up until oscillation gets out of control. Measure the milliseconds from peak to peak.
Do repeated executions or get a potentiometer to vary the kp value for you (more advanced). Buttons to send the arm to the floor help trimming time.
Manually tune after zeigler nichols formulas are applied. Should be close.
Optional: repeat process going from up position down to the floor. More of a tuning down kp and increasing kd because gravity assists in that momentum down to the floor. Whacking the floor makes oscillation near impossible.