LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make subvi multithreaded?

I am currently working on a VI which calls a subVI to perform a task to open a valve for a certain amount of time and then closes it. However, I need to open another valve, which uses the same subVI during the time the subVI is already in use. The problem I have is that I have to wait for the subVI to finish before I can call the next one (this is inside a for loop). I just need to have the subVI open independent of what is called.

 

The way I have set it up, as seen in the attachment vi1.jpg, the file opens an excel sheet which has a matrix of 3 rows by X number of columns. First row is Valve number, second row is Time I want the valve to open, and third is how long. I input this all into the subVI known as WHICH VALVE?. (Even if I remove the frame case, it still has to wait for WHICH VALVE? to release before I can recall it again).

 

For vi2.jpg, it is the WHICH VALVE? subVI. The valve number is used to pick which case, and the time it should open and wait.

 

For vi3.jpg, it is the Valve subVI that actually controls the opening and closing of the valve based on the time input from the above levels.

 

Someone told me that perhaps just multithreading this would work. But I don't know how to make it so that the program doesn't have to wait for the subVI to finish.

 

I hope this is enough information for someone to help me. I am not very proficient in anyway for LabView because I self taught myself to get this far. I don't know where to go from here. If anyone has an idea what to do, it would be helpful. And perhaps you can dumb it down for me, as I've tried looking around in different forums and found something that might be useful, but I couldn't understand it. But thank you so much in advance if you do help.

 

because I self taught myself to get this far.
Download All
0 Kudos
Message 1 of 4
(7,286 Views)

Hi Dbkim,

 

If you want to call multiple instances of a subVI simultaneously then you'll want to make it reentrant.  Check out this KnowledgeBase article: Differences Between Reentrant VIs (Preallocate), Reentrant VIs (Share Clones), VI Templates, and Dyn....

 

If you want to call a subVI and have it execute without LabVIEW waiting for it to finish, then check out the example in this KnowledgeBase article: Calling a SubVI Without Waiting for It to Complete Execution.

 

I hope this helps!

 

- Greg J

0 Kudos
Message 2 of 4
(7,273 Views)

hello,

I want to ask your help for my problem. i'm wroking for an application using labview in which i have a main interface and if i click a button  i will open a subvi.

When the subvi is running, a want to go back to work at the main interface. My problem in this case is that i'm blocked on the interface of the subvi and i can't go back to the main one. I want to applicate th"multhithreading" with subvi's and i don't know how can i do it in my case.

 

Could you help me plea? 

thank you 

0 Kudos
Message 3 of 4
(6,327 Views)

Hi Dbkim

 

Have a look to this forum it might help you with your application

 

Regards

Esteban R.

0 Kudos
Message 4 of 4
(6,313 Views)