From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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,511 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,486 Views)

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

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

thanks

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