What Is PID—Tutorial Overview

Get Tuning Tips Newsletter PID stands for Proportional, Integral, Derivative. Controllers are designed to eliminate the need for continuous operator attention. Cruise control in a car and a house thermostat are common examples of how controllers are used to automatically adjust some variable to hold the measurement (or process variable) at the set-point. The set-point is where you would like the measurement to be. Error is defined as the difference between set-point and measurement. (error) = (set-point) - (measurement) The variable being adjusted is called the manipulated variable which usually is equal to the output of the controller. The output of PID controllers will change in response to a change in measurement or set-point. Manufacturers of PID controllers use different names to identify the three modes. These equations show the relationships:


Proportional Band = 100/gain Integral = 1/reset Derivative = rate = pre-act

(units of time) (units of time)

Depending on the manufacturer, integral or reset action is set in either time/repeat or repeat/time. One is just the reciprocal of the other. Note that manufacturers are not consistent and often use reset in units of time/repeat or integral in units of repeats/time. Derivative and rate are the same. Choosing the proper values for P, I, and D is called "PID Tuning". Find out about PID Tuning Software

Proportional Band
With proportional band, the controller output is proportional to the error or a change in measurement (depending on the controller). (controller output) = (error)*100/(proportional band) With a proportional controller offset (deviation from set-point) is present. Increasing the controller gain will make the loop go unstable. Integral action was included in controllers to eliminate this offset.

With integral action, the controller output is proportional to the amount of time the error is present. Integral action eliminates offset. CONTROLLER OUTPUT = (1/INTEGRAL) (Integral of) e(t) d(t)

The controller output is calculated by the rate of change of the measurement with time.Notice that the offset (deviation from set-point) in the time response plots is now gone. rate. Thus derivative takes action to inhibit more rapid changes of the measurement than proportional action. Integral action has eliminated the offset.) Integral action gives the controller a large gain at low frequencies that results in eliminating offset and "beating down" load disturbances. Derivative. the controller output is proportional to the rate of change of the measurement or error. Some manufacturers use the term rate or pre-act instead of derivative. Derivative action can stabilize loops since it adds phase lead. DERIVATIVE = RATE = PRE ACT Derivative action can compensate for a changing measurement. dm CONTROLLER OUTPUT = DERIVATIVE ---dt Where m is the measurement at time t. (Graphic courtesy of ExperTune Loop Simulator. The response is somewhat oscillatory and can be stabilized some by adding derivative action. When a load or set-point change occurs. This additional phase lag is what you give up by adding integral action. Derivative is often used to avoid overshoot. Derivative With derivative action. and pre-act are the same thing. if you use derivative action. more controller gain and reset can be used. The controller phase starts out at –90 degrees and increases to near 0 degrees at the break frequency. the derivative action causes the controller gain to move the "wrong" way when the measurement gets near the set-point. Derivative action adds phase lead and is used to compensate for the lag introduced by integral action. Generally. .

Sensors must be in appropriate locations and valves must be sized correctly with appropriate trim.With a PID controller the amplitude ratio now has a dip near the center of the frequency response. The controller phase now has a hump due to the derivative lead action and filtering. At higher frequencies the filter on derivative action limits the derivative action. Control Loop Tuning It is important to keep in mind that understanding the process is fundamental to getting a well designed control loop. P is in units of proportional band. and derivative action causes the gain to start rising after the "dip". the dynamic controller gain should be as high as possible without causing the loop to be unstable. So increasing P or I. decreases their action in the picture.) The time response is less oscillatory than with the PI controller. (Graphic courtesy of ExperTune Loop Simulator. put the controller in manual change the output 5 or 10%. At very high frequencies (above 314 radians/time. the Nyquist frequency) the controller phase and amplitude ratio increase and decrease quite a bit because of discrete sampling. If the controller had no filter the controller amplitude ratio would steadily increase at high frequencies up to the Nyquist frequency (1/2 the sampling frequency). for the tightest loop control. The process is typical with a dead time of 4 and lag time of 10. I is in units of time/repeat. then put the controller back in auto. Also see the response shape of loops with I or P too high or low. In general. You can use the picture to recognize the shape of an optimally tuned loop. Integral action gives the controller high gain at low frequencies. . Optimal is red. To get your process response to compare. Choosing a controller gain is accomplished easily with PID Tuning Software PID Optimization Articles Fine Tuning "Rules" This picture (from the Loop Simulator) shows the effects of a PI controller with too much or too little P or I action. Derivative action has helped stabilize the loop.

02 to 5 0.1 to 1 0. Until you've done it a few times.05 0.005 to 0.1 to 20 Valve Type Linear or Modified Percentage Linear or Modified Percentage Linear Linear or Modified Percentage Equal Percentage Linear These settings are rough.temperature. flow controllers . But after after few attempts (and falls). Use ExperTune's PID Loop Optimizer to find the proper PID settings for your process and controller.2 to 50 10 to 120 Integral rep/min 20 to 200 20 to 200 0. assume proper control loop design.1 to 20 0. the literature you've read really doesn't hit home.Starting PID Settings For Common Control Loops Loop Type Flow Liquid Pressure Gas Pressure Liquid Level Temperature Chromatograph PB % 50 to 500 50 to 500 1 to 50 1 to 50 2 to 100 100 to 2000 Integral min/rep 0. ski or maybe riding a bull.008 to 0.in fact it was kind of fun! The PID controller is every where .05 0.99 and Tuning and Control Loop Performance (McMillan) p 39) PID Controller CIRCUIT PID1. ideal or series algorithm and do not apply to all controllers. motion.02 to 0.005 to 0.1 0.01 to 0.05 0. you find it wasn't so bad after all .02 to 10 0.and its available in analog and digital forms.CIR Tuning the PID controller can be like learning to roller blade. Why use it? It helps get your output .1 to 50 1 to 100 0.1 Derivative min none none 0. (From Process Control Systems (Shinskey) p.

heater.but as usual. and where you're actually at (Vsensor).Integral.easy enough! To get the Integral term. current source GI converts V(2) to a current and integrates it on C1=1F. Ki and Kd adding in various amounts of these functions to get the system to behave the way you want. THE PID CONTROLLER You've probably seen the terms defined before: P -Proportional. temperature. Summing even a KI x ∫ Verror dt small error over time produces a drive signal large enough to move the system toward a smaller error. In many applications the PID controller can do the job .) So simple. I . These terms describe three basic mathematical functions applied to the error signal . Tuning a system means adjusting three multipliers Kp. OUTPUT PROCESS. with compromises. Reduces the final error in a system. This error represents the difference between where you want to go (Vset). position) where you want it. The resulting voltage becomes V(5) = L1 di / dt. yet so powerful! If tuned correctly.(velocity. Finally. THE CONTROL SYSTEM PID CONTROLLER. How do we create the PID terms? To get the Proportional term. To include the effects of the motor's inertia or heater's thermal mass. A quick substitution of L1 = 1 H and i = Verror gets you V(5) = d Verror / dt. and with little error. The table below summarizes the PID terms and their effect on a control system. Term P Proportional I Integral D Derivative Math Function KP x Verror Effect on Control System Typically the main drive in a control loop. you'll get a chance tune a PID controller. D Derivative. This helps reduce overshoot and ringing. with minimal overshoot. EP multiples Verror at V(2) by a fixed gain of 1 . we've added some time delay . The controller performs the PID mathematical functions on the error and applies the their sum to a process (motor. in a short time. Verror = Vset . etc.Vsensor. It has no effect on final error. The gain of 100 could represent an output transfer function of 100 RPM / V or 100 ° C / V. Counteracts the KP and KI terms when the output KD x dVerror / dt changes quickly. the Derivative term is created by GD converting V(2) to a current and forcing it through L1. KP reduces a large part of the overall error. the signal Vsensor should move closer to Vset. EOUT represents a very simplified model of a process to be controlled like motor velocity or heater temperature. After a short intro to the PID terms and an example control system.

2 and rerun the simulation (Change EPID to look like . Wow. 2. Although Vout is simulated in volts. what is the sensor voltage compared to the desired 10V? The output falls short by 5V! To reduce this error. a thermistor circuit could produce 0. increase KP until the output starts overshooting and ringing significantly. 10 0 0 ). Push KP up higher to 20 or 30. Plot the system input V(1) and the sensor output (12). 20 0 0. For motor velocity. we know it really represents other variables like velocity in RPM or temperature in °C.. a tachometer could generate 1 V / 100 RPM. HANDS-ON DESIGN Run a simulation of the circuit file PID1.. SENSOR. for temperature. SET KD. the error reduces. your system will become unstable and break out into song (oscillate). typically by a voltage. Start with a small value like KD=0. But as you can see. Now you're wrestling control back into the system . Increase KD until the overshoot is reduced to an acceptable level. I and D terms at V(3). TUNING THE PID CONTROLLER Although you'll find many methods and theories on tuning a PID. 3. KI=0 and KD=0. Yes. SET KP.CIR. KI=0 and KD=0. here's a straight forward approach to get you up and soloing quickly. SET KI. SET KD. V(4) and V(5). 1. You can adjust the PID terms at the EPID source that adds the P. increase KP to 10 (Change EPID to look like . Eventually.. the PID multipliers are set to KP=1. The derivative term can rescue the response by counteracting the KP drive when the output is changing. but the overshoot gets worse. Because a sensor does not respond instantly.0) 0 1 0 0 SET KP. Back off KP to 20 or so. the output now reaches 9V. reducing the error to 1V..0) (5. VSET generates a 10V step input voltage to the control system.the ringing and . the output is getting wild with overshoot and ringing. Initially. ESENSOR models this feedback device. Starting with KP=0. The sensor tells you.into the output using two cascaded RC filters.0) (4. Although the response looks smooth.2 ). Increase KI until the final error is equal to zero. what's happening at the control system output.01 V / deg C. EPID 6 0 POLY(3) (3. an RC filter is also added here to model its finite response time.

DIVING DEEPER Diving a little deeper you can get a clearer view of the PID components. a ramp function. 20 10 0.5 ). What kind of gain do you need for a 1% error? You can easily calculate it as a gain of 100. KI=0 and KD=0. What is the final error for each case? You may have noticed the errors of 1 and 0. KI=0 and KD=0.5 and plot the I term at V(4).5V (or 5%)! Now. Now plot the D term V(5) which we know is dVerror / dt. we've already seen how large gain cause overshoot.. but the final error is a disappointing 0. Alternatively. Start with KI = 10 ( EPID should look like . However.let's see how. INSIDE D KD counteracts KP . Notice how dVerror / dt swings negative when Verror is initially positive. This will integrate the remaining error into a drive signal big enough to reduce the error further. big KP gets you into big trouble with overshoot and ringing. How does this help? Essentially D counteracts the P term potentially reducing ringing and oscillations. the faster it will move toward 10V. Before we go beneath the surface. To get a good view of D. This makes sense .no change in output. ringing and oscillations! KP can't do it alone. However. an integrator can also give you a big gain by accumulating even a small error over time. With KP=20. The nice thing about the D term is that it goes to zero as the output settles. Like the other terms.5.overshoot are reduced! Crank up KD some more. KI=0 and KD=0..5 the response looks respectable. You can estimate the error by Verror ≈ Vset / KP for large KP. a value is reached where the KI does more harm than good as the system becomes less stable. Check out the last half of the V(12) . set the Y-Axis limits to +100 /-200V.the sensor output moves slowly toward 10V! You might want to put up a cursor on the plot to monitor the exact value of V(12). KI=0 and KD=0. Add in some of the D function by setting the multipliers to KP=10. INSIDE I We've seen how a large gain produces a small error. set KP=10.5V are proportional to the gains of 10 and 20. Plot V(1) and V(12). The bigger you make KI. What does it look like? Notice. INSIDE P Run a couple of simulations with KP=10 and KP 20. no derivative term.5. The initial overshoot should be significantly reduced. SET KI. Return KD to around 0. Plot the P function V(3) which is really Verror. representing Verror integrated over over . Set KP back to 10 and run a simulation. Run a simulation with KP=10. Improvement should continue to a point where the system becomes less stable and overshoot increases again. try the KI term.

The I term completes the controller's job by moving the output toward an error of zero.. SIMULATION NOTE Need a handy way to combine multiple signals such as the PID sum? A controlled source can be a function of multiple inputs described by a polynomial.0) 0 10 2 1 creates a polynomial of the form V(6.. you can get higher order terms and cross terms by extending the coefficient list VO = .+ k4∙V1∙V1 + k5∙V1∙V2 + k6∙V1∙V3 + + k7∙V2∙V2 + k8∙V2∙V3 + + k9∙V3∙V3 If you're not using a term. This feature is great for simpler polynomials.0) (4.0) (5.0) + 2 ∙ V(4.0) + 1 ∙ V(5. Add in the I function by setting KP=10. PID1. The example below EPID 6 0 POLY(3) (3. you can't just leave it out.5. VO = k0 + k1∙V1 + k2∙V2 + k3∙V3 In fact. Keeping track of the coefficient list for large polynomials can get crazy fast.time.CIR . SPICE FILE Download the file or copy this netlist into a text file with the *. KI=40 and KD=0. builds up to a significant drive voltage.0) or more generally.THE PID CONTROLLER * * SET POINT VSET 1 0 PWL(0MS 0MV RSET 1 0 1MEG * * CALCULATE ERROR EERROR 2 0 1 12 1 RERROR 2 0 1MEG 1MS 10V 2000MS 10V) . you need to put a 0 in its place.cir extention.0) = 0 + 10 ∙ V(3. What is this polynomial? The equation is defined by a coefficient list at the end of the statement.

TRAN 10MS 2000MS * * VIEW RESULTS .0) 0 1 0 0 RPID 6 0 1MEG * * AMPLIFIER EAMP 7 0 6 0 1 RAMP 7 0 1MEG * * PROCESS BLOCK WITH TIME LAG (PHASE SHIFT) EOUT 8 0 7 0 100 RP1 8 9 100K CP1 9 0 1UF RP2 9 10 100K CP2 10 0 1UF * * SENSOR BLOCK WITH TIME LAG ESENSOR 11 0 10 0 0.PROBE .01 RP3 11 12 10K CP3 12 0 1UF * * ANALYSIS .END .INTEGRAL TERM GI 0 4 2 0 1 C1 4 0 1 R1 4 0 1MEG * * D .PRINT TRAN V(1) V(12) . ADJUST PID MULTIPLIERS EPID 6 0 POLY(3) (3.PROPORTIONAL TERM EP 3 0 2 0 1 RP 3 0 1MEG * * I .0) (5.0) (4.* * P .DERIVATIVE TERM GD 0 5 2 0 1 L1 5 0 1 * * ADD PID TERMS.

Sign up to vote on this title
UsefulNot useful