LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple copies of a single VI??

I need to open multiple independant copies of a single VI with front panel. I realise this can be done by re-saving multiple copies of the VI but as i do not know until run-time how many copies are required this is not a good solution. The VI is an instrument user interface and thus i require each instance of the VI to display its front panel and act independantly. Cheers for your help
0 Kudos
Message 1 of 7
(3,218 Views)
Hi,

Your problem can be solved by the use of VI Templates (.vit) and has been discussed on the discussion forum before.

Search on ".vit" and you will find a couple of answers and examples solving your problem.

Best regards,
Mattias
0 Kudos
Message 2 of 7
(3,217 Views)
See the KnowlegeBase article 2J5GNUDV found by searching for Labview and template.
http://ae.natinst.com/operations/ae/public.nsf/fca7838c4500dc10862567a100753500/2d1ed26dc6d084ce86256b7400828d0e?OpenDocument
0 Kudos
Message 3 of 7
(3,217 Views)
>Jeremy Braden wrote in message news:<5065000000050000000F700000->1017707437000@exchange.ni.com>...
> See the KnowlegeBase article 2J5GNUDV found by searching for Labview
> and template.
> >http://ae.natinst.com/operations/ae/public.nsf/fca7838c4500dc10862567a100753500/2d1ed26dc6d084ce86256b7400828d0e?OpenDocument

The link for those external to NI is at
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/3848aff0a69fecf886256a4c0029ced6?OpenDocument

S.
0 Kudos
Message 4 of 7
(3,217 Views)
Thanks Sash. I got in a hurry and made a mistake. The exact document I was thinking of is: http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/2d1ed26dc6d084ce86256b7400828d0e?OpenDocument
And I reached it from the external pages from NI's advanced search page (it is advanced because one can limit one's search to the resources of interest). Goto www.ni.com >> support >> advanced search (click on the words). This launches the advanced search page.

Jeremy Braden
National Instruments
0 Kudos
Message 5 of 7
(3,217 Views)
I don't know what the discussion on templates involve, but it isn't really the proper solution to your problem (although that discussion may in fact be about the proper solution: instanciation, but be missnamed.)

What you need to do is drop in a "Call by Reference" node. This will call an "instance" of your VI (load a copy of your VI into memory.) To call your VI, you need two things: a prototype, and the path. The prototype is just a copy of the connector pane. You can just open your VI, view the connector pane, and drag-and-drop it onto the Call by Reference node. You can now wire your inputs and outputs. If you have no inputs or outputs, you can just use the VI server, which you have to use anyway for the next steps. You need to create a referenc
e to the VI using the Open Reference. Wire a constant to the Path input, and use the path to your VI.

Now that you have that done, or if you are going to use only the VI server (if you have no inputs or outputs), you need to drop some invoke/property nodes. If you are only using VI server to call your interface (again, if you have no inputs or outputs), you need to Invoke the VI. Check out the VI Server examples for help on this. Then, you will need to use Property nodes to make the front panel visible. Be sure to also name your instance each time, so that the system isn't confused.

If you still have problems, let us know where you get stuck.

Good luck
0 Kudos
Message 6 of 7
(3,217 Views)
Labviewguru,

Tom WP wants to operate multiple front panels of the same VI. The technique you explained can't allow this. Opening many references to a non-reentrant VI creates references to the same instance of the VI in memory, then only one front panel is available. If the VI is reentrant, opening many references indeed creates many instances of the VI local data but then the front panel can't be operated because yet only one front panel is available and it can't display simultaneously the front panel data of its different instances.

To resolve this, one has to either open references to multiple file copies of the VI so that uniquely named copies on the VI may be and memory. Another way to load uniquely named copies of the same VI in memory
is to save the VI as a template, e.g. with the VIT extension. Everytime a reference to a template is opened, a newly named instance of the VI is loaded in memory e.g. "VI Name 1.vi" , "VI Name 2.vi" , etc. whose front panels can be operated independantly as different VIs (which they are).


LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 7
(3,217 Views)