The original work is at here. I borrow this existing implementation and test it with some tuning procedure I have read.
There are many propose method to tune a PID controller, and here I write down my finding in following these procedure to tune a PID controller
- Online trial and error method
Adopt from link
Here is the procedure
-
Find KP: Set τI=∞, and τD=0. Find KC such that the system is critically stable. Denote this value at KP, max
-
Find τI: Set KP=0.5KP, max, and τD=0. Find τI such that the system is critically stable. Denote this value at τI, min
-
Find τD: Set KP=0.5KP, max, and τI=2τI, min. Find τD such that the system is critically stable. Denote this value at τD, max
-
The tuning result is KP=0.5KP, max; τI=2τI, min; τD=0.5τD, max
Here are tuning steps
Step | Result |
---|---|
1 (KP=2; τI=∞;τD=0) | |
2 (KP=1; τI=0.012;τD=0) | |
3 (KP=1; τI=0.006;τD=0.006) | |
4 (KP=1; τI=0.006;τD=0.003) |
- Ziegler-Nicholas method
Detail please refer to link
-
Setting KI=0, and KD=0, and find ultimate gain Ku and oscillation periodTu
-
Setting KP, τI and τD according to this table
Control type | KP | τI | τD |
---|---|---|---|
P | 0.5Ku | - | - |
PI | 0.45Ku | Tu/1.2 | - |
PD | 0.8Ku | - | Tu/8 |
classic PID | 0.6Ku | Tu/2 | Tu/8 |
Pessen Integral Rule | 0.7Ku | Tu/2.5 | 3Tu/20 |
some overshoot | 0.33Ku | Tu/2 | Tu/3 |
no overshoot | 0.2Ku | Tu/2 | Tu/3 |
Ziegler-Nicholas in action
- I run it in both windows and Linux and find that the tuning value is quite difference. It may because of the different implementation of 3rd parties packages.