I would like to create a dataset that contains a list of tags with various live values of tag properties (value, converted value, units, timestamp, quality). Currently I am running a script every second that reads the tag values, calculates and creates a dataset. The script is driven by a power table custom datetime property event I call “clock”. I bind the custom property “clock” to the tag “[System]Client/System/CurrentDateTime”. Then in the power table propertyChange event handler I have the following code:
if event.propertyName == 'clock':
udtPath = event.source.udtTagPath
ds = makeLocalizedTagDataset(udtPath)
event.source.myDataset = ds
# prototype code...
def makeLocalizedTagDataset(udtPath):
#get a list of tag paths for all tags in UDT with system.tag.browseTags()
#read the tag values with system.tag.readAll()
#convert some of the tag values to local units
#create a dataset
# return dataset
This works just fine, but it does a tag read of a group of tags every second which may or may not play nicely with the GUI thread, I don’t know. I am thinking there might be a better more event driven way to do this. Ideas ? Will I run into any issues the way I have written this ?
Example output: