Hello, I’m looking for some guidance on the following issue…hoping to do this with an expression tag or a tag event script on an OPC tag that writes to 2nd tag.
I have a “lifetime counter” tag that is totaling by the minute but never resets. I’m looking to hold the value from the previous day so that I can have a tag that calculates Current value-previous day= daily amount.
Don’t want to create a transaction group for this either
I’d use a gateway timer script and move the value into a memory tag to use in the project. I have a number of things I do like that over night to prepare for the next day. You can do a tag event script on an expression looking for a set time of day but my personal preference is to do it through a gateway script that looks for a set time. Something like what I have below running in a gateway timer script would do it.
hour = system.date.getHour24(system.date.now())
min = system.date.getMinute(system.date.now())
if hour == 3 and min == 0:
r = system.tag.readBlocking(['yourCounterTag'])[0].value
w = system.tag.writeBlocking(['memoryTag'],[r])
@bpreston Thanks for the help, got it to work!