12-07-2009 06:05 PM
Thanks for all the posts. I was finally able to get the functionality I desired...running three instances of a Main VI from one top-level executable.
I made my Main.vi into a VI template and then open multiple references to this template from a top-level VI. While there are ways to get re-entrant behavior out of FGs (link) I decided to eliminate any FGs I had and to pass the data using wires or queues instead. All my SubVis were made re-entrant.
I then insert each of the Main.vis into separate Subpanels on my top-level VI (each running a separate instance of the Main.vi). Each instance of teh Main.vi communicates with an indivdual USB-6008.
Works well.
Dan
03-12-2010 09:50 AM
03-12-2010 09:58 AM
03-12-2010 10:48 AM
03-12-2010 11:56 AM
| Another clarification question - If I understood you correctly, you enveloped your LABVIEW code into a DLL, correct? |
No, I made the top level VI a VI template and opened separate instances to this template
In response to:
You mentioned that "All my SubVis were made re-entrant". What is done with VIs from third-party vendors? I am not able to select the Execution properties of those VIs.
If the third party VIs need to maintain separate data space then they need to be re-entrant, even when opening seperate instances of the template vi.
In response to:
| I would like to take your idea just one step further - I was hoping you (anyone actually) could tell me if this is feasible. In your case, you had two instances that you ultimately rolled up into one top-level VI. In my case, I will have anywhere from one to 16 instances that I want to have the top-level VI control. I envision a client telling me how many apps he needs, I programmatically create that many, then the client sends me a TCP message (with some ID to direct the message to the correct app). Does this dynamic growth seem possible? |
Anything is possible...
I ended up having three separate instances, 3 or 16 shouldn't matter. Just create the instances in a loop as needed.
Dan
03-12-2010 12:30 PM
1) How do I make third party VIs re-entrant?
2) Can you elaborate on how you ".. made the top level VI a VI template and opened separate instances to this template"? Not sure how to do those two things. I think I read that the VI Server is involved when trying to call this template, but I'm not sure what that looks like.
03-12-2010 12:58 PM
1) A VI is a VI and you make any VI reentrant by going to VI Properties>Execution. If a VI that you created or someone else created is password protected, then you cannot make changes to either the code or properties.
2) You make a VI a template by doing a save as .vit. Calling a template is really no different than calling any other VI. You can call it statically or dynamically. Calling a VI dynamically with VI Server is shown in several shipping examples.
03-12-2010 01:02 PM
1) (a) Either get access to the source code from the thrid party, or (b) looks like the reentrancy is a VI property (Execution.IsReentrant), use a property node to set this property for all exes. To do this you will need to open a reference to the VI that is part of the third party build.
2) All you need to do to make a vi template is Save As..with a .vit extension. Then just use open VI reference to obtain the reference to the template. Each reference will be a separate instance.
Also see:
http://decibel.ni.com/content/docs/DOC-7721
http://digital.ni.com/public.nsf/allkb/98847B4E4C715E6D86256C59006B57CC
http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/creating_vi_templates/
Dan
03-12-2010 01:48 PM
I am curious why the Main.vi needs to be a .vit (template) file if it is to be used as a dynamically loaded reentrant vi. According to the documentation, you can convert a vi to a vit just by adding the "t" to the end of the filename, there is no difference in the code at all!
03-13-2010 07:13 AM