10-10-2019 02:02 AM
Hi Everyone:
The vi software is attached.
Questions
Any recommendation, suggestion, any help would be highly appreciated.
Thanks
10-10-2019 01:59 AM
Hi Everyone:
The vi software is attached.
Questions
Any recommendation, suggestion, any help would be highly appreciated.
Thanks
10-10-2019 06:14 AM
I can't open your vi as I've not yet converted to 2019 but you just need to read 100 points at a time and then average them. I'm not sure how this works with the DAQ Assistant but it's easy to set up using DAQmx.
10-10-2019 08:28 AM
I agree with Johntrich that you would do well to learn a little DAQmx (which "does all the work" of the Dreaded DAQ Assistant (a.k.a. DDA), and eliminates its Evil Twin, the Dynamic Data Wire. I strongly recommend that you spend a little time and review the excellent DAQmx Tutorials that NI publishes, especially "Learn 10 Functions in NI-DAQmx and Handle 80 Percent of your Data Acquisition Applications".
The basic Idea is that you create some Tasks (in MAX, for example) that spell out the details -- how many channels, voltage range, timing, sampling mode, etc., and your VI basically consists of a DAQmx Start (with a constant wired to the Task input that you "expand" by clicking on the little "selection triangle" and choosing the Task you just created and saved in MAX), a While Loop containing the DAQmx Read, and outside the While, a Stop Task and Clear Task.
Each time the loop runs, it should give you 100 points. Depending on whether you asked for 1 or N channels, and whether you specified that you wanted "just data" or a Waveform output, you'll have the output you specified and can do what you need to with it. If a single channel of Data (1D Array of Dbl), you simply put it through the Mean function found on the Math Palette (under Prob & Stat), while if it is a single Waveform, you unbundle the Data (Y) and take its mean. If N channels, you do the same thing, but run the N channels through a For loop to do them one at a time, getting an Array of Means.
If you need to do additional processing, particularly if the processing takes time comparable with the time to acquire N samples, you can treat the Acquisition loop as a "Producer" and pass the data to a Consumer in a Producer/Consumer Design Pattern. Otherwise, if it is something simple (and relatively fast, like saving to disk), just do it inside the DAQmx Read While loop (being sure to do the "slow" things, like opening and closing the file, outside the loop, before and after).
Bob Schor
10-10-2019 10:40 AM
If I'm reading your code correctly (and with so many Express Nodes it's hard to be sure without investing more time than I'm happy to - sorry!) then you're not taking a Moving Average - you're taking the average of all of the samples you've acquired so far.
The "Append Waveforms" node creates an output waveform that is the total of all of your iterations of the loop so far, and then you pass this into the statistics Express VI. So the output stats will be from the input data set (i.e. all). You could change this by wiring only the new data (i.e. the second input to Append Waveforms) into the stats Expr. VI.