LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

on fly average for multiple input channels

I am taking 2 input from DAQ M6251.  I have written a VI which is attached. I am using the for loop (500 iterations). I want to average the data over 500 iterations for both the inputs separately. But I am not able to calculate on the fly average. When I give save to measurement file vi for saving the data, it only saves the final reading not all 500 iterations like it does for single input. I cannot enable the indexing. Please tell me how can I get the averaged data for both the inputs separately.

0 Kudos
Message 1 of 6
(3,081 Views)

Hi bsunny,

 


I am taking 2 input from DAQ M6251


And why do you initiate, start and kill those tasks each iteration? Ever considered looking at the examples coming with LabVIEW?

Instead of iterating you simply could set the SampleTiming for each task accordingly, no loop needed...

 


But I am not able to calculate on the fly average.


Why not?

 


I cannot enable the indexing.


Yes, you can. But it will not fit with your ExpressVIs used afterwards...

 

- Create a proper design after studying the examples.

- Analyze your waveform signals to calculate the averages you need...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,071 Views)

I get the error shown in the attachment when I try to initialize the feedback for "on the fly average". How can I iterate without giving for loop??

Download All
0 Kudos
Message 3 of 6
(3,061 Views)

Hi,

 

I've made this video to try and help you : http://youtu.be/H0KgnkShZqY

 

I think it's best if you try to modify your VI yourself, that's why I didn't post it.

 

Hope this helps


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 4 of 6
(3,047 Views)

Thanks a lot for the video. I tried that VI. Can you please tell me couple of things:

1. which vi have you used to join the errors.

2. which waveform have you used to display the mean because in my case it is not showing anything.

 

I used graph for displaying the results. But I am getting the following error

Possible reason(s):

Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available.

Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped.

Attempted to Read Sample: 1000
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value: 0

Task Name: _unnamedTask<2BAE3>

 

Instead of this it is possible to synchronise 2 separate VIs ??

0 Kudos
Message 5 of 6
(3,029 Views)

1. the VI is called "merge error" I believe, it is to be found in the "dialog palette"

2. to display the mean I merely put digital indicator, but you could use a chart, that could make sens

 

I don't have LabVIEW here (at home) so it will be easier to answer your questions tomorrow.

 

If you read carefully the error message you posted it's telling you that the acquisition has stopped so the read samples VI fails to read the next 1000 sample. It means at the first iteration of the for loop, everything is ok, but at the second iteration not. Take a good look at the sampling paramters you chose for the analog input samplke clock : finite sample & number of samples = 1000 so the DAQmx analog input task will automatically stop after acquiring 1000 sample at the rate you specify, then inside the loop the read sample VI is set to get a chunk of 1000 samples... that's why at the second iteration the read sample VI tells you (after it has reached the timeout, 10 seconds by default) that it failed.

To fix this you need to change the sample clock settings, I let you play around with the different options available, enjoy!


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 6
(3,015 Views)