Transcript today`s
Data Acquisition Overview
Using LabVIEW to acquire, analyze and record data
1
Data Collection
One shot
vs. time
Using the while loop
Using the DAQ for timing
2
DAQ set up for both
Choose RSE or differential, usually the latter
Choose voltage range to match your expected inputs
3
Timing
DAQ set up for while
Collect one sample
DAQ set up for DAQ timing
Collect N samples
Put controls on the front panel for rate and number of points
4
Saving Data
Use the Write to Measurement vi
General set up
One File only
One header only
One time column only
For one shots or while loop control set up: Append to File
For DAQ timing: Use next available file name.
5
Power Spectra
Use Spectral Analysis
Set to power spectrum, linear
Use DAQ timing
Number of points must be a power of 2, N = 2k
Sampling frequency (rate) must be high enough that half the frequency,
the so-called Nyquist frequency,
exceeds
the highest expected frequency
(Maximum sampling frequency for USB6009 is 48 kHz)
6
Other Power Spectra Issues
Zero Offset
Correct using a high pass filter
Install a control for the cut-off frequency
Aliasing
Test for by changing the sampling frequency
7
Power spectra amplitudes and frequencies
Use the Peak Detector vi
Create controls for threshold and peak/valley
Create indicators for number detected, locations and amplitudes
(but see below)
Wire the output of the Spectral Analysis vi to the X (input) terminal
of the Peak Detector
Optional: Multiply the output of the locations terminal by
rate/(number of points)
to convert location to frequency
8
Spectral Analysis Schematic
I think we can record peaks as well,
but I haven’t done it yet.
DAQ
Filter
Spectrum
Peaks
File
The spectrum
Raw data
9
Data Analysis Overview
What to do with your data when you’ve got it
sitting in an Excel file
10
Possible tasks
Calibration, interpolation
Characterizing variation in material properties
Deducing constants in a theory
Deducing a theory
11
Calibration, interpolation
Generally a polynomial trendline is good enough
Assess the fit using R2, which you get for free, but which isn’t as good as
Standard deviation of the fit
s
y
i
i yi
2
nk
(We have not explored techniques by which we can choose a “best” k.)
12
Characterization of Material Properties
You can use interpolation if you are fully ignorant
You can fit models if you have one
We looked at the Andrade model for the viscosity of water
If you have time, energy and intuition, you can perhaps dream up a model
and assess it!
13
Deducing Constants in a Theory
Write out the theory
Beat your data into a form that you can fit in Excel
Find the trendline
Convert back to theory
Assess the result using s.
14
Bernoulli Example
Theory:
h h0 CD
AE
AT
2
1
A
2gh0 t gCD2 E t 2
2
AT
Plot h vs. t and fit a quadratic equation.
Calculate s for the fit
Is s consistent with the expected errors in the data?
Do the two values of CD you calculate agree with each other?
15
Cooling Curve Example
Theory:
T Tf Ti Tf ekt
You need to know, measure or estimate Tf.
Plot ln(T-T
f) vs. t
Fit a linear trendline: m = -k and b = ln(Ti-Tf)
T exp b mt
Assess the fit in the original data:
T T
2
i
s i
i
n 2
16
Deducing a Theory (Boyle’s Law)
Plot the data and look at it
Pressure vs Volume (Boyle)
140
120
D (absolute pressure)
100
80
60
40
20
0
0
10
20
30
40
50
60
A' (volume)
17
Looks good, but what is it?
It’s not linear
You can make a polynomial fit, but . . .
there’s no physics in that — not a good idea
Note: p = 0 —> V —> ∞; V —> 0 —> p —> ∞.
A power law might be a good thing; plot ln(p) vs. ln(V).
18
Natural Logarithm of the Pressure vs Natural Logarithm of the
Volume
5
4.75
y = -0.9984x + 7.2447
4.5
ln(D)
4.25
4
3.75
3.5
3.25
3
2
2.2
2.4
2.6
2.8
3
3.2
3.4
3.6
3.8
4
ln(A')
19
Nice trendline (which you should assess)
The linear term is the exponent, looks like -1.
Carry on with the hypothesis pV = constant.
(We did this and I won’t do it again here.)
20