I'm Confused...

Wolfsnap

Newcomer
Joined
Jun 15, 2003
Messages
19
Location
North Carolina
I'm writing an application (controlling a piece of machinery) that records an event history and saves the event history as a text file each time an event occurs (machine started, machine stopped, etc.). I'm saving the files with current date as the filename. No problems yet, until the day changes. Then I want to clear the text and start a new file for the new day - but there's no way of knowing if the machine will be on right at midnight or knowing when it will be shut down the previous day.

This isn't too much a problem for someone who shuts the machine off at 5PM and back on at 8AM - it loads the days event history or creates a new one when the system starts. The problem is with the guy who runs the machine 24/7. An event occurs at 11:59 and gets saved, then another event happens at 12:01 and gets saved to a new day's file, but with all of the previous day's events. There's probably a simple solution, but it's confusing the tar out of me.

HELP!
 
I may be off track but I have built many PLC controlled machines with trending history similar to yours. I simply end the file at 12:00 am and start a new file at 12:01 am with the same event as the 12:00 am ended with. Come to think of it, you could also start the new file with machine started date:time, etc.

Hope that helps a bit,
Dan
 
Back
Top