Triggering a data log on an event


#1

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


#2

@kevin

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


#3

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 too.


#4

Also we are using esync to see the data


#5

@kevin

You can easily use deadband logging to log the values on any type of change or in you can 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 commands longs 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)


Edit: Also, here is a much better write up I did on event driven historical logging.


How to set up the I/O tags for event transfer rather then timed
How to set up the I/O tags for event transfer rather then timed
Undefined Data points in Historical Log
#6

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


#7

The log file is automatically created inside of the eWON.

https://ewon.biz/products/flexy-data-logging/data-logging

https://developer.websupport.ewon.biz/content/historical-logging


#8

thanks for the help


#9

WHEN IT PUT THE SCRIPT IN AND HIT RUN I GET THIS ERROR CODE…
"="expected(3) 13:LogTags Section:


#10

@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


#12

IN THE “MYBIT” SECTION DO I USE THE TAG NAME OR ADDRESS?


#13

@kevin

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


#15

ONCHANGE “B2_SEND_DATA”,Goto LogTag

LogTags:
LOGIO “B2_GLYCOL_PUMPED”
GETTING A SYNTAX ERROR


#16

You are missing your double quotes around Goto LogTag

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


#17

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


#18

@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.


#19

thank you!


#20

A post was split to a new topic: LOGIO question