Using custom tag parameters

This doesn't work, but is there a way to do this?

image

Bind a tag parameter to the value of a custom tag parameter?

No. Regular tags only support bindings on alarm props, and those execute only on the alarm activation.

UDTs might be able to do this, but the bindings won't subscribe--the bindings only evaluate on tag start/restart. Only changes to UDT parameters will restart the instance.

Related discussion:

1 Like

What I am trying to do is be able to write a script that will write in last part of the OPC item path based on data I am pulling for excel sheet. Part I am struggling with is modify the OPC item path.
Seeing the custom parameter there I was hoping I could just write the value there in the UDT definition and the tags built on that UDT would update. but that doesn't appear to work (doesn't fill in the value of the custom parameter)

Alternatively I was thinking I could just write to the OPCItemPath parameter directly but that breaks the binding.

UDT Definition set manually showing correct in tag

running this script to try to figure out how to change via script

tagPaths = ['[PLC3]PLC3/Inputs/CUB 1/1/CB1_1_TGMS_EAS001/Config/AI/Alarm Hi SP.OpcItemPath']
value = system.tag.readBlocking(tagPaths)
print 'Tag OPC Item path before change'
print value[0].value
tag = system.tag.getConfiguration("[PLC3]_types_/TGMS/TGMS_INPUT/Config/AI/Alarm Hi SP")
print 'UDT OPC Item Path before change'
print tag[0]['opcItemPath']
tag[0]['opcItemPath']= '{bindType=parameter, binding={OPCPath}Cfg_AlarmHiSetpointNEW}'
# Failed -- tag[0]['opcItemPath']= '{OPCPath}Cfg_AlarmHiSetpointNEW'
collisionPolicy = "o"
system.tag.configure("[PLC3]_types_/TGMS/TGMS_INPUT/Config/AI", tag, collisionPolicy)
value = system.tag.readBlocking(tagPaths)
print 'Tag OPC Item path after change'
print value[0].value
tag = system.tag.getConfiguration("[PLC3]_types_/TGMS/TGMS_INPUT/Config/AI/Alarm Hi SP")
print 'UDT OPC Item Path after change'
print tag[0]['opcItemPath']


results (tag OPC item path is read again before tag is reinitialized with change to UDT)

Tag OPC Item path before change
{bindType=parameter, binding={OPCPath}Cfg_AlarmHiSetpoint}
UDT OPC Item Path before change
{OPCPath}Cfg_AlarmHiSetpoint
[Good]
Tag OPC Item path after change
{bindType=parameter, binding={OPCPath}Cfg_AlarmHiSetpoint}
UDT OPC Item Path after change
{bindType=parameter, binding={OPCPath}Cfg_AlarmHiSetpointNEW}

after tag is initialized

Tried writing just the string as it appears in the editor and that doesn't work either.

tag[0]['opcItemPath']= '{bindType=parameter, binding={OPCPath}Cfg_AlarmHiSetpointNEW}'

should be done as
tag[0]['opcItemPath'] = {'bindType':'parameter', 'binding':'{{OPCPath}Cfg_AlarmHiSetpointNEW'}

The designer displays as a string and you right in as a string inside the designer but if using script need to write to it as a dictionary.