Change the Computing Method of PTerm
My Problems
I have used the codes to do temperature control, it is useful. But sometimes, it could not work.
PTerm may be a instant value
From the photo, I think the PTerm is a instant value. So I changed the method and do some new tests. I did some change in the test file, changed the sample time to 0.1s and loop time to 0.01s , the result was better than the original codes.
As far as I can see, the only thing you did is break the sample functionality.
The sample functionality allows you to let the PID controller run at a lower frequency than the calls to update(). You changed it so that if you try to run it at a lower frequency than the update() calls, it starts to act as a P controller in between, thus destabilising the controller.
However, I'm an information engineer, and not all that familiar with PID control so maybe I'm missing something.