script for hourly logging


asaikk

Recommended Posts

You can do it in an event, or just a low priority sequence. In a sequence it'd be something like:

while(1)
  logging.myLog.strFileName = "c:\data\myData_" + formatDateTime("%y%m%d_%H",systime()) + ".csv"
  delay(1)
endwhile

That would create a new file every hour where the date and hour is part of the file name.

Link to comment
Share on other sites

Thank you for the quick response.

On some reference, the script for daily logging is written below;

<logging.log.strFileName = "c:\mydata_" + formatdatetime("%y%m%d",systime()) + ".csv">

compared with above, the one for hourly logging you mentiioned (below) is somewhat non-similar.

<logging.log.strFileName = "c:\mydata_" + formatdateTime("%y%m%d_%H") + ".csv">

Would you please explain the meanings of the commands below?

"%y%m%d"

"%y%m%d_%H"

systime()

Link to comment
Share on other sites

I installed the sequence of hourly log below on the DAQ Factory Express, but it does not work.

---------------------------------------------------------------------------------------------

while(1)

logging.log.strFileName = "C:\aa onlinesoft\datalogger\HourlyLog" + formatdatetime("%y%m%d_%H",systime()) + ".csv"

delay(1)

endwhile

---------------------------------------------------------------------------------------------

On the "Sequence Summary" window, this "HourlyLog" is shown to be "RUNNING", (see the attached figure).

What could be wrong?

post-8497-1328912849_thumb.jpg

Link to comment
Share on other sites

First, is your logging set named "log"? I think the parser actually might have a problem with that because log() is a function for doing logarithm. So, first you might consider renaming your logging set. Second, does the file name change to something like HourlyLog120210_15.csv?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.