Hi,
I’m trying to dynamically build the source tag path of a Reference Tag.
I have been reading this post but I cannot make it work.
I have a UDT, Probe_UDT, with a tag to read temperature, PV:
Probe_UDT
{
"name": "Probe_UDT",
"typeId": "",
"tagType": "UdtType",
"tags": [
{
"name": "01_Inputs",
"tagType": "Folder",
"tags": [
{
"opcItemPath": {
"bindType": "parameter",
"binding": "ns\u003d1;s\u003d[Sample_Device]_Meta:Ramp/Ramp{TankNumber}"
},
"valueSource": "memory",
"expression": "dateExtract(now(), \"sec\")",
"dataType": "Float4",
"historyProvider": "IGN_Historian",
"name": "PV",
"historyEnabled": false,
"tagType": "AtomicTag",
"opcServer": "Ignition OPC UA Server"
}
]
}
]
}
I have mobile tanks that can get their temperature reading from a different probe, depending their position. So I have a UDT, CoolTank_UDT, to handle tanks. One of the fields is a reference tag. I would like to change dynamically its “Source Tag Path” to point the relevant temperature probe.
I tried to build the “Source Tag Path” at the reference tag, but it didn’t work; the expression wasn’t executing. So I added an expression tag to build the probe tag path and added the expression tag in the “Source Tag Path” of the reference tag. But it doesn’t work neither.
PV_Path expression tag expression:
{[.]TankPath} + "/" + {[.]Probe} + "/01_Inputs/PV"
CookTank_UDT Jason definition:
CookTank_UDT
{
"name": "CoolTank_UDT",
"typeId": "",
"tagType": "UdtType",
"tags": [
{
"name": "01_Inputs",
"tagType": "Folder",
"tags": [
{
"valueSource": "memory",
"dataType": "String",
"name": "Probe",
"tagType": "AtomicTag"
},
{
"valueSource": "expr",
"expression": "{[.]TankPath} + \"/\" + {[.]Probe} + \"/01_Inputs/PV\"",
"dataType": "String",
"name": "PV_Path",
"tagType": "AtomicTag"
},
{
"valueSource": "memory",
"dataType": "String",
"name": "TankPath",
"tagType": "AtomicTag"
},
{
"sourceTagPath": {
"bindType": "parameter",
"binding": "{[.]PV_Path}"
},
"valueSource": "reference",
"dataType": "Float4",
"name": "PV",
"tagType": "AtomicTag"
}
]
}
]
}
Example:
Probe tag:
Tank tag: PV_Path has the right path to Probe1 PV, but Tank 1 PV SourceTagPath doesn’t get the value of PV_Path (I have tried with [.]PV_Path, without the {} too, with the same result):
If I harcoded the value in PV_Path in the “Source Tag Path” of the reference tag (PV), it works.
Do you know why the “Source Tag Path” doesn’t get compiled?