Temperature Control Using Labview
Temperature Control Using Labview
Temperature Control Using Labview
Sam McCandlish
Physics Department, Brandeis University, Waltham, MA, 02454
(Dated: 5/10/12)
We present a study of control theory applied to a thermal control problem. We use a thermoelectric cooler, controlled by LabView, to heat and cool a metal stand. We describe the theory and
implementation of a basic PID control program in LabView, and we show how to tune the controller
using the Ziegler-Nichols method. Results of various tuning parameters suggested by this method
are shown.
I.
INTRODUCTION
II.
EXPERIMENTAL SETUP
Our objective is to heat or cool a metal base to a desired temperature. We do this using a thermo-electric
cooling device. This device makes use of the Peltier
1
1
+ ln
T0
B
R
R0
1
0.5
1
0.5
0
0
20
10
0
2
0
10
20
2
0
2
0
Time t
0.5
10
20
10
10
20
2
0
kd
2
0
20
Time t
kd
ki
Input u
0
0
20
kp
Input u
10
1.5
ki
Output y
0
0
Input u
1.5
kp
Output y
Output y
1.5
Time t
(b) PI control
Figure 10.2: Responses to step changes in the reference value for a system with a proportional
controller (a), PI controller (b) and PID controller (c). The process has the transfer function
Figure
2: Effect of tuning various parameters. Image: [1]
P(s) = 1/(s+1)3 , the proportional controller has parameters k p = 1, 2 and 5, the PI controller
has parameters k p = 1, ki = 0, 0.2, 0.5 and 1, and the PID controller has parameters k p = 2.5,
ki = 1.540
and kd = 0, 1, 2 and 4.
Temperature HCL
80
100
120
140
160
295
Proportional Control
A reasonable first attempt would be proportional control, where our power output is set to be proportional to
the difference between the measured temperature and
the desired temperature:
u (t) = KP e (t)
where u (t) denotes the signed duty cycle of the PWM,
with positive u indicating heating and negative u indicating cooling, and where e (t) = Twant T (t) is the er-
B.
Integral Control
C.
Derivative Control
3
Rule Name
KP
Ziegler-Nichols
Pessen Integral Rule
Some Overshoot
No Overshoot
0.6Kc
0.7Kc
0.33Kc
0.2Kc
TI =
KP
KI
0.5Tc
0.4Tc
0.5Tc
0.5Tc
TD
0.125Tc
0.15Tc
0.33Tc
0.33Tc
Table I: Various rules of thumb for PID tuning using the Ziegler-Nichols method.
Source:
http://www.mstarlabs.com/control/znrule.html
This derivative term is the first term in a series expansion e (t + TD ) e (t) + TD de(t)
dt . Hence, we can interpret TD as the time delay between powering the TEC
and measuring a temperature change. This has the effect of anticipating overshoot and damping the power
output when the temperature approaches the desired
temperature. This use of proportional, integral, and
derivative terms is known as PID Control.
D.
Tuning
IV.
To implement this PID control method, we use LabView. LabView programs are composed of graphical
elements connected together using wires. An example of using LabView to control the duty cycle of the
PWM and the sign of the current is shown in Fig. 4.
The proportional, integral, and derivative terms are implemented in a straightforward way by computing the
4
51.0
V.
RESULTS
Temperature HCL
50.5
50.0
49.5
49.0
50
100
150
200
250
200
250
KP
Time HsL
72
70
68
66
64
0
50
100
150
Time HsL
Figure 6: The critical gain is found by increasing the proportional term KP until sustained oscillations occur. We found
the critical value to be 71, though damped oscillations were
present starting from a much lower value.
[1] K Astrm and R Murray. Feedback Systems: An Introduction for Scientists and Engineers. Princeton University Press, 2008.
[2] J S Sharp, P M Glover, and W Moseley. Computer based
We started by implementing only proportional control, as shown in 3. The system does not reach the
target temperature, as expected. Increasing the proportional constant sufficiently leads to sustained oscillations about the target temperature 7. To find the critical gain and time constants, we more slowly increased
the gain until oscillations occurred that did not damp
out eventually 6. The critical gain was KP = 71, and
the critical period of oscillations was determined to be
3.3s, determined by Fourier analysis of the data at critical gain. I tried many of the suggested parameters
from the table shown above. One example of the supposed no overshoot rule is shown in 8. Clearly, there
is a significant overshoot of multiple degrees for larger
changes in target temperature. To attempt to understand this, I reduced the proportional term further to
find the origin of the oscillations. In 9, it is clear that
when the anti-windup function is switched off at 5 degrees from the target temperature, the temperature begins to rapidly change and begins oscillating. I believe
that the abrupt nature of my anti-windup implementation causes the integral term to overshoot the target
temperature, even when the proportional term is turned
aggressively down. Hence, if given more time, I would
implement a smoother method of turning on the integral method, as suggested above.
learning in an undergraduate physics laboratory: interfacing and instrument control using Matlab. European
Journal of Physics, 28(3):S1S12, May 2007.
5
45
Temperature HCL
40
35
30
25
20
10
20
30
40
50
60
Time HsL
Figure 7: If the proportional term is increased above the critical gain Kc , the temperature oscillates about the target value.
50
Temperature HCL
45
40
35
30
25
20
50
100
150
200
250
Time HsL
Figure 8: Response to changes in target temperature for the no overshoot tuning. The constants used are KP = 14.2,
TI = 1.645, and TD = 1.1.
50
Temperature HCL
45
40
35
30
25
20
10
20
30
40
50
60
70
Time HsL
Figure 9: Attempt to find true no overshoot parameters with a reasonably fast equilibration time. This was unsuccessful,
likely due to the abrupt turn-on of the integral term when e (t) = 5 C. The constants used are KP = 7, TI = 1.15, and
TD = 1.1.