You are on page 1of 5

# What is a PID controller?

Return to Contents PID stands for Proportional-Integral-Derivative. This is a type of feedback controller whose output, a control variable (CV), is generally based on the error (e) between some user-defined set point (SP) and some measured process variable (PV). Each element of the PID controller refers to a particular action taken on the error: Proportional: error multiplied by a gain, Kp. This is an adjustable amplifier. In many systems Kp is responsible for process stability: too low and the PV can drift away; too high and the PV can oscillate. Integral: the integral of error multiplied by a gain, K i. In many systems Ki is responsible for driving error to zero, but to set Ki too high is to invite oscillation or instability or integrator windup or actuator saturation. Derivative: the rate of change of error multiplied by a gain, K d. In many systems Kd is responsible for system response: too high and the PV will oscillate; too low and the PV will respond sluggishly. The designer should also note that derivative action amplifies any noise in the error signal.

Tuning of a PID involves the adjustment of Kp, Ki, and Kd to achieve some user-defined "optimal" character of system response. Although many architectures exist for control systems, the PID controller is mature and well-understood by practitioners. For these reasons, it is often the first choice for new controller design. It satisfies Occams Razor in being the simplest solution for most cases. A simple digital implementation of a PID controller, in which rectangular integration is assumed, is as follows: Pk = Kp (ek ek-1) Ik = K i T e k Dk = (Kd/T) (ek 2 ek-1 + ek-2) CVk = CVk-1 + Pk + Ik + Dk where ek = SPk PVk, and T is the sampling interval. This is referred to as two-degree-of-freedom (two-DOF) design. Notice for this implementation its assumed that all three controller actions involve e k. Many practitioners try to avoid this: applying Kp and/or Kd to the set point can magnify transient errors introduced by rapid changes to the SP. Consider the alternative implementation, in which Kp and Kd are applied only to the PV: Pk = - Kp (PVk PVk-1) Ik = K i T e k Dk = -(Kd/T) (PVk 2 PVk-1 + PVk-2) ...which is one-DOF. You can apply any level of complexity to a PID implementation simply by basing it on a different type of integration. Consider this implementation based on trapezoidal integration: Pk = - Kp (PVk PVk-2) Ik = + (Ki T/2) (ek + 2 ek-1 + ek-2) Dk = 2 (Kd/T) (PVk 2 PVk-1 + PVk-2)

CVk = CVk-2 + Pk + Ik + Dk Increasing complexity is not necessarily wise, however: this alone will not make derivative action noise go away, nor will it make an inherently unstable system stable. The practice of having Kp=0 and Kd=0 acting on the SP are only special cases of two-DOF design and are mostly used in process industries. There is nothing wrong in having greater K p acting on the SP than on the PV in applications where SP tracking is required. The effect is improved transient response to SP change. In transfer function terms, this is zero placement. If the proportional term uses the error signal, then the closed loop transfer function (CLTF) will have a lead term (or, numerator zero). This can give rise to quick, large changes if the command contains steps (derivative action makes things worse). Asea Brown Boveri is one manufacturer providing a more than true two-DOF controller. It uses the ideal form with a weighting factor (beta) in the SP path. You can then tune for optimum load rejection (K p and Kd on error) and then adjust beta to weigh the extent to which the SP is included in the proportional action; e.g. if beta=0, you have an I-PD controller; if beta=1 you have an IP-D controller. Some tuning methods allow you to calculate beta to position the resulting closed-loop zero optimally.

Motion control
In many cases, you might not want to let the SP make steps, even if the user requests it. Steps can cause integrator windup, actuator saturation, stresses, and other nonlinear effects. A motion controller (for instance) would ramp the SP from one position to another at a velocity and acceleration the motor can handle. In motion control, a full PID might include a first-order filter in front of the SP memory, to separate the system poles. This is essential if you choose PID on single loops instead of some multivariable method for motion control. In motion control applications, the SP is governed by a trajectory generator. Besides the standard parameters (Kp, Ki, and Kd), other parameters are involved: velocity, acceleration, and friction feedforward. Their purpose is to reduce tracking error during acceleration/deceleration, at higher speeds and at motion start/stop. These are equivalent to variable gain and SP weighting.

## When must a PID be tuned, and why?

Return to Contents You may not encounter the same process twice. If you dont, you wont see the same type of controller twice. There are different types of objectives to be addressed by a controller: error can be minimized in different ways, as can CV activity. Some systems have interactions, and those interactions may be of various strengths. And any interaction affects tuning of an individual PID. There is no single definition of best tuned that applies to all loops, so no single tuning aid will tune all loops optimally. Tuning is part of the design of the loop. You might see a need for a loop to be tuned if it responds slowly, or if it oscillates too much, or if it has a steady-state error; and most definitely if its unstable! :-)

## A PID MAY HAVE TO BE TUNED WHEN...

Careful consideration was not given to the units of gains and other parameters.

The process dynamics were not well-understood when the gains were first set, or the dynamics have (for any reason) changed. Some characteristics of the control system are direction-dependent (e.g. actuator piston area, heat-up/cool-down of powerful heaters). You (as designer or operator) think the controller can perform better.

Always remember to check the hardware first. You may not have to tune the controller at all.

## A PID MAY NOT HAVE TO BE TUNED WHEN...

A control valve sticks. (You may be able to spot this without leaving the control room.) Valves must be able to respond to commands. A control valve is stripped out from high-pressure flow. A valves response to a command must have some effect on the system. Measurement taps are plugged, or sensors are disconnected. Bad measurements may have you correcting for errors that dont exist.

## How is a PID tuned?

Return to Contents Coming up with first-pass tuning values is very easy: make a step change on the output, trend the response, pull two values off the trend, and apply a few simple equations. You then check how well the tuning works in real life. That's the hard part. And for many loops, this works fine. But you have to be able to come up with acceptable control for the problem loops as well, and that doesn't reduce to a simple procedure.

The operator
In a process plant you do NOT block the operator from doing anything unless it is absolutely unsafe. In all other areas, the operator is the driver and has a free hand.

Gain scheduling
Systems in which process dynamics will change in known ways during operation will often benefit from gain scheduling, in which Kp (at least) is the result of a closed-form expression or a table look-up based on a known process characteristic. This technique depends on good knowledge or prediction of the process.

Feedforward control
Systems in which set point changes or disturbances can be anticipated can sometimes benefit from feedforward action, in which the anticipated changes are processed independently of process error. You can compensate for them approximately, before they have a chance to influence process dynamics. One reader does this with cascade control loops on the Honeywell DCS by using the SP as feedforward input, then optimizing feedback response with the normal tuning constants, and adjusting feedforward gain to optimize the SP response separately.

## Inner loop control

Sometimes you may want to control separate quantities within the same system, e.g. position and velocity in motion control. In those cases you might have an outer loop for position, and an inner (faster responding) loop for velocity. (Dont apply Kd twice!)