raining010 Posted October 10, 2013 Share Posted October 10, 2013 Hi, Mr Guru My project is in commissioning, and I still have some technic issues, so post many topics here. Thanks for your helping. Customer's request is to save alarms and logs, then read them. The alarm maybe happen many times in one year, so we need to know at which time it happened before. For alarm display, I didn't write codes by myself, I use DF's alarm overview. But if I want to check the history of alarm, how can I set? Or need I write codes to achieve this? And same with log. The program reads analogue data from external devices, I define 10 off log sets for all devices. Then they will be saved in hard disk, could I visit this history date by using the trend inside DF(just set the x scale will be a nice way)? (should I define 1 log set for 10 devices, or 1 log set for each device, does this bring CPU more load? I use 1 log set for each one, because DF will generate separate document for different logset) Link to comment Share on other sites More sharing options...
AzeoTech Posted October 10, 2013 Share Posted October 10, 2013 You can do both of these, but you will need to write some script to retrieve the files, using the File. functions, and probably ReadDelim() if you use CSV files. Take a look and post specific questions as they come up. Link to comment Share on other sites More sharing options...
SteveMyres Posted October 11, 2013 Share Posted October 11, 2013 Here's a function to take a DAQ Factory time and return Excel-formatted time as a string to write to a CSV file. Then if you format that column in Excel in one of the time formats, it will be correct. function ExcelTime(JTime) return DoubleToStr(JTime / 86400.0 + 25569.0) Link to comment Share on other sites More sharing options...
raining010 Posted October 12, 2013 Author Share Posted October 12, 2013 Hi, thanks for your reply. But both DF time and excel time are not what I want. I want the window time we usually use, for example, 20131010, just let us know the date and time, it's enough. My customer doesn't have ability to read 41559.61301and 1381140370.695, and they won't use excel to change this date type. I have to write codes to revert it for them to read Link to comment Share on other sites More sharing options...
raining010 Posted October 13, 2013 Author Share Posted October 13, 2013 I solved this problem today, list here if could help other guys I started to understand the time after monitoring systime, formatdate, formattime The time in excel(log document created by DF logging) is 41559.46172 I use the code below, I read from excel by line, store each line into F_line File.Write(W_Handle,FormatDate((strtodouble(Parse(F_line,0,","))-365*70-19)*86400)) //get date File.Write(W_Handle,FormatTime((strtodouble(Parse(F_line,0,","))-365*70-19)*86400)) //get time The time in alarms.dat(alarm document created by DF alarm) is 1381140370 I use the code below File.Write(W_Handle,FormatDate(strtodouble(Parse(F_line,0,",")))) //get date File.Write(W_Handle,FormatTime(strtodouble(Parse(F_line,0,",")))) //get time Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.