LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I learn how to implement parallel loops in separate VI's?

So I posted a thread yesterday and a bunch of you were saying to use the actor framework, and to put my separate loops into their own VI's.

 

I went to the example called "LabVIEW Real-Time Control on CompactRIO (RIO Scan Interface)" and tried to break it down on my own, but this style is very unfamiliar to me and I was quickly overwhelmed.

 

Is there a course from NI that goes into detail about this stuff? I went through Core 1 and Core 2 mostly and I didn't see anything (maybe I missed it?) about how to create loops in their own VI's and running them in parallel.

 

Any good tutorials on youtube/courses from NI would be greatly appreciated. Heck, I'd even buy a udemy course if it was good

0 Kudos
Message 1 of 6
(1,533 Views)

I believe Core 3 focuses more on inter-process communications (sending data between loops).

 

If you want to learn about DQMH (rather than actor framework), they have some great resources, especially the youtube videos.

http://delacor.com/documentation/dqmh-html/HowtoLearnDQMH.html

https://www.youtube.com/playlist?list=PLZ3A_SIOKdQs73IjbtaWwCSqoxQfxlWj6

 

Message 2 of 6
(1,530 Views)

Oh yes, that's right. I think it was you who mentioned DQMH. I'll check out the links, thanks!

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

Is the DQMH framework apply to my situation where I'm not planning on having a user interface, and I'm just using the real time and FPGA? When I say I'm not planning on having a user interface, I mean that my code will just be running in the background and the users will not be interacting with it directly.

0 Kudos
Message 4 of 6
(1,519 Views)

I don't use LabVIEW real-time, so take this with a grain of salt. But, it looks like DQMH does support real-time.

http://delacor.com/documentation/dqmh-html/DQMHinLabVIEWRealTime.html

 

Certainly, a DQMH project does not have to have open front panels when running.

Message 5 of 6
(1,513 Views)

I use multiple loops in separate VIs in both "regular" LabVIEW and LabVIEW-RT.  Here is an example of a routine I wrote that has 4 "part-time" Parallel Loops (they are not all 4 running at the same time, only 3 of the 4, based on a "choice" determined by the first loop).  Here's what's going on:Multi-loop LabVIEW RT.png

 

The first VI, "Start myRIO", starts the FPGA in the myRIO which contains 11 independent "Do Forever" While Loops -- I counted this as one of the 4 Parallel Loops, but it should probably be counted as 11 (in which case this picture involves 14 Loops).  This runs a little bit of code in the FPGA to determine whether I've got a Power Supply turned on to charge the batteries in my Instrument.  If so, it will run the Main routine "Battery Charger" (inside the Case Statement).  I consider this a Parallel Loop as it "runs until it determines that all the Batteries are charged", and then exits.  So that's 2 (or 12) Parallel Loops.   

 

See the little VI on the left just before the Case, with an Icon that looks like a While Loop?  That's another "Do Forever" VI that implements a Watch Dog Timer that tells the FPGA (in one of its Parallel Loops) to generate a 2 Hz square wave on a myRIO DIO Line that keeps the Battery Power flowing to the Instrument (if the myRIO stops working, the Instrument loses power and stops, which is the "safe" thing to do).

 

The final Parallel VI is in the other Case not shown in this (static) Picture (I know, I'm violating "Bob's Rule", no pictures ...).  This is another Main routine that runs the Instrument the Batteries are powering, again until the User presses the Stop button (there is no "Start" button -- when we run this Routine.  On the Block Diagram of this Dispatcher routine, it appears as a single VI, but inside it, it has a Queued Message Handler and two free-running Parallel Loops (in "While Loop" Icons) that handle two of the five Network Streams sending data between the Host PC and this Target code running on the myRIO.

 

Needless to say, the Host code is also replete with numerous single-VI Parallel Loops.  The main difference between the Host and Target organization is the Host uses Asynchronous Channel Wires for synchronization (Streams, Tags, and Messengers instead of Queues and Notifiers).  I found that LabVIEW 2019 "has trouble" with Messenger Channel Wires, a problem has seems to be rectified in LabVIEW 2021. 

However, there is, as yet, no 2021 support for the myRIO, which I'm hopeful will be remedied soon.

 

Bob Schor 

 

0 Kudos
Message 6 of 6
(1,451 Views)