Download In the experiment, the NTC resistance (and the associated

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Electrical substation wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Electrical ballast wikipedia , lookup

Resilient control systems wikipedia , lookup

PID controller wikipedia , lookup

Stray voltage wikipedia , lookup

Buck converter wikipedia , lookup

Alternating current wikipedia , lookup

Current source wikipedia , lookup

Ohm's law wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Power MOSFET wikipedia , lookup

Voltage optimisation wikipedia , lookup

Control theory wikipedia , lookup

Metadyne wikipedia , lookup

Thermostat wikipedia , lookup

Mains electricity wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Opto-isolator wikipedia , lookup

Lumped element model wikipedia , lookup

Thermal runaway wikipedia , lookup

Negative feedback wikipedia , lookup

Control system wikipedia , lookup

Transcript
Practicum LV4: Temperature control with PC
Goal of experiment
The goal of this experiment is to build a LabVIEW-driven temperature control system, which is
supposed to regulate the temperature of a small block of copper. The electronic parts of the system are
sketched in the figure below, were the "small block of copper" is incorporated in the heater in the lower
right-hand corner. The complete system uses a temperature sensitive NTC resistance as temperature
sensor, a simple heating resistor as heater, and a combination of ADC & DAC & PC for the electronic
feedback. It is your task to (i) wire up the hardware, (ii) write the appropriate PI control software in
LabVIEW 7, (iii) test the complete system, and (iv) optimize the feedback parameters.
+20 V
Safeguard against
shortcircuiting
DAC
+5 V
PC
1k
heater
ADC
NTC
The temperature sensor (NTC resistor)
The temperature sensor is a so-called NTC resistor, where NTC stands for Negative Temperature
Coefficient and refers to the phenomenon that the resistance of such a device decreases with
temperature. This decrease is quite rapid (the resistance decreases typically by as much as 4 % per
degree Centigrade), making these sensors ideal for accurate temperature measurements.
It is worthwhile to spend a few lines on the physics of NTC resistors. An NTC resistor is nothing more
than a piece of semiconductor material with a bandgap that is small enough to allow for thermal
excitation of some of the electron from the valence band to the conduction band, or (equivalently) for
the thermal excitation of electron-hole pairs. When the temperature rises, the number of thermally
excited electron-hole pairs will increase and the resistance goes down, thus explaining the name NTC.
As the thermal excitation is limited by (very small) Boltzman factors of the form exp(U / k BT ) , where
U is the potential barrier, k B 1.38110 23 J/K is the Boltman constant, and T is the temperature (in
Kelvin), respectively, the NTC resistance changes exponentially with temperature via
Tc Tc
 ),
T T0
where Tc is related to the potential barrier U and R0 is the resistance at some reference temperature T0 .
Our NTC resistors are specified for Tc  3528 K  18 K and R0  1.0 k at
R  C exp(Tc / T )  R0 exp(
1
25 C. Based on these values we can calculate the following reference table for NTC resistance versus
temperature, which allows for a quick manual conversion of one into the other:
T[C]
R[k]
15
1.508
20
1.224
25
1.000
30
0.823
35
0.681
40
0.567
45
0.475
50
0.400
55
0.339
60
0.288
65
0.246
70
0.212
In the experiment, the NTC resistance (and the associated temperature) can be determined from the
ADC voltage in the circuit shown above, in which the 5 V source from the I/O card is put over a serial
circuit of an NTC resistor and a fixed 1 k resistor (see figure). This 1 k resistor is mounted in the
groundplate of your compact experimental set-up and can be observed by turning the device upside
down.
The heater (high-power resistor driven by Darlington circuit)
As heating device we use a simple high-power resistor that is driven by a so-called Darlington circuit,
comprising a back-to-back combination of a standard transistor and a high-power transistor (see figure).
Such a combination is needed because the current amplification of a single high-power transistor is
rather small and because the DAC can’t supply more than 5 mA of output current.
Every circuit should also contain the special box that we labelled “safeguard against short-circuiting” in
the figure above. This box should be positioned between the +20V supply that you get “out of the wall”
and the Darling amplifier circuit. It safeguards against shortcircuiting by limiting the output current to
about 1 A. The way this box works is relatively simple: it contains a semiconductor with the intriguing
properties that it’s resistance is very low (about 0.25 ) at currents below 1 A, but rises rapidly for
currently above 1 A. If the green LED is on the voltage is passed through, if the red LED is on there is a
short in your circuit.
There are two more details of the heating circuit that you need to know. First of all, the voltage over the
heater is about 1.2 V lower than the DAC voltage, as there is a voltage drop of about 0.6 V over each of
the two transistors inside the Darlington circuit. Secondly, the power that you dump into the heater and
that takes care of the temperature control is of course proportional to the square of the heater voltage!
Combining these two effects we find that the dissipated power is about
P  (VDAC  1.2) 2 / Rheater
where Rheater  22  at room temperature. At the maximum DAC output of 10 V about 4.1 W is
dissipated.
The special relation between the dissipated power and the regulating voltage has of course also
consequences for the regulating feedback loop that we want to construct. We challenge you to figure
these out for yourself (and explain them in your report).
Temperature dynamics of a simple system
2
The figure on the right presents a very simple
model for the thermal management in our
system (= copper block). Energy can be fed into
Heating power P [W]
the system with a heating resistor that generated
a heating power P [W]. Energy leaks out of the
system
Heat capacity C [J/K]
system through thermal contact between the
system and the environment = thermal bath.
Thermal conductivity  [W/K]
Two parameters determine the temperature
dynamics of this system: (i) the system's heat
capacity C [J/K], which quantifies the thermal
Thermal bath (= large environment)
energy increase per Kelvin, and (ii) the thermal
conductivity  [W/K] between the system and
its environment, which quantifies the energy leak between system and bath per Kelvin temperature
difference. With these parameters in mind it is relatively easy to write down the time evolution of the
system's temperature as
C
dT
 P   (T  T0 )
dt
where T0 is the temperature of the environment. Please check the dimensions in this equation and note
that these are indeed correct. At constant heating power the solution of this differential equation is
easily found as
Teq  T0 
P

and
T (t )  Teq  T exp( t /  ) ,
where Teq is the equilibrium temperature and   C  is the thermal time constant (check the
dimensions!). The temperature dynamics of this simple system is thus surprisingly straightforward: the
equilibrium temperature of the system is P  larger than that of the environment and the relaxation of
the system to any new equilibrium temperature is predicted to be exponential with a time constant
 C .
Practical system might of course deviate from this simple system in several ways. The temperature
might not be completely uniform over the system and there will probably be some time delay between
the application of a heating pulse at one end of the system and the temperature rise observed with a
sensor at the other end. The thermal contact between the system and its environment might be more
complicated then sketched in the model, which assumes that the bath remains at a fixed temperature and
must therefore be “infinitely large”. As a practical example of the latter complication we note that the
large black block, which contains the copper system, might heat up at some point. In principle, we can
model the temperature of this black block in a similar way, introducing a second heat capacity and
thermal conductivity (now between black block and larger environment). This type of modelling,
however, goes way beyond our present needs.
Theory digital feedback control
The basic idea of any electronic feedback system is very simple. Suppose you want to control a voltage
V (t ) and keep it at some fixed set-point voltage Vs . The first thing you will of course do is compare the
two voltages and calculate the error signal or error voltage e(t )  V (t )  Vs . As a second step you will
need some kind of algorithm, the details of which are given below, that uses this time-dependent error
voltage to calculate how much control or feedback y (t ) is needed in order to quickly reduce the error
3
voltage to zero. As the third and last step we will apply this feedback under the usual assumption that
the system responds linearly to this control via d V (t ) d t   y(t ) .
The simplest control algorithm uses only proportional feedback, i.e., feedback that is proportional to
the error signal at that very moment, via y(t )  K P e(t ) . As we sample at discrete times t  n T , this
proportional feedback can also be written as
y(nT )  K P e(nT ) .
The main advantage of proportional or P-control is of course it’s simplicity. The main disadvantage is
that this type of feedback can never reduce the error signal to exactly zero (Why not?). We can of
course make the residual error signal smaller by increasing the proportionality constant K P , but if we
increase it too much our control system will become unstable and start to oscillate. The main reason for
this behaviour is the presence of unavoidable time delays between the temperature measurement and the
heating response at that same position. These time delays correspond to phase shifts in the frequency
domain that will give the feedback the wrong sign and make it in-phase (feed forward), instead of outof-phase (feed back), at sufficiently high frequencies.
An alternative control algorithm uses integrating feedback, where the feedback depends not only on the
instantaneous error, but also on the past error values. For this type of control the feedback is given by
y (nT )  K I
n
 e(mT )  y((n  1)T )  K
m0
I
e(nT ) .
The main advantage of integrating feedback is that it has a memory of past perturbations and in
principle controls the system back to zero error signal. This memory is at the same time a disadvantage,
as it reduces the control speed; the low-frequency fluctuations are much better controlled than the highfrequency ones.
A very popular control algorithm uses the combination of both proportional and integrating feedback
in a so-called PI control. In the above notation this type of control has
y (nT )  K P e(nT )  K I
n
 e(mT )
.
m 0
When we specialize this to our temperature control setup, this becomes
n
Pheater (nT )  K P  [V NTC (nT )  Vs ]  K I   [V NTC (mT )  Vs ] ,
m 0
where VNTC (nT ) is the measured voltage over the NTC resistor for the nth sampling point, Vs is the set
NTC voltage that we want to reach, Pheater is the heating power that needs to be applied and K P en K I
are the feedback constants. In the actual experiment a complication arises from the fact that the system
temperature is controlled via the heating power, which is a quadratic function of the DAC voltage. The
vi program should account for this complication.
As a side remark we note that the "strength of the integrating feedback" is not only proportional to K I ,
but is also inversely proportional to the sampling time T . More sample points per unit time will
obviously lead to an increase in the integrating feedback y (nT ) in the above discrete representations of
the time integral
 e(t ) dt . Based on this notion, there is another (more physical) parameter to quantify
4
the relative strength of the integrating feedback as compared to the proportional feedback. This
parameter is ``effective integration time " TI  ( K P K I ) T , which is the time it takes the integrating
control to build up to the same strength as the proportional control (at fixed error signal). In terms of
this parameter the PI feedback is
y(nT )  K P { e(nT ) 
T
TI
n
 e(mT )}
m 0
There are fancier algorithms than PI control. One of these is the so-called PID control, in which an
extra differential term, for which the feedback is proportional to the time-derivative of the error signal,
is added to the PI control. The form of this differential term alone is
yD (nT )  K D {e(nT )  e((n  1)T )}  K D {e(nT )  3 e((n  1)T )  3 e((n  2)T )  e((n  3)T )} / 6 ,
where the right-hand expression is an alternative discrete representation of the time-derivative that is
less sensitive to noise. The advantage of PID over PI controls is that they are generally faster, as the
differential term increases the feedback strength of high-frequency fluctuations. The disadvantage of
PID controls is that they more susceptible to noise, due to the differential action.
The figure on the next page shows typical time traces of three controled systems and summarizes their
differences. For P control the equilibrium does not correspond to the set-point. In theory, the evolution
towards this equilibrium should be a simple exponential decay. In practice some overshoot can occur
due to time delays between sensor read-out and actuator response. PI control is better in the sense that
the equilibrium does correspond to the set-point. Theoretically, this equilibrium is reached after a
damped (or possibly overdamped) harmonic oscillation. PID controls can potentially be faster, albeit
somewhat more noisy.
Optimisation of the feedback parameters of a PI control requires some skill. A standard trick to find the
limitations of system & control is to search for the ultimate feedback constant K P  K u at which the
system starts to oscillate under proportional feedback only ( K I  0 ). As a rule of thumb, the optimum
parameters for stable PI control are now roughly K P  0.5 K u for the proportional term and TI  Tu for
the integrating term, where Tu is the oscillation period of the unstable system.
5
Experimental challenges
1.
HARDWARE:
(a) Wire up the temperature sensing circuit, by connecting it to the AI 0 (= Analog
Input 0 = ADC 0) and the external + 5V of the I/O box . Make sure that you ground
both cables!
(b) Wire up the heating circuit, by (i) routing the DAC (AO0) output to the B connector
of the Darlington circuit and the associated ground to the grounding of the heating
device, (ii) connecting the E output of the Darlington to the other side of the heating
resistor, and (iii) routing the +20V and ground from the banana plugs out of the wall
through the safety box into the E connector of the Darlington circuit and the heater
grounding, respectively. Please compare your connections very carefully with those
depicted in the figure before you make the final connection with the +20V supply;
a short circuit is easily produced.
2.
SOFTWARE:
(a) Write a VI that allows you to monitor both the voltage over the NTC (related to the
temperature) and the DAC voltage (that is send to the Darlington circuit and produces
the heating power) as a function of time. Add a meter to show the instantaneous
heating voltage and at least four digital controls to set the sampling rate, the require
NTC voltage, and the strength K P and K I of the proportional and integrating
feedback terms. Also add a digital indicator for the instantaneous NTC voltage.
(b) It is probably wise to separate the PI control from the complications that originate
from the quadratic relation between heating power and drive voltage. We suggest that
you first derive the (instantaneous) error voltage en , by subtracting the NTC voltage
from the require value, and write the PI control algorithm that calculates the required
heating power from these error voltages, in combination with the feedback parameters
K P and K I .
(c) Have another look at the relation between the DAC voltage and the heating power.
Now construct an equation that converts the required heating power back into a DAC
drive voltage and incorporate this equation behind your previous PI control algorithm.
After connection with suitable analog output subVI(s), this completes your PI control.
(d) Save the VI before you run it. Complicated VIs have a tendency to crash on the first
run!
3.
VI TESTING & THERMAL RESPONSE
(a) Before running and testing the VI we have to set a few input parameters. The first
choice we have to make is the sampling time. Theory tells us that it is in principle
sufficient to take a sampling time that is about 1/10-th of the response time of the
system, but how fast is the thermal response of the system? Make a reasonable guess
for the sampling time, set the feedback parameters K P and K I equal to zero and run
the VI. Set the y-axis for auto-scaling and the lay-out of the waveform chart that
records the NTC voltage for points-and-lines plotting (use symbol in upper right-hand
corner for layout changes). If the VI runs properly, you should be able to see the
ultimate limitation of the ADC in the form of "bit noise".
- Check whether the voltage step per bit agrees with the expected value for our 16-bit
ADC. Print the figure and clue it into your Labjournal.
(b) We will now check the thermal time response of the system. For this purpose we
want to run the VI over an extended period of time (say 5-10 minutes) and might need
more data points on the waveform chart. If you want to change the standard number of
6
1024 data points into something bigger, you can do so via the option chart history
length that shows up after right-clicking on the waveform chart. Check the thermal
time response, by performing a single run under three consecutive conditions: (i) first
with heater/feedback off, (ii) then with heater fully on (just take large feedback
constants), (iii) with heater/feedback off again. The 2 nd part of this run shows how fast
the system heats up under maximum heating. Please don't to go beyond 50-60 C, as I
am not sure how much heat the system can stand. The 3rd part of this run shows how
fast the system cools down. In a simple model this cooling corresponds to an
exponential decay of the deviation from room temperature.
- Play around with the parameters until you have a neat-looking time trace and print it
for your labjournal. Show it to an assistant as a proof that your wiring is correct.
(c) Does the temperature excursion decay exponentially and if so, what is thermal
response time of your system? In view of this knowledge, did you make a proper choice
for the sampling time, or did you over-sample? (answers in labjournal)
4.
TEMPERATURE CONTROL WITH (PI) FEEDBACK
(a) Finally we want to test and optimize the control system, by modifying its feedback
parameters K P and K I . Start with proportional feedback only ( K I =0) and try a few
feedback parameters. Discuss the results with an assistant and summarize the
conclusions in your labjournal. Add a print of a characteristic time trace.
(b) Repeat these tests for integrating feedback only ( K P =0) and report the results.
(c) Use a combination of proportional and integrating feedback and draw your
conclusions. Explain in jour labjournal how you determined the optimum feedback and
what criteria you used.
(d) (Optional) For fun you could also check how good this feedback scheme controls
the temperature and protects it from external influences like air currents (blowing).
(e) (Optional) If you still have time left, please feel free to dress up the temperature
control in any way you find suited. One extension could be the inclusion of a
differential part in the feedback scheme, to make it a PID instead of a PI control. In
principle, this could speed up the control, but also makes it noisier. Another extension
could be the addition of a digital filter, to suppress some noise and incorporate time
response effects. The most elegant extension is to let the algorithm optimise its own
feedback constants. Such an "intelligent control" works by probing the system's
dynamics during the heating and cooling trajectories and uses the obtained information
to optimise the feedback parameters K P and K I (and possibly even K D ).
Report
We expect some nice prints in your labjournal and answers to all questions addressed under points 3
and 4 above.
7