Image Animation on a Timer. Timer sometimes gets slower

Hi,

I run an animation in vision by changing the position of an image with the function system.gui.transform() using the changed value of an object timer. It works great, but sometimes, the timer slows down. It seems to increment at half the speed (similar to this post : Timer running slow). What is the issue? Is it related to a perfromance issue? Is there a work around?

Thank you!

I might have a clue,

The speed of the timer seems to be correlated with the gateway ping time. When I see the ping time getting slower, the timer runs slower:

image

So, how can I get a timer that is not affected by the gateway ping time?

That usually means you are regularly calling out to the gateway on your foreground (user interface) thread. That should be avoided. The most common culprits are tag reads, alarm status calls, and database queries in event scripts. Including those called from runScript(). Wherever possible use tag bindings, indirect tag bindings, and named query bindings to bring gateway information to the client. Those run in the background. Then the foreground scripts can access the values of properties, which do not require a call-out.

In a pinch, use system.util.invokeAsynchronous() to run something in the background. At the end of its function, use system.util.invokeLater() to deliver results to your UI. (Or write to client tags--that is safe in the background.)

1 Like