Gateway Event Tag Change Script Instances

I am trying to create a simulation of some of our conveyors so I can test some new routing logic. I created a UDT with several tags and deployed 19 instances of this UDT to represent the individual conveyor stations. I then took a specific tag from all UDT instances and set it as the trigger for a Gateway Tag Change Script with the hope that each conveyor station would fire separately from all other simulated stations, thereby simulating that every conveyor can respond independently of all other conveyors.

However, while testing, as the conveyor stations get full with data, it appears that conveyor stations are waiting for other stations to finish their action from the gateway event script before triggering the gateway event tag change script. Can a specific Gateway Tag Change Script have only one instance running at a time? Do other tags that are referencing that same Gateway Event Tag Change script have to wait until the script finishes for other tag changes before they can run the script?

Yes, they are queued, only one instance for the entire tag list will run at a time.

Thanks! If I use a Tag Event Script on the tag, will it then fire when each instance of the UDT updates?

Yes, but… there is also some level of queuing going on with Tag Event scripts as well.

Each tag has a queue of size 5 (I think?), which won’t necessarily be a problem, but there’s also only ever 3 Tag Event scripts executing concurrently at any given time. Tag Event scripts are not meant to execute long running tasks.

Okay, sounds good. I think I’m going to change my architecture slightly. The issue is that I want the simulation to simulate that data doesn’t move instantly from station to station, so I have added an arbitrary pause to some of the scripts to keep the data in one station for 0.2 seconds. I am going to try to move that to someplace else so that the Gateway Tag Change scripts finish immediately.

Thanks for the help!

Are tag events potentially lost?
I have ~200 PLCs (more at other facilities) building parts on average of 2.5 second cycle time.
It's quite possible for several of them > 5 to complete a part at very nearly the same time.
@Kevin.Herron, @pturmel Will I be better off using Tag Event Scripts instead of Gateway Event Tag?

Gateway Tag Change Events pile up indefinitely, and are strictly sequential per event script defined. Tag Events-Value Change are thrown away if five pile up for the same tag, but are concurrent for different tags (up to three at a time, normally). When an event is discarded, the missed events flag is set on the next event for that tag that isn’t thrown away.

Trade-offs. I usually use Gateway Tag Change events (in the project, not on the tag). If I need concurrency, I selectively push events into custom work queues from the main event script.

1 Like