Containment examples
- Last UpdatedDec 03, 2024
- 2 minute read
You can have a Tank object that contains two DiscreteDevice objects that represent its inlet and outlet valves.
Note: Base templates cannot be contained by another template, either as the container or as the template being contained. You can only use containment with derived templates.
To implement containment
-
Create the following instances: Tank1 from $UserDefined and Valve from $DiscreteDevice. Valve has only one name, Valve.
-
In the Model or Deployment view, drag Valve on to Tank1.
Note: If Tank1 already contains an object with a contained name of Valve, the Galaxy generates a unique contained name for the newly contained object, such as Valve_001.
-
Change the contained name of Valve within Tank1 to Outlet. Valve can now be referred to by its tagname, Valve, as well as its hierarchical name, Tank1.Outlet.
-
Create an instance called Reactor1 from $UserDefined.
-
In the Model or Deployment view, drag Tank1 onto Reactor1.

-
Change the contained name of Tank1 to Holding. Tank1 now has two names, Tank1 and Reactor1.Holding. Also, Valve has a three-part hierarchical name: Reactor1.Holding.Outlet.
For the three objects in this example (Reactor1 containing Tank1 containing Valve), the following naming hierarchy exists:

To implement template-level containment
Note: Contained Templates do not have tagnames. When an instance hierarchy is created from a template and its contained children, unique tagnames will be created for the instances based on their contained names.
-
Create the following derived templates: $Tank from $UserDefined and $Valve from $DiscreteDevice.
-
Derive $Inlet from $Valve.
-
In the Template folder, drag $Inlet on to $Tank. If $Tank already contains a template named Inlet, the Galaxy generates a unique tagname for the new contained template, such as Inlet_001.
The contained template now has a hierarchical name $Tank.Inlet.
-
Create an instance (Tank001) of $Tank.
-
The Model and Deployment views show an instance Tank001 that contains an instance called Inlet.
