LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Figuring out the frequency of the while- and Timed loops

Solved!
Go to solution

Do you have any tips how to implement queues between different VIs?
My main program is programmed with the event and message handling structure but I am not sure how to dequeue elements from that program to my sampling program

0 Kudos
Message 11 of 15
(787 Views)

@Amr95 wrote:

Do you have any tips how to implement queues between different VIs?
My main program is programmed with the event and message handling structure but I am not sure how to dequeue elements from that program to my sampling program


  1. Make a VI that starts both VIs. Create the queue in that VI and pass the reference to both SubVIs.
  2. I'd avoid named queues, but they do the trick.
  3. Same for (functional) Globals.

 

You're talking about "main program" and "sampling program". I'd see it as one program, with two processes. Those processes could be considered actors, if you're into the actor framework.

 

You probably are, or will soon be, in the situation where your program needs to step up a notch on architecture...

0 Kudos
Message 12 of 15
(786 Views)

Thanks a lot for your advice!
I have been trying implement a little bit differently after I read about the multiple consumer loops to add the sampling subVI to my main program and connect it with my queue to dequeue the elements I need from it, but I encountered the problem that the queue contains also other messages from the LLC and LLS SubVIs down there in the picture. I don't wanna handle those messages I only want to handle the "Acquire Data" message as the other messages are already being handled by the message handling loop but I get an error in my sampling subVI and it states that I need to add a case to every message that the queue carries. Is there a way I could only handle a certain message on the queue and ignore the rest? 
I attached a picture of my main program, I know it's not recommended on the Forum to attach pictures of the VIs but I am not allowed to upload the program so I think it's better than nothing and it will give you an idea of what I'm trying to explain here. 
I attached the modified version from my sampling program though

Download All
0 Kudos
Message 13 of 15
(763 Views)
Solution
Accepted by Amr95

As long as you attach images, you might as well embed them in the post ("Insert Photos"). Saves us a download, open, close and delete!

Screenshot%20(106)

 

You can't dequeue a queue in more then 1 loop! Unless you want to divide the load to those loops, it just won't work.

 

One dequeue will remove the element from the queue, and the other loops will not process them.

 

You'd need either:

  • multiple queues, or
  • a one-to-many mechanism, like user events (that are actually many-to-many).

 

You could also look into channel wires.

Message 14 of 15
(760 Views)

Thanks a lot for all the help! 
It finally worked out by following your tips and hints 🙂

Message 15 of 15
(751 Views)