10-11-2016 04:16 AM
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
10-11-2016 04:23 AM
basically i need to launch multiple clones of a vi..
10-11-2016 04:31 AM
Did you try to change in VI Properties, Category Execution to tick "Shared clone reentrant execution" ?
BR,
Vincent
10-11-2016 04:32 AM
yes I have, but in the VI Hierarchy I keep seeing only one opened instance...
10-11-2016 04:47 AM
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
10-11-2016 06:17 AM
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.
10-11-2016 06:56 AM
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?
10-11-2016 07:05 AM
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.
10-11-2016 07:09 AM
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.
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
10-11-2016 07:19 AM
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)