LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/Consumer loop does not save correctly

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.

 

producer_consumer_issues.PNG

 

Thank you!

0 Kudos
Message 1 of 7
(2,743 Views)

@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?

 

 

0 Kudos
Message 2 of 7
(2,727 Views)

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.

0 Kudos
Message 3 of 7
(2,720 Views)

@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.

0 Kudos
Message 4 of 7
(2,702 Views)

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!

0 Kudos
Message 5 of 7
(2,699 Views)

@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.

0 Kudos
Message 6 of 7
(2,690 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(2,677 Views)