Cyclic increment value in a script

Thanks for the comments. You made the point.

The previously posted script was drafted in a script console to test the class object function and then pasted in the gateway timer script to try out the simple-pid library. It was poorly structured.

I thought the same when I started the gateway script, as per the code, there should be a new script starting every one second, because the previous script will never complete.

But when I checked the gateway "Current running script" status page, there's only one script running, I thought maybe the gateway list only one instance of the duplicated script. But because I write a flag log in the script, if there's duplicated scripts running, there should be one new log every one second. But from the gateway log, there's only one log only.

So I was kind of confused, maybe Ignition is doing something smart to run only one script to prevent the memory from overflowing?

logger = system.util.getLogger("myLogger")
logger.info(str(pv))

I used the gateway script only a handful of times over the years and I had poor experience when using it. For example, in the gateway script, I will always write log to keep track of the running script status. But for quite a few times I found the script was not listed in the current running script page, but the log keep on updating with new status log, which means there's a script running at the backend but not captured by the gateway, the only way to stop it is to restart the gateway.

Anyway, the gateway cyclic script is not the show stopper to my current case.
My real problem is how to create object from class, store the object in gateway or running project, then run the object function.
I have started a new post about it, but since this post attracted more attention, maybe we can continue the discussion in this post. :grinning:

1 Like