Uploaded by Luigi Wellner

3.1 Lab3.Dyn Signals.Handout (1)

advertisement
EML 3303/EAS 3800C
Dynamic Signals
EML 3303C and EAS 3800C
MECHANICAL AND AEROSPACE ENGINEERING MEASUREMENTS
DYNAMIC SIGNALS (GROUP REPORT)
I)
1.
2.
3.
Objectives:
Utilize digital data acquisition systems (computer) for dynamic signal acquisition.
Demonstrate how to properly avoid aliasing.
Use FFT for spectral analysis of dynamic signals.
II) Theory:
A dynamic (i.e., time-dependent) signal, y(t), can generally be represented in different forms such as:
a) Time domain representation:
Examples:
1. y(t)=A0 + A1 t + A2 t2 + …+ An tn
Where, A0, A1, A2, An are constants; and t is time
2. y(t)=A sin (ωt+Φ)
Where, A is the amplitude of the signal
ω is the angular frequency in radians/s, (ω =2πƒ)
ƒ (ƒ=1/T) is the frequency in cycles/s (Hz)
T is the signal period, in s
Φ is the phase angle (in radians)
Note that here the time, t, is the independent variable.
b) Frequency domain representation:
Examples:
1. y(t)=A sin (ωt+Φ)
Note that here the frequency, ω, is the independent variable.
2.
y(t)=A0 + ∑∞
𝑛=1(𝐴𝑛 π‘π‘œπ‘ (π‘›πœ”π‘‘) + 𝐡𝑛 𝑠𝑖𝑛(π‘›πœ”π‘‘)) =A0+A1 cos(ωt)+B1 sin(ωt)+A2 cos(2ωt)+B2
sin(2ωt)+…
Where, n is an integer (n=1, 2, 3, …). The above series is called the Fourier series and the constants An and
Bn can be determined from:
𝐴0 =
1 𝑇/2
∫ 𝑦(𝑑)𝑑𝑑 = 𝐷𝐢 π‘œπ‘“π‘“π‘ π‘’π‘‘ π‘œπ‘“ π‘‘β„Žπ‘’ π‘ π‘–π‘”π‘›π‘Žπ‘™
𝑇 −𝑇/2
2 𝑇/2
𝐴𝑛 = ∫ 𝑦(𝑑)cos(π‘›πœ”π‘‘)𝑑𝑑
𝑇 −𝑇/2
Page 1
EML 3303/EAS 3800C
Dynamic Signals
2 𝑇/2
𝐡𝑛 = ∫ 𝑦(𝑑)sin(π‘›πœ”π‘‘)𝑑𝑑
𝑇 −𝑇/2
In this analysis, y(t) can be any integrable periodic function with limited number of discontinuities. Here,
T is the signal period, in s; ƒ (ƒ=1/T) is the frequency in cycles/s (Hz); and ω (ω =2πƒ) is the angular
frequency in radians/s. Another amplitude parameter, 𝐢𝑛 , can be defined as: 𝐢𝑛 = √𝐴2𝑛 + 𝐡𝑛2
The spectrum of a square wave.
𝑦
a
III) Apparatus:
The equipment for this lab include: National Instruments
LabVIEW software; device capable of sound generation
(primary device running LabVIEW or secondary smartphone).
IV) Procedure:
π΄π‘šπ‘π‘™π‘–π‘‘π‘’π‘‘π‘’(𝐢𝑛 )
)
Consider a square wave (see Fig 1.a) with an
amplitude range ± a in Volts, and a fundamental
2πœ‹
frequency “πœ”” in rad/s. Here, πœ” = 2πœ‹ 𝑓 = , f
𝑇
0
T/2
T
-T/2
is the fundamental frequency in Hz, and T is the
signal period, in sec. According to theory, the
spectrum (i.e., the frequency domain
representation) of this signal will have peaks at
-a
frequencies “n πœ””, where n is an odd integer
Fig 1.a Square wave representation in the
(i.e. n=1,3,5,7,…). The amplitudes of these
time domain
peaks (Cn) depend on the values of An and Bn.
Here, Bn= 4a/nπ, and An =0. Hence, in this case, Cn = Bn.
4a/π
The resulting frequency-domain representation is shown
in Fig. 1.b.
0
4a/3π
πœ”
3πœ”
𝑑
4a/5π
5πœ”
πΉπ‘Ÿπ‘’π‘žπ‘’π‘’π‘›π‘π‘¦
Fig 1.b Square wave representation in
the frequency domain
Computer-based measurements:
In this section, certain signals will be acquired and analyzed using FFT in real-time. Signals will also be saved to
spreadsheet files for later analysis. For each data set, make sure to record the sampling frequency and file name where
the data is saved. After the lab is done, you can use software (such as Excel, MathCAD, Matlab, etc) to read the data
files and perform post processing. In this part of the experiment you will also observe the input signal via the graph
plotted on the front panel.
Page 2
EML 3303/EAS 3800C
Speaker
Microphone
Figure 2: Experimental setup
Dynamic Signals
Building a VI - Overview.
You will first use the Simulate Signal block to
generate and acquire sinusoidal and square waves.
Then you will use the Acquire Sound block to
acquire a multiple sinusoidal signal and airplane
sounds. Use of a laptop is highly encouraged as
some desktops use digital sound cards that
LabVIEW will not recognize. You will build a VI
that:
1) Acquires one signal.
2) Uses the Simulate Signal block (for sine and
square waves) or the Acquire Sound block (for
multiple sinusoid and sound signals) to set
parameters like (i) sampling rate (also called
sampling frequency) and (ii) the number of
samples (i.e., number of data points to be
acquired).
3) Plots the acquired signal.
4) Uses LabVIEW “Spectral Measurements”
function to calculate and plot the spectrum of the signal.
5) Saves your data in a single spreadsheet file. The file should contain the time series (The recommended format:
column 1= time; column 2 = signal voltage). The file should also contain spectral data (Recommended format:
column 3= frequency; column 4 = spectral value).
Building a VI - Procedure. See the Flow of Activities document for available tutorial video(s).
1) Add the Simulate Signal block to your diagram. Right-click > Express > Input > Simulate Sig.
2) Click OK. You will adjust the Signal and Timing settings later in the procedure.
3) Add a Graph Indicator. Right-click the output of Simulate Signal > Create > Graph Indicator. Change the
graph title to “Time-Domain”.
4) Add the Spectral Measurements block to your diagram. Right-click > Express > Signal Analysis > Spectral.
Under Selected Measurement, select Magnitude (Peak) and under Result, select Linear. Click OK.
5) Connect the output of Simulate Signal to the Signals input of Spectral Measurements.
6) Add a Graph Indicator. Right-click the FFT – (Peak) output of Spectral Measurements > Create > Graph
Indicator. On the front panel, edit the x-axis of the Waveform Graph (the one that will display data in the
frequency-domain) from “Time” to “Frequency”. Change the graph title to “Frequency-Domain”. Resize and
position the graphs as desired.
7) Add a signal merger. Right-click > Express > Sig Manip > Merge Signals. Connect the output of Simulate
Signal and the FFT – (Peak) output of Spectral Measurements to the signal merger.
8) Add a Write To Measurement File block. Right-click > Express > Output > Write Meas File. Select your file
destination and filename by clicking the folder icon. Under If a file already exists, select Use next available
filename so previous trials are not overwritten. Under X Value (Time) Columns, select One column per
channel. We are saving data in the time-domain (first signal in the merger from Simulate Signal) and in the
frequency-domain (second signal in the merger from FFT – (Peak)). Therefore, our two channels of saved data
will have different x values. Click OK.
9) Connect the output of the signal merger to the Signals input of Write To Measurement File.
Note on sampling frequency vs. signal frequencies.
a) The sampling frequency (or sampling rate) is set in LabVIEW and is the frequency at which the signal of
interest will be acquired by the DAQ. For example, if you set your sampling rate in LabVIEW to 4 kHz, the
program will acquire 4000 points/sec.
b) The signal frequency, on the other hand, is the frequency you set in the function generator, which is the
frequency at which your signal is changing.
Page 3
EML 3303/EAS 3800C
Dynamic Signals
For example, a 125Hz sinusoidal signal is a signal that oscillates at 125 cycles/sec. Such signal can be acquired
at a sampling rate of 4000 Hz, which means that the DAQ will capture 4000 points of this signal per second.
Data Acquisition of a sinusoidal signal (2 files). See EXAMPLE IN FIGURE 3
1) Record the brand name and model and serial number of all equipment (when available).
2) Set Simulate Signal to Sine Signal type, 125 Hz Signal Frequency, 1 V Amplitude, and 0.05 Noise amplitude
(Check Add noise).
3) Use the Result Preview to check the signal amplitude.
4) Set Samples per second to 4 kHz in the Timing section. Choose the number of samples = 2001 (uncheck
Automatic) to acquire 0.5 seconds of the signal.
5) Run your VI. Observe the spectral output on the computer screen. Record the values of the spectral peaks for later
comparison.
6) Take a screenshot of the front panel and block diagram and attach it to the report (in the appendix). Choose an
appropriate time and frequency scales. For example, choose a time axis that shows a few cycles of the signal.
7) Your VI (when properly designed) should have saved the LabVIEW data to a file for later analysis. Keep track
of your filename and which file contains which data. Check your saved file to make sure it saved all info needed
(See recommended file format above).
8) Observe the spectral amplitude at zero Hz.
9) In the Simulate Signal dialogue box, increase the Offset of the signal to 1 V. Monitor the signal on the Result
Preview as you change the DC offset. Record the value of DC offset on your Sample Calculations sheet.
10) Run Your VI and save the LabVIEW data for later analysis.
11) Note the effect of changing the DC offset on the spectral amplitude at zero Hz.
12) Using the waveform graph on the LabVIEW front panel, determine the period (T) of the waveform by adjusting
the x-axis until you can see a few full cycles. Record the period on your Sample Calculations sheet.
13) Using the period, T, determine the signal frequency (f=1/T) in Hz (Hz≡cycles/sec). Record this value on your
Sample Calculations sheet.
14) Determine the amplitude by looking at the y-axis and record this on your Sample Calculations sheet.
15) When done with this part of the experiment, reduce the Offset value to 0 in the Simulate Signal dialogue box.
Data acquisition of a square wave signal (1 file)
1) Set Simulate Signal to a square wave at 125 Hz and keep the peak-to-peak amplitude the same as the above sine
wave (see previous section). Check the amplitude using the Result Preview. Keep the sampling frequency at 4
kHz.
2) Use the VI to acquire the square wave and perform spectral analysis on it.
3) Save your data in the spreadsheet file containing time and frequency data. Keep track of the file name.
4) Take a screen shot of the VI front panel showing the results. Choose appropriate time and frequency scales.
Aliasing of a multiple sinusoid signal (5 files) See EXAMPLES IN FIGURES 4 and 5
In this section, you will use the Acquire Sound block instead of the Simulate Signal block. You will acquire the
signal at different sampling frequencies. You will also apply software and hardware filters in an attempt to remove
unwanted frequencies.
1) Delete the Simulate Signal block. Right-click > Express > Input > Acquire Sound. Choose “cancel” in the
window that will pop up. Connect the output terminal of the Acquire Sound block named “Data” to the wire that
was previously connected to the Simulate Signal output. Create controls for # Channels, Sample rate (Hz), and
Duration (s). Right-click the respective input > Create Control.
2) You will find the necessary audio files in the “audio files” folder on Webcourses. (Due to the high-pitched audio,
you may wish to wear headphones as hearing protection, but do not plug headphones into the computer). Play the
specified sound card signal using media player. Ensure environment sounds are minimized.
3) Make sure to set the volume control to maximum on both your computer and media player.
4) Set the # Channels to 1, Sample rate at 22050 Hz and the Duration at 2 s. Acquire the sound card signal
“Original 2 Sinusoids” using the VI that you built. Save your time and spectral data.
Page 4
EML 3303/EAS 3800C
Dynamic Signals
5) Observe the waveform on the front panel. Set the time scale such that you can see a few cycles of the slower
sinusoid in the signal.
6) Re-acquire the same signal (“Original 2 Sinusoids”) at 11025 Hz, which is too low (according to the Nyquist
criterion). Save your time and spectral data.
7) Observe the waveform on the front panel. Set the time scale such that you can see a few cycles of the slower
sinusoid in the signal.
8) To add a filter, Right-click > Express > Signal Analysis > Filter. Set the Filtering Type to Lowpass. Adjust the
filter Cutoff frequency to 1/2 of the sampling frequency (11025/2~5512Hz). Add plots to the VI showing the
filtered data in time and frequency domains. You will need to add a second Spectral Measurements block to
transform the filtered signal from the time to the frequency domain. Be sure to label each plot properly on the
front panel.
9) Acquire the signal (“Original 2 Sinusoids”) without changing your sampling rate and save your time and spectral
data. Remove the filtering block from your VI after collecting this data.
10) Play the provided “2 Sinusoids Hardware Filtered at 5500 Hz” audio using media player. Anti-aliasing filtering
was performed on the original audio signal.
11) Acquire the signal and save your time and frequency data. Note that low-pass filters inhibit frequencies higher
than the cut-off value but may not remove these frequencies completely.
12) Play the provided “2 Sinusoids Hardware Filtered at 4400 Hz” audio using media player. Anti-aliasing filtering
was performed on the original audio signal.
13) Acquire and save your data. Note the effect of this change.
Acquiring sound signals of three airplanes – no filter is used (3 files)
1) You will find the necessary audio files in the “audio files” folder on Webcourses.
2) Set the Sample rate to 22050 Hz. Play the sound of: a) a single engine plane, b) a helicopter, and c) a B-52
bomber from the computer sound card. Make sure to set the volume control to maximum on both your computer
and media player. Play one signal at a time.
3) Acquire each sound separately (acquire 2 seconds of each sound). Save the spreadsheet file(s) containing your
time and frequency data.
V) Calculations and Questions:
Computer based measurements:
1) Use the data (from the saved files) to plot the time-domain (voltage vs. time) sinusoidal and square waves (3
plots).
2) Use the data (from the saved files) to plot the spectrum (frequency vs. spectral value) of these signals (3
plots).
3) For the sine wave, determine the frequency and amplitude from the time and frequency domains, separately.
(In the time domain, find period, T, then calculate the frequency f=1/T).
4) Compare the amplitudes and fundamental frequencies determined from the two domains. Are the results
expected? You may have to zoom in or out to show appropriate features.
5) Do you see evidence of spectral leakage (i.e., spectral energy leaking to neighboring bins)?
6) What is the effect of increasing the DC offset on the spectral plot?
7) Comment on the spectral features (i.e., the fundamental frequency, offset in frequency values, harmonics,
etc.).
8) For the square wave, be sure to comment on how the FFT looks (i.e., the fundamental frequency, discrepancy
in frequency values, harmonics, etc.). You may have to zoom in or out to show appropriate features.
Determine the signal period (and corresponding frequency) from the time domain plot. Comment on the
differences and similarities between this frequency and the fundamental frequency obtained from the
frequency-domain analysis.
9) Using the amplitude of the square-wave signal, calculate the Fourier series expansion (See the theory section
above on how to calculate An, Bn and Cn), and plot the theoretical spectrum (i.e. Cn as a function of frequency
f or πœ”).
10) How well did your calculated theoretical Fourier series of the square wave match the results of your
Page 5
EML 3303/EAS 3800C
Dynamic Signals
LabVIEW VI? If there is mismatch, what may be the possible reason(s)?
11) Compare the amplitude from the time- and frequency-domain (See Fig. 1.a and 1.b). For example, when the
time-domain amplitude is ±a, the amplitude of the fundamental frequency (the amplitude of the first
frequency in frequency-domain) is 4a/π
12) Plot the spectrum of the multiple sinusoid signal for both the high and low sampling rates.
13) Compare the two spectral plots (frequencies and amplitudes) and explain any differences (Do you see
evidence of aliasing)
14) Plot the spectra after application of both software and hardware filters. Comment on similarities and
differences.
15) Which filter was more effective in removing aliasing? Why this is expected or not expected.
16) Plot the spectrum of the sound of the three airplanes. Discuss the similarities and differences. What is the
frequency range of each sound? What is the loudest frequency for each? Does the spectrum show sinusoids
with harmonics? is it broad band? or does is show both? Do you think we have leakage? Do you think we
have aliasing? Given this analysis, is the time domain or the frequency domain more helpful for
distinguishing between these 3 sounds?
III)
Report Details
Follow the instructions from the report writing guidelines and rubric. The main results including the plots
that are specifically requested should be in the main body of the report. Include a section called “Results
Summary” containing the following tables in the results section of your report. Insert your own table number(s)
in the place marked with “xx”. Express all values using 3 significant digits minimum. The very large sets of raw
data points (e.g., the thousands of data points usually acquired using LabVIEW) should not be included in table
form in the report. Instead, use meaningful plots to show this data, when requested.
Table xx: Sine wave
Domain
Fundamental Frequency (Hz)
Amplitude (V)
Comment (differences or
similarities among values)
Do you see spectral leakage
yes/no
Effect of DC offset
Spectral features
Table xx: Square wave
Spectral features
Time domain
Frequency domain
Fundamental frequency:
Discrepancy in frequency:
Harmonics (do they exist?):
Determine the period from
the time-domain. Compare
the corresponding frequency
with the frequency-domain
fundamental frequency.
Fundamental frequency:
Discrepancy in the fundamental frequency from the frequency setting
of the function generator:
How many harmonics can you see, approximately:
Time-domain
Period:
[ms] , Corresponding frequency:
[Hz]
Frequency-domain
Fundamental frequency:
[Hz]
Compare (differences/similarities between these frequencies):
Theoretical Bn coefficients
(first 5 terms)
Compare theoretical and
experimental values of Bn.
Comparison (similarity/difference):
Possible reasons for mismatch:
Page 6
EML 3303/EAS 3800C
Compare the amplitude from
the time- and frequencydomain. See Fig. 1.a and 1.b.
(e.g. when the time-domain
amplitude is ± a, the
amplitude of the first
frequency in the frequencydomain is 4a/π)
Dynamic Signals
Describe in brief sentences.
Table xx: Results of multiple sinusoid signal
Higher sampling rate
Frequencies seen in the
Hz and
spectral plot
Lower sampling rate
Frequencies seen in the
spectral plot before
filtering
Compare plot. Is there
aliasing?
Frequencies seen in the
spectral plot after
software filtering (case 1)
Frequencies seen in the
spectral plot after
hardware filtering (case 2)
Frequencies seen after
reducing the LOW PASS
(case 3)
Was there amplitude
changes of the aliased
frequency for each filter
(3 cases)? Yes/Some/No
Which filter was more
effective in removing
aliasing? Why/why not
this is expected?
Hz
Hz
Hz and
Hz
Hz
Hz and
Hz
Hz and
Hz
Hz and
Hz
Software Filter:
Hardware Filter 1:
Hardware Filter 2:
Table xx: Results of airplane sound signals
Airplane
Frequency range
Loudest frequency
Spectrum have clear sinusoids and
harmonics? Broadband? Both?
Have leakage? (Yes/No/Do not know)
Have aliasing? (Yes/No/Do not know)
Is the time domain or frequency domain
more helpful (Choose/circle one)
Single engine
From
to
Hz
Time-domain:
Helicopter
Hz
From
to
B-52
Hz
Hz
From
to
Hz
Frequency-domain:
Page 7
Hz
EML 3303/EAS 3800C
Dynamic Signals
VI) LabVIEW VI examples
The figures below show example VIs that may be used in this lab.
Figure 3. Example of acquiring and plotting a simulated signal
Figure 4. Example of acquiring a sound signal, calculating the spectrum, plotting the time and frequency domain
data, and saving the data to a file (without applying a filter)
Page 8
EML 3303/EAS 3800C
Dynamic Signals
Figure 5. Example of acquiring a sound signal, calculating the spectrum, applying a filter, plotting the time and
frequency domain data, and saving the data to a file
VII)
a)
Reminders
Rubric: The rubric shows the grade distribution for your report. Remember to read the rubric before the lab
and collect all the data needed for your report.
b) Showing all work: In order to receive points, all related work (e.g., calculations) needs to be included in your
report. Showing the calculation details is best placed in the appendix. If you repeat the calculations many
times, only a sample of these will be sufficient.
c) LabVIEW: When using LabVIEW (staring experiment 2), remember to take the required screenshots of the
LabVIEW VI(s), front panel and diagram.
d) Figures and tables: All tables and plots must be made in software like excel, Mathcad, Matlab, etc. and
pasted from that software. No screenshots of figures (e.g. from LabVIEW or other software) will be
accepted as part of the data analysis section(s).
e) Appendices: The appendix must include your measured data tables and a sample of how each calculation
was made. A spreadsheet can be used to show both data and calculations as long as the equations used are
shown. Insert the table from your software, not a screenshot.
f) Acceptable data: Note that the labs and collected data are not identical to previous semesters. Only data and
analysis from this semester will be accepted. Turnitin is always used to analyze the content of your report.
Turnitin will report matches to previous (and current) semester lab reports. If data and analysis from a
different semester are submitted, those parts of the report will get zero grades. Submitting work from a
different semester is considered cheating that will be subject to UCF cheating policy and can result in
disciplinary action consistent with UCF policies.
Page 9
Download