Dynamic "Device connection" inside a UDT "OPC Item Path"

Hello everyone,

I’m making my first project in Ignition and the first thing I’m doing is preparing all the different UDT of the different objects I use inside my Siemens 1500 PLC (like valves, motor, analog signal etc…).

The problem I’m having right now is the dynamization of the device connetion at the start of the device connection since I’ll be using all these UDT in multiple project.

What I thought of doing was creating a “Memory tag” in the project called “PLC_Connection” and use the string inside this tag as the name of the Opc connection but it gives me error and I can’t understand why.

Here’s the “OPC Item Path” of one tag inside my UDT:

ns=1;s=[{PLC_Connection}]PLC.Blocks.DB_SPV_AIN.{InstanceName}.Bipolar

If I write manually the name of the plc connection inside the expression the tag work just fine, while if I change the tag “PLC_Connection” to the same value and add the tag in the expression, it doesn’t work.

Mirko Cerin

In a UDT, {PLC_Connection} is, in this case, expected to be a UDT parameter, which you can create a default value for, and override for the UDT instance as needed. Is there a particular reason you're not using the UDT parameters?

I’m not using a UDT parameter because I usually have around 20 to 30 object of this istance of this UDT in every project I make, not counting the other UDTs, so I was looking for a way to change the connection only once instead of doing it in every istance.

Make all the UDTs, export the tags to file, open in a text editor, Find/Replace "[device]" then reimport tag file. Super simple, super easy. You're only setting this up once, so why make it recalculate every time?

1 Like

It simply didn’t cross my mind abount exporting all the udts, and I also thought in case I add new instances while working it would be faster to do with the connection already set in the project.

You can export only select tags if you want, then when you bring them back in you can use the import tool to define how they come back in. That way you make your new UDTs, export only them and modify those ones and reimport.
Having random tags that are embedded in paths of other tags leaves a maintenance nightmare as none of the people following you will realise what the tag is, so maybe they delete the "unused" tags and everything disintegrates.

1 Like

I gave it a quick test in my own ignition designer, and only parameters are allowed to be bound in the OPC Item Path.

Your options are either using UDT params and updating them on every instance as necessary, or exporting, running find/replace on the json, and reimporting like Dave suggested.

If your naming convention has a decent pattern, you could also use the multi-instance wizard while doing the bulk setup.

Ok, then I’ll procede with the export/import of these tags.

Thanks both of you for your help.

1 Like