Log management on file or on SQL database

Making data / operations / event logs is an increasingly common request, and since the existing systems are equipped with old PLC models that do not allow the management of logs, the simplest solution is to delegate this task to the operator panel. Weintek added in all its products this possibility let's see how.

Data sampling

With the object Data Sampling it is possible to set the saving of data in a log file, it is possible to choose whether the saving should be performed on time or on a trigger event (PLC-controlled). With the button Data Format a table opens where it is possible to set the list of data to be saved, the data must be allocated consecutively to the PLC. For each data the description and the data format are defined.

The data can be saved in a file in the terminal, on an SDCard or on a USB dongle, the data format is a proprietary format dtl. Using the program easyConverter you can convert it to a format csv standard usable by Excel. Using the object Backup You can transfer the file dtl from a terminal file on a USB dongle already in the format csv. Some topics on the forum deal with the topic topical, topical.

Operation log

The operation log object allows you to automatically save all the operations performed on the panel, you can select the objects to be logged and when the operator acts on the object a record is automatically saved in a file SQL Lite. It is possible to enable the log on variables whose value change is automatically generated in the database.

You need to define the USB dongle on which to save the db file with the data, the object keeps a copy of a certain number of samples in the file system of the panel and occasionally updates the file on the dongle. If you extract the dongle during use to capture the file, the panel fills its local file and then updates the dongle when reinserted. However, it is advisable to use FTP access without removing the dongle.

The item Operation Log View it allows to display on the panel the log file, the object Operation Log Printing allows to print the log file. Some topics on the forum deal with the topic, topical.

Database Query

Some panel models (See manual appendix) manage SQL queries both on local (Internal to panel) and remote (SQL or MySQL Server) databases. In this case it is possible to create ad-hoc macros to manage any type of data recording on the database.

Of course this is the most versatile solution because by exploiting the power of the database with customized queries it is possible to create flexible logs, moreover several panels can send data to the same database allowing the aggregation of data from different panels. Some topics on the forum deal with the topic, topical.

... add one SlimLine

We have seen that the terminal offers many logging possibilities, but sometimes it does not allow us to have the flexibility that the end customer requires. So why not use one of our devices in combination with the terminal SlimLine, thanks to the ethernet connection (Modbus TCP) the terminal can send data to the system which, thanks to its powerful function blocks, can store data on the SDCard. With the function Sysfwrite it is possible to write freely in the file, in the forum you will find many examples of writing in csv format, topical.

The terminal has an FTP server, but many times the client asks to automatically transfer the log file to a remote FTP server (Waiting for Weintek to offer this possibility, which is in their road map) we can use the FB FTPClient di SlimLine to automatically store the file on the remote server, see topic.

And if the data is in the machine PLC? No problem if the PLC supports the Modbus protocol the function block ModbusMaster can read them, possibly the object Data Transfer on the panel can transfer data from the PLC to the SlimLine.

Was this article helpful?