06-24-2020 04:00 PM - edited 06-24-2020 04:01 PM
Hi NI Community,
I have a producer/consumer loop that collects, displays, and saves data. I found an issue with my program and was wondering if I could get some suggestions on how to debug it. I attached my code below.
The program ran fine when I was using "Analog 1D Wfm NChan NSamp", I switched it to "Analog 2D DBL NChan NSamp" and it stops working correctly.
The problem I'm having is the test runs without an issue but it seems like it is not saving all the data.
Thank you!
06-24-2020 04:24 PM - edited 06-24-2020 04:24 PM
@victor55 wrote:
I attached my code below.
No, that is just a truncated image of code. We cannot debug images. Please attach the actual VI.
What determines the loop rate of the upper loop? How often are both arrays empty?
@victor55 wrote:
The problem I'm having is the test runs without an issue but it seems like it is not saving all the data.
Is data missing randomly? Missing at the end? How do you tell what's missing?
06-24-2020 04:31 PM
You have one producer loop trying to produce two different things, and one consumer loop trying to consume two different things.
Split it into two separate producer/consumers.
06-24-2020 04:53 PM
@BowenM wrote:
You have one producer loop trying to produce two different things, and one consumer loop trying to consume two different things.
But the two enqueue operations are synchronous. While ugly, this should still work. Overall, not great, though.
06-24-2020 04:58 PM
Thank you for your reply.
I found the issue with my program, I did not turn on the power supply channel so it was not logging data. I think I should have 2 producer/consumer loops to make it work well!
06-24-2020 05:04 PM - edited 06-24-2020 05:04 PM
@altenbach wrote:
But the two enqueue operations are synchronous. While ugly, this should still work. Overall, not great, though.
... assuming the DC power supply can query measurements fast enough that the DAQmx task doesn't run into a buffer overflow.
06-24-2020 05:10 PM
@victor55 wrote:
I found the issue with my program, I did not turn on the power supply channel so it was not logging data. I think I should have 2 producer/consumer loops to make it work well!
If you don't mind 2 TDMS files, I would just use the DAQmx Configure Logging to enable DAQmx to log the data for you. It will be a lot more efficient than a Producer/Consumer for logging to a TDMS file. And then you can have another file for logging the power supply data.