LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging Fieldpoint Readings on Demand

Newbie Question:
 
I am taking data from a Compact Fieldpoint and the user would like a running average of a certain reading.  I am very close to making it work but can't quite get it. 
 
I have the Add Array Elements PtByPt VI in a case structure that I control.  I can make this VI count and average just the way I want to if I start from the moment I execute the VI but to average readings on demand I decided to count loop iterations in the false case and then subtract that from the loop iteration counts in the true case.  This did exactly what I want in taking me back to zero everytime I go to true.  The problem is when I did this my average dropped out. 
 
I have attached a basic example of what I have so far.  Any pointers would be appreciated.
 
Thanks
0 Kudos
Message 1 of 9
(3,429 Views)

Hi RZTC Dave,

could this be a solution for you? http://forums.ni.com/ni/board/message?board.id=170&message.id=312737

Mike

0 Kudos
Message 2 of 9
(3,425 Views)

Thanks Mike. 

I don't think those examples apply here.  I'm already in a loop with other things going on independant of this.  I need something I can turn on and off while the loop continues.  I can make an average in a completely dedicated loop.  This has to be executable independantly. 

0 Kudos
Message 3 of 9
(3,418 Views)
I only have 8.2, so I can't see your posted example, but this seems like it would work for a running average on demand.
 


Message Edited by JeffOverton on 04-03-2008 09:43 AM
0 Kudos
Message 4 of 9
(3,411 Views)

I believe that the "Add Array Elements PtByPt.vi" ignores the Sample Length input value if it is not the initial entry into the vi.

The first time the vi is called, Sample Length is read and loaded into a shift register internally. It will only look at that input again if the Initialize input is set to true. Of course each time you initialize the vi, it flushes its previous data.

So I think that the PtByPt.vi is not going to help you here.

0 Kudos
Message 5 of 9
(3,401 Views)

Jeff

Your example works perfectly until I stop and restart.  Any idea of how I can reset the counters to zero when the case goes false?  I'll keep tweaking.  I like your design because it's achieves the task simply.  Yours would work for the first sample period but my users want to change conditions on the fly and average the number in those conditions. 

What this comes down to truly is my people not wanting to average their data in excel.  As long as it keeps me working I'm fine with it.  That's what Labview is supposed to do.  Make their jobs easier.

Thanks!

0 Kudos
Message 6 of 9
(3,396 Views)

Jeff and all.

Got it.  It was one of those so simple I can't believe it took me 10 minutes to realize it.  I took your design and then in the false case I had the counts subtracting from themselves.  This made it always start at zero.

 

Thanks everyone for your help.  This forum is vital for me.  I'm on my own here.

0 Kudos
Message 7 of 9
(3,391 Views)

Instead of doing math in the false case, you could just wire zero constants to the output tunnels.



Message Edited by JeffOverton on 04-03-2008 11:42 AM
0 Kudos
Message 8 of 9
(3,376 Views)

Dog gone it.  I should have thought of that. 

Thank You!

0 Kudos
Message 9 of 9
(3,363 Views)