From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging 10kS/s to report data points at 10Hz

I have an NI USB-9215A using LabView SignalExpress software.  All I'm trying to do is to sample data (analog input voltages) as fast as possible (simultaneously from 4 channels) and give an average of that data every 100ms.  So data points reported at 10Hz.  My DAQ system is 16-bit and can sample at 100kS/s, so in theory it should be able to give an average of 10k samples every 100ms (I think? It may be slower by a factor of 1/4 because I'm sampling from 4 channels).  For the life of me, I can't figure out how to accomplish this in SignalExpress...I've been playing around with DAQmx Acquire and Time Averaging functions as well as Timing Settings in the program to no avail thus far.  I also have LabView 8.2 Student Edition, if would be easier to accomplish this with that program?  My file is attached. Any feedback is greatly appreciated. Thanks.
0 Kudos
Message 1 of 4
(4,320 Views)

Hi Nick,

You can perform this task in either LabVIEW SignalExpress or LabVIEW 8.2. Since you started with LabVIEW SignalExpress, I will continue with this and we can change later if needed. The 9215a can samples at 100kS/s (9215A Specifications, p12 - see picture), therefore if you would like to acquire 100ms of data at a time, you are correct - we would need to collect 10K samples.


To do this, in the DAQmx Acquire step, we will set the acquisition mode to ‘continuous’, ‘Rate‘ to 100K, and ‘Samples to read’ to 10,000. Next, use a ‘Statistics’ step (Insert After >> Analysis >> Time-Domain Measurements >> Statistics) to obtain the ‘mean’ value of the 10K samples just acquired. Go to the ‘Configuration and Results’ tab, and check the box for ‘Mean’. Lastly, Insert a step to Save the data (Insert After >> Load/Save Signal >> Analog Signals >> Save to (choose type) ). In the ‘Signals’ tab of the ‘save to’ please make sure to remove the original signal, and add in the signal for ‘mean’ which is being calculated in the previous step. (See picture below) Also make sure to configure the parameters in the ‘File Settings’ tab.


Regards,

Message Edited by David L. on 10-10-2007 08:21 AM

David L.
Systems Engineering
National Instruments
Download All
0 Kudos
Message 2 of 4
(4,302 Views)
Thanks, David.  This helps alot.  Couple questions though... Is there a way to get it so that a new file with a different name is created every time I click Run?  I had to set it to "If the file already exists: Append to file" so that all the values of my continuous run would all be together, but then when I start a new run that file is overwritten.  Also, when recording 4 channels simultaneously, is there a way to apply a different scaling/conversion formula to each channel separately?  I could only find options allowing me to scale all channels at once with one formula.  I am also attempting to do this in LabVIEW 8.2 Student Edition (since I own a copy) and am having similar problems.  I got the mean to work using DAQ Assistant (continuous, samples to read=1k, rate=10k) with Sample Compression (Reduction factor=1000) Express functions, but still can't apply 4 different formulae or have the files saved the way I want (I'm using the Write to Measurement File function).
0 Kudos
Message 3 of 4
(4,283 Views)

Hi Nick,

Let’s start with LabVIEW SignalExpress: When saving a file, you could choose ‘Next Available File Name’, but this will create a new file every time the ‘Save File’ step is run. This means that if you choose ‘Run’ (as compared to ‘Run Once’), than a new file will be created every time the step is run and you will have a large number of files when all is said and done. I do not believe this option best suites your project. This is the only way to create a new file programmatically when using LabVIEW SignalExpress, otherwise you can rename the file by hand manually before every run.

In regards to scaling in SignalExpress, all channels can be scaled separately by implementing a different scale for each channel. The picture below demonstrates adding a customer scale for AI0. The same can be done with the other channels, using a separate scale for each one. This does not only apply to LabVIEW SignalExpress, but all DAQmx tasks created in Measurement and Automation Explorer and LabVIEW.


When using LabVIEW, please see the shipping example ‘Cont Acq&Graph Voltage-To File(Binary).vi’ (Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage). When you leave the ‘File Path’ control empty, than every time the VI is run the user will be prompted to enter a file path, and you can create a new file. This new file will be written to until the VI is stopped. The following knowlegebase will assist with implementing a scale in LabVIEW, Programmatically Create a Custom Scale in DAQmx.

Message Edited by David L. on 10-11-2007 10:30 PM

David L.
Systems Engineering
National Instruments
0 Kudos
Message 4 of 4
(4,269 Views)