LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create several parallel running Sub-VIs by Main-VI

Hello,

I wrote a VI for LabView 6 which is able to control a single measurement
device. Afterwards I implemented this VI as a Sub-VI three times because I
have three devices (at the moment). In order to synchronize these Sub-VIs I
connected them with some rendezvous commands with an outer trigger.
So far everything works fine.

Now, I would like to change the main VI to be more flexible regarding the
number of measurement devices.
So how can I create a number of parallel running Sub-VIs by the main-VI
itself. Of course they still have to react to the outer rendezvous event.

I would appreciate any help for this problem.

Thanks in advance,

Rico
0 Kudos
Message 1 of 5
(3,519 Views)
Make a template of the VI and clone it for each device (open a reference to the template and run it using an invoke node set to not wait until finished...). Use e.g. the notify functions to give commands to the clones.

We do this for serial devices; there is one COMhandler that handles each port, and each device is it's own VI that polls the devices through ques to and from the COMhandlers (that way multidrop is supported, and it gives som additional funcionality that you would not get with e.g. semaphores).
0 Kudos
Message 2 of 5
(3,519 Views)
> Make a template of the VI and clone it for each device (open a
> reference to the template and run it using an invoke node set to not
> wait until finished...). Use e.g. the notify functions to give
> commands to the clones.

Thank you very much for your helpful answer. I finally managed to solve my
problem.

For those of you, who are interested in more details, the following link
might be very useful as it was for me:

http://www.acsis.com/papers.htm

There you should refer to the article "Cloning Front Panels".

So far,

Rico
0 Kudos
Message 3 of 5
(3,519 Views)

Hi Mads,

I want to communicate with several serial devices but the number of them is variable. On this thread you suggest using templates in order to run several subVIs in parallel. So, First I created a VI from template that manages the serial communication for one device and in other VI
I opened a reference to this template and I could run it and set up values for its front panel.

As I saw that this worked for one device, I opened 10 references to the same VI template in a For loop in order to connect more devices but I'm getting a delay of 10 seconds.Probably somebody could thing that this delay is not too much, however I'm also going to need to run in parallel between 3 to 30 subVIs to save the data. So, at last I think this technique could bring me a lot of delays before my program starts acquiring and saving data.

Could you tell me if there is a way of reducing these delays or another method to do that with a minimum delay?

Note: I reduced the size of my VI template and changed the properties of the subVIs that are included in the VI template but it doesn't     improve the performance of my program.

Best Regards, dtp.

 

0 Kudos
Message 4 of 5
(3,183 Views)
Perhaps you can post some example code of what you have done so far.  You're right, I don't think 10 seconds is too big a deal for opening up 10 VI's.  You should only have to do this once at the beginning of the program.  So while there may be some delay, once you have all of your instances initialized, you shouldn't have to worry about a delay anymore.
0 Kudos
Message 5 of 5
(3,164 Views)