Further Development

The PID controller presented here is a simplified example. The controller should work fine, but it might be necessary to make the controller even more robust (limit runaway/overflow) in certain applications. Adding saturation correction on the integral term, basing the proportional term on only the system process value can be necessary.

In the calculating of IFactor and DFactor the sample time T is a part of the equation. If the sample time T used is much smaller or larger than 1 second, the accuracy for either IFactor or DFactor will be poor. Consider rewriting the PID algorithm and scaling so accuracy for the integral and derivative terms are kept.