LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

spawn loops at runtime

Hi,

 

I want to program a timed loop that spawns new parallel processes (e. g. while loops) at specific points in time. It's kind of a C++ loop that dynamically creates thread objects at certain interation points and calls the thread member function start() immediately. The loop can continue iteration after spawning a thread, regardless of the threads runtime.

 

At the moment placing a number of LabView while loops that are waiting for a start signal (via notifier or queue) from a main loop is the best way I can think of. But this approach is fixed in number.

 

Is there something I can do via VI references?

 

0 Kudos
Message 1 of 6
(3,185 Views)

Hi pgraebel,

 

"Is there something I can do via VI references?"

Well you could use VI templates with your while loop and start them via VI server method calls...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,176 Views)

I found a forum thread that discusses a similar topic: Link

 

 

They open a VI reference (which I want to do anyway) and they call the VI via a method node "Run VI", where a "wait until done" flag is available.

 

But how do I specify input values for the VI?

 

0 Kudos
Message 3 of 6
(3,163 Views)

You might be able to leverage these techniques.

=====================
LabVIEW 2012


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

 


@pgraebel wrote:

 

But how do I specify input values for the VI?

 


 

Use the Set Control Value method.

 

Capture.PNG

=====================
LabVIEW 2012


0 Kudos
Message 5 of 6
(3,151 Views)

Zwischenablage02.png

I managed it to open and call two instances of the same VI (CallMe.vi). These two instances get different input values (Wait Time). The CallMe.vi block diagram shows a double run arrow instead of a simple white arrow and both CallMe.vi instances terminate at different times according to their different Wait Time input values. I had to check "invariant execution" in the CallMe.vi VI settings.

 

Is this a or the correct way to dynamically call different instances of the same VI or various VIs without having to wait for their termination?

 

0 Kudos
Message 6 of 6
(3,131 Views)