It's been a little while since I posted anything here but here we are, back at it with LabVIEW. I have a VI (attached) that takes a few different continuous data sets from different modules but I have found that when the program is left running for extended periods of a time, say 2 weeks, the save files can become somewhat hectic. Under the "update UI" state of the block diagram there is a section labeled the "TVA data producer" which reads two different data values each second "temperature" and "flow rate". Both of these are then written to the same TDMS file along with the current date and time, where the save file is also denoted by the time and date that logging was started. The issue I have is that I would like to be able to change the save sequence for these data sets to create a new save file for each time a new days begins whilst the program is running, opposed to just creating one on the day it is started and then continuously adding to this until the program is stopped potentially days or weeks later. Hoping for any help I can get since I was planning on tackling this solution at some point this week *screams internally*.
Many thanks in advance as I know you're all very helpful people! for rookies like myself!
P.S. I have added a few images to hopefully better explain the issue showing the data source from serial COMs and how the data is saved under the current date.
Solved! Go to Solution.
What you want to do isn't that difficult, but you'll want to have some parallel loops to enable you to separate out various tasks. I presume you know about Producer/Consumer Designs, where you have a Producer that generates data and a Consumer that writes it to, say, a TDMS file.
Suppose you wrote the Consumer as a Queued Message Handler, accepting a "Write Data" Message from the Producer and an "Open New File" Message from a loop that fires once a day to close the old file and open a new one. There's a bit of extra bookkeeping you'd need to do (such as knowing when to close the existing file, though that could be a separate Message, and knowing how to stop the Once-a-Day loop when the program ends).
I'd make a function that generates a filename based on the date. Then use a shift register to remember the current result file, if they're different (new day) you close the current one and open the new file and write in that one.