Passing master UDT parameters to child nested UDTs

Hi,

I have a number of UDTs for tank devices at a winery (agitator, brine valve, temperature probe, etc.) and then a set of tank UDTs (‘master’ UDTs) that includes different configurations of these tank device UDTs.
E.g.
Tank_01_ABT

  • Agitator
  • BrineValve
  • Temperature

All UDTs take the same parameters to make it easy to create the tank UDTs. How do I pass the parameters from the master to its child nested device UDTs? When I type ‘{’ into the parameter section for these nested UDTs, none of the parent UDT’s parameters show in the list and an error is produced if I manually type them in…

E.g. parameters:

  • TankPrefix (‘YT’, ‘RF’, etc.)
  • TankNumber (‘8203’, '8304’m etc.)
  • TankArea (‘Red Processing’, etc.)
    etc…

Thanks in advance.

Nick

Edit: a note RE the solution. This works perfectly, but you cannot use the UDT instance wizard to create tags, as default values are replaced with empty strings.

1 Like

So this works for me in 7.9 All my UDTs have string parameters DeviceName and StartingAddress. I have a Pump UDT and a Tank UDT. From there I have a (master) PumpStation UDT that also have the string parameters DeviceName and StartingAddress. I’ll add two Pump UDTs and a Tank UDT to the PumpStation UDT. In the Pumps and Tank UDTs instances I set their DeviceName parameter values to {DeviceName} and their StartingAddress parameters to values like {StartingAddress+10}, {StartingAddress+25}, and {StartingAddress+40}. This causes the Pumps and Tank UDTs to reference the parameter values of the PumpStation UDT. Of note, when I set the values of the Pumps and Tank UDT parameters the DeviceName and StartingAddress are not in the list, they have to be manually typed.

So my PumpStation UDT looks like -

PumpStation - DeviceName = "MyPLC", StartingAddress = 134 Pump1 - DeviceName = {DeviceName}, StartingAddress = {StartingAddress+10} Pump2 - DeviceName = {DeviceName}, StartingAddress = {StartingAddress+25} Tank - DeviceName = {DeviceName}, StartingAddress = {StartingAddress+40}

Hi Pat,

Thanks for your reply.
I’ve tried this again and yes, this works*, I’m not sure what happened when I tried this the first time.

*this only works when creating instances manually, i.e. not using the multi-instance wizard. If you use the wizard, you need to manually (and painfully) enter in all of these parameter values into each and every child’s UDT parameters, which basically defeats the purpose… If you don’t enter these into the child parameters as well in the wizard, the defaults that you set in the master UDT for the child parameters, are overwritten with blanks.

What I think is needed is a property override added to the parameter section. This way, you could set this at the master UDT level and make them unchangeable at the instance level, much like all of the other tag properties.

The parent UDT must have a parameter that gets passed to the child UDT

Parent UDT Parameters:
Name DataType Value
IOServerTopic String CBI_FLVRINJ_CP01
Parent_Name String {InstanceName} // => Flam_Mix_Tank_Seq_Step
OPC Item Paths: ns=1;s=[{IOServerTopic}]{InstanceName}.{TagName}
[CBI_FLVRINJ_CP01].Flam_Mix_Tank_Seq_Step.Description

The child UDT must have a parameter that gets passed to the child UDT

Child UDT Parameters:
Name DataType Value
IOServerTopic String CBI_FLVRINJ_CP01
Instance_Name String {InstanceName} // => ActiveStep
Parent_Name1 String {Parent_Name} // => Flam_Mix_Tank_Seq_Step
OPC Item Paths: ns=1;s=[{IOServerTopic}]{Parent_Name}.{Instance_Name}.{TagName}
[CBI_FLVRINJ_CP01].Flam_Mix_Tank_Seq_Step.ActiveStep.Description






I think most of the guests have already left the party :grinning_face_with_smiling_eyes:

The issue I was having was actually not that the UDT parameters weren’t passing in correctly, at least when I instantiated the normally, but it was when I was trying to use the UDT creation wizard to bulk create lots of UDT instances at once where I was having the issue. And, as I mentioned in my edit, the wizard actually overwrites the default values set in the child UDT instance parameters with blanks if you don’t specify their values which is a bit silly… The wizard expects you to type values into all UDT parameters, both parent and child parameters and it will not simply use the defaults provided if you leave them blank in the wizard (i.e. the only time I would ever want to use it), which essentially makes using the wizard null and void for instantiating UDTs with child UDT instances

1 Like