Triggering a data log on an event

Trying to figure out the script to move a tag value to a log based on status of another tag.

@kevin

To confirm, if say a bit changes you want a value to be logged in the historical log?

In my plc I am using one bit to move 5 different values. I want to log them with a time stamp so I can export then to an excel spreadsheet. We have a ton of ewon flexy’s we will be doing this to.

Also we are using esync to see the data

You can easily use deadband logging to log the values on any type of change or, in your case, use a script that will trigger it.

For the script you would basically need the bit tag and the 5 tags you would log. Then the script would be:

    INIT Section
    ONCHANGE "mybit", "goto LogTags"

Essentially what that little snippet does is it says, if my bit changes (at all +/-) to go to the LogTags section.

    LogTags Section:
    LOGIO "TagOne"
    LOGIO "TagTwo"
    etc, etc, etc

This section will actually log a single point for each of those tags when this section runs.


New Feature

Now in a newly released firmware (12.2s1) we actually have a new feature called LogGroupIO. Essentially this does almost the exact same as the above in one single command. Additionally it can log all of the tags in that group with a single timestamp.

The only requirement is that you put the tags into tag groups (done on the tag setup page).

The new command would be:

    INIT Section
    ONCHANGE "mybit", LogGroupIO("A")

This single command logs all tags in the A group for the same timestamp! So for example it will round the timestamps (10:30:00 instead of 10:30:02)

1 Like

Do I need to create the log or where does it log it to?

The log file is automatically created inside of the eWON.

thanks for the help

When I put the script in and hit run I get this error code…
"="expected(3) 13:LogTags Section:

@kevin

Ah that isn’t perfect syntax. That was more of me separating the sections for readability.

Try this, you can copy and paste this directly into the init section.

ONCHANGE “mybit”, “goto LogTags”

LogTags:
LOGIO “TagOne”
LOGIO “TagTwo”
etc, etc, etc

In the “mybit” section do I use the tag name or address?

@kevin

That should be the name of the tag that you created in the eWON to reflect your PLC tag.

ONCHANGE “B2_SEND_DATA”,Goto LogTag

LogTags:
LOGIO “B2_GLYCOL_PUMPED”

Getting a syntax error

You are missing your double quotes around Goto LogTag

It should be: ONCHANGE “B2_SEND_DATA”, “GOTO LogTag”

Do you leave the real time logging and historical logging setup the same?

@SamLeedy

You can leave the setup the same as long as you have historical logging enabled.
Your tag(s) must have historical logging enabled for the logio command to work.

1 Like

Thank you!