Вы находитесь на странице: 1из 8

MECH3660

Analogue Sampling and LabVIEW


Part A - Timing, Quantization and Resolution Calculations
You are asked to acquire real-time data from a pressure sensor, and the expected highest frequency of
the pressure variations is 20 Hz.

1. What is the lowest sample rate you can use to avoid aliasing when sampling?





2. If we are interested in the shape of the signal, not just its frequency components, what might be a
good sample rate?





3. If the signal is affected by noise mains power (240V, 50Hz), what is the lowest sample rate you can
use to stop the noise component of the signal being aliased into our frequencies of interest?





4. If we are limited to a 50Hz sample rate, what else could we do to remove aliased signal
components?




5. If the ADC we are using has a maximum sample rate of 5kHz, what is the maximum achievable time
resolution for our digitised signal?





6. If we have a 12-bit ADC, how many discrete levels will our digitised signal have?





7. If the range of our 12-bit ADC is 5V, what is the voltage resolution of our digitised signal?



8. If the signal we are measuring with the 5V, 12-bit ADC is only expected to be in the range of
100mV, how many discrete values do we have to describe the actual signal?





9. How can we improve the number of discrete values across the range of the 100mV signal and thus
improve the quality of our acquired, digitised signal?





10. If you are starting a data acquisition project, and you dont yet have any DAQ hardware available,
how can you start developing your acquisition and analysis development?





11. Which of the following sample methods will allow us to acquire 100 separate samples from a signal
in a LabVIEW loop that iterates 100 times as fast as the computer will allow?

a. Single Sample Software Timed (On Demand)

b. Finite Buffered Acquisition (N Samples)

c. Continuous Buffered Acquisition (Continuous Samples)




12. Which of the following sample methods will allow us to acquire samples at 10kHz until a user
presses stop?

a. Single Sample Software Timed (On Demand)

b. Finite Buffered Acquisition (N Samples)

c. Continuous Buffered Acquisition (Continuous Samples)



13. Which of the following sample methods will allow us to acquire 100 samples at 10kHz?

a. Single Sample Software Timed (On Demand)

b. Finite Buffered Acquisition (N Samples)

c. Continuous Buffered Acquisition (Continuous Samples)






Part B Signal Conditioning in LabVIEW
1. Create and graph a noisy, offset sine wave in LabVIEW
a. Open a blank VI in LabVIEW (File>>New VI)
b. From the Block Diagram, right-click to open the functions palette and navigate to Express >>
Input >> Simulate Signal (you could also search for Simulate Signal from the top of the controls
palette).
c. Configure the Simulate Signal Express VI exactly as shown in the figure below.


Figure 1. Simulate Signal Express VI Configuration

d. On the Front Panel of the VI, right-click to open the controls palette and navigate to Modern >>
Graph >> Waveform Chart.
e. Place the Waveform Chart on your Front Panel and resize it to your liking.
f. On the Block Diagram, wire the Noisy Sine output of the express VI to the Waveform Chart
terminal.
g. Run the VI from the Front Panel.
h. Adjust the X-scale on your graph to 1 second, by double-clicking on the right-most value on the X-
scale and typing in 1.
Notice how the VI creates and graphs 100 points of a 1 kHz sine wave (0.1 seconds worth of
data).



2. Add a For Loop to the LabVIEW VI.
a. On the Block Diagram, right-click to open the functions palette and navigate to Programming >>
Structures >> For Loop. Your mouse pointer will indicate that you are ready to draw your loop
around the desired code.
b. Draw the For Loop by clicking and dragging your mouse to create a rectangle around all of your
code (much like using the selection tool in paint)
c. Right-click the N terminal on the For Loop and create a constant. Set the value of the new
constant to 10. This will make the loop iterate 10 times.

Figure 2. Simulated Sine, Graph and For Loop in LabVIEW

d. Run the VI from the Front Panel and notice how there is now about 1 second worth of data
graphed.

3. Replace the For Loop with a While Loop.
a. On the Block Diagram, right-click the border of the For Loop and select Replace with While
Loop.
b. Delete the constant of value 10.
c. Click on the Broken Run arrow on the VI and try to figure out what is wrong with the VI.
d. Right-click the conditional terminal o the While Loop and select Create Control. This will
place a stop button on your front panel and allow your VI to run.
e. On the Front Panel, position and resize the stop button to your liking, then press Run.
f. Notice how the VI now runs continually until the stop button is pressed.
g. You may need to add a time delay to your loop to see the signal better, 100mS would be a good
value

4. Add a Filter to remove Noise.
a. Create some space on your Block Diagram between your Simulate Signal Express VI and your
Chart. (Pressing the control button while drawing a rectangle on the block diagram will help to
create space).
b. Right-click the block diagram to open the functions palette and navigate to Express >> Signal
Analysis >> Filter. Place the Filter Express VI on the Block Diagram between the Simulate Signal
Express VI and the Chart Terminal and configure it as shown below.

Figure 3. Low Pass Filter Configuration

c. Press OK.
d. Delete the Wire Joining the Simulate Signal Express VI to the Graph, and then wire up the Block
Diagram as shown below.

Figure 4. Simulate Sgnal, Filter and Graph VI
e. Run the VI and notice how the noise in the signal has been reduced.
f. Option: Play with the filter cutoff frequency in the Filter Express VI to see the effect it has on the
signal noise. What seems to be a good cut-off to eliminate noise yet keep the signal shape?


5. Add a filter to remove the voltage offset.
a. Create some space on your Block Diagram between your Filter Express VI and your Chart.
b. Right-click the block diagram to open the functions palette and place a second Filter Express VI on
the Block Diagram between the first Filter Express VI and the Chart Terminal.
c. Configure it as shown below and press OK.

Figure 5. High Pass Filter Configuration

d. Delete the Wire Joining the Filter Express VI to the Graph, and then wire up the Block Diagram as
shown below.

Figure 6. Simulate Signal, Filter twice and Graph VI

e. Run the VI and notice how the offest in the signal has been eliminated (the data is now centred
around zero).
f. Option: Play with the filter cutoff frequency in the Filter Express VI to see the effect it has on the
signal offset and amplitude.
g. Save your VI as Simulate and Analyse.vi.
6. Hide the filtering complexity in a SubVI. (This step is an optional challenge complete if time permits)
a. Draw a rectangle around the two filter express VIs on the block diagram to select them
b. Select Edit >> Create SubVI
c. Open the Front Panel of the new SubVI by double clicking it. You will notice that it has an input
and output data structure on its front panel. These are used to wire data in from the Simulate
Signal Express VI and out to the Waveform Chart.
d. Open the Block Diagram of the new SubVI. You will see the two Filter Express VIs.
e. Copy the Filtered Signal output on the Block Diagram by selecting it and pressing ctrl-c. Create a
second output by pasting the copied one onto the block diagram. Relabel it All Signals.
f. Connect the Input wire (the one before the first Filter Express VI) to the All Signals output.
g. Connect the Wire between the two Filter Express VIs to the All Signals output. A Merge
Signals function will appear so that multiple wires can be connected to the one output.

h. Click on the Merge Signals function and pull down on the bottom blue expand square to add
another input terminal

i. Connect the second Filter output to the new Merge Signals input to create the block diagram
shown below.

Figure 7. Filter Sub VI
j. Double-click the All Signals terminal to find it on the Front Panel.
k. Create a SubVI connection for the All Signals output by clicking on an output terminal in the
connector pane (top right of window), and then clicking the All Signals output on the Front
Panel.

l. If you wish, create an Icon for the SubVI by double clicking the icon in the top right of the window
to open the icon editor.

m. Save the VI as Filter Sub.vi. Close it and return to your main VI.
n. Create a second Waveform Chart on your front panel by copying the existing chart. Resize and
Rearrange your front panel so you can see both charts and the stop button.
o. On the Block Diagram, place the new Waveform Chart inside the while loop and wire the second
output from the SubVI to it.
p. Go back to the Front Panel and Run it. You will see all three plots on the graph the raw signal,
low-pass filtered signal, and the final high-pass filtered signal.
q. Stop and save the VI.

Figure 8. Finished Block Diagram with Filter SubVI


Figure 9. Final Front Panel

Вам также может понравиться