As promises, for this chapter we gonna learn about how to Analyzing and Saving a Signal that generates a signal, filters the signal, indicates if the signal exceeds a certain limit, and records the data.
- Create New list, select VI»From Template»Tutorial (Getting Started)»Generate, Analyze, and Display.
- This template VI simulates a signal and analyzes it for its root mean square (RMS) value.
Modifying the Appearance of Graphs
- On the block diagram
❤ TIPS
Hold down the <Ctrl> key → click and drag to create an additional → Release the mouse button to place the copied Simulate Signal Express → updates the name of the copied Simulate Signal Express 2
2. Double-click the Simulate Signal2 Express VI to display the Configure Simulate
3. follow as figure above
Adding Two Signals
To add two signals together to create one signal, use the Formula Express VI, you can find it in the block diagram → Push right click on a plain space → on mathematics tab → click script&formula.
There you can find formula function.
- Double click the formula, it'll shown table of configuration formula → Edit X1 in the column "SINE"→ Edit X2 60Hz and Noise → click ok
Filtering a Signal
Then do double click the filter function to change all the specification
Add it to the block diagram between the Simulate Signal2 Express VI and add it to the block diagram between the Simulate Signal2 Express VI and the Amplitude and Level Measurements Express VI.
After that put the while loop
Modifying the Appearance of Graphs
Analyzing the Amplitude of a Signal
- Double-click the Amplitude and Level Measurements Express VI→Configure Amplitude and Level Measurements dialog box→Amplitude Measurements→remove the check-mark from the RMS checkbox→select Peak to peak box
Controlling the Speed of Execution
You can add a time delay to the block diagram. A time delay slows the speed at which a VI runs.
- On the block diagram→Place the Time Delay inside the while loop →Enter 1.000 in the Time delay(seconds)
Adding a Warning Light
- Front panel window → Right-clicking (Controls palette)→ Express → LED → Round LED → Double-click the Boolean label → Change to WARNING
Setting a Warning Level Limit
- To compare the peak-to-peak value to a limit you set
- On the block diagram → push right click → Compare Condition tab→select the Greater option → Comparison Inputs section → select Value and enter 2 in the Value numeric control
- Name of the Comparison Express VI changes to reflect the operation of the Express VI,
- Peak to Peak output →connect to Operand 1(input of the Greater)→ right-click the wire that connects the Peak to Peak output to the Operand 1→ select Create»Numeric Indicator
Tip ❤ You also can press <Ctrl> and drag a rectangle in open space to add more working
space to the front panel or block diagram
space to the front panel or block diagram
Warning the User
- Make sure the Warning terminal is inside the While Loop
❤ TIPS : Red coercion dots appear automatically at the Pk-Pk and Warning input terminals to alert you that you wired two different data types together and LabVIEW converted the value passed into the node to a different representation.
❤TIPS : The block diagram places the coercion dots on the border of the terminal where the conversion takes place
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.
- The Configure Write To Measurement File dialog box appears.
- The Filename text box displays the full path to the output file, test.lvm.
- A .lvm file is a tab-delimited text measurement file you can open with a spreadsheet application or a text-editing app
Saving Data to a File
- When you run the VI, LabVIEW saves the data to the test.lvm file
- To generate the test.lvm file:
- On the block diagram→wire the Pk-Pk output of the Amplitude and Level Measurements to Signals input of the Write To Measurement File Express VI.
- Select File»Save As and save the VI as Save Data.vi → rename the file
- Display the front panel and run the VI
- Click the front panel STOP button
- On the block diagram→wire the Pk-Pk output of the Amplitude and Level Measurements to Signals input of the Write To Measurement File Express VI.
- Select File»Save As and save the VI as Save Data.vi → rename the file
- Display the front panel and run the VI
- Click the front panel STOP button
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. Use the Operation page to specify how a button behaves when a user clicks it. To see how the button reacts to a click, click the button in the Preview Selected Behavior section.
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.
- 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. Viewing Saved Data



No comments:
Post a Comment