Transaction Group basic functionality question

Hi guys,

I can't seem to get the right combination of settings to create this simple functionality with a transaction group:

Monitor an OPC tag
When it transitions high, start an hour meter
Increment the hour meter value until the monitored OPC tag transitions to low
Write the incremented value to the DB as a new entry, only once, when the OPC tag transitions LOW
Any subsequent execution starts the hour meter count from zero again

Thanks for your help,

Doesn't sound like a normal use of a transaction group. Consider recording timestamps and tag value whenever the tag value changes. Then your DB can tell you the duration with a lead() or lag() expression.

I would probably have an event on the tag for value changed and when it goes high it writes to another tag and records the datetime then when it goes back low it takes the difference in between now() and the datetime tag then writes it to the database.

Use of hour meter and event meters are normal uses of a transaction group. Else they wouldn't be options. :wink:

That said, they're not quite as intuitive to use.

You need to use the tag twice in the transaction group. Once as an hour meter, once as a trigger.

My Test Tag
image

Tag Setup



Action Tab

Trigger Tab.
image

DB Table
image

1 Like

Yeah, totally normal. Not. IMNSHO.

Jordan, I have implemented this as you suggested, but it seems it always writes a zero to db. Somehow, mine is resetting the hour meter before it can write the value to the DB. But I do see that your implementation does not. What could I be missing? Only thing I see different is that my first OPC tag in the group is the trigger, and the retentive hour meter one is second. Could this affect it?

You can try swapping them, but it should be logging the latched value of the hour meter.

Try it with a memory tag. If it works as it should, and not with the OPC tag, then you may have a bouncing signal.

Otherwise you can use the method outlined by others (especially @pturmel). It would be easier to maintain, in any case, as you can see how much of a pain this can be.

Seems to be working now. I put them in the order you had them in the screenshot. Thank you!

1 Like