From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saved file size decreases with time

Solved!
Go to solution

Hi all, 

I am using Data acquisition system with  rate 10000 and 1000 sample per channel (exist 4 channels) to acquire analog voltage signals to measure the amplitude in each channel.

Moreover the raw signals are saved as TDM file of 1 minute. The system is running continuously for one week. I noticed that after 3 hours the saved file size is decreased as a function of time.

The size starts with 50 MB/min and after 3hours it became 42MB/min, after 1 day became 11MB/min. That indicated the data was lost , please, what is my programing mistake.

 

Thanks

0 Kudos
Message 1 of 11
(3,228 Views)

Hi MAAM,

 

two points:

- Don't use an additional wait in your DAQ loop. Timing is maintained by the DAQmxRead function and the sample rate…

- Put the file save function in a parallel running loop - same as your chart display. File functions may have a big impact on loop iteration times, and more worse: impact isn't predictable at edit time…

Best regards,
GerdW


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

Hello GerdW,

Thanks for response,

you mean something like this,,

0 Kudos
Message 3 of 11
(3,203 Views)

Not yet…

 

You should NOT dequeue elements from a queue at two places!

Either use ONE consumer loop to save your data and display them in charts OR use two queues with two consumer loops…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(3,193 Views)

Thanks again GerdW,

Here I initiate another queue,

What about restart the program automaticaly after certain time or when an error occurs, is it good idea?

Thanks

0 Kudos
Message 5 of 11
(3,177 Views)

GerdW wrote:  - Put the file save function in a parallel running loop - same as your chart display. File functions may have a big impact on loop iteration times, and more worse: impact isn't predictable at edit time…

Even easier is to just use the DAQmx Configure Logging function.  It just streams the data to a TDMS file.  No need for an addition queue and loop for logging of the data.  There are also properties to make DAQmx use multiple TDMS files automatically when X samples are saved.


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 6 of 11
(3,170 Views)
I am likewise confused as to why the queue and second loop are needed. But just for the record, it is perfectly permissible to have multiple loops monitoring the same queue -- as long as (and this is the important bit) they are both doing the exact same thing. In your case, one of the loops was throwing away data every time it iterated.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 11
(3,145 Views)

Hi crossrulz and Mike,

Appreciate your response.

Actually I had just starting use queue, because I think it will solve the problem of two different execution rate. I have three target from this program: firstly, acquire data with 1kHz continuously for one week. Secondly, save all the data during this period. And lastly display those data.

Previously I am using the attached vi (Zero stage) but the diminish of the saved data with time change my mind to use queue.

This program can save the data to TDM file every minute, also it's able to cancel errors and run again, but it has the limitation of data loss after 3 hours of continuous operation. for me I hope to overcome

the problem using this VI.

Thanks

0 Kudos
Message 8 of 11
(3,135 Views)
Solution
Accepted by topic author M.Ali

From the State Zero code, there are several things that could be improved here.

 

1. You only need to create the task once before your main loop.

2. You probably do not even need the outter loop if you use the DAQmx Configure Logging like I have already stated.  And you can use properties to say how many samples to go into a file before moving on, so that part of your code is eliminated.

3. The display can just be a simple chart (it looks like you are probably already using a chart).

 

What is your chart history set for?  That could be causing your slowdown if there are too many data points.


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 11
(3,115 Views)

Hi Mike,

If I create the task once before the outer loop then, it will not be possible to re-run the VI again if one of the three terms of the inner loop is met ( elapse 60 econds, error occurance or stop botton).

Regard to the display, I just got attention to that, I am using graph, Now I change it to chart of 1000 history size.

For  DAQmx Configure Logging, I didn't understand well how to use it, i try to use it, but it runs once and the stop,Smiley Sad, I am sure that I didn't understood the functionality of it well, can you state me for some example ,.

Thanks again,,,

0 Kudos
Message 10 of 11
(3,103 Views)