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: 

Saving data at cycle and/or time intervals

Hi all,
I'm wrestling with an issue of trying to reduce the amount of data I write to a file. I'm sampling at 1 kHz (50 samples per read) and want to be able to write the data based on a user input number of cycles (or, if necessary, a time calculated from number of cycles and frequency). Each time I save I need to be able to write data for a couple consecutive cycles (maximum deflection occurrs for each valve opening, denoted by "test type" global variable.) I would be fine with just triggering the saving based on one cycle count and saving for 1-2 seconds each time, but I can't seem to make that work. I have attached two data files: 1 is similar to my raw data sampling, where I get several samples for each cycle. The second is what I have been able to accomplish with my hacking around.
I have tried this with case structures, wait functions in the while loop, and some of the ideas posted on here for similar issues. I'm thinking I'm doing something exceptionally stupid here and would greatly appreciate any information from someone that is actually competent. Thanks in advance for any help!
0 Kudos
Message 1 of 7
(3,598 Views)

Hello,

 

I apologize, but I am unclear about what you are asking.  I see one location where data is being written to a lvm file – and that is in the top left (producer) loop embedded in the main outer loop (any reason you aren’t using sub-VIs?).  You indicate that you want to reduce the file size being written.  This implies you are either writing redundant data that can be condensed, or you are writing data more frequently than necessary.  I’m uncertain about the particular problems you are encountering, but a good strategy for tracking it down would be to reduce your program to remove as many components as possible while still reproducing the problem.  Once your program is drastically reduced, the structural problems leading to the problems will hopefully become more clear.

 

If you have any additional information, clarifications, or questions please feel free to post those.  Also, posting screenshots or smaller representative code is always a great idea.  Thanks for posting — have a great afternoon!

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 2 of 7
(3,579 Views)
Travis,
Thanks for the reply. I apologize for being unclear in my original post. This VI is set up for a fatigue tester that will be recording data over at least 100,000 cycles, and potentially up to 3,000,000 cycles. We wish to sample the data at intervals throughout the test period to provide an indication of any trends in the deformation of the test specimen as the test continues. I wanted to sample the data at regular intervals to provide this information while minimizing the amount of data written to the file. To that end, I don't really consider it redundant and I'm not really certain how I could reduce the rate at which the data is initially written. I'm quite new at LabView and am in over my head at this point. I haven't included more sub-VIs as I have been constantly experimenting with different routines for dealing with the data and didn't want to save them as a sub VI until I was certain I had achieved the desired functionality. I've reduced the program immensely compared to where it was when I started with it (it was written by someone else and was initially full of globals, locals, and other stuff even I know is bad news. I would appreciate any suggestions you might have for reducing what I have thus far.
Would any screenshots or smaller code sections be of aid in this situation? Thanks for your suggestions thus far-I apologize for my ignorance, but I'm just trying to make the most of a situation in which I'm in above my head.

0 Kudos
Message 3 of 7
(3,573 Views)
To add to my confusion, the VI stopped saving data after approximately 16 minutes (4950 cycles). I had it setup for saving to multiple files and doing so every 60 megs (I know realize this will be too large, but the issue remains as the file size only reached approximately 8 megs). Does anyone have any thoughts on why this happened? Thanks in advance!
0 Kudos
Message 4 of 7
(3,563 Views)

Good afternoon,

 

Hum…. I don’t know exactly what could be going wrong, but I believe that it is something in the way the program was designed.  Before debugging that, take a look at the attached example.  This program generates simulated data, and writes it to a file in the same manner your program does.  Run this on your computer for a while, and see if it behaves in the way you would expect.  Hopefully this example will help clear up the problem with it only writing a subset of your data.  To resolve how to reduce your file size, you will need to either change the file format to be a binary file, or reduce the amount of data written.  If you are reducing the amount of data you want to write to the file you’ll have to choose what data you consider important enough to write to the file.  There are may ways to choose the important data – one popular way is to only write one sample per X acquired.  You won’t get all the data, but depending on what you choose for X you should get enough to analyze.  There are built-in functions which will decimate the arrays of data for you which should make the reduction easier.

 

I hope this helps!

Travis M
LabVIEW R&D
National Instruments
Message 5 of 7
(3,554 Views)
Thanks, that got me started on the right track and now all is well.

0 Kudos
Message 6 of 7
(3,529 Views)

sir

i am also doing an experiment on rotating bending fatigue testing machine.i was thinking to use labview for acquiring the strain subjected in the gauge legth of the specimen.can i use fatigue module in labview for my experiment

0 Kudos
Message 7 of 7
(3,129 Views)