LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW memory full error

Hi,

I am trying to acquire the data from a laser machine using NI usb 6251 for around 15 minutes. The VI continuously measures and stores the data in a .lvm file. The sampling rate is 1 Msps. However, halfway through the VI  stops and labview gives: memory full error. I have attached the VI used.

My laptop properties are: 64-bit operating system and 16.0 GB RAM.

The labview edition i use is labview 2015 32-bit.

0 Kudos
Message 1 of 14
(2,518 Views)

Hi Sara,

 


@SaraAl wrote:

The sampling rate is 1 Msps. However, halfway through the VI  stops and labview gives: memory full error. I have attached the VI used.

Well, your sample rate is 200kHz - atleast that's the way you configured the DAQAssistent…

 

Generic advice: while the DAQAssistent is "nice" for quick&dirty VIs it should not be used for production system (or "high-speed applications" like yours). Use plain DAQmx functions as explained here or in all those example VIs coming with LabVIEW! (You already use DAQmx functions to read that DI channel: why not use the same for your AI data?

Also hiding a "Continuous samples" DAQ acquisition inside a case structure is calling for trouble as DAQmx will try to buffer new samples even when the case is not executed!

 

How fast is your consumer writing the data to the file? When it is slower than the producer loop then the queue will need to buffer data - which might blow up the memory consumption over time. Please check the queue status to detect growing memory consumption when running the next test!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(2,510 Views)

hi, 

thank you for your help. I just noticed I have attached the wrong VI. I edited the post and have the one I used in my experiment attached. 

0 Kudos
Message 3 of 14
(2,504 Views)

Hi Sara,

 

so you deleted the only "senseful" part from your previous VI (those plain DAQmx functions) just to add one more DAQAssistent and a (senseless) TRUE constant before the case structure? Throwing in a sequence structure to enforce dataflow also shows lack of LabVIEW knowledge: why don't you use the error wire to ensure dataflow?

(Well, now you are reading 300k samples at 1MHz.)

 

Still the very same problem: how fast is your consumer loop? Does the queue grow over time?

Please check this using the QueueStatus function!

(I also recommend to replace all ExpressVIs by "plain" functions in your VI.)

 

One more recommendation: by using plain DAQmx functions you can also have the DAQmx task save all data directly to a TDMS file - without the need for a producer-consumer structure on your side!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 14
(2,489 Views)

the TRUE constant is not related to the data acquisition. it is used to start the laser machine when the VI runs. i used this VI to acquire the data at 200Ksps with N=150k and it worked fine. the problem started when i increased the sampling rate to 1Msps, but i will try it again making it "senseful" without using daq assistant. 

thanks.

0 Kudos
Message 5 of 14
(2,478 Views)

Hi Sara,

 


@SaraAl wrote:

 i used this VI to acquire the data at 200Ksps with N=150k and it worked fine. the problem started when i increased the sampling rate to 1Msps


This fits to my assumption of a (too) slow consumer loop. See comments in my last message…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 14
(2,476 Views)

If you write to a binary file instead of a text based one you'll write less data and the loop should keep up easier.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 14
(2,468 Views)

i replaced the daq assistant parts to read the analog input with daqmx functions, and i removed the case structure. should i also change the write to measurement file function?

0 Kudos
Message 8 of 14
(2,425 Views)

@Yamaeda wrote:

If you write to a binary file instead of a text based one you'll write less data and the loop should keep up easier.


The real problem with the current logger the OP is showing is the use of the Write Data Express VI.  That VI is constantly opening and closing the file, which is SLOW.  By opening/creating the file before the loop, writing inside the loop, and closing after the loop, you can GREATLY increase the write speed.

 

But I would go with GerdW's last suggestion, use the DAQmx Logging to stream the data straight to a TDMS file.  That is by far faster than using a Producer/Consumer setup.  But a caveat I recently ran into with that is the TDMS data is a little more complicated (highly optimized for write speed) and may not work with all TDMS tools.


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
Message 9 of 14
(2,418 Views)

@crossrulz wrote:

@Yamaeda wrote:

If you write to a binary file instead of a text based one you'll write less data and the loop should keep up easier.


The real problem with the current logger the OP is showing is the use of the Write Data Express VI.  That VI is constantly opening and closing the file, which is SLOW.  By opening/creating the file before the loop, writing inside the loop, and closing after the loop, you can GREATLY increase the write speed.

 

But I would go with GerdW's last suggestion, use the DAQmx Logging to stream the data straight to a TDMS file.  That is by far faster than using a Producer/Consumer setup.  But a caveat I recently ran into with that is the TDMS data is a little more complicated (highly optimized for write speed) and may not work with all TDMS tools.


Oh really? I assumed it was clever enough to keep the reference internally. Yes, constantly opening a file is slow.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 14
(2,414 Views)