logging option in CODESYS?

  • DavidBo

    DavidBo - 2020-03-26

    We are living in 2020 logging should be a trivial thing, but I am lost.
    I want to log the a temperature every time it has changed 10% or 1 degree from the desired value.
    I want the log to be cyclic,
    I want to store it an CSV file
    How do I do that? What shall I look for?
    Shall I use CmpLog.LOG_STD_LOGGER or maybe TrendRecording ?

  • i-campbell

    i-campbell - 2020-03-26

    Hi David. Alarm Manager should really be called Alarm and Event Manager. I use him for recording such events. It uses a SQLite database, but you can export it from the IDE as CSV.

  • DavidBo

    DavidBo - 2020-03-26

    Hi campell
    The end user of my application is not using the IDE and can therefore not export it to a CSV file. Is it possible to do it from the application if the user for instance press a button?
    I want to clarify I want to log every time the temperature change 10%. For instance:

    And so on. Is the Alarm and Event manager adequate for that?

  • Morberis

    Morberis - 2020-06-29

    There is another option for you. The DataLog Manager can set up logging like you're talking about. It can store as a CSV, it can be set to log data when hysteresis values are hit, like changes 0.1 degrees. The only issue is that is saves this data to flash memory. You can't direct it to save it to an SD card or usb drive. It is however super easy to use and is available on the free codesys version. You can then use the file handling libraries like SysLibFile to copy or move over the files either automatically or through user interaction. In that way you can make it easy for someone to access via a thumbdrive. If you have a nice ip67 usb connector this works well. Here is a link to the help file info about this function.

    The issue to saving to flash memory is eventually that flash memory will wear out. Especially if the manufacturer is misery and doesn't provide much (Looking at you Eaton).

    The Trend function also does logging. It definately saves it as an sqlite file that requires work to convert into a nice readable CSV. The date is not stored human readable for instance and needs to be converted. Also if for some reason the PLC loses power while saving to the trend file the trend file can become corrupt and will silently fail to log more data.

    I have used both the Trend function and the data log manager and the data log manager is superior.

    Oscat Network also has functionality you're looking for.

    Alternatively you can setup your own logging where you push the data to Azure or AWS.

    Here is one random example I found on Youtube. Kurt has some great videos if you haven't seen him before.


    Last edit: Morberis 2020-06-29

Log in to post a comment.