Undertaking a big upgrade of our Dyno VIs to include details about signal quality and better noise filtering.
I've got a producer/consumer set up to try and keep the data acquisition loop nice and fast/uncluttered but I'm not sure if i am misunderstanding the use or timing of queues or if something really obvious i'm missing.
I've made and example vi of of the problem, and a vi of what i would expect the low-pass filter to to do in a single loop. You can clearly see the effect on the filtered signal (red dotted). Changing the dequeue timeout makes the filter work as expected but stops the power spectrum working.
Simulate signal directly replacing the hardware (nothing else changed with queue etc)
Hopefully something obvious i'm missing with the use of queues,so any help would be greatly received.
Solved! Go to Solution.
Slowing down the power spectrum loop helps but every time the power spectrum refreshes the filtered signal (dotted red) still drops to zero for an instant.
Thanks for any help in advance
If it works it works!
However, not sure it is behaving quite as you anticipate.
There is a race between the two parallel consumer loops. This is because once an element is dequeued it is unavailable to be read elsewhere, in other words, it is removed from the queue. You would need a second queue from the second to third loop to ensure both signal processing steps receive all the data.
Many thanks for the quick work-around: is the attached the sort of thing you had in mind.............it works (please ignore lack of error)
My understanding that the point of queues was to be able to pass data around parallel loops but can see the difficulties if one loop is averaging etc................thought something like the queue would just build up as with the NI example (attached).
Thanks for the help
Thats great - Yes, that is the kind of thing I was thinking of.
Queues certainly are certainly for passing data around loops.
I think you have it but to re-iterate: the problem is deqeueing from the same queue in two locations. Each obtain queue creates a single data structure, the two dequeues were taking data from the same place. One loop was taking some and the other taking the rest. In the example one loop enqueues and one other dequeues. The third loop just looks at the queue size.