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

Simulate Signal Express VI' To Waveform Graph')

This document provides step-by-step instructions for creating LabVIEW VIs that: 1) Generate a sine wave and allow the user to control the amplitude with a knob, displaying the output on a graph. Data is compressed and displayed in a table. 2) Generate a synthesized signal containing a sine wave and noise, display the unfiltered and filtered signals on graphs, and add functionality for a warning light and data logging. 3) The exercises cover basic VI building blocks, front panel controls and indicators, block diagram programming, and adding functionality like data compression, filtering, and writing to files.

Uploaded by

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

Simulate Signal Express VI' To Waveform Graph')

This document provides step-by-step instructions for creating LabVIEW VIs that: 1) Generate a sine wave and allow the user to control the amplitude with a knob, displaying the output on a graph. Data is compressed and displayed in a table. 2) Generate a synthesized signal containing a sine wave and noise, display the unfiltered and filtered signals on graphs, and add functionality for a warning light and data logging. 3) The exercises cover basic VI building blocks, front panel controls and indicators, block diagram programming, and adding functionality like data compression, filtering, and writing to files.

Uploaded by

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

Exercise 1:

(1) Launch LabVIEW [Start > All Programs > National Instruments
LabVIEW]. From Getting Started screen, create a new, Blank VI.
(2) We start to work on front panel. On front panel, add a knob (as input) [Right
click > Controls Palette > Express > Numeric Controls > Knob]. Similarly,
add a waveform graph (as output) [Right click > Controls Palette > Express
> Graph Indicators > Waveform Graph].
(3) Now switch to block diagram [Ctrl+E]. In block diagram, add Simulate Signal
Express VI [Right click > Functions Palette > Express > Input > Simulate
Signal]. As configure dialog box appears [or double click the block, also try
Right click block > Properties], set Signal Type Sine, Frequency 10.7 Hz, and
click OK.
(4) If desired, expand Simulate Signal Express VI block to reveal Amplitude
[Click and drag lower border downwards]. Now, still in block diagram, wire
the relevant blocks (Knob to Amplitude Simulate Signal Express VI, Sine
Simulate Signal Express VI to Waveform Graph)
(5) Add a While loop to the block diagram [Right click > Functions Palette >
Express > Execution Control > While Loop, click and drag to form a
rectangular While Loop border containing all blocks]. This allows the VI to
run continuously until STOP button is pressed.
(6) Test run the VI to ensure there is no error [Click Run icon in Toolbar on
front panel, click and turn the knob to generate some amplitude value
to signal; also try Ctrl+R to run VI]. Stop the VI [Click STOP button].
(7) <optional> We can fine tune our VI further, e.g.:
Rearrange and resize front panel items
Customize knob (change label, needle color, change scale, etc.) [Right
click item on front panel > Properties]
Customize waveform graph (change label, axis display format, change scale
from Autoscale, etc.) [Right click item > Properties]

(8) Back to block diagram, within While loop, add Sample Compression Express
VI [Right click > Functions Palette > Express > Signal Manipulation >
Sample Compression]. As configure dialog box appears, set Reduction Factor
25, Reduction Methods Mean.
(9) Wire the new block correspondingly (Sine Simulate Signal Express VI to
Signals Sample Compression Express VI, Mean Sample Compression
Express VI to Waveform Graph). Observe LabVIEW automatically adds Merge
Signals block to the relevant wire branches.
(10) Next, expand the Sample Compression Express VI to reveal Enable. This
time, try adding a toggle switch directly from block diagram [Right click
Enable > Create > Control]. Items created by this method are already wired.
(11) On front panel, add an Express Table indicator [Right click > Controls
Palette > Express > Text Indicators > Express Table]. The relevant blocks
appear in block diagram as well. If the blocks are outside While loop, select the
blocks [click and drag a rectangular marquee containing the blocks] and
move them into While loop border. Then, wire the blocks (Mean Sample
Compression Express VI to Signals Build Table Express VI).
(12) To slow down the VI execution (e.g. plotting in waveform graph), add Time
Delay Express VI [Right click > Functions Palette > Express > Execution
Control > Time Delay]. As configure dialog box appears, set Time delay
(seconds) as 0.25
(13) Run the VI and explore the controls (turning knob, switching the toggle
switch). Knob changes amplitude, while toggle switch enables/disables sample
compression. Stop the VI.
(14) <optional> As usual, we can fine tune the VI slightly, e.g.:
Rearrange and resize front panel items
Expand waveform graphs plot legend to display both lines [Click and drag
upper border upwards]
Reduce number of columns of the table to 1 [Right click item >
Properties]
(15) Save and close VI.

Exercise 2:
(1) Launch LabVIEW, create a new, Blank VI.
(2) We start by creating a synthesized signal containing desired signal and
unwanted (to be filtered) simulated noise:
First, in block diagram, add Simulate Signal Express VI [refer previous
exercise for its location]. In configure dialog box, set Signal Type Sine,
Frequency 10.3 Hz, Amplitude 1, select Simulate acquisition timing.
Then, add another Simulate Signal Express VI. This time, set Signal Type
Sine, Frequency 60 Hz, Amplitude 0.1, select Add noise with Uniform
White Noise, Noise amplitude 0.1, Seed number -1, also select Run as fast
as possible. For clarity, uncheck Use signal type name and enter Signal
name 60 Hz and Noise.
Still in block diagram, add Formula Express VI [Right click > Functions
Palette > Express > Arithmetic & Comparison > Formula], for clarity
set X1 Label Sine, X2 Label 60 Hz and Noise. Create the addition formula
(Sine+60 Hz and Noise) [Click X1, click +, click X2].
(3) Switch to front panel [Ctrl+E], add a waveform graph. Again, for clarity
purpose, change its Label to Unfiltered Signal.
(4) Back to block diagram, wire the blocks correspondingly (Sine Simulate
Signal Express VI to Sine Formula Express VI, 60 Hz and Noise Simulate
Signal Express VI to 60 Hz and Noise Formula Express VI, Result Formula
Express VI to Unfiltered Signal).
(5) Add a While loop to contain everything in the block diagram. Then, test run
the VI to ensure there is no error (remember to stop the VI before proceeding).
(6) Now, we will attempt to filter this synthesized signal (remove noise). In block
diagram, inside While loop border, add Filter Express VI [Right click >
Functions Palette > Express > Signal Analysis > Filter]. Set Filtering Type
Lowpass, Cutoff Frequency 25 Hz.
(7) On front panel, add another waveform graph [or copy from existing one:
Ctrl+click and drag from existing waveform graph]. Change the Label to
Filtered Signal.
(8) Back to block diagram again, wire the new blocks correspondingly (Result
Formula Express VI to Signal Filter Express VI, Filtered Signal Filter Express
VI to Filtered Signal).
(9) To control VI execution rate, add Time Delay Express VI. Set Time delay
(seconds) 1.000, so the loop iterates once per second.

(10) <optional> Fine tune items on front panel, e.g.:


Rearrange and resize waveform graphs and STOP button location
Change waveform graphs Y-axis Autoscale to fixed Minimum and Maximum
(e.g. -2.5 & 2.5) to enhance visual comparison between graphs [Right click
items > Properties > Scales tab > Amplitude (Y-axis)].
(11) Test run the VI again. Notice the difference between unfiltered and filtered
signal.

(12) We can add more functionality to the VI, e.g. warning light when some
amplitude parameter exceeds pre-defined value. In block diagram, add
Amplitude and Level Measurements Express VI [Right click > Functions
Palette > Express > Signal Analysis > Amplitude and Level
Measurements]. Select Peak to peak. Then, still in block diagram, add a
numeric indicator [Right click Peak to Peak > Create > Numeric
Indicator, or add from front panel].
(13) Now, add Comparison Express VI [Right click > Functions Palette >
Express > Arithmetic & Comparison > Comparison > Comparison]. Set
Items to Compare Data points, Compare Condition Greater, Value as 2.
(14) On the front panel, add an LED indicator [Right click > Controls Palette
> Express > LEDs > Round/Square LED]. Change its Label to Warning.
<optional> If desired, position the LED indicator near the numeric indicator.
(15) Back to block diagram, wire the new blocks accordingly (Filtered Signal
Filter Express VI to Signals Amplitude and Level Measurements Express VI,
Peak to Peak Amplitude and Level Measurements Express VI to Operand 1
Comparison Express VI, Result Comparison Express VI to Warning). Note
that the numeric indicator is already wired if added directly from block diagram.
(16) Run the VI and observe the functioning of the newly created warning
system. Stop VI. <optional> Save VI for the next part of exercise.

(17) Finally, in this last part, we attempt to let the VI write its data externally to a
file. If the previously saved VI is still open, add Write To Measurement File
Express VI [Right click > Functions Palette > Express > Output > Write To
Measurement File]. We will use default settings [Click OK]. <optional>
Otherwise, explore the settings using context-help [Ctrl+H] and change them if
desired, e.g. different Filename and path, File Description, Delimiter type, etc.
(18) Wire the new block (Peak to Peak Amplitude and Level Measurements
Express VI to Signals Write To Measurement File Express VI).
(19) To add more functionality, on front panel, add a rocker switch [Right click
> Controls Palette > Buttons & Switches > Rocker]. Change the Label to
Write to File, and change its button behavior [Right click item > Properties
> Operation tab > Latch when pressed].
4

(20) Switch to block diagram, Wire the blocks (Write to File to Enable Write To
Measurement File Express VI). <optional> Expand the express VI first to reveal
Enable before wiring.
(21) Run the VI and click the rocker switch a few times. Peak-to-peak value is
written to file with every click. Stop the VI.
(22) We examine the file created. From Windows Explorer, navigate to the
relevant file path (set in Write To Measurement File Express VI), search for
test.lvm (or the relevant file name if a different name was set). Open the file
using (i) Notepad and (ii) Microsoft Excel.
(23) <optional> If desired, save the VI for future reference. Close the VI and
close all applications.

You might also like