Jump to content

Sub-VI vs. Flat code in 24-7 loops


Recommended Posts

In a loop performing reads on a card 24 hours a day, (analog inputs in this case), are there any issues with regard to using a Sub-VI or not? Note the JPG, and note that in this case the loop is slow, so we don't care so much about the 2.5uS (?) that it takes to open tand close the VI every loop iteration - I'm just wondering about the effect on memory in the long term. I would definately turn off debugging, but what about any gains with the Prioroty settings? Or Reload for each call vs. load and retain vs. load with callers ... etc.

Link to comment

QUOTE (BrokenArrow @ Jan 28 2009, 08:24 AM)

In a loop performing reads on a card 24 hours a day, (analog inputs in this case), are there any issues with regard to using a Sub-VI or not? Note the JPG, and note that in this case the loop is slow, so we don't care so much about the 2.5uS (?) that it takes to open tand close the VI every loop iteration - I'm just wondering about the effect on memory in the long term. I would definately turn off debugging, but what about any gains with the Prioroty settings? Or Reload for each call vs. load and retain vs. load with callers ... etc.

The only thing I see that could be different is the cluster. In the lower no-sub-VI loop, LV can reapeatedly through the last value into the buffer that is the output tunnel of the while loop. In the sub-VI flavor the sub-VI does not know the cluster is not being used whil looping so it has to return a copy of that data each time.

Ben

Link to comment

QUOTE (Paul_at_Lowell @ Jan 28 2009, 11:14 AM)

I don't think you will encounter any issues using a subVI. Have you experienced any issues after deploying the application and monitoring the PC's memory usage?

Well, no, not on this application, but in the past, I had an RT application that had a huge memory leak. Some of that issue ended up being a bug that NI admitted (fixed on 8.5.1). But since then, I get very nervous around applications that run for days on end.

QUOTE (beBulus @ Jan 28 2009, 11:28 AM)

The only thing I see that could be different is the cluster. In the lower no-sub-VI loop,
LV
can reapeatedly through the last value into the buffer that is the output tunnel of the while loop. In the sub-VI flavor the sub-VI does not know the cluster is not being used whil looping so it has to return a copy of that data each time.

On the non-SubVI flavor, which was a paste from the SubVI, I forgot the shift register for the incomming cluster. It should be there. Actually, since the cluster will change every iteration, I could just wire a constant there. Thanks Ben, I like you new name.

------

What do we think about setting a SubVI like this one to 'Load and retain' ?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.