LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple instances of sub-VI?

I am trying to run sub-VIs from a control center in such a fashion that
the control center does all the global data initialization etc. and then
allows the user to call sub-VIs via menu bar.

So far so good ... however I would like to be able to call multiple
instances of the same sub-VI (a new one each time the menu entry is
selected). The problem is that the calling loop will stall until the
called VI terminates. Is there any decent way around the problem that
does not require to hardwire the maximum number of instances?

In case it makes a difference, I am using LabVIEW 5.1.1.

TIA,

Rudolf
0 Kudos
Message 1 of 5
(6,838 Views)
Oops ... I just found out that LabVIEW is actually too stupid to call two
SEPARATE instances of the same VI ... that explains it, I guess.

Still, is there a way to call an independent copy of a VI containinng
front panel controls (i.e. the regular 'reentrant' approach won't work)?
After all it DOES appear silly to make a physical copy of a VI just so I
can run two of them ...

Rudolf

Rudolf Potucek (potucek@acs1.acs.ucalgary.ca)
wrote:
$ I am trying to run sub-VIs from a control center in such a fashion that
$ the control center does all the global data initialization etc. and then
$ allows the user to call sub-VIs via menu bar.

$ So far so good ... however I would like to be able to call multiple
$ instances of the same sub-VI (a new one each time the
menu entry is
$ selected). The problem is that the calling loop will stall until the
$ called VI terminates. Is there any decent way around the problem that
$ does not require to hardwire the maximum number of instances?

$ In case it makes a difference, I am using LabVIEW 5.1.1.

$ TIA,

$ Rudolf
0 Kudos
Message 2 of 5
(6,838 Views)
Technically, LV can call multiple instances of a reentrant VI,
but it currently doesn't allow Running multiple ones as this
requires duplication of VI pieces other than the dataspace.
To get multiple instances of a panel, you have two options.
You can duplicate the top-level VI on disk to a temp directory
with a unique name and open the new file instance. Again, it isn't
necessary to duplicate any subVIs, only the top-level VI.

The second approach is to make the multi-instance panel into
a template VI, a .vit file. Then open the file each time from
the template.

Greg McKaskle

Rudolf Potucek wrote:
>
> Oops ... I just found out that LabVIEW is actually too stupid to call two
> SEPARATE instances of the same VI ... that explains it, I guess.
>
> Still, is
there a way to call an independent copy of a VI containinng
> front panel controls (i.e. the regular 'reentrant' approach won't work)?
> After all it DOES appear silly to make a physical copy of a VI just so I
> can run two of them ...
>
> Rudolf
>
> Rudolf Potucek (potucek@acs1.acs.ucalgary.ca)
> wrote:
> $ I am trying to run sub-VIs from a control center in such a fashion that
> $ the control center does all the global data initialization etc. and then
> $ allows the user to call sub-VIs via menu bar.
>
> $ So far so good ... however I would like to be able to call multiple
> $ instances of the same sub-VI (a new one each time the menu entry is
> $ selected). The problem is that the calling loop will stall until the
> $ called VI terminates. Is there any decent way around the problem that
> $ does not require to hardwire the maximum number of instances?
>
> $ In case it makes a difference, I am using LabVIEW 5.1.1.
>
> $ TIA,
>
> $ Rudolf
0 Kudos
Message 3 of 5
(6,838 Views)
I had the same problem as the original poster. I am creating a graphing-VI that I want to be able to use multiple times.

The second solution you provided (creating a template) worked beautifully for me in a small test, so I am confident it will solve my problem!

IMHO it is a very useful 'trick' to get this working. I am sure other developers have wrestled with the same problem when making (more or less) general purpose VIs.

When I finish my small test example, I will see if I can post it online so other people can enjoy it too 🙂
0 Kudos
Message 5 of 5
(6,838 Views)
"Rudolf Potucek" wrote in message
news:8vkj1v$1ogo$1@nserve1.acs.ucalgary.ca...
> Oops ... I just found out that LabVIEW is actually too stupid to call two
> SEPARATE instances of the same VI ... that explains it, I guess.
>
> Still, is there a way to call an independent copy of a VI containinng
> front panel controls (i.e. the regular 'reentrant' approach won't work)?
> After all it DOES appear silly to make a physical copy of a VI just so I
> can run two of them ...

Hit http://www.ni.com/goop and see if that will help you any. If you can
restructure your VI such that you can open a refnum each time, perform the
work by reference, then end, perhaps that would work?

-joey
0 Kudos
Message 4 of 5
(6,838 Views)