Hierarchical references and containment relationships
- Last UpdatedJul 23, 2024
- 1 minute read
Placing one or more AutomationObjects within another AutomationObject results in a collection of AutomationObjects organized in a hierarchy that matches the application model, allows for better naming and manipulation, and for more precise scripting.
Using hierarchical references in scripts makes use of the fully qualified name of a contained object, including the container object's TagName.
The following table provides generic examples of using hierarchical references and containment relationships in scripts.
|
Without hierarchical references |
With hierarchical references |
|---|---|
|
GraphicName = "MyContainer.Contained |
GraphicName = MyContainer.Tagname + ".ContainedObjectHierachy GraphicName = me.Container + ".ContainedObjectHierarchy |
|
GraphicName = "MyPlaform.GraphicName"; |
GraphicName = MyPlaform.Tagname + ".GraphicName"; |
|
GraphicName = "MyEngine.GraphicName"; |
GraphicName = MyEngine.Tagname + ".GraphicName"; |
|
GraphicName = "MyArea.GraphicName"; |
GraphicName = MyArea.Tagname + ".GraphicName"; |
An example of a HierarchicalName is a valve object with a contained name of "Inlet" within a reactor named "Reactor1". The valve object would have "Reactor1.Inlet" as the HierarchicalName.
The valve object would also have a unique TagName distinct from its HierarchicalName, such as "Valve101".
Another example of a HierarchicalName is a level transmitter with the TagName "TIC101" placed within a container object called "Reactor1" and given the name" Level" within that container. This results in the HierarchicalName "Reactor1.Level".