Presentation is loading. Please wait.

Presentation is loading. Please wait.

Contents of the presentation:

Similar presentations


Presentation on theme: "Contents of the presentation:"— Presentation transcript:

1 Finn Haugen. Telemark University CollegeNational Instruments Confidential

2 Contents of the presentation:
Learning PID control essentials with LabVIEW 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) hello

3 Case: Temperature control of air heater with LabVIEW
PWM indicator Pt100 sensor (secondary) AC/DC Pulse Width Modulator (PWM) Air tube Fan Heater RS232 Serial Air Pt100-mA transducer Pt100 sensor (primary) Fan speed adjust Laptop PC with LabVIEW P C laptop. 3 x Voltage AI (Temp 1, Temp 2, Fan indication) 1 x Voltage AO (Heating) Fieldpoint FieldPoint (Dual Channel Voltage I/O)

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

5 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 the control signal.) Should be small or large?

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

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

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

9 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 does the control For the PID control: PID settings: Kc = 40,8; Ti = 8.0s; Td = 2.0s. (found from the LabVIEW PID Autotuning.vi with ”fast response”). The meas. filter is lowpass 2. order Butterworth with bandwidth 0.4Hz.

10 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% again. Temp1 sensor in the outmost position Duration of experiment: 60 seconds

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

12 Trying three control strategies cont.
strategy: Blind 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 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.

13 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. These variations can be reduced in several ways: Using a measurement lowpass filter, e.g. IIR filter or FIR filter. (The FIR filter on the PID Control Palette is inflexible. The Butterworth PtByPt filter on Signal Processing Palette is flexible and easy to tune.) Setting the derivative gain to zero, i.e. using PI in stead of PID (Block diagram is repeated on next slide for easy reference.)

14 Block diagram of control system (repeted)
The students will implement this system from scratch in LabVIEW.

15 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.4Hz (tuned by trial and error) IIR filter, and setting derivative time to zero, i.e. PI control No filter FIR, PID contr IIR, PID contr IIR, PI contr No surprise that PI is more popular than PID in industry!

16 Easy controller tuning
Two easily available tuning tools or procedures in LabVIEW: (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 implementation of the Ziegler-Nichols’ ultimate gain method.)

17 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 operation.

18 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 :-)

19 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 Ti = Inf Td = 0 The control signal amplitude, A, is set via the output range input to the LabVIEW 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’ formulas.

20 Relay-based tuning cont.
Pu = 12 sec Result from an experiment: A = 20 %. E = 0.4 %. Pu = 12 sec. Thus, Ku = 4*A/(pi*E) = 63.7. PID setting: Kc = 0.6* Kcu = Ti = Pu/2 = 6 s. Td = Pu/8 = 1.5 s. 2E = 0.8% (The PID Autotune.vi gave Kc = 40,8; Ti = 8.0 s; Td = 2.0 s – not so different.)

21 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.0s; Td = 1.25s. This control system becomes unstable at the minimum flow rate (3.2%).

22 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.0s; Td = 2.00s. Flow 33%: Kc = 30.6; Ti = 7.0s; Td = 1.75s. Flow 3%: Kc = 34.7; Ti = 5.5s; Td = 1.38s.

23 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.)

24 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 as the fan speed indication? Let us first try without feedforward. The figure shows ordinary PID control as the fan speed was changed from minimum to maximum, and back again. Performance indexes: |e|max = |e|mean = 0.36.

25 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 1D 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 better! |e|mean = (vs 0.36). Much better!

26 Block diagram of control system (repeted)
The students will implement this system from scratch in LabVIEW.

27 Conclusions LabVIEW 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.


Download ppt "Contents of the presentation:"

Similar presentations


Ads by Google