Restart tag via python script

Hello,
I have a UDT definition with some calculated tags and some data tags from a device.
The calculated tags are scrap calculations, which are initialized with 0 when the tag is restarted.
So whenever i want to reset the calculation, I just restart the tag and that works fine. :slight_smile:

Is there a possibility to restart a tag with a python script like it can be done with a right-click on the tag?
Are there any other ways to restart tag with a script?

Thanks in advance for your help and ideas.
Best Regards,
Gerald

Is there a script running on the calculated tags? You could just write values to your data tags to "initialize" them.

I would try to write values as the poster above me suggested but if you absolutely must restart the tag it appears moving the tag then moving it back will restart it. Maybe someone from IA has a more elegant solution.

tagPath = ['[default]testCalcTag']
newPath = '[default]move/'
system.tag.move(tagPath, newPath)
system.tag.move([newPath], tagPath[0])

Consider trying system.tag.configure() and changing something inconsequential.

Thank you for your answers.

@bmeyers: Yes, there are scripts running on the calculated tags. It also came to my mind, but it is hard to maintain and must always be adopted when something changes.

@ethomason, @pturmel : I add a new tag property and store the restart timestamp -> that restarts the tag :grinning: ... and i know when it happend last.

I added the request to the ideas list.

How exactly did you do this? I have a UDT that uses Lookup expressions, when I change the Dataset used in the UDT Lookups it takes forever to update without doing a Tag/UDT Restart, Hoping to add code to Restart the UDT in the Dataset Update Script. (I like your request 26 idea)

We are using system.tag.configure() to update UDT paramerers, but it seems to not trigger any update on the expression binding on the alarm display path. We need to restart the tag from the designer to update it.

Even if we change other parameters afterwards. Is this a bug? :thinking:

For alarm bindings, I'm not sure what pythonic event will cause them to refresh. They are only documented to be evaluated when an alarm event occurs.

1 Like