Sign in to follow this  
Followers 0
tashinz

CX-Supervisor logging on event

5 posts in this topic

I've made an application with CX-Supervisor 1.25 that controls and monitors several valves, pumps etc. A customer need is to log all parameters (integer and bits) of a particular automatic program. He wants to start logging when program start (when he press start in SCADA) and to stop logging when automation sequence is ended (an event in PLC read by SCADA). That is OK, i have StartLogging and StopLogging commands from the script. But customer wants ONE log file for one automatic program (chosen from a reciept). it can last several seconds or few hours. Data logging create a log file every hour (full hour, 13, 14, 15), day (00:00 to 00:00) or month. if my programs lasts for e.g. five minutes, if the next program is started within the full hour, it will be logged in the same log file. How can I avoid that? i made a *.csv file with the name like programname_date_time.csv with all necessary fields and it's ok, created, started logging and stoped when i want to, but the problem is that customer wants visual representation of the data in csv but without any additional software like excel. again, i tried with trend graph, it has all i need, start, stop commands and visual representation, but commands like EditGraph, SaveGraph, Snapshot etc. that i need for exporting data don't work. The Script Manual says it's obsolete feature and Data Logging should be used instead. How can i log data in a file that i control and have visual representation of the data in the file? Many thanks if anyone has a solution.

Share this post


Link to post
Share on other sites
After you execute the StopLogging command, you can use the CopyFile command to copy the data log file (Dataset1) to a new file (OldData) as shown below. CopyFileStatus = CopyFile("C:\DataLogFiles\Dataset1*.dlv", "C:\DataLogFiles\OldData.dlv") The * wildcard is used to ignore the date/time stamp on the data log file. Then use the ClearLogFile command to clear all the data in the log file before the next logging sequence begins: ClearLogFile("Dataset1") Each time the CopyFile command is used, the new files will each have a 1,2,3,etc. appended to the filename. IE none of the files will be overwritten: OldData.dlv OldData_1.dlv OldData_2.dlv OldData_3.dlv etc..... Hope this helps

Share this post


Link to post
Share on other sites
I forgot to mention you should set the Period in the Data Set properties to a high value so CX-Supervisor doesn't try to create a new file in the middle of your process. 1000 Months should do it!!

Share this post


Link to post
Share on other sites
many thanks ECSI this should work. didn't try it yet but it sounds perfect. many thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0