PID controller
|
A Proportional-Integral-Derivative controller or PID is a standard feedback loop component in industrial control applications. It measures an "output" of a process and controls an "input", with a goal of maintaining the output at a target value, which is called the "setpoint". An example of a PID application is the control of a process temperature, although it can be used to control any measurable variable which can be affected by manipulating some other process variable. For example, it can be used to control pressure, flow rate, chemical composition, force, speed or a number of other variables. Automobile cruise control is an example of an application area outside of the process industries.
The basic idea is that the controller reads a sensor. Then it subtracts the measurement from a desired "setpoint" to determine an "error".
The error is then treated in three different ways simultaneously:
- Proportional - To handle the present, the error is multiplied by a negative proportional constant P, and sent to the output. P represents the band over which a controller's output is proportional to the error of the system. E.g. for a heater, a controller with a proportional band of 10 deg C and a setpoint of 20 deg C would have an output of 100% at 10 deg C, 50% at 15 Deg C and 10% at 19 deg C. Adding the change to the output makes the output self-adjusting. For example, if the burner were to get dirty, decreasing the heater's efficiency, the baseline output would just drift upwards a bit, and then restabilise.
- Integral - To handle the past, the error is integrated (or averaged, or summed) over a period of time, and then multiplied by a constant I, and added to the proportional output. I represents the steady state error of the system. Using the Proportional term alone it is not possible to reach a steady set point temperature. Real world processes are not perfect and are subject to a number of environmental variables. As these variables are often constant they can be measured and compensated for. Using the Proportional example above; at 19.9 deg C the controller output is 1%, at this temperature environmental losses through heat transmission are 3%. In this scenario the system controller will never be able to reach set point, however it can be corrected by introducing an Integral term, which will attempt to remove errors that last for some time. In practice, the Integral term of a controller only considers a relatively short history of the controller.
- Derivative - To handle the future, the first derivative of the error (its rate of change) is calculated with respect to time, and multiplied by another constant D, and summed with the proportional and integral terms. The derivative term is used to govern a controller's response to a change in the system. The larger the derivative term the more rapidly the controller will respond to changes in the process value. This is a good thing to reduce when trying to dampen a controller's response to short term changes.
The generic transfer function for a PID controller is
- H(s)=<math>\frac{Ds^2+Ps+I}{s+C}<math>,
with C being a constant (typically .01 or .001).
Contents |
Tuning a PID loop
There are several methods for tuning a PID loop. The choice of method will depend largely on whether or not the loop can be taken "offline" for tuning, and the response speed of the system. If the system can be taken offline, the best tuning method often involves subjecting the system to a step change in input, measuring the output as a function of time, and using this response to determine the control parameters.
If the system must remain online, one tuning method is to first set the I and D values to zero. Increase the P until the output of the loop oscillates. Then increase I until oscillation stops. Finally, increase D until the loop is acceptably quick to reach its setpoint. The best PID loop tuning usually overshoots slightly to reach the set-point more quickly, however some systems cannot accept overshoot.
Effects of changes in parameters | ||||
Parameter | Rise Time | Overshoot | Settling Time | S.S. Error |
P | Decrease | Increase | Small Change | Decrease |
I | Decrease | Increase | Increase | Eliminate |
D | Small Change | Decrease | Decrease | Small Change |
Another tuning method is formally known as the "Ziegler-Nichols method". It starts in the same way as the method described before: first set the I and D gains to zero and then increase the P gain until the output of the loop starts to oscillate. Write down the critical gain (Kc) and the oscillation period of the output (Pc). Then adjust the P, I and D controls as the table shows:
Ziegler-Nichols method | ||||
Control | P | Tr | Td | |
P | 0,5·Kc | - | - | |
PI | 0,45·Kc | Pc/1,2 | - | |
PID | 0,6·Kc | Pc/2 | Pc/8 |
Problems
The PID controller algorithm itself has few problems. Most problems arise from instrumentation connected to the controller.
One common problem is "integral windup." It might take too long for the output value to ramp up to the necessary value when the loop first starts up. Sometimes this can be fixed with a more aggressive differential term. Sometimes the loop has to be "preloaded" with a starting output. Another option is to disable the integral function until the measured variable has entered the proportional band.
Some PID loops control a valve or similar mechanical device. Wear of the valve or device can be a major maintenance cost. In these cases, the PID loop may have a "deadband." The calculated output must leave the deadband before the actual output will change. Then, a new deadband will be established around the new output value.
Another problem with the differential term is that small amounts of noise can cause large amounts of change in the output. Sometimes it's helpful to filter the measurements, with a running average, or a low-pass filter. However, low-pass filtering and derivative control cancel each other out, so reducing noise by instrumentation means is a much better choice. Alternatively, the differential band can be turned off in most systems with little loss of control.
The proportional and differential terms can also produce undesirable results in systems subjected to instantaneous "step" inputs (such as when a computer changes the setpoint). To avoid this, some PID algorithms incorporate setpoint weighting where the setpoint and the process output are treated separately. Setpoint weighting introduces two parameters that are used to multiply the error entering the proportional and derivative terms to change the response to setpoint changes. The error in the integral term must be the true control error to avoid steady-state control errors. It should be noted that these parameters do not affect the response to load disturbances and measurement noise.
In practice, PID controllers are usually used as PI controllers, especially when dealing with measurements involving significant noise or delay (e.g. chemical composition, temperature). Many industrial PID systems actually measure the differential of the output quantity, which is always continuous (i.e., never has a step function), and usually moves in the same direction as the error.
Theory
Development of PID control originated from the observation that a proportional-only control can only eliminate the error between setpoint and process variable at one particular setpoint. At any other setting, there would be an offset between the setpoint and the true process value. Metaphorically, an operator could reset the controller setpoint by hand, until the actual process eventually stabilized at the desired value. In older control literature this is referred to "reset" action as a result. The derivative term reflects the ability to observe the rate of change of the process variable and again adjust the setpoint in anticipation of the final value. Again, an older term for this action is "rate".
A PID loop can be mathematically characterized as a filter applied to a frequency-domain system. Mathematical PID loop tuning induces an impulse in the system, and then uses the controlled system's frequency response to design the PID loop values. In loops with response times of several minutes, mathematical loop tuning is recommended, because trial and error can literally take days just to find a stable set of loop values. Optimal values are harder, and yet can save a company huge amounts of money. Commercial software is available from several sources, and can easily pay for itself if a PID loop runs a large, or expensive process. Some digital loop controllers offer a self-tuning feature in which very small setpoint changes are sent to the process, allowing the controller itself to calculate optimal tuning values.
Nomenclature
- Proportional Band is sometimes referred to as Gain
- Integral Band is sometimes referred to as Reset
- Derivative Band is sometimes referred to as Rate
Gain and proportional band are related but inverse quantities. A controller setting of 100% proportional band means that a 100% change of the error signal (setpoint-process variable) will result in 100% change of the output, which is a gain of 1.0. A 20% proportional band indicates that 20% change in error gives a 100% output change, which is a gain of 5.
There are three different forms of the PID controller. They are the standard or "non-interacting" form, the series or "interacting" form and the parallel form. The standard form is the ideal form where the terms are noninteracting in the time domain. The series or "interacting" algorithm applies the gain term to both integral and derivative terms (think of a PD and PI controller in series); this is effectively how older pneumatic and some analog controllers worked. It is the most restricted form of the three. The parallel form is the most general, "mathematician's" form and is the most flexible of the three. However, it is also the form where the parameters have little physical interpretation. It is mostly used when tuning the PID algorithm mathematically.
The series form is said to be the most intuitive to tune and is the classical form. The standard form admits complex zeros, which is useful when controlling oscillatory systems. Furthermore, the parallel form allows for pure proportional or integral action.
How to get one
PID controller functionality is a common feature of programmable logic controllers (PLC). They can also be implemented with any physical system that can produce ratiometric behavior and integration. Mechanical systems (usually the cheapest) can use a lever, spring and a mass. Pneumatic controllers were once common, but have been largely replaced by digital electronic controllers. Electronic systems are very cheap, and can be made by using an amplifier, a capacitor and a resistance. Software PID loops are the most stable, because they do not wear out, and their high expense has been decreasing.
External links
- sci.engr.* FAQ on PID controller tuning (http://www.tcnj.edu/~rgraham/PID-tuning.html)
- Information, including tutorial, on PID control algorithm (http://www.jashaw.com/pid)
- good, basic PID simulation in Excel (http://www.htservices.com/Applications/Process/PID2.htm)de:Regler