Background and Instructions – Data Acquisition System

advertisement
Background and Instructions – Data Acquisition System
Prepared by Professor J. M. Cimbala, Penn State University
Latest revision: 11 January 2012
A.
Hardware and Software
The same hardware and software are used in all of the labs in this course for data acquisition. Each computer has a
National Instruments PCI 6014 data acquisition card that has 8 differential analog input channels. The A/D converter is 16bit, and the range is set to –5 to 5 volts. The software is also from National Instruments: LabWindows is installed on each of
the lab computers. This software is similar to LabView, but is controlled from a computer program (written in C), rather than
from a graphical user interface. To the end user, the executable data acquisition “virtual instrument” looks and functions
similarly regardless of whether it was developed in LabView or in LabWindows.
B.
Operating Instructions
All the virtual instruments used in this lab have similar layout and function. A virtual instrument is started by doubleclicking on its icon, located on the Windows Desktop. Here is the format used for these instructions:






An underlined word or phrase means to click with the left mouse button on the corresponding icon.
R-underlined word or phrase means to click with the right mouse button on the corresponding icon.
word 1-word 2 means to click on word 1 and then on word 2.
An <enclosed word> means to hit a key on the computer’s keyboard. E.g., <Enter> is the keyboard’s Enter key.
“words in quotes” are to be typed in from the keyboard:
o Enter “words” means to type in the words, and then <Enter>.
o Type “words” means to type in the words without hitting the <Enter> key.
A word or phrase in italics refers to a Window name, a dropdown list, or a label on the screen.
The following steps are specific to operation of the virtual instrument called “Generic Data Acquisition”, but many of
these steps are common among all the virtual instruments.







C.
Before acquiring any data, you must first select a file for data output: Select File.
o Type in a file name, or select an existing file from the available list of text files. Always choose a name that is
both descriptive and unique to your group, e.g., “LVDT_calibration_Smith_Jones_Group_C.txt”. All files must
be text files, ending in txt. OK.
o If you select an existing file, you will be prompted whether you want to overwrite it (replace the existing file) or
append it (add new data to the end of the existing file).
Change (if necessary) various parameters such as sampling rate, number of samples per channel, etc. OK.
Select the values to be plotted on the X (horizontal) and Y (vertical) axes of the graph. E.g., to plot Parameter 1, a
manually entered value, as a function of Channel 2 voltage:
o In the Change Y Value dropdown list, select Parameter 1, and Change.
o Similarly, in the Change X Value dropdown list, select Chan. 2, and Change.
To take a data point:
o Click when Ready to take Data. A window will pop up, prompting you to enter parameters and comments.
o Type in a value for Parameter 1 and Parameter 2, if desired: These parameters are manual numerical entries,
such as angle of attack, manual traverse readings, time recorded on a stopwatch, etc. If you do not type
anything, the previous values are repeated. The default values are 0.000.
o Similarly, enter a comment if desired. Comments are generally phrases such as “re-zeroed the drag balance”,
“previous data point no good”, etc. If you do not type anything, the previous values will be repeated. The
default is no comment
o OK. A Wait window pops up while data are being taken by the computer. Do not change any settings on the
experiment until the Wait window disappears. Otherwise, the channel voltages will change during data
acquisition.
The voltages from each of the four analog channels (0, 1, 2, and 3) are averaged, and the average voltages are listed
on a table on the screen, along with the two parameters you typed in, and the comment. These values are also written
to the output file, and a data point is plotted on the graph.
After one set of data is taken, you may change any of the parameters, including the axes limits on the graph, the
sampling speed, and even the output file name. Then a new set of data can be taken.
After all desired sets of data have been taken, Quit. This terminates the data acquisition program.
Post-Processing Instructions
After the data acquisition program is terminated, use Windows Explorer to locate the output file just created. By
default, the output file is located in directory C:\temp. Double click on the file to open it in Notepad. It is recommended that
the data be processed in Excel. To copy the data into Excel, follow these instructions:




Highlight all the data in the text file. Edit-Copy (or <Ctrl> “C”).
Start Excel, click in a cell (row G or H is recommended so that you have room to add constants and titles above the
data). Edit-Paste (or <Ctrl> “V”).
The data are now in Excel. Sometimes all the data are in one column. If that is the case, the data need to be parsed
into separate columns. Since the values are separated by commas in the output file: Data-Text to ColumnsDelimited-Next-Comma-Finish.
Extraneous data can be deleted. E.g., if you are interested only in Channel 1 and Parameter 2, you may wish to
delete the columns for Channels 0, 2, and 3, and the column for Parameter 1. (This step is unnecessary, but helps to
clean up the Excel spreadsheet and make it neater in appearance.)
In many of the lab experiments, a regression analysis (least-squares curve fit) is required. In Excel, polynomial
regression analysis can be performed to any desired order:


For a first-order (straight line) least-squares curve fit:
o Data-Data Analysis-Regression.
o Click in the area named Input Y range. Highlight the dependent (Y) data. E.g. if Parameter 2 is to be curve fit as
a function of Channel 1, highlight all the data in the column for Parameter 2.
o Similarly, click in the area named Input X range. Highlight the independent (X) data. E.g. if Parameter 2 is to be
curve fit as a function of Channel 1, highlight all the data in the column for Channel 1.
o Click in the area named Output Range, and click on a cell in an open area of the spreadsheet: This is where the
regression analysis output will be written.
o At the bottom of the Summary Output from the
regression analysis, there are two values:
25
 Y-intercept is the intercept of the linear curve fit.
 X variable 1 is the slope of Y versus X.
20
o The equation for the least-squares fit is Y = (Yintercept) + (X variable 1)*X. This equation can be
15
used to calculate a value of Y for a given value of X.
For a second-order, third-order, or higher-order
V (m/s) 10
polynomial least-squares curve fit:
o Insert a new column to the right of the independent
5
(X) data. Fill in this column with X2. If a third-order
fit is desired, insert a second column and fill with X3.
0
Similarly, create as many new columns as needed,
depending on the desired order of the polynomial
-5
least-squares curve fit.
2
2.5
3
3.5
4
o Tools-Data Analysis-Regression.
Channel 0 (Volts)
o Click in the area named Input Y range. Highlight the
dependent (Y) data.
o Similarly, click in the area named Input X range.
raw data
Least-squares fit
Highlight the independent (X) data and the data in
the column for X2, X3, etc. (Highlight more than one
Figure 1. A sample plot created in Excel.
column of data at a time.)
o Click in the area named Output Range, and click on a cell in an open area of the spreadsheet: This is where the
regression analysis output will be written.
o At the bottom of the Summary Output from the regression analysis, there are three (or more) values:
 Y-intercept is the intercept of the linear curve fit.
 X variable 1 is the slope of Y versus X.
 X variable 2 is the slope of Y versus X2.
 X variable 3 is the slope of Y versus X3, and so on.
o The equation for the least-squares fit is Y = (Y-intercept) + (X variable 1)*X + (X variable 2)*X2 + (X variable
3)*X3 + ... This equation can be used to calculate a value of Y for a given value of X.
In most labs, you are asked to create plots. This is most easily done in Excel. It is assumed that you know how to plot
data in Excel. As a quick refresher, however, note that Excel’s Scatter Plot option is usually most appropriate for engineering
plots. With this option, you can select separate columns of data for X and Y. Also remember to plot experimental data points
as symbols only (no line), and to plot equations or theoretical curves as lines only (no points). An example of a nice Excel
plot is shown in Figure 1.
Download