0% found this document useful (0 votes)
39 views

Spectral Analysis & Programming Options

Starting Frequency + Counter * Frequency Increment Wire this output into the frequency input of the subVI in Frame 1. Now the code will sweep frequency each time through the loop!

Uploaded by

ashimgiyanani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Spectral Analysis & Programming Options

Starting Frequency + Counter * Frequency Increment Wire this output into the frequency input of the subVI in Frame 1. Now the code will sweep frequency each time through the loop!

Uploaded by

ashimgiyanani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

AOE 3054

Spectral Analysis
&
Programming Options
Spectral Analysis Lab Agenda
1. Spectral Analysis and Aliasing
2. Experiment 6b LabView Preparation
3. 6b Experimental Idea- Impulse Input
(Optional)

2
Spectral Analysis
Often, you will sample a signal that is not a
simple sine or cosine wave but a combination of
several.
Fouriers theorem states that any waveform in
the time domain (that is, one that you can see
on an oscilloscope) can be represented by the
weighted sum of sines and cosines.
The combined waveform appears in the
frequency domain as amplitude and phase
values at each component frequency.
Open ExampleVI.vi and run the vi. Adjust the 3
frequencies. What does the code do?
Spectral Analysis
Spectral Analysis
Now add a spectral measurements VI to
the block diagram (Express>Signal
Analysis>Spectral Analysis).
Select Magnitude (Peak), Result>Linear
and Windowing>None on the pop up
window.
Input the combined signal wire into the
Spectral Measurements VI and add
graphical indicators to the phase and FFT
outputs. This should result in.
Spectral Analysis

Amplitude and
phase spectra
obtained from the
Spectral express VI
(Express>Signal
Analysis>Spectral)
Spectral Analysis Exercises
Vary the frequencies of the signals and
understand what is happening to the
amplitude and phase spectra.
Spectral Analysis - Aliasing
Open the Aliasing LLB (LabView Library
File), then double click on the Aliasing.VI
in the LLB manager screen.
Follow the instructions under the
Description section of the program,
which provide a number of different
exercises to learn about aliasing in
experiments.
Spectral Analysis - Aliasing
Aliasing Exercise
Vary the signal frequency for a fixed
sampling rate until the signal is greater
than half the sampling rate.
What is happening to the sampled frequency
in the spectrum?
Can you relate this to the way the spectrum is
computed?
Spectral Analysis Lab Agenda
1. Spectral Analysis and Aliasing
2. Experiment 6b LabView Preparation
3. 6b Experimental Idea- Impulse Input
(Optional)

11
Experiment 6 Digital Introduction
In the second Instrumentation Lab (Experiment 6a),
you manually controlled a function generator to
excite a beam and used an oscilloscope to
measure the response of that beam.
Week 5s Instrumentation Lab is essentially a redo
of the first Experiment 6, but will incorporate new
digital measurement techniques to automate most
of the data taking.

12
Experiment 6 Digital Introduction
Specifically, you will be using the myDAQ to
output a voltage signal that will control the function
generator. The myDAQ will also measure the
function generator output as well as the output
from the proximeter. The code you create will
cycle through output voltages until the resonant
frequency is found.
All operations will be controlled via Labview, using
a code that will be created today.
Further details of Experiment 6 Digital can be
found on the course website. 13
Automated Data Acquisition
We will write a code that sweeps frequency and
looks for resonance.
LabView is not a linear programming language.
You can add various functions on your block
diagram and they will be all run simultaneously.
To find the resonant frequency we need to
perform the following operations in a specific
order:
Adjust the frequency on the function generator using
the MyDAQ analog output
Let the beam adjust to the new frequency
Take measurements using the MyDAQ analog inputs
Automated Data Acquisition
Flat Sequence (Programming>
Structures> Flat Sequence)

Frame 1 Frame 2

The flat sequence consists of a series of frames or actions that


are executed sequentially. Frame 1 will be executed and then
Frame 2. Add frames before or after an existing frame by right
clicking on either the right or left boundary of the frame,
respectively. The frames execute from left to right. Add three
frames to a blank vi. This will be the building block for your code
this week.
Frame 1
Frame 1 will be used to set the frequency of the signal
output by the function generator, which drives the beam.
Open your final VI from last instrumentation lab.
Copy over the modified HW 2 subVI and DAQ assistant-
the ones that convert a frequency to voltage and output it-
to the Block Diagram of a new VI. Double check that the
DAQ assistant is set to output a voltage on the AO0
channel (refer to previous lectures on how to do this).
Label the numeric control input as Starting Frequency
and place it outside of the frame structure.
A picture of this is shown on the next slide.
Frame 1
Frame 2
The purpose of Frame 2 is to intentionally set a
delay between Frame 1, which changes the
forcing frequency on the beam, and Frame 3,
which measures the response of the beam.
This time delay allows the beam to adjust to the
new frequency and settle into a consistent
sinusoidal response pattern.
From your Block Diagram, right click to bring up
your Functions Palette. Then, go to
Programming->Timing->Wait (ms), and drag and
drop into Frame 2.
Create an input control to the function, and keep
the label as the default milliseconds to wait.
How many ms is sufficient? That can be
something you test in 6b to find out.
Frame 3
In Frame 3, the excitation frequency output from the
function generator and the beam response, output by the
proximeter, will be measured for a specified number of
samples.
Copy and paste your final code from the previous
instrumentation lab into Frame 3.
Delete the components that were already copied over to
Frame 1.
Right click the edge of the while loop and click Replace
with for loop.
Note: Youll likely have to drag and expand the size of
your frame structures to include everything.
Frame 3
Frame 3
Create a numeric indicator to control the upper count
limit of the for loop. Label it Number of Measurements.
This is not to be confused with the number of samples
already wired into the DAQ Assistant.
To clarify, for each iteration of the for loop, the DAQ
samples N number of samples to output a value for the
excitation and response amplitude, frequency, and
phase. The number of total iterations is set by M
Number of Measurements.
Also remember that all of this is occurring for a single
excitation frequency.
How large must M and N be to obtain accurate answers?
That can be something you investigate during lab 6b.
Frame 3
After N iterations of the for loop, we wish to average the
results to obtain a single value for both the excitation
frequency and response amplitude.
To do this, we must use shift registers and arrays in a
similar manner as Homework 4.
Create two Initialize Arrays and place them outside the
loop on the left.
Create a constant of 0 to wire in to the initialization value
input of the arrays.
Wire these arrays to your for loop. Make sure you add
shift registers (right click on the for loop wall).
Refer to the HW 4 help Powerpoint for a refresher on
any of these materials.
Frame 3
Frame 3
Next we need to add somewhere to store each excitation
frequency/response amplitude value from each iteration of the loop.
To do this, create two Insert into Arrays (Programming->Array)
inside the for loop.
Wire the loop iteration counter into the Index input for each array.
Wire the previous arrays from the shift registers on the left into the
array input on each Insert into Array.
Wire the excitation frequency output from the subVI into the New
Element input of the top array.
Wire the response amplitude output from the subVI into the New
Element input of the bottom array.
Wire the output arrays to their respective Shift Registers at the right
side of the for loop.
Frame 3
Frame 3
Now, we need to average the results from the arrays.
Add two Mean functions (Mathematics->Probability and
Statistics -> Mean) outside of the for loop on the right.
Wire the outputs from the for loop (at the shift registers)
into these functions.
Wire the mean outputs to the wall of the frame structure.
Create an indicator for the response amplitude, label it
Mean Resp. Amplitude
Frame 3
Automating the Code
The code, as currently written, will excite the
beam at a given frequency (controlled by a
single numerical input) and measure the
excitation signal and beam response for that
frequency.
We need to write code that will sweep through to
find the resonant frequency.
Our approach is based on the fact that the
beams response amplitude is at a maximum at
resonance.
Automating the Code
First, create a while loop around the entire
code so far except for the Starting
Frequency control.
We will use the while loop to start at a low
input frequency, sweep through excitation
frequencies and stop when resonance is
reached.
Automating the Code
Automating the Code
We want to set the input frequency to increase each time
the code is executed.
To do this, create a numeric control inside Frame 1 and
label it Freq. Increment.
Multiply this number with the while loop counter (The
blue icon at the bottom left of the loop).
Add this number to the initial frequency input. This way,
each time the loop executes it increases the excitation
frequency by the frequency increment.
Automating the Code
Automating the Code
Next, we need to set our condition for stopping the loop. We want this to
occur when the response amplitude reaches a maximum.
We will stop the loop when the response amplitude begins to decrease.
To do this, right click on the right side of the while loop and Add shift
register. Note that it will appear black for the time being.
Wire the mean response amplitude output from Frame 3 to the shift register.
This sends the final response value from one iteration back to the start of
the next iteration.
Underneath Frame 3, add a <= function (Comparison-> <=).
Wire the final mean response amplitude value to the top input of the <=, and
wire the previous iterations mean response from the shift register on the left
end of the while loop to the bottom input of the comparison.
Wire the Boolean output of this comparison to the Stop of the while loop at
the bottom right.
With this logic, the code will stop as soon as the response amplitude for a
given excitation frequency is less than the previous excitation frequency.
Automating the Code
Automating the Code
Finally, we need a way to display the resonant frequency. This is
slightly difficult, because the code wont actually stop running until
the iteration after the actual resonant frequency.
Create another shift register on the while loop, and wire the mean
excitation frequency output in Frame 3 to the right shift register.
Underneath Frame 3, but still inside the while loop, add a case
structure (Structures->Case Structure).
Inside the case structure, with the top option set to True, add a
numeric indicator and name it Resonance. Make sure nothing is
inside the False option.
Wire the Boolean output from the response amplitude comparison to
the T/F input of the case structure.
Wire the excitation frequency shift register on the left side of the
while loop to the Resonance indicator. This excitation frequency
will be the frequency from the codes previous iteration- in our case,
the actual excitation frequency.
Automating the Code

Excitation frequency

Response amplitude
Wrapping Up
Now, all the pieces of the lab 6b code are put together. Study each
component of the code and make sure you understand exactly what
is going on. Dont hesitate to ask questions if something isnt clear.
You will also have to go to your VI Front Panel and organize the
graphs and indicators.
If you finished early, use the rest of the time to prepare for lab 6b.
Think of some new goals you can accomplish using the automated
code and myDAQs that werent possible using the analog
equipment. Feel free to modify the code you just created as well to
do additional things.
A complete picture of the code is found on the next slide.
Also included, starting on slide 37, is an exercise to excite the beam
via an impulse force and measure the sinusoidal decay.
Your myDAQs will be collected at the end of Week 5s lab session.
Make sure all of the components of the myDAQ are collected in the
box you received it in.
Complete Code
Spectral Analysis Lab Agenda
1. Spectral Analysis and Aliasing
2. Experiment 6b LabView Preparation
3. 6b Experimental Idea- Impulse Input
(Optional)

39
Impulse Input
In this test, instead of measuring the response of
the beam to a sinusoidal excitation, we will
measure the response of the beam to an initial
impulse.
In theory, a pure impulse function will set an
initial velocity to the system. After the initial
impulse, there are no outside forces on the
system besides the damping and spring forces,
and the system will vibrate at its damped natural
frequency.
Experimental Setup
You will have to power the beam proximeters,
and set up the myDAQ to measure the output of
the proximeter.

Connect the Power Supply to the proximeter and


set it up for the correct output voltage. Remember
to take into account whether you are using the NEW or OLD
proximeter.

Refer to previous lecture slides for instructions


on properly connecting the devices.
myDAQ Connections
Connect your myDAQ to your computer
using the USB port.
Open LabView and your functional
Homework 3 VI

42
myDAQ Connections
BEFORE turning any of the equipment on, make
sure that you do not supply more than 20V to
the myDAQ through its analog inputs (myDAQ
Overvoltage protection: +/-30V, 20 Vrms)
This will require connecting the response signal
to the oscilloscope and measuring amplitudes
before connecting the myDAQ.

43
myDAQ Connections:
Response To Ch1 on
Attach the output Oscilloscope

BNC connector of
the proximeter to a
BNC-to-clipping- Proximeter
probe connector Output
using a T-connector
Then connect the BNC to
clipping probe
T-connector to (to myDAQ)
Channel 2 on the
oscilloscope 44
Providing the Impulse
We will approximate an impulse force by
simply plucking the end of the beam.
Before you connect the proximeter to the
myDAQ, watch the proximeter signal
response on the oscilloscope to make
sure its voltages stay within the +/- 10V
range.
You will have to practice to make sure
you dont hit the beam too hard (see
video to the right).
myDAQ Connections:
Response
When you know that the response will be within range,
clip the two ends of the probe coming from the
proximeter to wires and attach to the myDAQ AI1
channel. Make sure the red clip goes to the 1+ channel,
and black to the 1-.
You can use the Homework 3 code to measure the
response. In this case, the excitation signal will just be
noise and can be disregarded.
Set the sampling rate to a sufficient time to be able to
measure the entire response signal.
Run your code, pluck the beam, and measure the
response. An example output is seen on the next slide.
46
Impulse Function Response

From this, how can you determine the damped natural frequency? And how can that
be used to measure the damping and spring constants? That is up to you to
determine for next weeks lab.
Wrapping Up II
Once again, all the pieces of the lab 6b code are put together. You
now have all the tools to create various codes that will excited the
beam at various frequencies and determine the system
characteristics (b,m, and k).
Think of some new goals you can accomplish using the automated
code, todays lesson, and the myDAQs that werent possible using
the analog equipment. Feel free to modify the code you just created
as well to do additional things.
Your myDAQs will be collected at the end of Week 5s lab session.
Make sure all of the components of the myDAQ are collected in the
box you received it in.

You might also like