Before starting this part of the article, I would like to share some knowledge about realization of PID controller. What I have discussed in the first and second part of the article are about digital realized PID. In other words, the PID controller is written in form of coding and implemented in a microcontroller or microprocessor.
On the other hand, there is also the analog PID which can be realized using operational amplifiers (op-amp). I will not discuss much about this analog PID but basically, if you have attended Electronic Devices classes, there are some circuit where op-amps are used as summing junction, amplifiers, integrator and differentiator. This is where the circuit can be combined to perform as a PID controller.
Back to the Practical Digital PID Controller, I will discuss about the integrator part of the controller. The problem with integrator in a PID controller is the saturation wind up.
For example, let's us look at a motor driver, driving a DC motor. Let's put that the driver's supply voltage is only 24 Volts and the PID controller output is 26 V, it will be saturated to 24 V. The error will be held constant at 2 V until infinity time.
If the controller output contains the integral element, the error will cause the integral term to be integrated to a large amount. If the desired set point is about to reach, the error will cause a large overshooting and undershooting about the reference point.
Therefore to prevent the integral term to integrate, a flag is used. If the controller output is saturated, the flag will be set. And for the next sampling time, the integral term will not integrate. If the controller output is not saturated, then the integral term will be allowed to integrate.
This method is actually not a proven method to prevent from saturation wind up. For a complete analysis and proofs of PID controller this site can be referred to.
The source code for the implementation of Practical PID Controller can be downloaded here. Note that the code is released under the GNU General Public License.
The code too could be checked out from sourceforge.net using Subversion at this server https://utmrobocon.svn.sourceforge.net/svnroot/utmrobocon/trunk/PID/
Practical PID Controller Part II
Practical PID Controller Part I