Chemical Process Controls: PID control, part I By Peter Woolf (pwoolf@umich.edu) University of Michigan Michigan Chemical Process Dynamics and Controls Open Textbook version 1.0 Creative commons Heater Example F, Tin Goal: Heat a stream to a desired set point temperature, Tset Assumptions: • All liquid in lines and tank, thus Fin=Fout=F • Flow is constant • Fluid does not boil • No reactions • Tank is well stirred • Heater has no lag F, T F, Tin Simplified Energy Balance: TÝ Qfeed Qexit Qheat F, T How should we control T to Tset using Qheat? Option 1: On/off control (bangbang control) IF TC1>TC1set THEN: set Qheat to zero ELSE set Qheat to max Assume we can control Qheat via the heating coil Advantages of on/off control: • Relatively simple to design and execute • Binary sensors and actuators are generally more reliable and less expensive F, Tin F, T How should we control T to Tset using Qheat? Option 1: On/off control (bangbang control) IF TC1>TC1set THEN: set Qheat to zero ELSE set Qheat to max Problems with on/off control: • Inefficient (like driving with full gas and full brakes) • Can generate noise when seeking stability • Physical: Wear on valves and switches • Physical: Hydraulic hammer F, Tin F, T How should we control T to Tset using Qheat? Option 2: Continuous control IF TC1>TC1set THEN: adjust down Qheat ELSE adjust up Qheat Partial Answer: PID Control Questions: • What does “adjust up” and “adjust down” mean exactly? • What information do you want to use to decide your adjustment? • All past measures? • Just current measures? • Estimate of future states? • All of the above? • What if you can’t provide more heat? P, I, D, PI, PID • P: Proportional control. Responds in proportion to the current deviation. Philosophy of P Deviations will be affected in proportion to their magnitude. A temperature deviation of 10 degrees will receive 10x the response that a 1 degree deviation will cause. P, I, D, PI, PID • P: Proportional control. Responds in proportion to the current deviation. Example: TÝ Qfeed Qexit Qheat Qheat K c (Tset T) c What is the steady state? Proportional gain P, I, D, PI, PID At steady state Set dT/dt=0 and solve Q feed Qexit c K cTset Tss Kc Observations: 1. At steady state we will always get an offset with P-only control. 2. Larger Kc means smaller offset 3. Larger Kc values bring you near to steady state faster. Increasing the speed of response is the primary benefit of P- control. 4. Larger Kc requires greater controller effort P, I, D, PI, PID • I: Integral control. Responds proportionally to the integral of the deviation. Philosophy of I Deviations will be affected in proportion to the cumulative sum of their magnitude. A temperature deviation of 1 degree for 10 time steps will receive 10x the response that a 1 degree deviation for 1 time step will cause. P, I, D, PI, PID • I: Integral control. Responds proportionally to the integral of the deviation. Example: TÝ Q feed Qexit Qheat Qheat What is the steady state? 1 I t (T set T)dt 0 Integral control gain P, I, D, PI, PID . At steady state Set dT/dt=0 and solve Observations: 1. Key Advantage: Integral control eliminates offset 2. Can destabilize controller 3. Integrator windup T Qfeed Qexit t (T 1 I I Qfeed Qexit set T)dt 0 0 t (T set T)dt 0 d d t I Qfeed Qexit (Tset T)dt dt dt 0 Tss Tset P, I, D, PI, PID • D: Derivative control. Responds proportionally to the change of the deviation. Philosophy of D Deviations will be affected in proportion to their Speed. A temperature change of 10 degrees/second will receive 10x the response that a 1 degree/second deviation will cause. P, I, D, PI, PID • D: Derivative control. Responds proportionally to the change of the deviation. Example: TÝ Q feed Qexit Qheat Qheat What is the steady state? d(Tset T) D dt Derivative control gain P, I, D, PI, PID At steady state Set dT/dt=0 and solve d(T T) set TÝ Q feed Qexit D dt TÝ Q feed Qexit D TÝ Q Q feed exit Ý T 1 D Therefore derivative control alone does not yield a steady state temperature--it only resists change P, I, D, PI, PID • D: Derivative control continued: – Observations: Corrects for fast responses and oscillations. Reducing oscillations in feedback systems is the key advantage of derivative control. • Does not eliminate offset • Slows the response P, I, D, PI, PID • D: Derivative control continued: • Derivative kick: if we have a setpoint change, we will get a spike from our D controller causing derivative kick. This is removed by replacing the derivative term with just -T’, instead of (Tset-T). • Calculating derivatives: We never have infinite measurements from a real system, so how to calculate derivatives? Simplest way is finite difference: d(x(i)-x(i1))/d(t), or lagged over a window. P, I, D, PI, PID • PID: All control elements combined to yield the strengths of each method. Philosophy of PID Deviations will be affected in proportion to their magnitude, cumulative sum of Magnitude, and Speed . P, I, D, PI, PID • PID: All control elements combined to yield the strengths of each method. e.g. TÝ Qfeed Qexit Qheat Qheat d(Tset T) K c (Tset T) (Tset T)dt D c I 0 dt 1 P t I D Test your PID intuition!!! P signal K c F Fset I 1 I D t dt 0 D d c dt Test your PID intuition!!! P signal K c I 1 I D t dt 0 D d c dt F Fset Step: P + I = PI = PI + D = PID = Response to a step then a drop Results from PID.example.2.xls Response to a sinusoid Results from PID.example.2.xls When to use which controller? Estimate When to use Examples P present Systems with slow responses, t olerant to offset I back Not often used alone, as is t oo slow Example use: float valves, thermostats, humidistat. Example use: used for very noisy systems D forward Not used alone because is t oo sensitive t o noise and does not have setpoint Example use: none PI P resent & back Often used P ID All time Often used, most robust, but can be noise sensitive Example use: thermostats, flow control, pressure control Examples: Cases where the system has inertia that could get out of hand: temperature and concentration measurements on a react or for example. Avoid runaway. PID vs Feed forward, Feed back control • P, I, and D look at different time windows – P responds to current error – I responds to accumulated past error – D anticipates future error • Feedback control: uses changes in the control variable to control the control variable. • Feed forward control: uses changes in an upstream variable to control the control variable. • BUT FF and FB can use P, I, PI, or PID control Basic PID modeling Tank example: Imagine we have a tank where the exit flow is governed by a P ID controller to maintain the level in the tank. LC 1 Questions: What will this do? LC1 Fo How do we model it? TK 1-001 V1 dh Fo c * v1 * h dt 1 d v1 Fos K C dt i i dt A h hset Fo TK 1-001 Basic PID modeling V1 dh Fo c * v1 * h dt 1 d v1 Fos K C dt d i i dt A h hset Substitute in the error term d d(h hset ) dh dt dt dt Create a new variable xI dxI dt Fo TK 1-001 Basic PID modeling V1 dh Fo c * v1 * h dt 1 d v1 Fos K C dt d i i dt A h hset Substitute new terms in dh A Fo c * v1 * h dt 1 dh v1 Fos KC x I d i dt dxI h hset dt Basic PID modeling dh 1 1 dh Fo c * Fos KC x I d h dt A i dt dxI h hset dt Substitute and rearrange dh A Fo c * v1 * h dt 1 dh v1 Fos KC x I d i dt dxI h hset dt Basic PID modeling dh 1 1 dh Fo c * Fos KC x I d h dt A i dt dxI h hset dt Simplify and move dh/dt to the left Solve numerically Or analytically! 1 1 Fo c * Fos KC x I h i dh A c dt 1 * d h A dxI h hset dt PID modeling complexities • Heaters, valves, and switches don’t have infinite range. – Solve with IF.. THEN.. Type logic • Responses become unstable with some parameter values Heater Example F, Tin Goal: Heat the output stream to a desired set point temperature, Tset Assumptions: • All liquid in lines and tank, thus Fin=Fout=F • Flow is constant • Fluid does not boil • No reactions • Tank is well stirred • Heater has no lag • Heater has finite range F, T idealized behav ior Case: Heated CSTR Starting at 120, and Tset=130. Tfeed=100. 135 (see PID.example.xls) 130 temperature 125 120 idealized res pons e T feed limited ac tion 115 110 105 100 0 0 .5 1 1 .5 2 t ime 2 .5 3 3 .5 idealized behav ior Case: Heated CSTR Starting at 120, and Tset=130. Tfeed=100. 140 135 (see PID.example.xls) 130 temperature 125 idealized res pons e T feed limited ac tion 120 115 Here we use a smaller KI to show integrator windup 110 105 100 0 1 2 3 4 t ime 5 6 7 idealized behav ior 140 Case: Heated CSTR Starting at 120, and Tset=130. Tfeed=100. 135 (see PID.example.xls) 145 temperature 130 125 idealized res pons e T feed limited ac tion 120 115 110 Here Ki and Kc are smaller. 105 What happened?? 100 0 1 2 3 4 t ime 5 6 7 idealized behav ior 140 Case: Heated CSTR Starting at 120, and Tset=130. Tfeed=100. 135 (see PID.example.xls) 145 temperature 130 125 idealized res pons e T feed limited ac tion 120 115 110 Here Ki and Kc are even smaller. 105 What happened?? 100 0 1 2 3 4 t ime 5 6 7 Outstanding questions • How should we choose Kc, Ki, Kd? • Can we know what parameter sets will make our system stable?