Templates Inheritance
  • 04 Jul 2022
  • 1 Minute to read
  • PDF

Templates Inheritance

  • PDF

Article summary

Users can assign the default value of a Custom Property to the value of another Custom Property belonging to an upper entity in the Model Hierarchy. This way, if the user does not specify a different value for the Custom Property, it will automatically inherit the value from the upper entity.

Let's see an example:

  • Step 1: Add the scan_rate Custom Property to the Inverter Template we previouslycreated and assign its value to the scan rate property of the tags within the template.
  • Step 2: Assign a default value to the scan_rate property equal to {scan_rate}. It will be displayed in a characteristic dark yellow color, as shown in the image below, meaning that it will take its value from an upper entity.

Figure 16- Templates InheritanceFigure 16. Templates Inheritance

  • Step 3: Click on the menu on the left-hand side of the Templates header, select New Group->Group, and enter a name for the template (in this example Cabin).
  • Step 4: In the Templates panel select the Cabin Template, click on the Custom properties button, and from the drop-down menu select New custom property.
  • Step 5: Enter scan_rate in the custom property Name and Type of Number. Click on Save.

Figure 17 - Cabin Template(1)Figure 17. Cabin Template

  • Step 6: Create an instance of the Cabin template, click on the menu on the left-hand side of the Model header, select New Group-->Cabin, enter a name for the instance (in this example Cabin1) and click Save. Enter a value of 1,000 in the scan_rate custom property field.
  • Step 7: Click on the ellipsis button, on the right-hand side of the Tags label, select New Group->Inverter and enter a name (in this example, Inverter01).

Figure 18- New Inverter within the Cabin InstanceFigure 18. New Inverter within the Cabin Instance

  • Step 8: Expand the inverter tags and check that they have inherited their Scan rate value from the cabin. It should be equal to 1,000.

Figure 19- Inherited Scan Rate Value (2)Figure 19. Inherited Scan Rate Value

Was this article helpful?