Tag value change event

what is the difference of value change event in tag editor and gateway event scripts?
I see this event in both places, how should I choose and what are their application scenarios?

Gateway tag change events will fire if any of the listed tags change. In some projects we use this to begin some shutdown processes if certain alarms tags occur, or for API calls when some of our devices are used.

Tag change events on each tag will only occur if that tags changes, you can also trigger scripts if an alarm becomes active. I've used this in the past to fire some named queries, API calls or if more complex calculations need to occur, we can start that calculation each time a reading changes (though if the calcs are simple you should probably use an expression tag).

Depends how many you use, if you want tag change bound to a tag in a UDT you use a lot, use them on the tag, as then don't need to copy and paste lots of gateway events. Special change events where only one will ever be needed can be done on gateway.

Keep in mind that tag value change events only have a limited queue of change events. If this fills up due to either slow running event handler code or sufficiently quick value changes, then events may be missed. Gateway events do not suffer from this. Keep your tag value change scripts extremely fast

This. Events on tags themselves should run in single digit milliseconds or less, due to the likelihood of blocking the system-wide thread pool for tags. That means no database operations nor any network access operations nor any recursive searches in these events.

Gateway tag change events in a project have their own (unbounded) queues and their own threads. Put any time-consuming operations there. But do note that only one thread services all the tags for a given event, so there can be more latency.

So,the limited queue of change events is shared for all tag?

Thank you, the information you gave is very critical

No, each tag has its own event queue (length 5 by default), and its own "Missed Event" tracking. But they all run in the same thread pool (threads = 3 by default), so delays in a small number of tags can block processing in all others.

I guess we can't add a tag in the tag change event list of tags. They have to be statically configured in the tag change event triggered gateway script. Correct me I am wrong, I want to be able to dynamically update this list thru a script. Can we do that?



You should review this related topic (in its entirety) for some further options: