Introduction to LabVIEW

advertisement
Introduction to LabVIEW - Part 3
A.
Data Acquisition
As we have discussed in class, a data acquisition system consists of five components:
computer, software, data acquisition board, signal conditioner and transducers. The sketch
below shows these components in a typical system. To enable the computer to recognize the
existence of data acquisition boards, Lab VIEW comes with VI’s for this purpose. These VI’s
are found in the LabVIEW Data Acquisition library and they are used to control National
Instruments plug-in DAQ boards.
Each board is capable of performing many functions: A/D (analog-to-digital) conversion,
D/A (digital-to-analog) conversion, digital input/output (I/O) as well as timing operations. The
DAQ hardware must be configured before LabVIEW DAQ VI’s can be used, since the VI’s will
call directly the low-level electronic operations in the board.
B. Thermocouple Calibration
We will be using an instrument called a thermocouple for this experiment. A
thermocouple is an extremely simple device for measuring temperature. It consists of just two
wires of different materials, welded together at their tips, to create a bimetallic junction.
Changes in temperature induce a change in voltage across this junction, and the change in
voltage is linearly proportional to the change in temperature. The signal, when amplified, can
thus serve as an indication of temperature. To convert voltage into temperature, however, we
must go through the usual calibration procedure. We will do this by measuring the (amplified)
voltage output of the thermocouple at three known temperatures, and then using a least-squares
fitting routine to fit a linear relation of the form
T  aV  b
to the data. Here T is the temperature, V is the voltage output of the thermocouple, and a and b
are, respectively, the slope and intercept of the linear fit.
From LabVIEW, open DAQ_temp.vi in the ME21 folder. The operation of this VI is
identical to the other calibration VI’s that we have used previously. From the thermometer on
the wall, determine the room temperature in F. With the tip of the thermocouple exposed to
ambient conditions (don’t hold the tip between your fingers! It will simply record your body
temperature), enter the room temperature and click the data acquisition button. Now dip the tip
of the thermocouple successively into the beakers of ice water and boiling water provided, enter
the respective temperatures (32 F and 212 F), and take the remaining two voltage readings.
The VI will then do a least-squares fit and calculate the slope and intercept of the fit for you.
Write these numbers down for later reference.
C.
VI Programming for the AT-MIO16L DAQ Board
In the past two lab sessions, you have learned how to write a VI for a temperature
measurement experiment. Recall that in Part I, you used the DemoVoltageRead.vi to provide
dummy signals from a random number generator to simulate temperature readings. This was
done so that you could create your Temp.vi without the need for a DAQ board. In the presence
of a DAQ board (in this case, the AT-MIO16L card from National Instruments), you will no
longer need the DemoVoltageRead.vi. We now want to modify the VI that you wrote previously
to read actual voltage signals.
1. In LabVIEW, open the file a:Temp.vi, which should reside on your floppy disc. Switch to the
Diagram Window and you will see the object DemoVoltageRead.vi. Pop up with the right
mouse button on this object and select the Replace option. Then select the sequence
ReplaceData AcquisitionAnalog InputAISampleChannel.vi.
AISampleChannel.vi
measures a single value from the signal on the specified channel and returns the measured
voltage. Once you have made the replacement, it will be necessary to rewire. At the Menu
Bar, click HelpShow Help. Wire the connections as indicated by the help box and by the
figure on the next page. To enter the high limit (10V) and low limit (-10V), go into the
Functions palette and choose NumericNumeric constant. Do this twice, one for the high
limit and one for the low limit. Type in the numbers 10 and -10 and then connect these
1
numeric input boxes to the respective connectors in the AI Sample Channel object. If there
are any broken wires, press Ctrl-B or go to the Edit menu and choose Remove Bad Wires.
2. Now that you have replaced the DemoVoltageRead.vi with the DAQ VI called
AISampleChannel.vi , you are nearly ready to take data, except for the fact that the signal
coming out of AISampleChannel.vi is in volts, and we want degrees Farenheit. This is where
the calibration of the thermocouple comes into play. Carry out the following steps to include
the calibration factors into your VI. Delete the wire between the Product Operator X and the
AI Sample Channel object. Furthermore, delete the Product Operator itself, as well as the
numeric constant of 100. These were simply used to scale the output of the random number
generator, and are of no more use to us. Replace these by the objects shown in the diagram
below. To enter the numeric values for the Intercept and Slope (calibration parameters), you
need to return to the Panel Window. In the Controls panel, select Numeric  Digital Control
(top left icon). Create two of these objects, one for the Intercept and the other for the Slope,
and type in the labels as shown in the diagram. In the objects, type the numerical values for
the Intercept and Slope that you obtained from the calibration procedure. Now return to the
Diagram Window, and wire all objects as shown in the sketch. Notice that the effect of all
this is just to convert the voltage signal V to temperature T in F, according to the formula
T
V b
a
2
Finally, save as the result as a:Temp.vi, overwriting the old file of this name.
The Experiment
Finally, we are ready to acquire data. From LabVIEW, call up the VI that we wrote in the
last session, Templot.vi. Notice that this VI makes use of temp.vi. However instead of the
previous version, Templot.vi will now use the version that we just modified and saved.
Otherwise, it will function just as before. The only modification that we will need to make is in
the data acquisition time, which we want to slow down a bit. Switch to the Diagram Window
and change this value to 1000 ms (1 sec). Return to the Panel Display. On both the Temp
History Plot and the Temp Graph, use the Labeling Tool to change the upper limit on the
temperature scale to 220, just above the boiling point of water.
Hold the thermocouple so that the tip of the thermocouple rests in the boiling water (you
may need the instructor to help at this point). Now start the VI and start to acquire temperature
data from the thermocouple. You will see a data point appear every 1 seconds on the Temp
History Plot. After about 20 seconds or so, pour some cooler water from another beaker into the
beaker with the boiling water. Continue to acquire data for about another minute. You should
see the temperature in the beaker decrease abruptly when the cooler water is poured into the
boiling water, and then start to slowly rise again with heat input from the hot plate. At this point,
stop the experiment with the Enable switch. The Temp Graph should appear, along with the
maximum, minimum, and mean temperatures.
3
Download