Creating relative OPC tag UDT / templates

I am working to understand how to create relative OPC tags. I have a server layout that defines an object like this:

  • module name
    – parameters
    — parameter value
    ---- parameter attributes

There can be any number of modules, any number of parameters under the parameter heading, and a fixed number of parameter attributes. I think I will have to template somehow for module names and for parameters. However, I am starting with parameter attributes.

So a parameter will look like this:

  • default
  • min
  • max

I can define a UDT that takes the top most tag as an opc tag. However, I would like default, min and max to be an OPC tag that is a path relative to the parameter opc path.

For example:
(yes my paths are strings in opc server)
Now I want default to be:

Can I make OPC paths relative to another tags OPC path?

Sort of. You can reference UDT parameters inside of the OPCItemPath of a tag, e.g.

OPCItemPath: ns=1;s=[{PLCName}]{DeviceName}.Sts

Where PLCName and DeviceName are UDT parameters.
However, you can’t reference other tag values or their properties.

Do you have a more complete example of what it would look like in the end? (can you construct using standard tags (non-UDT) and paste the json?)

1 Like

My aim was to reduce setup. I just found I can drag entire sets of tags into the project. So maybe my thought of how intensive this would be is wrong.

I did play with using parameters to set OPC tag paths. It does seem to work. So I can make that dynamic if I choose.