LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to to continuously average dynamic voltage data

Solved!
Go to solution

Hi All,

 

I have LV 8.6 basic.

I am aquiring a continuous analog voltage signal from an RPM transducer using a DAQ Asistant.

the display jumps around quite a bit and it could use some smoothing out. My thought is to average the data in sample groups.

The data type is dynamic coming from the assistant. I would like to try and average 10 to 20 samples them update the display so appears more stable.

I did search and look at many examples but I still stumped.

 

Any thoughts?

 

Mully

 

0 Kudos
Message 1 of 26
(14,703 Views)
Hi, Personally I am a fan of an exponential average in a situation like this.  It has the advantage of being a point-by-point average so it can be updated along with the data.  The formula I use is that NewAve = ((D-1)*OldAve + NewValue)/D.  D is often referred to as the degree of the filter.  This VI shows a very simple example of smoothing random numbers, the MaxMin check is used to ensure that the degree used is less than or equal to the number of points.  You can skip this if you don't mind the value being off for the first D points.
Message 2 of 26
(14,688 Views)

Hi Darin,

 

Thanks for the vi. I am new to programing so I'm still confused. I just want to output the mean value of a set number of voltage data points to a display set after set after set. This is much like the Average express .vi does in the profesional version of LV. Any thoughts?

 

Thanks in advance.

Mully

0 Kudos
Message 3 of 26
(14,667 Views)

Hello,

 

Please see the basic averaging code screenshot I have attached. Where the DAQ assistant is located would be where your dynamic data goes in.

0 Kudos
Message 4 of 26
(14,663 Views)

Hi Mark,

 

I built a .vi based on the picture you sent but it looks like 0 is added to the aquired data value and then devided by 1???

 

I would like to out put to a display the mean of every 10 data points aquired. I must be missing something??

 

Thanks

Mike

0 Kudos
Message 5 of 26
(14,655 Views)

Hello,

 

The symbol that the 0 constant is wired to is a Shift Register. This initialises the first run of the loop to have 0 in the shift register. On successive runs, the value going into the adder is the previous adder result which is wired to the right side Shift Register, this is a method of feedback to the next iteration of a loop.

0 Kudos
Message 6 of 26
(14,648 Views)

Hi,

 

I put a loop around your vi but it always passes 0 into the shift register and devides by 1 every time it loops ??? What do I have wrong?

 

 

ScreenHunter_04 Jul. 29 13.42.gif

0 Kudos
Message 7 of 26
(14,625 Views)

Hello,

 

Try my code, which is attached!

 

Notes: Replace the DAQ Assistant with your own,  set to read a voltage on a channel of your choosing, with a finite (N Samples) number of samples (this is why I don't have a timer in my loop).

 

Make sure the samples to read is greater than 1, more like 1000 otherwise you won't have a valid average.

Message Edited by macaba on 07-30-2009 03:17 AM
0 Kudos
Message 8 of 26
(14,602 Views)

Hi Mark...................Thanks.

 

This seems to work.

 

So when the Daq assistant is set to "N samples" it takes that amount of samples and outputs them to the average code which updates the display each time the loop runs?

 

 

Do I have this correct??

 

Ps.

 

I have a vi that has multiple loops. I want to stop them all with one front panel button but I need to complete the "shut down code in the last block of a flat sequence structure before exiting.Here is what I have.

Any ideas??

thanks in advance!!

Mike

 

0 Kudos
Message 9 of 26
(14,586 Views)
Solution
Accepted by Mully911


"So when the Daq assistant is set to "N samples" it takes that amount of samples and outputs them to the average code which updates the display each time the loop runs?"

 

Absolutely right.

 

As for your other question, try removing this from your sequence:

 

stopVI.PNG

 

This is stopping your whole VI before the last frame of the sequence has a chance to execute. Your stop button will stop the while loop and let the next frame of the sequence execute.

0 Kudos
Message 10 of 26
(14,584 Views)