Finn Haugen Telemark University College National Instruments Confidential

  • Slides: 27
Download presentation
Finn Haugen. Telemark University College. National Instruments Confidential 1

Finn Haugen. Telemark University College. National Instruments Confidential 1

Learning PID control essentials with Lab. VIEW By Assistant Prof. Finn Haugen, Telemark University

Learning PID control essentials with Lab. VIEW By Assistant Prof. Finn Haugen, Telemark University College, Norway Contents of the presentation: • Description of the case (student assignment): Temperature control of heated air tube • Block diagram of control system • Performance indexes • Control strategies (Blind; Manual feedback; Automatic feedback. ) • Measurement noise • Easy controller tuning • Gain scheduling (adaptive control) • Feedforward control (added to feedback control) National Instruments Confidential 2

Case: Temperature control of air heater with Lab. VIEW PWM Pt 100 sensor indicator

Case: Temperature control of air heater with Lab. VIEW PWM Pt 100 sensor indicator Pulse Width Modulator (PWM) AC/DC (secondary) Air tube Fan Heater RS 232 Serial Air Pt 100 -m. A transducer Fan speed adjust Pt 100 sensor (primary) 3 x Voltage AI (Temp 1, Temp 2, Fan indication) 1 x Voltage AO (Heating) Laptop PC with Lab. VIEW Fieldpoint Field. Point (Dual Channel Voltage I/O) National Instruments Confidential 3

Block diagram of control system The students will implement this system from scratch in

Block diagram of control system The students will implement this system from scratch in Lab. V National Instruments Confidential 4

Some performance indexes of control systems Maximum of absolute value of control error: Should

Some performance indexes of control systems Maximum of absolute value of control error: Should be small or large? Mean of absolute value of control error: (Almost the same as the popular IAE index – Integral of Absolute value of control Error. ) Should be small or large? Mean of absolute value of time-derivative of control signal: (Inspired by optimal control, e. g. MPC, where the objective function includes the variation of t Should be small or large? National Instruments Confidential 5

Implementation of performance indexes The three performance indexes defined above can be implem as

Implementation of performance indexes The three performance indexes defined above can be implem as follows. • The maximum control error index: can be implemented with the following code: National Instruments Confidential 6

Implementation of performance indexes cont. The mean of absolute error index: can be implemented

Implementation of performance indexes cont. The mean of absolute error index: can be implemented with the following code: (Alternatively, could have used the Mean. Pt. By. Pt. vi. ) National Instruments Confidential 7

Implementation of performance indexes cont. And the control signal time-derivative index: can be implemented

Implementation of performance indexes cont. And the control signal time-derivative index: can be implemented with the following code: (Alternatively, could have used the Mean. Pt. By. Pt. vi. ) National Instruments Confidential 8

Trying out three control strategies The three performance indexes (|e|max, |e|mean, |du/dt|mean) are recorded

Trying out three control strategies The three performance indexes (|e|max, |e|mean, |du/dt|mean) are recorded for each of the below control strategies: • Blind control, i. e. control with a fixed control signal • Manual feedback control, i. e. the human (student) does the control • Automatic feedback (PID) control, i. e. the computer For the control: does the. PID control • PID settings: Kc = 40, 8; Ti = 8. 0 s; Td = 2. 0 s. (found from the Lab. VIEW PID Autotuning. vi with ”fast response”). • The meas. filter is lowpass 2. order Butterworth with bandwidth 0. 4 Hz. National Instruments Confidential 9

Trying out three control strategies cont. The process is operated as follows: • Setpoint

Trying out three control strategies cont. The process is operated as follows: • Setpoint = 40% (fixed) • Fan speed = 60% (initial value) • A disturbance change: Increasing the fan speed for about 10 sec from 60% to 100% and then back to 60% • Temp 1 sensor in the outmost position • Duration of experiment: 60 seconds National Instruments Confidential 10

Trying three control strategies cont. Blind control: Control Manual feedback: Automatic feedback (PID): Setpoint

Trying three control strategies cont. Blind control: Control Manual feedback: Automatic feedback (PID): Setpoint Filtered temp National Instruments Confidential 11

Trying three control strategies cont. Control Blind strategy: control: Manual feedback: Automatic feedb (PID):

Trying three control strategies cont. Control Blind strategy: control: Manual feedback: Automatic feedb (PID): |e|max 0. 78 % 0. 86 0. 44 |e|mean 0. 39 0. 21 0. 12 |du/dt|mean 0 4. 54 7. 00 Perform. index: Observation: Automatic feedback (PID) gives smallest max and mean control error, but the control action is the most aggressive! This is general, too. National Instruments Confidential 12

The problem with measurement noise In a feedback control system measurement noise is propagated

The problem with measurement noise In a feedback control system measurement noise is propagated via the controller to the control signal, causing variations in the control signal. The derivative term of the controller amplifies these variations. • Using a measurement lowpass filter, e. g. IIR filter or FIR These variations can be reduced in several ways: filter. (The FIR filter on the PID Control Palette is inflexible. The Butterworth Pt. By. Pt filter on Signal Processing Palette is flexible and (Block diagram is repeated on next slide for easy reference. ) easy to tune. ) • Setting the derivative gain to zero, i. e. using PI in stead National Instruments Confidential 13

Block diagram of control system (repeted) The students will implement this system from scratch

Block diagram of control system (repeted) The students will implement this system from scratch in Lab. V National Instruments Confidential 14

Measurement noise cont. The figure below shows the PID control signal in four situations:

Measurement noise cont. The figure below shows the PID control signal in four situations: • No measurement filter. (Max amplitude is due to the LSB of the 12 bits ADC!) • Using the 5. order FIR filter on the PID Control Palette • Using an IIR filter in the form of a 2. order Butterworth filter with bandwidth 0. 4 Hz (tuned by trial and error) • IIR filter, and setting derivative time to zero, i. e. PI control No filter FIR, PID contr IIR, PI contr No surprise that PI is more popular than PID in industry! National Instruments Confidential 15

Easy controller tuning Two easily available tuning tools or procedures in Lab. VIEW: (Tuning

Easy controller tuning Two easily available tuning tools or procedures in Lab. VIEW: (Tuning based on estimated process model is in advanced assignments. ) • The PID Autotuning. vi, which invokes a tuning wizard. The tuning principle is to automatically change the setpoint stepwise, and to calculate the controller parameters from the response. The autotuner requires that the control loop is stable initially (with P, PI or PID controller). • Åstrøm-Hägglund’s relay-based tuning method with the PID Advanced. vi or the PID. vi. (This method is basically a practical Confidential implementation of National the Instruments Ziegler-Nichols’ ultimate 16

Controller tuning cont. PID Autotuning. vi The wizard is opened when the autotune? input

Controller tuning cont. PID Autotuning. vi The wizard is opened when the autotune? input is TRUE. When the tuning is finished, the new PID settings are written to the PID_gains local variable. The FALSE case above (which is active when the tuning is finished), contains the PID Advanced. vi which is used in normal op National Instruments Confidential 17

Tuning cont. One of the dialog windows of the PID Autotuning. vi wizard is

Tuning cont. One of the dialog windows of the PID Autotuning. vi wizard is shown in the figure: Results: Kc = 40, 8 Ti = 8. 0 s Td = 2. 0 s. Representative setpoint step response after tuning: Seems ok : ) National Instruments Confidential 18

Tuning cont. : Relay-based tuner In the tuning phase, the PID controller must be

Tuning cont. : Relay-based tuner In the tuning phase, the PID controller must be replaced by an On/Off-controller, creating sustained oscillations in the loop How to turn the PID controller into an On/Off-controller: • Kc very large, e. g. 1000. • Ti = Inf • Td = 0 • The control signal amplitude, A, is set via the output range i to the Lab. VIEW PID functions, since A = (umax – umin)/2. Assume: • The oscillatory control error amplitude is measured as E. • The period of the oscillations is measured as Pu. By representing the square wavy controller signal by fundamental Fourier series term, the ultimate gain (relay gain) is Kcu = (Ampl out (by Fourier))/(Ampl in) = (4*A/π)/E The PID setting can now be found from the Ziegler-Nichols’ National Instruments Confidential 19

Relay-based tuning cont. A = 20% Result from an experiment: Pu = 12 sec

Relay-based tuning cont. A = 20% Result from an experiment: Pu = 12 sec A = 20 %. E = 0. 4 %. Pu = 12 sec. Thus, Ku = 4*A/(pi*E) = 63. 7. PID setting: Kc = 0. 6* Kcu = 38. 2. 2 E = 0. 8% Ti = PID Pu/2 = 6 s. Tdgave = Pu/8 = 1. 5 (The Autotune. vi s. = 40, 8; Ti = 8. 0 s; Td = 2. 0 s Kc – not so different. ) National Instruments Confidential 20

Gain scheduling (adaptive control) The problem: It can be shown both experimentally and mathematically

Gain scheduling (adaptive control) The problem: It can be shown both experimentally and mathematically (using a simplified model) that the gain and the transport delay of a flow process increases as the flow descreases. If the (temperature) controller is tuned at a high flow rate, the control system may get poor stability if the flow rate decreases. The figures to the right illustrate this for the air heater. The PID controller was tuned at flow rate 100%: Kc = 42. 0; Ti = 5. 0 s; Td = National Instruments Confidential 1. 25 s. 21

Gain scheduling cont. One simple solution: Since the stability of the control system depends

Gain scheduling cont. One simple solution: Since the stability of the control system depends on the flow rate, let us try varying the controller parameter settings as functions of the flow rate. This is implemented using the PID Gain Schedule. vi. The scheduling is based on three PID settings each found by using relay-based tuning: Flow 67%: Kc = 24. 1; Ti = 8. 0 s; Td = 2. 00 s. Flow 33%: Kc = 30. 6; Ti = 7. 0 s; Td = 1. 75 s. Flow 3%: Kc = 34. 7; Ti = 5. 5 s; Td = 1. 38 s. National Instruments Confidential 22

Gain scheduling cont. The result: The figures to the right illustrates that the control

Gain scheduling cont. The result: The figures to the right illustrates that the control system now has good stability for the minimum flow (and for the maximum flow). An alternative solution: Conservative tuning Tune the controller at one specific flow rate, and keep the controller settings fixed for all flow rates. For which flow rate? Any drawback? (This solution is not demonstrated here. ) National Instruments Confidential 23

Feedforward control (+ feedback control) Variations of the air flow act as disturbances to

Feedforward control (+ feedback control) Variations of the air flow act as disturbances to the process. The feedback controller tries to compensate for such variations using the temperature measurement. Can we obtain improved control by also basing the control signal on measured air flow, which is here available fan speed Let us firstastrythe without feedforward. The figure shows ordinary indication? PID control as the fan speed was changed from minimum to maximum, and back again. Performance indexes: |e|max = 1. 01. |e|mean = 0. 36. National Instruments Confidential 24

Feedforward cont. Now, let us try feedforward from fan speed (air flow). (Block diagram

Feedforward cont. Now, let us try feedforward from fan speed (air flow). (Block diagram is repeated on next slide for easy ref. ) A number of corresponding values of fan speed and control signal was found experimentally. Temperature setpoint was 40 deg C. The feedforward control signal, u_ff, was calculated by linear interpolation with Interpolate 1 D Array. vi, and was added to the PID control signal to make up the total control signal: u = u_PID + u_ff. Performance indexes: |e|max = 0. 27 (vs 1. 01). Much National Instruments Confidential better! |e| = 0. 073 (vs 0. 36). 25

Block diagram of control system (repeted) The students will implement this system from scratch

Block diagram of control system (repeted) The students will implement this system from scratch in Lab. V National Instruments Confidential 26

Conclusions • Lab. VIEW with PID Toolkit offers a flexible and user-friendly environment for

Conclusions • Lab. VIEW with PID Toolkit offers a flexible and user-friendly environment for students to learn practical PID control. • Practical control is best learned in (practical) labs because the students will then experience important realistic problems and phenomena related to e. g. noise. National Instruments Confidential 27