Title: Contents of the presentation:
1(No Transcript)
2Contents of the presentation
Learning PID control essentials with LabVIEW
By Assistant Prof. Finn Haugen, Telemark
University College, Norway
- 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)
3Case Temperature control of air heater with
LabVIEW
Pt100 sensor (secondary)
PWM indicator
AC/DC
Pulse Width Modulator (PWM)
Air tube
Heater
Fan
RS232 Serial
Air
Pt100-mA transducer
Pt100 sensor (primary)
Fan speed adjust
Laptop PC with LabVIEW
Fieldpoint
3 x Voltage AI (Temp 1, Temp 2, Fan indication) 1
x Voltage AO (Heating)
FieldPoint (Dual Channel Voltage I/O)
4Block diagram of control system
The students will implement this system from
scratch in LabVIEW.
5Some 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?
6Implementation 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
7Implementation of performance indexes cont.
The mean of absolute error index
can be implemented with the following code
(Alternatively, could have used the
MeanPtByPt.vi.)
8Implementation 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.)
9Trying out three control strategies
The three performance indexes (emax, emean,
du/dtmean) 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.
10Trying 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
11Trying three control strategies cont.
Blind control
Manual feedback
Automatic feedback(PID)
Control
Setpoint
Filtered temp
12Trying three control strategies cont.
Control strategy
Blind control Manual feedback Automatic feedb (PID)
emax 0.78 0.86 0.44
emean 0.39 0.21 0.12
du/dtmean 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.
13The 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.)
14Block diagram of control system (repeted)
The students will implement this system from
scratch in LabVIEW.
15Measurement 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!
16Easy 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ägglunds 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.)
17Controller 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.
18Tuning 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 -)
19Tuning 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 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) (4A/p)/E The PID setting
can now be found from the Ziegler-Nichols
formulas.
20Relay-based tuning cont.
A 20
Pu 12 sec
Result from an experiment A 20 . E 0.4 .
Pu 12 sec. Thus, Ku 4A/(piE) 63.7. PID
setting Kc 0.6 Kcu 38.2.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.)
21Gain scheduling (adaptive control)
The problemIt 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).
22Gain scheduling cont.
One simple solutionSince 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.
23Gain 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.)
24Feedforward 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 emax 1.01. emean
0.36.
25Feedforward 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
indexesemax 0.27 (vs 1.01). Much better!
emean 0.073 (vs 0.36). Much better!
26Block diagram of control system (repeted)
The students will implement this system from
scratch in LabVIEW.
27Conclusions
- 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.