jcallen1 Posted December 30, 2013 Share Posted December 30, 2013 I want to use the Lab Jack U3 with Daq Factory Express to log voltage data over a 24 hour per day period beginning at 7AM and ending at 7PM when the file would be saved and a new file automatically started from 7PM to 7AM and ongoing in this fashion with each file having a time or other means of distinguishing it. Could you forward a simple script to accomplish this. I assume such a script would be placed in the sequences section of the program. Thanks you for your assistance. James Link to comment Share on other sites More sharing options...
AzeoTech Posted December 31, 2013 Share Posted December 31, 2013 The best place to do this is in the Event for one of your channels. You'd do something like this: if ((myChan.time[0] - (7 * 3600)) % 43200 < (myChan.time[1] - (7 * 3600)) % 43200) logging.mylog.strFileName = "c:\data\myFile_" + formatDateTime("%y%m%d_%H", myChan.time[0]) endif I did that off the cuff, so there might be a few typos, but that is about right. The idea is to use the Modulus operator to get the time of day, but in 12 hour chunks, and to shift the time by 7 hours. So: (myChan.time[0] - (7 * 3600)) % 43200 will yield 0 when the time of myChan's most recent point is 7am or 7pm. The if() looks for a transition from 6:59 or so (which the above formula will yield 43140) to 7:00 (or the PM version) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.