LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous data acquisition and saving in new files

Solved!
Go to solution

I am acquiring the continuous data using a Chassis and DAQ card at a sampling rate of 50 kHz. There is no issue with the acquisition. Next, I am required to save the data of 10 seconds duration in files in tdms format and each file should have a different name. I have used the producer/consumer approach. Everything is working fine except that the code stop after 2 hrs with a pop-up error message as attached stating that LabView memory is full. Please suggest the possible solution so that internal memory remains free and the acquisition will not stop. 

Thanks in advance. 

0 Kudos
Message 1 of 13
(2,317 Views)

There is nothing attached.

 

Obviously, you probably need to show us your VI. There are many ways to run out of memory. Once we see the code, we can probably tell.

0 Kudos
Message 2 of 13
(2,309 Views)

Are you using real time OS or Windows?

 

George Zou
0 Kudos
Message 3 of 13
(2,305 Views)

@kapil2408 wrote:

I am acquiring the continuous data using a Chassis and DAQ card at a sampling rate of 50 kHz. There is no issue with the acquisition. Next, I am required to save the data of 10 seconds duration in files in tdms format and each file should have a different name. I have used the producer/consumer approach. Everything is working fine except that the code stop after 2 hrs with a pop-up error message as attached stating that LabView memory is full. Please suggest the possible solution so that internal memory remains free and the acquisition will not stop. 

Thanks in advance. 


Memory full error indicates that the array handling in inefficient resulting in utilizing a lot of memory and not releasing them appropriately. It would help to share the VI (preferrable in 2019) to guide you better.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 13
(2,299 Views)

Thanks for your prompt reply. Please find the attached code and error message. 

Regards, 

Download All
0 Kudos
Message 5 of 13
(2,256 Views)

Thanks for your prompt reply. Please find the attached code and error message. Please help me to manage the memory issue.

Regards, 

Download All
0 Kudos
Message 6 of 13
(2,255 Views)

Windows. 

 Please find the attached code and error message. 

Regards, 

Download All
0 Kudos
Message 7 of 13
(2,252 Views)

Thanks for your prompt reply. Please find the attached code and error message. Sorry for the missing attachment. Please find it now. 

Regards, 

Download All
0 Kudos
Message 8 of 13
(2,247 Views)

Hi kapil.

 

you don't need to answer 4 times in a row with the same answer, we all can see your message as it's a public board!

 

Your VI shows some mis-conceptions!

  • You read 500k samples from DAQmxRead, with a samplerate of 50kS/s. The timeout is set to 10s: this may fit, but there is a chance it will not fit! The usual recommendation is to read just 1/10 of the samplerate, in your case that would be to read 5k samples at 50kS/s samplerate!
  • Your charts are set to display 1024 elements in their history buffer. Each element right now is a waveform of 500kS, which needs 500k*8Byte=4MB! So keeping 1024 waveforms in the buffer requires 400MB of history buffer for each chart!
  • Trying to plot (upto= 1024*500k samples = 500M samples in a chart of just ~150 pixels width is just ridiculous! It doesn't make any sense!
    You need to use smaller waveforms, less history buffer and still a lot of data decimation when using such tiny charts…
  • Why do you need two ExpressVI functions (MergeSignal, FronDDT) to create an array of waveforms? What about functions in the array palette, like BuildArray or InitArray???
  • Why do you need to open and close the TDMS file in each iteration? Open/close just once before/after the loop!
  • Why don't you use the TDMS-saving feature directly built into the DAQmx driver? (Ok, you want to create a new file for each capture, but you also could employ creating groups in your TDMS file instead!)

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 13
(2,232 Views)
Solution
Accepted by kapil2408

You are running out of memory.  Saving is much slower than DAQ.

Instead of saving data every 10 sec, you could save data in one file, or every hour to avoid too many TDMS open/close calls.  You could do that outside the loop.  The TDMS data can be split to 10 sec/file in post process.

 

Saving data loop can be moved to a SubVI, running in a non-UI thread.

 

If you are using LabVIEW 32 bit, you should consider convert to 64 bit.  So you can utilize more RAM (>4GB).

 

If you want to do DAQ much long than 2 hours, software solution might not be enough.

 

You could get more RAM, get SSD...

 

 

George Zou
Message 10 of 13
(2,228 Views)