From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

CSLUG - Central South LabVIEW User Group (UK)

cancel
Showing results for 
Search instead for 
Did you mean: 

low pass filter behaviour when dequeued

Solved!
Go to solution

Afternoon,

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.

 

Kind regards

 

Martin

0 Kudos
Message 1 of 5
(4,970 Views)

Extra info:

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

 

Kind regards

 

Martin

 

 

0 Kudos
Message 2 of 5
(4,966 Views)
Solution
Accepted by topic author Martin_from_Dorset

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.

Nick
0 Kudos
Message 3 of 5
(4,961 Views)

Afternoon Nick,

 

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

 

Kind regards

 

Martin

0 Kudos
Message 4 of 5
(4,956 Views)

Hi martin,

 

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.

Nick
Message 5 of 5
(4,948 Views)