LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement a configurable queue datatype?

I have an LV6.1 application that uses queues to transfer cluster data from one VI to another. I want to be able to (re-)define the cluster make up in one place, and have both the sending VI and the receiving VI adapt. As a relative newbie, am I missing a well known way of effectively defining a datatype and then using it in several VIs?

If it makes it any easier, the variable part of the cluster is a 2 dimensional array, whose size may change. Otherwise the cluster makeup is fixed.

On a related point, how do I pass a typed queue reference from one VI to another? I've found that if I wire a queue ref, then change the queue type, I have to delete and rewire the ref to get rid of errors?

Ian
0 Kudos
Message 1 of 7
(3,264 Views)
Can you explain your question (i.e. with a scratch of your VI)? Here you can find an instrument that uses the reference to pass data from one VI to another.

Bye, L.
0 Kudos
Message 2 of 7
(3,264 Views)
Thanks for your example - if understand the way references work, your vis pass a reference to a cluster through the queues. I assume this means that when the consumer dequeues something, it is a reference to the original cluster, not a copy. I'm trying to pass the cluster by value through the queue, without having to fix the cluster structure at design time.

cheers, Ian
0 Kudos
Message 3 of 7
(3,264 Views)
Yes, it's a reference to the original cluster. Try these "new" VI version: when you choose (with go!) to dequeue the elements, the value visualized is the value actually present on the front panel (which is the object referenced), while with the "pass value" version, all the values are visualized.

Bye, L.
Download All
0 Kudos
Message 4 of 7
(3,264 Views)
The most fundamental way of doing this is to define the interface datatype as a typedef. With a typedef any non-cosmetic changes will be propegated to all VIs that use it the next time they open. If you want even cosmetic changes to be propegated, make it a strict typedef.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 7
(3,264 Views)
Your 'pass value' versions appear to do exactly what I want 🙂 . What intrugues me is that the size of the array contained in the cluster can be changed dynamically and the data is passed correctly. In fact, initialising the array with dimensions of 0 x 0 works just as well as the 2 x 2 in your example.

So, the same queue can handle different sized arrays just as I wished. I must say this is contrary to my expectation (but very welcome).

Thanks very much for your help.

Ian
0 Kudos
Message 6 of 7
(3,264 Views)
Hi Mike,

Thanks - I looked at using a typedef initially. What I failed to realise is that a typedef can contain an array which can be resized. Using that in conjunction with L's example of queues has enabled me to devise a suitable arrangement: I'm using a typedef to define a queue message type, which contains a variable sized array.

Though I must admit to being curious about whats going on behind the scenes in terms of memory allocation etc.

ian
0 Kudos
Message 7 of 7
(3,264 Views)