LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/ consumer architecture for reading multiple channels and displaying it

Hello I am using Producer/consumer design pattern to read multiple channels and display it on the graph. I am confused as to how to split the data and display it on the multiple graphs. I have tried different methods but nothing seems to work. The pic attached is one way I tried. In this method the data on the first cconsumer loop works but the second consumer loop doesn't work. Please provide some feedback as to how it can be done

0 Kudos
Message 1 of 4
(3,017 Views)

Hi pk4,

 

why do you use variants and DDT datatypes?Why do you make your VI more complicated than it needs to be???

 

- Define your queues as queues of scalar DBL values.

- Instead of "Split signal" use IndexArray to get the values of both signals.

- Wire scalar DBL values to your Enqueue functions, read those scalar values with Dequeue and plot them…

 

Edit:

Why do you need two queues and two consumer loops?

Why not use a queue of 1D array of DBL and plot both signals in one consumer loop in one chart? (Or atleast use just one consumer to read the values and plot them on two charts.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,999 Views)

Thank you. Removing the extra consumer loop and adding array indexing made it work. Thank you. In addition to that if I put the PWM block in the producer it considerably reduces my loop speed. The loop speed without the PWM block is around 170 Hz and when I add PWM block the speed drops to 90-100Hz.

0 Kudos
Message 3 of 4
(2,967 Views)

Greetings! The main purpose of the producer/consumer architecture, is to have a 100% lossless data handling, which is why producer needs to focus on exactly that, producing data and nothing else, while consumer deals with the processing and stuff like that. If you have instrument/machinery control, you might benefit from having a third while loop. I have a rather big project where I have four loops running in parallel: a producer/consumer, a main control loop and a user-event response loop.

Message 4 of 4
(2,944 Views)