LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

launch clone vi

hello,

I need to launch multiple instances (or clones) of the same vi.

 

In the attached labview project I am trying to do it, the only problem is that when I look at the VI Hierarchy I only see 1 instance of the VI I am trying to clone. So I think there is something wrong.

 

As you can see,I use the  "open the VI reference" block with option 8, plus I set the VI execution property to be reentrant.

 

Can somebody point me out a possible solution?

 

thanks in advance 

 

 

0 Kudos
Message 1 of 15
(2,490 Views)

basically i need to launch multiple clones of a vi..

0 Kudos
Message 2 of 15
(2,479 Views)

Did you try to change in VI Properties, Category Execution to tick "Shared clone reentrant execution" ?

 

BR,
Vincent

0 Kudos
Message 3 of 15
(2,475 Views)

yes I have, but in the VI Hierarchy I keep seeing only one opened instance...

0 Kudos
Message 4 of 15
(2,472 Views)

Try to launch asynchronous call of your VI multiple time ?

Careful you have to close it right with queue or whatever you are working with.


Vincent

0 Kudos
Message 5 of 15
(2,468 Views)

The VI Hierarchy does not display what and how many VI's are runing, it only display the vi's in memory and who calls who. 

0 Kudos
Message 6 of 15
(2,455 Views)

well since each clone has its memory allocation, I am expecting too be able to see it in the hierarchy...how else can I verify it?

0 Kudos
Message 7 of 15
(2,446 Views)

They are only spanned when you run the code. 
The VI hierarchy does not act on running code. 

 

You can use the DETT, the Profile Performance tool  or some of the other tool under Tools->Profile. 

But most only works with running code to get you information.

0 Kudos
Message 8 of 15
(2,444 Views)

I do this in several of the Projects that I've created.  My preferred way to start and run parallel routines is to use the Start Asynchronous Call method, which also works very well with Clones.  One advantage of the method shown here is that it works identically in both Development Mode and when built into an Executable.

 

This code is in LabVIEW 2016 (which you might not have), so I'm only supplying a "picture" (something I'm ordinarily critical of other Forum Posters for doing -- please forgive me).  However, the technique should be obvious, but I'll explain.

Create Clones.png

The Clone (here the "Blue VI" called "Producer") is, as you've done, configured as a Preallocated Clone Reentrant Execution.  The For Loop starts as many copies as you specify.  We begin by creating a specific Named Queue for each Clone (I pass in the Loop Index, incremented, to create Queues named "Clone 1 Q", "Clone 2 Q", etc.).  To set up the Start Asynchronous Call, we need a VI Reference.  We begin by using a Static VI Reference, browsing for the Path to the VI of interest (here "Producer").  See the red star?  I right-click the Reference and select "Strictly Typed Reference" (which includes the information needed to specify the VI's Connector Pane).  This gets wired to a Property Node to get the Path to the VI.  The Path gets wired to the path input of Open VI Reference, with the "typed" VI Reference wired into the top Type Specifier input, and the appropriate option codes (here 0x140, 100 for Call and Collect, 40 for Clone).  Now we can drop a Start Asynchronous Call node, wire in the VI Reference, and the appropriate Front Panel Input connectors will appear for wiring (here I'm passing two queues and a "Clone Number" (so the Clone will "know its name")).

 

Bob Schor

Message 9 of 15
(2,442 Views)

thanks man, I have versione 2016 so you can upload you code if you wish.

 

In the meantime I will try and reproduce what you have shown.

 

will let you know (please post code if you can)

0 Kudos
Message 10 of 15
(2,439 Views)