Example Code

Linear Averaging over an adjustable Integration Time

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Sound & Vibration
  • LabVIEW

Code and Documents

Attachment

Description:
Currently, the Sound and Vibration toolkit supports a hard restart when performing Fractional Octave Analysis on one channel's data, meaning that when averaging it does not track or weight previous data. However, when implementing Linear averaging of Octave Measurements, a user might want to equally weight the band power outputs and maintain a running average over a specified Integration time. For example, with an Integration time of 32 seconds, a program could maintain the last 32 seconds of data and average it, releasing the oldest data as new data was recorded.
 
The VI attached below uses a running window average that tracks the last 32 seconds of data and uses that in the calculations. The attached VI uses simulated data, but it takes the user defined inputs of Integration Time, Sampling Rate, and Number of Samples to perform Linear Averaging. The VI shows an "all time" average which encompasses all data from when you start the VI until you stop it and then it also has a running average which is only the last 32 seconds.
 
Steps to implement or execute code
To implement this example:
  1. Define sampling info and integration time
  2. Run VI

 

Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

 

2017-10-30_14-41-42.jpg2017-10-30_14-41-15.jpg

 
**This document has been updated to meet the current required format for the NI Code Exchange.**
Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.