LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use a static reference to keep a VI in memory but then call it in parallel?

Solved!
Go to solution

Tanya,

 

Thanks for the code snippet!  I've actually moved on with my application at this point (work deadlines and all that), and it is working fine using a dynamic reference to the subVI and just holding onto the reference via a functional global to keep the subVI in memory.  I definitely wish I had built my subVI from the beginning with the model of running in parallel, and just showing or hiding the front panel as necessary similarly to how you described; I've stored your snippet away for reference for the next time.  🙂

 

Now I'm just trying to satisfy my intellectual curiousity (and broaden my LabVIEW knowledge); do you know how to use a static reference to run a subVI in parallel to the main VI, as opposed to the rest of us here? 😉

 

-Joe

0 Kudos
Message 11 of 17
(3,555 Views)

Hi Joe,

 

The way you used the Static VI Reference in your second post is the correct way to use a VI reference if you want it to run the VI in parallel with your main VI. A Strictly Typed VI reference is for use with the Call by Reference Node, which calls VIs dynamically.There is a LabVIEW example that ships with the program that demonstrates how to use the Call by Refence Node. The example is called Dynamic Load Example and can be found in the Example Finder under Programmatically Controlling VIs»Dynamically Loading and Calling VIs»Dynamic Load Example.vi.

 

Kind regards,

Tanya Visser
National Instruments
LabVIEW Group Manager
Message 12 of 17
(3,535 Views)
Thanks Tanya, I'll take a look at the materials you referenced.
0 Kudos
Message 13 of 17
(3,520 Views)
Solution
Accepted by topic author jmorris

Okay, just to have some closure to this thread, here's the final answer to my question.  It turns out the solution is simpler than I had been making it; when I read "When the Static VI Reference function outputs a strictly typed VI reference, LabVIEW reserves the referenced VI as long as the top-level VI is running" in the LabVIEW help, I thought it meant that I had to mark the static VI reference as strictly typed if I wanted it to keep the VI in memory.  That is not the case, and marking it as strictly typed was what was causing the problems with it already being reserved for running, etc.

 

When I removed the strictly-typed setting, everything suddenly worked like I wanted.  Opening and closing the reference as I had been doing in earlier examples is also unnecessary with the static VI reference.  The much simpler solution is shown here, and works just as I desired as described in my first post:

 

MainVI.png   MainVI_2.png

 

Thanks to everyone again for talking it out with me, even if for some reason the words weren't sinking in.  😉

 

-Joe

Message 14 of 17
(3,435 Views)

hi,

 

can u please tell me if it is possible to store a static vi reference in an array so that it can be used to run whenever it is called? If yes how?

I am new to labview, so any help would be appreciated. 🙂

 

Cheers

0 Kudos
Message 15 of 17
(2,994 Views)

cmskorpion,

 

FYI, it is considered better forum manners to start a new thread if the current conversation has been over for more than a month or so, especially when asking a new question like this one.

 

To answer your question, most any type of data which you have on a wire can be put into an array by using the Build Array VI.  I haven't done it personally, but I don't think static VI references would be any different.

 

Hope that helps,

 

-Joe

0 Kudos
Message 16 of 17
(2,986 Views)

joe,

 

I will start a new thread. thanks for the advice, since i am new to this i am not aware of the general convenance. any inconvenience is regretted.

 

BTW also thanks for your suggestion.

 

-cmsKorpion

0 Kudos
Message 17 of 17
(2,982 Views)