I am having problems doing something that was real easy to do in Wonderware. I badly need to do it here as well and feel like there is surely a way to do so, but I can’t figure it out.
Lets say I have a UDT for a device, with an OPC tag, some memory tags, and a Data Type Parameters in that UDT. The device that this UDT represents can have one to eight sub-devices, for lack of a better name, that are common to the main device and use theData Type Parameter of the main device to make up part of the OPC Item Path for the OPC tags in the sub-devices.
So, I create the main device UDT. We’ll call it Parent for this discussion. Then I create a sub-device UDT, which we’ll call Child. What I want to do is create an instance of the Parent UDT and set the Data Type Parameter to point to its OPC device. Then I want to create instances of any sub-devices of the parent device and link them to that parent device.
I haven’t found a way to do this yet. The instance of the parent device won’t allow me to add an instance of a child device to it, which I kind of understand as that is not part of the UDT it was instanced from. In Wonderware, you would create an instance of the parent, then you could create instances of the child and link them to the parent instance in a hierachical tree fashion such as the following by dragging them and dropping them on the parent.
Parent
_Child01
_Child02
_Child03
If you do that here, the children instances do not appear as children of the parent, on the next level, but instead appear as a UDT instance on the same level as the parent instance, as such.
Parent
Child01
Child02
Child03
The only way I have been able to get this to work is to create a folder called Subs in the Parent UDT, then add one or more Child UDTs in the folder. The problem is that if I add eight Child UDTs to the Parent UDT, which is the maximum it can have, and the instance of the parent I create only has one Child, the other seven Child UDTs are useless and wasting resources. Sure, I can create a Parent UDT that has one Child, another that has two, another that has three, and so on. But that’s bad programming logic.
How would one go about doing this the best way, so that everything is organized and the only Child UDT instances created are being utilized and are linked hierarchically to the parent?