Parameterizing Siemens PLC Tag Mappings

Hi everyone,

I have created UDTs for repetitive tag blocks in a Siemens S7 PLC. My hope was to parameterize the OPC mappings in my UDTs, but I am having trouble getting it to parse correctly. Here is an example of a opc path: nsu=http://www.siemens.com/simatic-s7-opcua;s=“Motor_CamAssy_Mtr11”.“DrvTemp”.

However, due to the double slashes in the http address, this is what the mapping looks like:

Whenever I try to pass in my machine name string parameter with the value Motor_CamAssy_Mtr11, I get an Error_Config. I’m not sure if the path just isn’t resolving correctly with the parameter or if there’s another way I need to format the path.

Any help is appreciate.

Ignition uses curly braces around parameters, not quotes. I’m not familiar with the Siemens OPC server, but I would not expect quotes to be in the final item path.

Try ns=3. That is the default Simatic namespace

Correct. This is what the path looks like when I pass in the parameter. I’ve tried it with and without the quotes surrounding the param:

Oh, they’re definitely part of the OPC Item Path.

What he’s doing is fine. Using the URI is actually safer because technically a server can change the index a namespace resides at.

2 Likes

Using curly brackets like in this post should work… not sure why yours is acting differently. What “doesn’t work” about it?

Whenever I pass in the parameter into the opc item path, it is throwing an Error_Config:

thanks for linking that other post. I can review that to see if anything is configed wrong on the plc itself

Wow. Typical mistake on my side where it doesn’t work until I reach out and makes a liar out of me lol thanks for the quick help, all

Do the tag diagnostics for that tag have any more details?

You’re definitely missing the quotes, whether you put them in the parameter value or OPC Item Path is up to you.

It looks like there are quotes missing around {Machine Name},

Try "{Machine Name}"

1 Like

Yeah, that was it. I swear I’ve tried that in the past. Thanks for the help!