Am I overthinking dynamic linking PLCs?

Is there an easier way than the following? I think I’m over-complicating this…

I am trying to link a PLC to a project, where this PLC can change dynamically across the entire project (depending upon user login, location, etc.). I am using a client tag called PLCName (string) that points to the name of the PLC being used in the project, but I am having a hard time trying to use as little scripting as possible. I want to be able to change PLCName and all tags in my project are referencing that PLC.

For buttons and other things I have to use the Script Editor to read the PLCName from the client tag, and write to PLCName+baseTag (especially with pop-ups passing in the tags as strings). For numeric labels it is a little easier to use an expression like tag({[Client]Settings/PLCName}+"/Path/To/Tag/LaserSPTag")

Too complex? Easier solution? I’m open to ideas, but my tag paths are fairly rigid at this point.

TL;DR - Same project, different PLCs for different areas/users. If PLC changes, tag references change. Easy or not?

I would be very wary of doing it that way, if something happens and you don’t set the client tag properly you could potentially end up with an operator changing values on a different PLC than he intends to.

Good point. So different Projects (copies) for different PLCs?

That is how I would do it yes.
That will make it much easier for things like alarms and permissions as well.
You could structure your tag database based on location.

etc, then in each project you could restrict access to the tag structure based on roles, scripting, login names, etc

1 Like

Consider making more use of indirect tag binding, where the PLC name in the client tag contributes to the tag path. Indirect bindings can still be bidirectional, making it convenient to direct writeback to the correct PLC when your UI or even a script writes to that component property. Avoid using the tag() expression function. Every such use can be re-arranged (possibly with an intermediate custom property) into an indirect tag binding.

1 Like