NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Trusted Enthusiast
Darren
Posts: 2,905

Darren's Weekly Nugget 06/19/2006

[ Edited ]
Have you noticed the new "Call Setup..." menu option when right-clicking subVIs in LabVIEW 8.0?  It's a really handy way to clean up your diagrams, and improve the load times of your VIs:
 
 
The code in the two frames is functionally equivalent.  In the second frame, I simply dropped the subVI on my diagram, right-clicked and chose Call Setup.  Then I selected "Reload on each call".  That makes the code function the same as doing an Open/Call By Reference/Close, like in the top diagram.  If I had selected "Load and retain on first call", the VI would be loaded into memory the first time it is called, but its reference would be kept in memory if the code is ever called again (like if this frame was in a loop).  If I had selected "Load with callers (like subVI)", it would behave exactly like a normal subVI (and the little "Call By Reference" halo around the VI would be removed).
 
So in this example, we are using Call Setup primarily to clean up our diagram, since both frames do exactly the same thing.  But there are some cases where it can improve performance as well.  One example where I have used Call Setup is in the VI Analyzer 1.1.  The subVI we use to load a configuration file in the VI Analyzer is rather large (with hundreds of subVIs).  In VI Analyzer 1.0, this subVI was called statically, meaning whenever you launch the VI Analyzer from the menus, this VI (along with everything else in the VI Analyzer) had to be loaded into memory.  In VI Analyzer 1.1, we used Call Setup on the file loading VI and selected "Load and retain on first call".  This improved the VI Analyzer launch time quite a bit, since now we only load the file loading VI into memory if the user needs to load a VI Analyzer configuration file.  In other words, with version 1.1, the waiting time it takes to load the file loading VI is only experienced by users who need to load a configuration file...with 1.0, everybody had to wait.
 
-D

P.S. - Check out past nuggets here.

Message Edited by Darren on 06-19-2006 12:38 PM

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Active Participant
MattH
Posts: 202
0 Kudos

Re: Darren's Weekly Nugget 06/19/2006

Darren:

Pretty cool stuff... but I am curious if there was a reason you used the sequence structure... just to show that the subVI would load ONLY during that sequence step?

out of habit, I tend to avoid sequence structures and kinda cringed at the sight of one.

Thanks,

Matt Holt
Toshiba International Corp.
Trusted Enthusiast
Darren
Posts: 2,905
0 Kudos

Re: Darren's Weekly Nugget 06/19/2006

I used the sequence structure simply to illustrate exactly which portion of the original code could be replaced with the Call Setup feature.  As for sequence structures, I completely avoid Stacked Sequence Structures, but I find the Flat Sequence Structure quite useful in an Initialize/Handle Events/Clean Up VI, where there might be local variables or other objects in my code that don't lend themselves well to data flow.

-D

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Active Participant tbd
Active Participant
tbd
Posts: 887
0 Kudos

Re: Darren's Weekly Nugget 06/19/2006

Hi Darren,

      I don't have LV8 - but there may be a good reason to upgrade hiding in your example.  In LV7.1, the VI type-specifier has to be updated by browsing to the VI template when there's a connector-pane change.  Is there a similar procedure in LV8 - or has requirement dissappeared along with the VI type-specifier?

Thanks. 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Active Participant
crelf
Posts: 1,485

Re: Darren's Weekly Nugget 06/19/2006



Darren wrote:
Have you noticed the new "Call Setup..." menu option when right-clicking subVIs in LabVIEW 8.0?  It's a really handy way to clean up your diagrams, and improve the load times of your VIs:


While "Reload on each call" is pretty cool, it creates a static link to the VI it's calling - I'd love to see an input when I can define the path of the VI to load... :smileyhappy:




Copyright © 2004-2014 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
Trusted Enthusiast
Darren
Posts: 2,905
0 Kudos

Re: Darren's Weekly Nugget 06/19/2006

Hi tbd,

When using the Call Setup feature, you no longer have to worry about connector pane changes.  However, if you are using the normal Open/Call By Ref/Close approach, there was no change in LabVIEW 8 regarding connector pane updates...you still have to do them manually.

-D

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Member
travispape
Posts: 87

Re: Darren's Weekly Nugget 06/19/2006

I'm having trouble with "Call Setup..." "Reload for each call" not actually letting go of memory. The simplest way to state my problem is with reference to Darren's nugget example. The way that it is working for me, "Dynamically_Called_VI.vi" would actually leave memory for the LV 7.x example; however, for the example marked LV 8.0, it does not leave memory.

 

In my case, it is not a small deal.

 

Load with Callers = 1.1 GB at the end of the run

Reload for each call = 940 MB at the end of the run

The "LV 7.x" way = 94 MB at the end of the run

 

where the amount of memory is as seen in the process list of task manager.  I'm running LabVIEW 8.5.1 on Vista.

 

I tried the "reload for each call" method with the profiler running, and when I take a snapshot after the program is done running (and everything should therefore be gone out of memory) I still have a huge list of VIs present in memory.  For the "LV 7.x" method everything that should be gone is gone.

 

By the way, I have stuck a  "Request Deallocation" function wired True in each of my dynamically-called VIs.

 

In short, "reload for each call" does not work as advertized for me--it seems to behave more like you would expect for "load and retain on first call". 

 

I have I found a bug or is this one regard that the two methods are functionally different?

 

Travis

Member
Dani007
Posts: 2
0 Kudos

Re: Darren's Weekly Nugget 06/19/2006

Hello Darren, i have a major problem with the call setup.

You mentioned that there are no more problems when the connector pane changes, well i couldn't figure that one out.

I have a large Application where i use a lot of the call setups when i made some chenges in the connector pattern i never get an error message.

When i build the exe file there is no error message coming up during the build process, it only comes up when the programm reaches the call and the error message only says :

 

Error 1031 occurred at Call By Reference Node in Untitled 1
Possible reason(s):

LabVIEW:  VI Reference type does not match VI connector pane.

 

With this kind of error message i can't even find out which Vi the error caused,

so i have to check each call setup in the VI. :smileymad:

 

This is even worse then in the old style, because if you had an error there you also saw which VI it caused.

So what possibility is there to make a general test of all VIs loaded with a call setup?

It seems to me that with the call setup the connector pane is picked once when you create a call setup from the normal vi,

and it only updates the connector pane when you do again your right click and set the call setup again.

why does it not normaly update the actual connector pane??? :mansurprised:

 

I also didn't understand that in the LV 7.x Version. because there was the same problem with the conector pane.

Why isnt there a possibility to auto update the connnector pane????

 

Greetings Daniel