Hello all,
I need a script that will use the values from "ImpA" which is located in a memory tag dataset to update my values in the "Ideal Current" tags.
My CB folders are 23(CB 1...CB 23).
Hello all,
I need a script that will use the values from "ImpA" which is located in a memory tag dataset to update my values in the "Ideal Current" tags.
My CB folders are 23(CB 1...CB 23).
could be something like this
# type here you ds tag paht
dsTagPath = ''
# fix your destination path
cbBasePath = '....../Inverter %s/DC Inputs/CB %s'
# read you DS here
dataset = system.tag.readBlocking([dsTagPath])[0].value
tagPaths = []
values = []
for row in system.dataset.toPyDataSet(dataset):
cbNumber = str(row['CBNumber'])
inverterNumber = str(row['InverterNumber'])
impA = row['ImpA']
tagPaths.append( cbBasePath % (inverterNumber, cbNumber) )
values.append( impA)
# your final write
system.tag.writeBlocking(tagPaths, values)
Is there a good reason that you are not using expression bindings that would be much faster and easier on resources?
I didn't think that of that. Wouldn't that require going into each folder and creating the expression(which might take longer)?
Are you not using a UDT for each breaker? That usually simplifies this sort of thing (after the initial head-scratching). You can make a parameter on the UDT for the CB number and use that in the expression binding to look up the appropriate value in the dataset.
See the Dataset Access section: