取消
顯示結果 
搜尋替代 
您的意思是: 

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 積分
1 條訊息(共 9 條)
3,440 檢視

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 積分
2 條訊息(共 9 條)
3,436 檢視

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 積分
3 條訊息(共 9 條)
3,429 檢視
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 積分
4 條訊息(共 9 條)
3,422 檢視

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 積分
5 條訊息(共 9 條)
3,412 檢視

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 積分
6 條訊息(共 9 條)
3,407 檢視

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 積分
7 條訊息(共 9 條)
3,402 檢視

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 積分
8 條訊息(共 9 條)
3,387 檢視

Dog gone it.  I should have thought of that. 

Thank You!

0 積分
9 條訊息(共 9 條)
3,374 檢視