LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

API buffer overflow: Anyways to decrease consumer loop time? Or other aspects to be considered?

Dear all,

 

I am working on data acquisition in labview using Alazar Tech ATS-SDK VIs. I am already using a producer-comsumer loop architecture by enqueuing data acquisited into the loop shown in screenshots "1" and "2" and dequeue into loop in screenshots "3" and "4" for saving into a .dat file and displaying processed data.

 

Initially the program can run only a few seconds before returning API buffer overflow error but I have tried pausing the display in the enqueuing loop(false case does not have anything) to decrease producer loop time and this allows the program to run up to 2 minutes, however the API buffer overflow error still occurs after that.

 

I am wondering is it because of the queue holding too many elements that causes computer RAM to be insufficient and limits the data transfer from DAQ buffer into labview queue. I have monitored the Memory usage on task manager and indeed the error occur when the Memory usage is about 96%. 

 

I am trying to optimize the consumer loop to increase speed of dequeuing to avoid the fast increase in queue size, please let me know from your precious experience which part is causing the inefficiency or am I in the correct direction to deal with this.

 

Note: The for loop after the dequeue is to realign datas to their correct position to display because we increase the buffer size of the DAQ and one buffer contains datas from several lines.

 

Thank you so much!

HL 

0 Kudos
Message 1 of 2
(123 Views)

Looking at your screenshots leaves a lot to be desired:

  1. You have loads of local variables. Each local variable will make a copy of the data; for arrays this can be costly. In addition, there are potential race conditions. Use a wire and shift register.
  2. You split arrays constantly; this leads to data copies. Try to use array subset instead if possible.
  3. Break your code into subVIs, it looks like your code stretches multiple screens.
  4. You should post your code.
Message 2 of 2
(100 Views)