LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

running average

Hi all
I have attached just a part of my VI but it's enough to undersatand my problem.
I have a sampling rate of 200 S/s and i would like to plot the mean value of the temperature reading every 0.5 sec.
The mean has to be performed over 500 samples...  This is NOT achieved using the method that you can see in my VI: it would take 2.5 sec to plot every new mean on the chart (moreover the 100 constant is wrong but i don't know what number i have to use).
Any suggestions?
Thanks for saving my life again Smiley Wink

Kind regards

Message Edited by Maverick83 on 10-30-2006 05:20 AM

I love the smell of napalm in the morning
0 Kudos
Message 1 of 22
(4,771 Views)
Hi Maverick,

I attached an image of a runing average... It's the easiest version without any fancy stuff. It's up to you to make a better version 🙂

Message Edited by GerdW on 10-30-2006 01:43 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 22
(4,739 Views)
Hi
Thanks for the solution but i haven't understood how to implement it in my VI to update my chart every 0.5 sec with the average on 500 samples and a sampling rate of 200 S/s...
Have you seen the attached VI? is it possible to modify it in order to obtain what i have asked?
Thanks a lot

Best regards.
I love the smell of napalm in the morning
0 Kudos
Message 3 of 22
(4,730 Views)
Hi Maverick,

maybe you can test the attachment...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 22
(4,723 Views)
Hello,
Using that sample rate (200 S/sec) your VI will be unable to get 500 samples every 0,5 seconds in order to calculate your mean temperature value. For this reason you shuld vary at least one of your paremeters, following this formula:
 
                                      time_to_spend = (Number of samples)/(Sample rate)
 
For example, if you want to plot the mean temperature value, calculated over 500 Samples, every 0.5 seconds you must acquire with a sample rate of 1000 S/sec at least.
The attached VI seems correct, you just modify one of the above parameters, in order to have a coherent behaviour.
 
Best regards,
 
Fabio
 
Fabio M.
NI
Principal Engineer
0 Kudos
Message 5 of 22
(4,684 Views)
Hi Fabio,

he just wants to display the mean of the last 500 samples every 0.5s. The 500 samples doesn't have to be measured in the last 0.5s! That's a huge difference 🙂
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 22
(4,684 Views)
Hi GerdW
You're right. I have adopted your solution and my VI works as i wanted.
Unfortunately there's another problem in it, but i'll dicuss it in a new topic because it's a strange problem.
Thanks again

Best regards.
I love the smell of napalm in the morning
0 Kudos
Message 7 of 22
(4,666 Views)
Take a look at the attached mod.  I used a waveform chart to store the latest 500 points.  I then hid this indicator so it isn't visible on the front panel.

One loop does the data acquisition.
One loop does the averaging which updates every 0.5 seconds.

I also removed the digital display below the temp guage.  The temp guage has one that you can make visible to display the numeric value of the guage.


Randall Pursley
0 Kudos
Message 8 of 22
(4,643 Views)
Attached is the same with a slight mod so the data acquisition acquires faster than the temp guage updates.
Randall Pursley
0 Kudos
Message 9 of 22
(4,638 Views)

Randall,

I like your trick of using a hidden chart control as a lossy circular buffer.  Have you done any performance benchmarking on this technique?  I keep meaning to, but perhaps you've already gone down that road...?

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 10 of 22
(4,626 Views)