UDT Composition
It's possible to set up UDT composition in Ignition where you are putting one UDT inside of another UDT.
In this example, let's use our a Motor and Tank data types that were already created and used in previous sections of this manual. We are going to create a third UDT called Area that will contain the Motor and Tank data types inside of it.
-
In the Tag Browser, right click on Data Types and select New Data Type. The Tag Editor window will open.
Assign the new data type a Name called Area. -
Inside of the Area data type, create two data type instances, one for Motor and the other for Tank.
Click on the green + icon, select Data Type Instance > New Motor.
Click on the green + icon, select Data Type Instance > New Tank.
Rename both new data types to Motor and Tank respectively. -
Now, you have both the Motor and Tank UDTs in the Area UDT. Motor has two parameters: DeviceName and MotorNumber.
Tank also has two parameters: DeviceName and TankNumber.
-
Every UDT you add inside another UDT, those instances have parameters that need to be specified and passed in from the parent UDT. In the Area UDT, create the DeviceName, MotorNumber and TankNumber parameters in the the Area UDT. (Even though both data types use the same DeviceName parameter, you only need to enter it once in the Area UDT).
-
The values in the Area UDT need to pass to the Motor and Tank data types so references need to be added.
Click on Motor, and enter the following references:
For DeviceName, enter the value {DeviceName}.
For MotorNumber, enter the value {MotorNumber}.Click on Tank, and enter the following references:
For DeviceName, enter the value {DeviceName}.
For TankNumber, enter the value {TankNumber}.
Click OK. -
Now, that you added all your parameters, create a new instance of Area. In the Tag Browser, right click on Tags, select New Tag > New Data Type Instance > Area.
-
The Tag Editor window will open. Enter a Name for the new instance name, called Area 1.
Enter the values for each parameter:
For DeviceName, enter the value CLX.
For MotorNumber, enter the value 1.
For TankNumber, enter the value 100.
Click OK. -
From the Tag Browser, you can see Area 1 was created, and if you expand Area 1, it will show the two UDTs (Motor and Tank) and that values are coming through pointing to the appropriate places in the PLC.
-
Check the OPC Item Path in the Tag Tree to verify that Motor is pointing to Motor 1 and Tank is pointing to Tank 100.
Similar Topics ...