4.1 PID Controller Background
A complete discussion of Proportional Integral Derivative (PID) controllers is beyond the scope of this document. However, this section provides some basics of PID operation.
A PID controller responds to an error signal in a closed control loop, and attempts to adjust the controlled quantity to achieve the desired system response. The controlled parameter can be any measurable system quantity, such as speed or flux. The benefit of the PID controller is that it can be adjusted empirically by varying one or more gain values and observing the change in the system response.
A digital PID controller is executed at a periodic sampling interval. It is assumed that the controller is executed frequently, hence the system can be controlled. The error signal is formed by subtracting the desired setting of the parameter to be controlled from the actual measured value of that parameter. The sign of the error indicates the direction of change required by the control input.
The Proportional (P) term of the controller is formed by multiplying the error signal by a 'P' gain, causing the PID controller to produce a control response, which is a function of the error magnitude. As the error signal becomes larger, the 'P' term of the controller becomes larger to provide more correction.
The effect of the 'P' term tends to reduce the overall error as time elapses. However, the effect of the 'P' term diminishes as the error approaches zero. In most systems, the error of the controlled parameter gets very close to zero but does not converge. The result is a small remaining steady state error.
The Integral (I) term of the controller is used to eliminate small steady state errors. The 'I' term calculates a continuous running total of the error signal. Therefore, a small steady state error accumulates into a large error value over time. This accumulated error signal is multiplied by an 'I' gain factor and becomes the 'I' output term of the PID controller.
The Differential (D) term of the PID controller is used to enhance the speed of the controller and responds to the rate of change of the error signal. The 'D' term input is calculated by subtracting the present error value from a prior value. This delta error value is multiplied by a 'D' gain factor that becomes the 'D' output term of the PID controller.
The 'D' term of the controller produces more control output as the system error changes rapidly. Not all controllers will implement the 'D' or less commonly, the 'I' term. For example, this application does not use the 'D' term as it could amplify the noise, which in turn can cause excessive changes in the PWM duty cycle affecting the operation of the algorithms and produce over current trips.