Make Decisions Faster through Instant Insights with LabVIEW

Publish Date: May 19, 2017 | 3 Ratings | 5.00 out of 5 | Print | Submit your review

Overview

Make data-driven decisions faster with LabVIEW using one of 1000+ built-in analysis functions for engineering and science applications. You can use LabVIEW to analyze signals in line with your data acquisition, so you can make immediate decisions based on analyzed results and display them to your user immediately. If you want to store your data to analyze later, you can use LabVIEW to perform offline analysis. Whether you’re running analysis on a general-purpose OS like Windows, a real-time OS, or even an FPGA, LabVIEW has the tools you need to get your job done.

 



Table of Contents

  1. Explore Configuration-Based Analysis With Express VIs
  2. Performing Analysis Using LabVIEW Functions
  3. Reuse Your .m Files With the MathScript Node
  4. Additional Resources

1. Explore Configuration-Based Analysis With Express VIs

With Express VIs, you can apply common analysis functions to your data by configuring a set of parameters. Express VIs are a great way to rapidly prototype an algorithm or get quick access to results with minimal programming. LabVIEW comes with nearly 40 different Express VIs for signal analysis and manipulation.

  1. Open Limit Testing Measurement_ Express VIs.vi from Evaluating Analysis.lvproj. This VI includes a prebuilt UI and signal simulation. For this exercise, add the code to generate the power spectrum of the signal, and perform limit testing to determine if the signal is out of a specified range. If you have your own hardware, you can replace the Simulate Signal Express VI with code to connect to your own instrument to collect real data.

    Figure 1: Starting Limit Testing Application.

  2. First, calculate and display the power spectrum. LabVIEW includes several Express VIs to perform common measurements on a waveform. You can find these functions on the block diagram by right-clicking and selecting Signal Processing»Waveform Measurement. The light blue functions are configurable Express VIs. Select Spectral Measurements and place it on the block diagram.

    Figure 2: Navigate to Waveform Measurement Express VIs.

  3. Configure the Spectral Measurements Express VI to display the power spectrum in decibels. Select OK to generate the code.

    Figure 3: Configure Spectral Measurements VI.

  4. Wire the output of the Simulate Signal Express VI to the input of the Spectral Measurements Express VI, and wire the power spectrum output to the power spectrum display terminal as shown in Figure 4.

    Figure 4: Wire the simulated signal to the input of the Spectral Measurements Express VI, and connect the resulting power spectrum output to the display.

  5. Switch to the front panel and run the application by pressing the Run Arrow in the upper left corner. Try moving the Inject Noise slider. As the noise amplitude increases, the power spectrum output responds accordingly.

    Figure 5: Click Run on the front panel to see the output power spectrum.

  6. Return to the block diagram and press <Ctrl-Space> to launch Quick Drop. Type in “Mask” and select the Mask and Limit Testing Express VI from the list by double-clicking on it. Drop it on your block diagram.

    Figure 6: Select Mask and Limit Testing.vi.

  7. When you drop the Mask and Limit Testing Express VI on your block diagram, a configuration window opens. Check the Upper Limit and Lower Limit boxes since you need to define both an upper and lower limit for your signal. Right now, the Mask and Limit Testing Express VI isn’t connected to an input signal, so the sample result is drawing from default data. Click OK.

    Figure 7: Default Masks for the Mask and Limit Testing Express VI. 

  8. Wire the output of the Simulate Signal VI to the input of the Mask and Limit Testing Express VI as shown below. Run the application by clicking the Run Arrow on the front panel.

    Figure 8: Connect the simulated signal to the Mask and Limit Testing Express VI and wire the outputs to the display.

    Right away you can see that the default upper and lower limits don’t match the signal. You can specify what the upper and lower limits look like to match the square wave.

  9. Double-click on the Mask and Limit Testing Express VI on the block diagram to reopen the configuration window. The Result Preview window shows your simulated square wave instead of the default because you have run this VI since connecting the input signal. This preview data is a useful guide to configure the limits. First, work on the upper limit. Click the Define button under the Upper Limit section.

  10. The Define Signal dialog is used to define the X and Y values of your limits. This is useful for signals whose limits aren't constant. For example, your square wave oscillates between 1 V and -1 V. 

    The simulated square wave is a 1 Hz signal with a sampling rate of 50 Hz and 128 samples. Based on these parameters, you can calculate dX as 20 m. Set the dX parameter in the timing section to 20 m and then begin defining your data points. At X=0, the upper limit of the signal is the top of the square wave at 1 V. Set Y=1.1 at X=0 to provide a 0.1 V margin of error. At X=0.5, the square wave shifts to its low value at -1 V. Set Y=1.1 for X=0.54 and then set Y=-0.9 at X=0.55 since the square wave drops low. Keep filling out the table to define all the values, as shown below in Figure 10. Click OK when you've completed the table.

    Figure 9: Configure the X and Y values of the upper limits at the transition points for the square wave.

  11. Now repeat the same steps for the lower limit. Click the Define button under the Lower Limit section.

    Figure 10: Now define the mask for the lower limit.

    Just like for the upper limit section, set dX to 20 m and fill out the table as shown in Figure 9. Click OK when the table is complete.

    Now both the upper and lower limits are defined. Your Result Preview should look like Figure13. Click OK to return to the block diagram.

    Figure 11: The Configured Upper and Lower Limit Masks.

  12. Switch to the front panel and click the Run Arrow to run the finished application. You should see the upper and lower limits on the graph as well as the simulated square wave and any failure points. Adjust the Inject Noise slider above 0.2 to add noise that exceeds the set margin of error. Observe how the number of failure points increases. 

    Figure 12: Front Panel of the Finished Application.

Calculating the power spectrum and performing a limit test are just two examples of performing analysis in LabVIEW. There are over 1000 other functions available. See what else you can do with LabVIEW for measurement analysis.

 

Back to Top

2. Performing Analysis Using LabVIEW Functions

Though Express VIs provide a quick and easy way to add analysis to your application, more advanced users may need added flexibility and lower-level control than what Express VIs offer. You can use low-level VIs in LabVIEW to accomplish the same task as an Express VI and use additional types of analysis where an Express VI is not available.

Figure 3: Power Spectrum and Limit Testing Implemented Using Built-In LabVIEW Functions.

Open Limit Testing Measurement_ Base Functions.vi from Evaluating Analysis.lvproj. This VI performs the same functions as the VI from Part 1, but it's written using built-in LabVIEW functions instead of Express VIs. Here you can configure your limits using a cluster containing arrays that define the X and Y limit points. This is really useful if you have two types of limits you want to apply depending on your device under test. You don't have to re-enter the parameters into a configuration window each time. Instead, switch them programmatically, depending on what you're testing.

Back to Top

3. Reuse Your .m Files With the MathScript Node

Finally, you can implement your analysis using text-based math with the MathScript node. Using the LabVIEW MathScript RT Module, you can integrate your custom .m files into the LabVIEW graphical environment. Combining the benefits of text-based math with graphical programming presents a new hybrid approach to programming that offers you the freedom to choose the most appropriate syntax.

Figure 4: With the LabVIEW MathScript RT Module, you can integrate your custom .m files into the LabVIEW graphical environment.

LabVIEW MathScript provides two methodologies for programming: an interactive and a programmatic interface. Designed for the development of scripts, the MathScript Interactive Window features a command-line interface in which you can load, save, design, and execute .m file scripts. Designed for the deployment of scripts, the MathScript Node is an embedded LabVIEW feature that connects the text-based I/O variables with the inputs and outputs of LabVIEW.

The LabVIEW MathScript RT Module runs on all LabVIEW desktop platforms as well as all LabVIEW Real-Time hardware targets. LabVIEW makes the once expensive path to hardware for .m files simple and quick. Just combine your .m file with LabVIEW graphical code using the MathScript Node, and drag and drop your application onto the real-time target within the LabVIEW project.

Download a Free Trial of the LabVIEW MathScript RT Module

 

Back to Top

4. Additional Resources

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit