LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed average sub vi

Solved!
Go to solution

I am trying to average sensor data by sending it to a sub vi i created, which will append an array within the sub vi every second, and then at the end of the set time, output an average over that time period and reset the array.  For some readon some of my data values are coming out very wrong.  Could there be someting wrong with this vi? Specifically, I am wondering if there is a problem with persistent data in the sub vi array..  I am running LabVIEW 8.5

Download All
0 Kudos
Message 1 of 4
(2,472 Views)
Solution
Accepted by topic author hankthetank

You need to set you subVI to be reentrant.  Go to VI Properties->Execution.  There is a checkmark there for reentrancy.  If you can choose, you want to preallocate clone for each instance.

 

What this will do is each call to the subVI will have its own memory space.  It is currently sharing the memory space and therefore your averages are getting all messed up.

 

I would recommend visiting the LabVIEW Field Journal as there were some good articles this year on this subject matter.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,447 Views)

That fixed it right away. Great work, thank you!

0 Kudos
Message 3 of 4
(2,435 Views)

thanks

0 Kudos
Message 4 of 4
(2,320 Views)