09-01-2008 02:19 AM
Hi,
I'm currently modifying my Labview program in order to run an unknown number of VI at the same time. In my example, I have to send same GPIB command to an unknown set of GPIB addresses (reentrant application) that is defined by user. Hence the numbers and addresses of GPIB devices is not known initially. I have several choices:
1. To form a FOR loop that accept GPIB addresses as an array. This way the VI will execute any number of GPIB address given by user but not simultaneously (multicore CPU won't help as it executes loop by loop)
2. To direct connect several of the application without any structure. This way VI will execute the applications simulateneously (multicore CPU helps a lot), but it is not user definable
Is there a way to ensure simultaneous run of all the vi application for any given set of data? I have a feeling the answer is related to VI server/ Call by reference, but I have no idea on the exact implementation.
Thanks in advance,
Delphin
09-01-2008 03:42 PM
Yes, you can have VIs running simultaneously. If the subVI is reentrant you can launch it multiple times using the VI Server.
HOWEVER. It won't matter since GPIB commands are sequential.
09-01-2008 08:50 PM
Hi,
Thanks for your feedback. I missed the fact that GPIB will be executed sequentially however the idea is there that I have unknown number of VI that I want to execute simultaneously. for my other example I actually have 4x PXI-4461 that I want to perform similar measurement simultaneously, however I want to give user freedom to add/ remove another 4461 which I won't know in advance.
- Using FOR loop is not good as it execute from i=0 up to N sequentially
- Using unstructured method is not good as well as we can't predict how many of the VI the user want to activate in advance
I've been checking several of the VI server/ Reentrant VI/ Call by reference node examples, but they're either using FOR loop or unstructured method which still have above problem.
Is there a way to run all unknown number of reentrant VIs and satisfies simultaneous running and able to run unknown number of VI?
Regards,
Delphin
09-02-2008 09:33 AM - edited 09-02-2008 09:33 AM
I think you're confusing the launching of a VI with the running of a VI. You can launch a VI with the VI Server and have it run on its own, and you'll be returned to the caller. Then you can immediately launch the next one. This can be done by simply doing this: