1) Modifying a VI Created from a Template
- Firstly, click New to display the New dialog box and then Create New list, select VI»From Template»Tutorial(Getting Started)»Generate, Analyze, and Display.
- Click the OK button or double-click the name of the template to create a VI from the template.
- Display the front panel and remove the RMS indicator, shown at left (student will not use the RMS functionality of the Amplitude and Level Measurements Express VI for this exercise).
- Display the block diagram and remove any broken wires that result from removing the RMS indicator.
- Then return to the front panel window and right-click the waveform graph indicator.
- Select Properties from the shortcut menu. The Graph Properties dialog box appears.
- On the Appearance page, place a checkmark in the Visible checkbox in the Label section and enter Unfiltered Signal in the text box then click OK and RUN (the signals will appear).
- Then Stop.
2) Adding a Signal
- Drag Simulate Signal Express VI to create an additional Simulate Signal Express VI.
- Double-click the Simulate Signal2 Express VI to display the Configure Simulate Signal dialog box.
- Select Sine from the Signal type pull-down menu and Enter 60 in the Frequency (Hz) text box then Enter 0.1 in the Amplitude text box.
- Place a checkmark in the Add noise checkbox to add noise to the sine signal.
- Select Uniform White Noise from the Noise type pull-down menu.
- Enter 0.1 in the Noise amplitude text box and Enter -1 in the Seed number text box.
- In the Timing section, select the Run as fast as possible option.
- In the Signal Name section, remove the checkmark from the Use signal type name checkbox.
- Enter 60 Hz and Noise in the Signal name text box and then click OK.
3)Adding Two Signals
- In the block diagram window, triple-click the wire that connects the Sine output of the Simulate Signal Express VI to the Signals input of the Amplitude and Level Measurements Express VI and to the Unfiltered Signal indicator. Remove the wire.
- Click Functions palette, click the Search button to search for the Formula Express VI and add to the block diagram.
- The Configure Formula dialog box appears.
- In the Label column, change the label for X1 to Sine and the label for X2 to 60 Hz and Noise.The Formula Express VI automatically enters the first input, Sine, in the Formula text box.
- Click the + button and then the X2 button to add Sine and 60 Hz and Noise together in the Formula text box.
- Then click OK.
- Use the Wiring tool to wire the Sine output of the Simulate Signal Express VI to the Sine input of the Formula Express VI.
- Wire the 60 Hz and Noise output of the Simulate Signal2 Express VI to the 60 Hz and Noise input of the Formula Express VI.
- Wire the Result output of the Formula Express VI to the Unfiltered Signal indicator and to the Signals input of the Amplitude and Level Measurements Express VI.
- Run the VI, then the signal with noise will appears.
- Click the STOP button to stop the VI.
-
Select File»Save As and save the VI as Analysis.vi in an easily accessible location.
- Search for the Filter Express VI, shown at left, and add it to the block diagram between the Simulate Signal2 Express VI and the Amplitude and Level Measurements Express VI. The Configure Filter dialog box appears.
- In the Filter Specifications section, change the Cutoff Frequency (Hz) to 25.
- Click the OK button to save the configuration and close the Configure Filter dialog box and the Display the front panel and duplicate the Unfiltered Signal waveform graph indicator.
- Triple-click the Unfiltered Signal 2 label above the new waveform graph indicator and enter Filtered Signal to change the label of the indicator.
- On the block diagram, wire the Result output of the Formula Express VI to the Signal input of the Filter Express VI and to the Unfiltered Signal waveform graph indicator.
- Wire the Filtered Signal output of the Filter Express VI to the Signals input of the Amplitude and Level Measurements Express VI and to the input of the Filtered Signal waveform graph indicator.
- Then save.
4) Modifying the Appearance of Graphs
- In the front panel window, right-click the Unfiltered Signal graph indicator and select Properties from the shortcut menu. The Graph Properties dialog box appears.
- On the Display Format page, select Time (X-Axis) from the top pull-down menu.
- Select the Default editing mode option.
- In the Type list, select Automatic formatting.
- In the Digits field, enter 6 and select Significant digits from the Precision Type pull-down menu.
- Place a checkmark in the Hide trailing zeros checkbox.
- Select Amplitude (Y-Axis) from the top pull-down menu and repeat steps from Display Format page so the y-axis configuration matches the x-axis configuration.
- On the Scales page, select Amplitude (Y-Axis).
- Remove the checkmark from the Autoscale checkbox.
- Enter -2.5 in the Minimum text box and 2.5 in the Maximum text box.
- Click OK.
- Repeat the same steps to the Filtered signal.
5) Analyzing the Amplitude of a Signal
- On the block diagram, double-click the Amplitude and Level Measurements Express VI to display the Configure Amplitude and Level Measurements dialog box.
- In the Amplitude Measurements section, remove the checkmarkfrom the RMS checkbox.
- Place a checkmark in the Peak to peak checkbox. Peak to peak appears in the Results section with the corresponding value of the measurement.
- Then click OK button.
6)Controlling the Speed of
Execution
On the block diagram, search for the Time Delay Express VI and place inside the While Loop and Configure Time Delay dialog box appears-
.
- Enter 1.000 in the Time delay (seconds) text box and click the OK Button.
- Display the front panel and run the IV.
- The VI run more slowly and it rates once every second and stop the VI.
7) Adding a Warning Light
- Display the Controls palette by right-clicking any blank space in the front panel window.
- On the Express palette, select the LEDs palette.
- Select the round LED indicator and add it to the front panel to the left of the waveform graphs.
- Double-click the Boolean label above the LED and enter Warning to change the label of the LED.
- Save the file and read the various dialog box options. Select the Copy and Substitute copy for original options to create a copy of the original VI and immediately edit the copy and then Click the Continue button and save the VI as Warning Light.vi in an easily accessible location.
8) Setting a Warning Level Limit
- On the block diagram, search for the Comparison Express VI and place it to the right of the Amplitude and Level Measurements Express VI. The Configure Comparison dialog box appears.
- In the Compare Condition section, select the > Greater option.
- In the Comparison Inputs section, select Value and enter 2 in the Value numeric control to assign a constant value at which you want the LED to light.
- Click the OK button to save the current configuration and close the Configure Comparison dialog box.
- Wire the Peak to Peak output of the Amplitude and Level Measurements Express VI to the Operand 1 input of the Greater Express VI.
- Move the cursor over the wire that connects the Peak to Peak output to the Operand 1 input.
- When the Positioning tool appears, right-click the wire that connects the Peak to Peak output to the Operand 1 input and select Create» Numeric Indicator from the shortcut menu.
9)Warning the User
- In the block diagram window, move the Warning terminal to the right of the Greater Express VI. Make sure the Warning terminal is inside the While Loop.
- Wire the Result output of the Greater Express VI to the Warning terminal.
- Display the front panel and A numeric indicator labeled Peak to Peak appears in the front panel window. This indicator displays the peak-to-peak value of the signal and run the VI.
- When the peak-to-peak value exceeds 2.0, the Warning indicator lights. Then Click the STOP button to stop the VI.
10) configuring
a VI to Save Data to a File
- Search for the Write To Measurement File Express VI and add it to the block diagram below and to the right of the Amplitude and Level Measurements Express VI.
- In the Configure Write to Measurement File dialog box, locate the If a file already exists section and select the Append to file option to write all the data to the test.lvm file without erasing any existing data in the file
- .In the Segment Headers section, select the One header only option to create only one header in the file to which LabVIEW writes the data
- Enter the following text in the File Description text box: Sample of peak to peak values. LabVIEW appends the text you enter in this text box to the header of the file.
- Click the OK button to save the current configuration and close the Configure Write To Measurement File dialog box.
11) Saving Data to a File
- On the block diagram, wire the Peak to Peak output of the Amplitude and Level Measurements Express VI to the Signals input of the Write To Measurement File Express VI.
- Select File»Save As and save the VI as Save Data.vi in an easily accessible location.
- Display the front panel and run the VI and Click the front panel STOP button.
- To view the data student saved, open the test.lvm file in the LabVIEW Data directory with a spreadsheet or text-editing application. The file has a header that contains information about the Express VI.
- Close the file after you finish looking at it and return to the Save Data VI.
12) Adding
a Button That Stores Data When Clicked
- Display the front panel and search the Controls palette for a rocker button. Select one of the rocker buttons and place it to the right of the waveform graphs.
- Right-click the rocker button and select Properties from the shortcut menu to display the Boolean Properties dialog box.
- Change the label of the button to Write to File.
- On the Operation page of the Boolean Properties dialog box, select Latch when pressed from the Button behavior list.
- Click the OK button to save the current configuration and close the Boolean Properties dialog box. Save the VI.
13) Saving Data When Prompted by a
User
- In the block diagram window, double-click the Write To Measurement File Express VI to display the Configure Write To Measurement File dialog box.
- Change the filename test.lvm in the Filename text box to Selected Samples.lvm to save the data to a different file.
- Click the OK button to save the current configuration and close the Configure Write To Measurement File dialog box.
- Right-click the Signals input of the Write To Measurement File Express VI and select Insert Input/Output from the shortcut menu to insert the Comment input.
- Right-click the Comment input of the Write To Measurement File Express VI and select Select Input/Output»Enable from the shortcut menu to replace the Comment input with the Enable input.
- Move the Write to File terminal to the left of the Write To Measurement File Express VI.
- Wire the Write to File terminal to the Enable input of the Write To Measurement File Express VI.
14) Viewing Saved Data
- Display the front panel and run the VI. Click the Write to File button several times.
- Click the STOP button.
- Open the Selected Samples.lvm file with a spreadsheet or text-editing application.
- Close the wordpad.
- Save and close the VI.
No comments:
Post a Comment