LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How would you recommend that I schedule a file-creation process to occur at midnight each day during a long term data logging operation in LV6.1?

I am operating a continuous system that logs data over a period of years. There are large amounts of data being logged and I have a technique for naming new files when the date changes. However, my technique requires me to poll the date each time I go to write the data to file. What I really want is the ability to schedule the file generation event to occur at a specific time of day. My data logging function is in a functional global structure; so I could call a "start new day" function from another structure that could handle the desired once-a-day event. I could do this now with a parallel loop that polls the date and
calls the "start new day" function, but it wouldn't really save much other than to direct the polling to a different thread perhaps. What is the best way to schedule such an event in LV6.1?
jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 1 of 7
(2,953 Views)
I can't think of any way to actually fire an event when the date changes, but you could certainly toss the poll into a seperate loop (or toss it in a timeout case if you are using an event structure). Since you are just checking for a date change you could give the loop a very hefty wait like 10000 ms or so, and it would have almost no effect on the rest of your processing (an even better way would be to use a timed while loop because then you could put it at a very low frequency and still stop it instantly, but that would require 7.1).

Regards,
Ryan K.
0 Kudos
Message 2 of 7
(2,953 Views)
Thanks for your response, Ryan. The only problem with that approach is that I am getting data every two seconds and I would like the data to go with the date of the file, i.e. I could potentially get about 10 seconds worth of data in the previous day's file. Not a big deal, but I already have such an approach in place and I'm looking for a precisely scheduled event.
jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 3 of 7
(2,953 Views)
Hrm, I can only think of one way that you might be able to do it and it wouldn't be very easy. Using Windows events you could probably set something up, I'm not sure if there is a Windows Event for date change, I haven't seen one, but it's certainly possible. There's a big list of all the windows events here
http://www.microsoft.com/windows2000/techinfo/reskit/ErrorandEventMessages/default.asp
but it doesn't have much info for each event, so you might have to start there and do some additional research. Once you're able to find a Windows event (or possibly create your own by some creative use of something like the TimeSetEvent function) you'd need to write a DLL which handled that event (probably in C++) and then generated a LV user defined even
t using the PostLVUserEvent() function. Of course, user events don't exist in LV 6.1 so this approach would be impossible without using at least 7.0 (as will any type of custom event at all).

Regards,
Ryan K.
0 Kudos
Message 4 of 7
(2,953 Views)
To avoid polling you could calculate (in a separate loop) the amount of time left before the next save and then feed this time to the timeout of a wait notification node. When the notification times out, write file. Other processes can control/abort this loop sending notifications to the loop e.g. when the wait notification node returns, you check for notification data or a timeout.


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 7
(2,953 Views)
This sounds like a good approach. I think I will give it a try in my next update.
jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 6 of 7
(2,953 Views)
I have the same problem as Jcrooke, and I partially understand your answer. Would it be possible for you to show a sample vi? I go not understand the wait notification node part. Thanks.

KB
0 Kudos
Message 7 of 7
(2,953 Views)