LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When Do You Name a Queue?

Solved!
Go to solution

Queues we generally use when we are running parallel loops and had to transfer data from one loop to the other. For using the queue in different vi's we use LV2G (Functional Global) to take its reference so wherever the queue is need we can use the LV2G and use it.

-----

The best solution is the one you find it by yourself
Message 11 of 27
(2,314 Views)

@P Anand wrote:

Queues we generally use when we are running parallel loops and had to transfer data from one loop to the other. For using the queue in different vi's we use LV2G (Functional Global) to take its reference so wherever the queue is need we can use the LV2G and use it.



My prefered solution also. 

Message 12 of 27
(2,308 Views)

@diarmaede wrote:

All these answers make sense.  Thanks.  I've been creating local variables of the output of the "Obtain Queue" function and using them, instead of wiring the queue directly.  Is there anything inherently wrong with this approach?  I suppose it could cause some timing conflicts.


Exactly, Locals has a big chance of creating race conditions. /Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 13 of 27
(2,298 Views)

I always name my queues but never obtain the queue in another location by name (use the wire when possible since this is common practice in LV development).  The reason I name my queues is for better readability code documentation and most importantly error handling.  If your queue throws an error the name of the queue is passed to the error handler and makes debugging easier.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 14 of 27
(2,264 Views)

@falkpl wrote:

...If your queue throws an error the name of the queue is passed to the error handler and makes debugging easier.



Never knew that. Maybe I will start naming my queues now...

0 Kudos
Message 15 of 27
(2,260 Views)

I thought this worked as it does in daq, but it might not.

I still like naming my queues and tasks for documentation eighte way

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 16 of 27
(2,230 Views)

I just looked at some code and found why my errors show the queue name, I wrote a FG that uses the queue name and makes its own error messages, the queue name is accessable from the queue status, but using the queue name in error messages would be a good idea.  DAQ does this for channels and tasks and it is a lifesaver when you have hundreds of channels.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 17 of 27
(2,224 Views)

A lot of good reasons given here for naming queues. I recently just started always naming my queues simply because I wish I had on previous occasions. It's always better to have too much information than not enough.

PaulG.
Retired
0 Kudos
Message 18 of 27
(2,221 Views)

I seldom name my queues and various methods to pass the queue ref wire to whoever needs it.

 

The reason I avoid the name and use the wire is it allows me to quickly clone parts of application without concerns of the cloned code using the queue of the original code. To use named queus and avoid the cross-talk I would have to use some method to ensure the queue name for both instances was unique ... and I may as well pass the queue ref if I am passing a name prefix or what-not.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 19 of 27
(2,208 Views)

Instead of using the queue name, I rewrote my code to use a Sequence Local to pass the queue wire from one frame of my stacked sequence to the next.  Is there anything wrong with this approach?

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 20 of 27
(2,188 Views)