I have a scenario where I need to run one script and then later run another script and am wondering what the proper way to implement it would be? Looking through the documentation it suggests using system.util.invokeLater and I wanted to check if that’s best practices to not cause any issues and also ensure that there’s no scenario where it doesn’t execute the second script.
Ignition 8.1.48
The specific situation: We have a large number of tags read through Cirruslink’s totalflow module that we want to read at a very slow poll rate but on demand be able to poll them upon request. Example is for example gas compositions, that only change once every week or even every few weeks. Poor comms and trying to limit data traffic is an issue (cell / radio connections to remote sites). Talking with the module devs they helped suggest a way I can stop one poll group and enable another to handle the slow vs fast polling of tags.
So when the operator clicks poll now, I plan to have a tagTrigger that flips, which then triggers a gatewayEvent tag change that executes pollFast(site) then invokeLater(pollSlow(site), delayTime) and resets tagTrigger. Given that this is editing device connections it’s crucial they execute properly even if perspective closes so I wanted to double check this is the proper way to go about it?
system.util.invokeLater() is Vision Client scope only.
I would write a timestamp that is now plus what ever delay to a tag, then have another expression tag that compares that time to the current time. Once the current time is above that, use another gateway tag change to call the pollSlow() function.
Ahh thanks for catching that. Didn’t realize that was vision only. Doing it with a timestamp is a good solution, then I can also extend the timestamp if another user hits the button on the same site again while it’s already running.
I don't have experience with that driver, but other drivers like Logix you can read tag values outside of their poll rate by using system.opc.readValues which will request the values directly from the plc instead of from the cache (system.tag.read*). Maybe you can do the same thing?
Unfortunately system.opc.readValues doesn’t seem to work like that with their driver. I tried this below and unfortunately it only changes value and timestamp every 10 seconds, which is what was set in the driver’s poll group.
The tags exposed by Cirruslink’s Totaflow module can’t be used that way AFAIK. Changing the tag group setting has no impact on them as they are only updated by the module based on the driver’s poll group settings.