02-13-2016 12:45 AM
Scenario:
I'm logging temperature data from the four channels of my NI 9219. The VI runs indefinitely and I can stop the program by clicking the stop button.
1. How can I set the maximum file size of my data_log.txt to be just 200 kB?
2. Once the maximum file size is reached, I want to create another file (same max file size) in order to continue the data logging, and rename it to let's say data_log1.txt.
Do you have any idea on how to implement this?
02-13-2016 01:33 AM
Hi,
I'm guessing your acquisition happens in a while loop, right?
You can use the iteration terminal (the blue "i" square) to decide when to create a new log file.
I would suggest I define a maximum number of lines per log file and then what you have to do when the iteration terminal reaches a multiple of that max number of line you create a new file. File name can be generated using the date and time.
Maybe post you code or a screen shot of it if you need more help to implement that.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-13-2016 05:36 AM
I remember seeing something similar on one of the Project Templates that NI distributed with LabVIEW 2012 (I assume its still there in 2015). In developing the (I think) Data Acquisition with Logging (or something similar) Project from a Template, they wrote Errors to an Error Log, which had a user-defined Maximum Size. After every write, the file size was checked, and if it was bigger than the Max, the file was rewritten starting at the second half (so the first half was thrown away).
You could easily adapt this technique to write to a maximum size, and when you exceed the size (or just before you exceed the size), close the current file and open another one.
I just checked the Projects shown in LabVIEW 2015 when you click "Create Project" -- I think you want to look at how the Error Logs are handled in "Continuous Measurement and Logging".
Bob Schor
06-15-2018 08:14 AM
Please find attached Vi. Let me know if it helps.
06-15-2018 09:22 AM - edited 06-15-2018 09:24 AM
I think the Get File Size function is what you are looking for...
Check the file size periodically and create a new file when necessary