Industrial Automation Automation Industrielle Industrielle Automation set point controller + - plant measurement 2.2 Control of continuous processes Control de procesos continuos Régulation de systèmes continus Regelung stetiger Strecken controlled variables 2.2 Continuous control 2.1 Instrumentation 2.2 Continuous control 2.2.1 Plant modeling and identification 2.2.2 Controllers 2.2.2.1 On/Off (two-point) controller 2.2.2.2 PID controller 2.2.2.3 Nested Controllers 2.3 Programmable Logic Controllers Industrial Automation Continuous control 2.2 - 2 Motivation for this chapter This is an intuitive introduction to automatic control as a preparation for the PLC programming lab at Siemens intended for students who did not enjoy control courses. For a correct engineering approach, dedicated courses are recommended (e.g., by Prof. Longchamp and Prof. Bonvin). . Content - modeling of plants - two-point controller - PID controller - nested controllers Industrial Automation Continuous control 2.2 - 3 Open Loop control vs. Closed Loop control open loop: temperature is imprecise, depends on ambient temperature and cooking quantity but heating level and duration can be modulated (e.g. let boil and then simmer during 30’) 3 2 4 1 5 sequential control closed loop: 140 120 180 200 + 220 - higher /lower temperature closely controlled, requires measurement of the output variable (temperature) continuous control temperature sensor Industrial Automation Continuous control 2.2 - 4 Open loop vs. closed loop open-loop control / command (commande / pilotage, Steuern) keywords: sequential / combinatorial, binary variables, discrete processes, "batch control", "manufacturing" closed-loop control / regulation (régulation, Regelung) keywords: feedback, analog variables, continuous processes, "process control" set-point (solicited) valeur de consigne Sollwert commands sequencer clock output plant - error (deviation) plant state display on/off controller + display measurement control variable variable de commande Stellgrösse plant output plant state measurement % process value valeur mesurée, Istwert Industrial Automation Continuous control 2.2 - 5 Definitions from IEC 351-47-01 closed-loop control (feedback control) process whereby one variable quantity, namely the controlled variable is continuously or sequentially measured, compared with another variable quantity, namely the reference variable, and influenced in such a manner as to adjust to the reference variable Closed action path in which the controlled variable continuously or sequentially influences itself 351-47-02 open-loop control process in a system whereby one or more variable quantities as input variables influence other variable quantities as output variables in accordance with the proper laws of the system Open action path or a closed action path the fact that the output variables being influenced by the input variables are not continuously or sequentially influencing themselves and not by the same input variables. Industrial Automation Continuous control 2.2 - 6 Example Cruise Control • Control Objective: maintain car velocity • Measured Process Variable (PV): car velocity (“click rate” from transmission rotation) • Manipulated Variable: pedal angle, flow of gas to engine • Controller Output (CO): signal to actuator that adjusts gas flow • Set point (SP): desired car velocity • Disturbances (D): hills, wind, curves, passing trucks.... Source: OCAL, clker.com Source: http://apmonitor.com/che436/uploads/Main/Lecture3_notes.pdf Industrial Automation Continuous control 2.2 - 7 Example Cruise Control Source: http://apmonitor.com/che436/uploads/Main/Lecture3_notes.pdf Industrial Automation Continuous control 2.2 - 8 2.2.1 Plant Modeling 2.1 Instrumentation 2.2 Control 2.2.1 Plant modeling and Identification 2.2.2 Controllers 2.2.2.1 On/Off (two-point) controller 2.2.2.2 PID controller 2.2.2.3 Nested Controllers 2.3 Programmable Logic Controllers Industrial Automation Continuous control 2.2 - 9 Modeling 1) analysis of control systems 2) define a controller that meets physical and economical requirements The first step is to get to know the plant, i.e., express the plant’s behavior in a mathematical way, generally as a system of differential equations, • White box approach: analyzing physical principles (requires that all elements are known) • Black box approach: identifying the plant’s parameters by analyzing its behavior (output) in response to an input change. +/- ? what is the effect of increasing thrust ? Industrial Automation Continuous control 2.2 - 10 Modeling for regulation: continuous processes Examples of such processes: drives, ovens, vehicles, chemical reactors x y y = F (x, t) Industrial Automation Continuous control 2.2 - 11 Example linear plant: Electrical motor with permanent magnet motor J [Nms] (inertia) i Ue (command tension) L ω [rad/s] (speed) R T [Nm] (torque) ui [V] (induced tension) Ue = R i + L di dt + ui di 1 = ui = K ω dt T = Ki dω dω dt T = L K = dt (Ue – K ω – R i) J i J ω Ue = K s2 (LJ) + s (RJ) + K2 Laplace - transfer, since the plant is linear Industrial Automation Continuous control 2.2 - 12 Example of non-linear plant: modeling a train obtain the relation between applied motor force (current) and the position of a train. Ffrict Ftract x mg dx v dt motor force Kc dv 1 ( Ftract mg sin( ) m C x v 2 C f v) dt m radius slope mass of the train plus contribution of rotating parts (wheels and rotors) Industrial Automation air friction curve friction mechanical friction Continuous control 2.2 - 13 Resulting train model in Matlab traction force i motor current acceleration train inertia Fz Km speed position v x a 1 m motor gravity v2 air resistance mgsin() mg ()2 Cx Cz friction |v| abs r(x) curve friction sin() Cc (x) sin() radius slope taken from topography database Industrial Automation Continuous control 2.2 - 14 Help in modeling for electricians: use an electrical equivalent water temperature ambient-water isolation R1 ambient temperature a Electrical equivalent R1 C heater-water isolation Heat resistance R2 water Uq R2 x~ C Ua ua ~ a Ua (ambient temperature) solicited temperature 2 controller energy Uq heating 1 1 ) dx 1 1 R R2 x 1 Uq Ua dt C R1C R2C ( dx Ax Bu C dt Industrial Automation cooling dx x 1 1 Ux R2C R2C dt dx Dx E dt Continuous control 2.2 - 15 Thermal (solid) vs. electrical model: conductivity q = heat flow [J/s = W] T = temperature [K] T2 R = thermal resistance [K/W] T1 q= k = thermal conductivity [J/m/K] (T2 – T1) = (T2 – T1) R kA d A = surface [m2] R= d = distance [m] A I = current [A] U = voltage [V] R = resistance [Ω] ρ = resistivity [Vm] Industrial Automation d kA d U2 U1 i i= A d (U2 – U1) = (U2 – U1) R R=ρ A ρd d A Continuous control 2.2 - 16 Thermal (solid) vs. electrical model: capacity q = heat flow [J/s = W] T = temperature [K] T C = thermal capacity [J/K] q=C Cm = thermal specific [J/K/kg] dT Cm C= dt ρV Cm = ρAd A = surface [m2] d = distance [m] ρ = density A d [kg/m3] I = current [A] U = voltage [V] U i=C i dt C = capacity [F] ε = dielectric constant [F/m] Industrial Automation dU A C=ε A d d Continuous control 2.2 - 17 Plant Identification Once the model is approximately known, the parameters must be determined by measurements. Classical methods are the response to a pulse at the input or to a calibrated noise at the input, in case the command signal varies little. Signal correlation then yields the parameters. test signal command unknown plant input output Industrial Automation Continuous control 2.2 - 18 2.2.2 Controllers 2.1 Instrumentation 2.2 Control 2.2.1 Plant modeling and identification 2.2.2 Controllers 2.2.2.1 On/Off (two-point) controller 2.2.2.2 PID controller 2.2.2.3 Nested Controllers 2.3 Programmable Logic Controllers Industrial Automation Continuous control 2.2 - 19 Controllers When a plant is known, a controller can be designed. In practice, the plant’s parameters vary (e.g., number of passengers in a train), and the plant is subject to disturbances (wind, slope) The controller • needs to measure through sensors the state of the plant and if possible the disturbances. • follows certain quality laws to stabilize the output within useful time, not overshoot, minimize energy consumption, etc….. Industrial Automation Continuous control 2.2 - 20 Controller loop (boucle de régulation, Regelschleife) disturbance Störgrösse perturbation set-point valor solicitado valeur de consigne (solicitée) Sollwert u state Zustand état controlled variable Regelgrösse valeur contrôlée (possibly invisible) controller e regulator Regler régulateur error Regelabweichung déviation y process value valor medido Istwert valeur mesurée m controlled system Regelstrecke système commandé x command Stellgröße valeur de commande measurement Messglied mesure feedback loop lazo de realimentación boucle de rétroalimentation Rückführschleife controller can be implemented by mechanical elements, electrical elements, computers,... controlled variable can not always be measured directly. Industrial Automation Continuous control 2.2 - 21 Human body as a regulator example Consider a person taking a shower as a control system disturbances feed-forward controller set point valor solicitado valeur de consigne Sollwert feed-back controller command x plant m y other constraints: energy, cost, cleanness measurement process value valor medido valeur mesurée Istwert Industrial Automation Continuous control 2.2 - 22 Where is that controller located ? • high-end: in a set of possibly redundant controllers (here: turbine control) • directly in the sensor or in the actuator (analog PIDs) • as a separate device (analog PIDs) (some times combined with a recorder) set-points • as an algorithm in a computer (that can handle numerous "loops"). sensors Industrial Automation actors Continuous control 2.2 - 23 2.2.2.1 On/Off (two-point) controller 2.1 Instrumentation 2.2 Control 2.2.1 Plant modeling 2.2.2 Controllers 2.2.2.1 On/Off (two-point) controller 2.2.2.2 PID controller 2.2.2.3 Nested Controllers 2.3 Programmable Logic Controllers Industrial Automation Continuous control 2.2 - 24 Two-point controller: principle The two-point controller (or bang-bang controller, regulator, Zweipunktregler, Régulateur tout ou rien) has a binary output: on or off (example: air conditioning) control variable energy set-point heater room temperature off on measured value thermometer Industrial Automation Continuous control 2.2 - 25 Thermostat Thermostat maintains desired (reference) temperature despite disturbances (such as doors opening/closing, variations of outside temperature, number of persons in the house, etc.) Industrial Automation Continuous control 2.2 - 26 Two-point controller: Input variable as ramp % 1.20 1.00 value 0.80 Setpoint Upper bound 0.60 Lower bound 0.40 Output 0.20 0.00 0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 time (s) Industrial Automation Continuous control 2.2 - 27 Hysteresis and Deadband of a Valve Hysteresis: difference between the valve position on the upstroke and its position on the down stroke at any given input signal (static friction) Deadband: no movement, generally occurs when the valve changes direction. Source: http://www.processindustryforum.com/solutions/valve-terminology-basic-understanding-of-key-concepts Industrial Automation Continuous control 2.2 - 28 Two-point controller: Hysteresis / Deadband temperature upper switch point 1.00 lower switch point 0.80 0.60 0.40 Note the different time constants for heating and cooling: non-linear system 0.20 0.00 time If the process is not slow enough, hysteresis and deadband are included to limit switching frequency and avoid wearing off the contactor. (thermal processes are normally so inertial that this is not needed) Industrial Automation Continuous control 2.2 - 29 2.2.2.2 PID Controller 2.1 Instrumentation 2.2 Control 2.2.1 Plant modeling and identification 2.2.2 Controllers 2.2.2.1 On/Off (two-point) controller 2.2.2.2 PID controller 2.2.2.3 Nested Controllers 2.3 Programmable Logic Controllers Industrial Automation Continuous control 2.2 - 30 Proportional Integral Derivative Controller • generic control loop feedback mechanism (controller) • widely used in industrial control systems Mode of operation: 1. calculate "error" e(t), the difference between measured PV and SP. 2. try to minimize error by adjusting the process control output m. disturbance set-point u state controlled variable controller (possibly invisible) regulator e process value y error command controlled system m x measurement t 1 de(t ) m(t ) ub K p e(t ) e( )d ) Td T dt i t0 K p , Ti , Td tuning parameters Industrial Automation Continuous control 2.2 - 31 Step response Gain: PV steady state change CO steady state change Source: http://www.stanford.edu/class/archive/ee/ee392m/ee392m.1034/Lecture6_Analysis.pdf Industrial Automation Continuous control 2.2 - 32 Plant model example The following examples use a plant modeled by a 2nd order differential equation: y y'T1 y"T2 m differential equation m y 1 m 1 sT1 s 2T2 y plant Laplace transfer function (since system is linear) Temporal response Typical transfer function of a plant with slow response, but without dead time (However, such a plant can also be approximated by a first-order low-pass and a dead time). 1.4 delay time constant T 1.2 1 step response In the examples: T1 = 1 s T2 = 0.25 s2 0.8 0.6 0.4 0.2 0 time 0 1 2 3 4 5 6 7 8 9 10 d ~ 0.2, T= 1.5s Industrial Automation Continuous control 2.2 - 33 P-controller: simplest continuous regulator proportional factor, control gain set-point controlled variable command variable P-controller u e y Kp x m plant error measurement process value the P-controller simply amplifies the error to obtain the command variable m(t) = ub +Kp • e(t) = Kp • (u(t) –y(t)) works, but if plant has a proportional behavior, an error always remains Industrial Automation Continuous control 2.2 - 34 P-Controller: Step response m(t), y0(t) 2 command 1.5 large error smaller asymptotic error 1 x large 0.5 x small 0 0 -0.5 1 2 3 4 5 6 7 8 9 10 Numerical: Kp = 5.0 set-point The larger the set-point, the greater the error. Industrial Automation Continuous control 2.2 - 35 P-Controller: Effect of Load change u1 = disturbance proportional factor controlled variable P-regulator u0 = set-point e = error Kp plant m = command variable command 2 measurement y0 = process value 1.5 value u0 (Solicited) 1 0.5 u1 (load change) 0 0 1 2 3 4 5 6 7 8 9 10 -0.5 Not only a set-point change, but a load change causes the error to increase or decrease. (A load change, modeled by disturbance u1, is equivalent to a set-point change) Industrial Automation Continuous control 2.2 - 36 u0(t), y0(t) P-Controller: Increasing the proportional factor 2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 0 1 2 3 4 5 6 7 8 9 10 time [s] increasing the proportional factor reduces the error, but the system tends to oscillate Industrial Automation Continuous control 2.2 - 37 PI-Controller (Proportional Integral): introducing the integrator equation symbol t y x( )d x t0 1 s y older symbol x d y input inflow [m3/s] y = level [m] output t2 level (t) = (inflow()) d t1 Time response of an integrator Industrial Automation Example of an integration process Continuous control 2.2 - 38 PI – Regulator : Equations t Time domain 1 m K p (e(t ) e( )d ) Ti t 0 Laplace domain 1 ~ ~ m K P (1 )e sTi Ti = reset time, tiempo de integración, temps d’intégration, Nachstellzeit Industrial Automation Continuous control 2.2 - 39 PI-Controller: response to set-point change value Kp = 2,0, Ti=1,0 s 2.2 2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 Solicited Output Command Integrator 0 1 2 3 4 5 6 7 8 9 10 time The integral factor reduced the asymptotical error to zero, but slows down the response (if Kp is increased to make it faster, the system becomes unstable) Industrial Automation Continuous control 2.2 - 40 PD controller Basic idea of the PD regulator: take into account not only the value of the error, but the rate at which the error changes. Example: when parking a car in front of a wall, the driver not only looks at the distance to the wall, but also at the speed at which the car approaches the wall. Industrial Automation Continuous control 2.2 - 41 PD-Controller: Introducing the differentiator equation: symbol: x y dx dt s A perfect differentiator does not exist. Differentiators increase noise. Differentiators are approximated by feed-back integrators (filtered differentiator): y temporal response: input Nf x 1 Td output ∞ Industrial Automation y 1 s Instead of differentiating, one can use an already available variable: e.g. the speed for a position control Continuous control 2.2 - 42 PD - controller command variable proportional factor set-point PD - controller error m Kp u plant Td derivative factor x s measurement process value y Adding the D-part allows to react vigorously to changes in set-point or perturbations. Industrial Automation Continuous control 2.2 - 43 PD – Controller: Equations Time domain Laplace domain de(t ) m(t ) K p e(t ) Td dt ~ ( s) K 1 T s e~ ( s) m p d Td = derivative time, temps de dosage de dérivée, Vorhaltezeit Tv Industrial Automation Continuous control 2.2 - 44 PID-Controller (Proportional-Integral-Differential) integral factor integrator proportional factor 1 Ti error 1 s Kp set-point process value command variable plant Td s PID controller derivative factor measurement The proportional factor Kp generates an output proportional to the error, it requires a nonzero error to produce the command variable. Increasing the amplification Kp decreases the error, but may lead to instability The integral time constant Ti produces a non-zero control variable even when the error is zero, but makes the system instable (or slower). The derivative time Td speeds up response by reacting to an error change with a control variable proportional to the steepness of change. Industrial Automation Continuous control 2.2 - 45 PID controller: Equations time domain Laplace domain t 1 de(t ) m(t ) K p e(t ) e( )d ) Td T dt i t0 ~ Td s m( s ) 1 K 1 p ~ Nf e ( s) sTi (1 s) Td Real differentiators include this filtering Kp = proportional factor, gain, Reglerverstärkung, Ti = reset time, temps de dosage d’intégration (Nachhaltezeit, TN) Td = derivative time, temps de dosage de dérivée, Vorhaltezeit Tv Note: some manufacturers define the terms differently, e.g. Industrial Automation ~ ( s) m 1 1 K T s p d e~( s) sTi 1 s Continuous control 2.2 - 46 PID response summary Plarge (Kp = 15) less error, but unstable PI: no remaining error, but sluggish response (or instable, if Kp increased) 1 Psmall (K=5) asymptotic error proportional only differential factor increases responsiveness load change (load decreases) 0 0 1 2 Solicited 3 Psmall 4 5 Plarge 6 PI 7 8 PID 9 10 U1 Play with Matlab: http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&section=ControlPID or control.xls Industrial Automation Continuous control 2.2 - 47 PID-Controller: empirical settings Rise time Overshoot Settling time Steady-State Error Kp Decrease Increase Small Change Decrease Ti Decrease Increase Increase Eliminate Td Small Change Decrease Decrease Small Change increasing See examples on http://en.wikipedia.org/wiki/PID_controller Source: http://www.stanford.edu/class/archive/ee/ee392m/ee392m.1034/Lecture6_Analysis.pdf Industrial Automation Continuous control 2.2 - 48 Extract from a controller’s manual: it’s empirical ! Optimization according to Ziegler-Nichols: Assuming that the process is stable at the operating temperature: 1. Set the Parameters ‘ti’ und ‘td’ to OFF. 2. Actual value differs now from solicited value by proportional factor. 3. As soon as temperature stabilizes, reduce proportional band ‘Pb’, until temperature starts to swing => swinging period „T“. 4. Slowly increase proportional band until temperature just stops swinging => band value ‘B’. 5. Set values of Pb, Ti and Td according to table But what do you do if this method does not work ? How do you know that this plant can be controlled by a PID controller? (many cannot) How do you prevent overshoot ? (this method does not) Trial-and-error can’t replaces a serious analysis -> see “for further reading”. Industrial Automation Continuous control 2.2 - 49 2.2.2.3 Nested controllers 2.1 Instrumentation 2.2 Control 2.2.1 Plant modeling 2.2.2 Controllers 2.2.2.1 On/Off (two-point) controller 2.2.2.2 PID controller 2.2.2.3 Nested Controllers 2.3 Programmable Logic Controllers Industrial Automation Continuous control 2.2 - 50 Several controllers act together: Electricity Generator DP Active power frequency (Pf) controller Df DQ Reactive power voltage (QV) controller DV Steam Controllable excitation source Main steam valve Valve control mechanism Turbine Generator Voltage sensors Frequency sensor Mechanical power Industrial Automation 3-phase Electrical Power DP + j DQ Continuous control 2.2 - 51 Generator Regulator structure excitation current voltage PID excitation Ie U = k × Ie × ω load speed ω frequency PID turbine generator voltage measure measure Industrial Automation Continuous control 2.2 - 52 Nested control of a continuous plant - example Example: position control of a rotating shaft Position PD Speed sol cmd is torque regulation (protection) PID Torque sol cmd is PID sol cmd is encoder M tacho amplifier Current Velocity Position Nesting regulators allow to maintain the output variable at a determined value while not exceeding the current or speed limitations Industrial Automation Continuous control 2.2 - 53 Nested loops and time response position control speed control torque control robot arm trajectory A control system consists often of nested loops, with the fastest loop at the inner level Industrial Automation Continuous control 2.2 - 54 Advanced Control controller disturbances plant model x economical objectives, control algorithms Cost functions m plant command (setpoints for further regulators) y measurement process value Istwert valeur mesurée This is a high-level control in which the set-points are computed based on economical objectives Industrial Automation Continuous control 2.2 - 55 Exercises http://tinyurl.com/p6sx4ol A Control System… a) is dependent not only on current environment but on past environment as well b) describes the direction PV moves and how far it travels in response to a change in CO (steady state) c) set of devices to manage, command, direct or regulate the behavior of other device(s) or system(s) What is the set point? a) Variable you want to control b) Desired value of control variable c) Signal that is continuously updated What has only one tuning parameter so it’s easy to find “best” tuning, but permits offset? a) P only b) PI c) PD What is proportional to both the magnitude of the error and the duration of the error? a) P only b) PI c) PD https://docs.google.com/forms/d/1CSfJ7yoGdRxNphQ75quNioe5Z0i94XAqqM7zz9g8Ms/viewform Industrial Automation Continuous control 2.2 - 56 Exercises A Control System… a) is dependent not only on current environment but on past environment as well b) describes the direction PV moves and how far it travels in response to a change in CO (steady state) c) set of devices to manage, command, direct or regulate the behavior of other device(s) or system(s) What is the set point? a) Variable you want to control b) Desired value of control variable c) Signal that is continuously updated What has only one tuning parameter so it’s easy to find “best” tuning, but permits offset? a) P only b) PI c) PD What is proportional to both the magnitude of the error and the duration of the error? a) P only b) PI c) PD https://docs.google.com/forms/d/1CSfJ7yoGdRxNphQ75quNioe5Z0i94XAqqM7zz9g8Ms/viewform Industrial Automation Continuous control 2.2 - 57 More Questions http://tinyurl.com/p6sx4ol Which statements are correct? 1. The path or length of time the PV takes to get to its new steady state does not enter into the calculation of the process gain. 2. Increasing Kp can lead to oscillations. 3. Step response analysis is used when tuning a closed loop plant. 4. For PID control a model of the plant is needed. 5. Feed-forward is a open-loop control technique. 6. In nested control the inner loop controller reads the output of outer loop controller as setpoint. Industrial Automation Continuous control 2.2 - 58 Assessment How does a two-point regulator works ? How is the a wear-out of the contacts prevented ? How does a PID regulator works ? What is the influence of the different parameters of a PID ? Is a PID controller required for a position control system (motor moves a vehicle)? Explain the relation between nesting control loops and their real-time response What is feed-forward control ? Industrial Automation Continuous control 2.2 - 59 To probe further "Computer Systems for Automation and Control", Gustaf Olsson, Gianguido Piani, Lund Institute of Technology “Modern Control Systems”, R. Dorf, Addison Wesley “Feedback Systems”, Karl Johan Aström, Richard M. Murray http://www.cds.caltech.edu/~murray/books/AM08/pdf/am08-complete_28Sep12.pdf Industrial Automation Continuous control 2.2 - 60