As explained in the last article on PID control, the aim of the PID regulator is to compute a correction according to the error (the difference between the target speed and the actual speed), its integral and derivative, and 3 chosen coefficients : KP (for proportional correction), KD (for derivative correction) and KI (for integral correction). This week, Xavier and I made some corrections on the software (presented in this article) and choose the coefficients.
This coefficient was the easiest to choose by following the steps indicated in this article.
We took the smallest KP for which the system oscillates (called critical KP) and multiplied it by ⅔.
The derivative gain is supposed to reduce the oscillations of the system.
At first, we tried what Alexis had suggested : increase KD until the system oscillates and then, multiply it by ⅔. But no matter how much we increased KD, the system didn’t seem to oscillate.
Then, we tried another usual tuning method: Ziegler-Nichols’ Tuning. We just need to find the critical KP, measure the period of the oscillations generated and calculate KD and KI by multiplying this period by a coefficient given in the paper. But we probably failed to measure the period of the oscillations accurately, so the KI and KD coefficients obtained didn’t seemed adequate at all.
But we had henceforth an idea of the value of KD beyond which the system oscillates. Finally, this morning, we tuned KD manually to obtain the best speed response possible:
Then, we increased KI to a non-zero value. Even if there is no final offset on the time ranges over which our tests were performed, this will prevent us from having one over a longer period.
Note that the system oscillates very fast if we increase KI too much, and if KI is too big, the value of the integral error exceeds the maximum value on a int64 and overflows (purple curve).
Eventually, with the coefficients we chose, we obtained this kind of speed response:
Changing speed between 10, 20 and 30 RPS
We tried to solve the undershoot issue when we slow down the motor by changing the KD coefficient according to the acceleration / deceleration, but it didn’t go very well, so we abandoned the idea. If you know a way to improve the undershoot, feel free to comment !
But anyway, as you will see in the next article, the moments while the Phyllo stabilizes its speed before it can age or rejuvenate the petals give it part of its charm 🙂