03-15-2024 06:07 AM
Hi all,
I am trying to create a queue to pass dynamic data from one while loop to another... However, I cannot create a functioning dynamic data constant that I can wire to the obtain queue element data type input... See the example below with the broken wire....
As you can see, I have successfully wired a boolean constant to the element data type input of one obtain queue to share the stop button signal between loops...
How do I do the same for the dynamic data queue?
Thanks for any advice.
03-15-2024 06:39 AM - edited 03-15-2024 06:40 AM
Hi jcannon,
@jcannon wrote:
Thanks for any advice.
Two questions:
03-15-2024 06:42 AM
I guess that Dynamic Data are too... dynamic for queues. You need to convert DD to a well defined type (Express -> Data manipulation palette).
03-15-2024 06:47 AM
Dynamic data is a LabVIEW monstrosity. It is not a real dataype but some sort of strange container that can refer to all sorts of data and usually when you try to convert it to real world data it may or may not convert in the correct way.
The only front panel control that supports this "data type" is the graph. No other control exists for it and accordingly no constant either. Generally use of Dynamic Data Type indicates a LabVIEW beginner, the same as Express VIs. They look nice and very handy until you try to actually program a real application. Then things start to spiral very fast downwards.
The closest to a Dynamic Data Type you can use for the queue would be a Variant. But a queue of variants will likely be the next cesspool you're eventually going to try to climb out of.
03-15-2024 06:53 AM
1. I have 5 x AIs (voltage) that I want to send to from a producer while loop to a consumer while loop.
2. Yes, I have tried the ToDDT function, which works, but that function still needs a constant wired into it.
03-15-2024 06:55 AM
I wouldn't use it (DDT), but if you feel lucky:
Not tested at all, because I want to do as little as possible with DDT 🤣. I wouldn't even know if it works or not.
03-15-2024 06:58 AM
Hi jcannon,
@jcannon wrote:
1. I have 5 x AIs (voltage) that I want to send to from a producer while loop to a consumer while loop.
Ok, that would be an array of 5 float (?) elements. Why do you need a DDT constant???
@jcannon wrote:
2. Yes, I have tried the ToDDT function, which works, but that function still needs a constant wired into it.
Yes, sure: you need something to be able to convert it to a DDT wire.
As others have said: please explain why you need a DDT in the first place before starting to stuff such DDT entities into a queue!
03-15-2024 06:58 AM
Yes, I take your point... The .vi I am working on is quite a few years old and acquires data using the DAQ Assistant... I don't have time to re-write it using DAQmx functions and "better" coding...
03-15-2024 06:59 AM
Hi jcannon,
@jcannon wrote:
I don't have time to re-write it using DAQmx functions and "better" coding...
Place a FromDDT after the DAQAssistent to convert the DDT wire into a common 1D array containing your 5 samples…
03-15-2024 07:08 AM
The dequeue element in the consumer loop cannot be wired to the write-to-file function if a DDT constant is not wired into the obtain queue element data type input (see the Data Queue).
And yes, the programming in the top loop is horrendous... Its needs to be rewritten as a state machine... A job for another day...