10-04-2016 10:15 AM
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
10-04-2016 11:02 AM - edited 10-04-2016 11:05 AM
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.)
10-04-2016 12:25 PM - edited 10-04-2016 12:26 PM
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.
10-04-2016 01:59 PM
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.