Professional Documents
Culture Documents
Applicationobject Containment Practices For Wonderware Application Server
Applicationobject Containment Practices For Wonderware Application Server
533
SUMMARY
This Tech Note provides a brief overview on the practice of Containment by providing a simple
tank example.
Containment is the relationship in which one application objects includes another in a parent-
child relationship. For example, a tank or vessel may contain inlet and outlet valves. In the
Application Server context, the tank is the container object, and the inlet and outlet valves are
contained objects.
Practicing containment saves engineering time, especially in the scripting area. Objects can be
referred to by the name that derives from the containment relationship.This name is called a
hierarchical name.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018
ApplicationObject Containment Practices for Wonderware Application Server Page 2 of 7
Note: For more information on containment, please refer to Creating Contained Templates, in
Chapter3 of the IDE documentation.
SITUATION
Application Version
• All versions including Industrial Application Server and Wonderware Application Server
3.0
Containment Example
The following example demonstrates how objects are referenced in a plant equipment model
such as a tank system.
Note: Name the derived templates appropriately so that they will be contained names when an
instance is created from the $Tank template. Otherwise, it will add more work if you rename
the contained name after creating the instance. In addition, you have to update the scripts also.
Contained names are not updated automatically in scripts when they are renamed.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018
ApplicationObject Containment Practices for Wonderware Application Server Page 3 of 7
Object Referencing
The following graphic shows the simple scripting done in container object ($Tank) referencing
to contained objects ($Agitator, $Inlet, $Level and $Outlet).
UDAs 1-6 are defined as UserDefined Attributes in the $Tank Object. UDAs 1-4 are
string types, UDA5 is an Integer, and UDA6 (used for the script Expression) is Boolean.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018
ApplicationObject Containment Practices for Wonderware Application Server Page 4 of 7
me.uda1 = me.outlet.tagname;
'Allows a script running within the parent object to reference its child outlet.
me.uda2 = me.inlet.tagname;
'Allows a script running within the parent object to reference its child inlet.
me.uda3 = me.level.tagname;
'Allows a script running within the parent object to reference its child level.
me.uda4 = me.agitator.tagname;
'Allows a script running within the parent object to reference its child agitator.
me.uda5 = me.level.pv;
'Allows a script running within the parent object to reference its child level.
'me.uda6 allows the script to fire when me.uda6 transitions from false to true.
The following graphic shows the scripting done in contained object ($Agitator) referencing to
container object ($Tank) and also to other contained objects ($Inlet, and $Outlet) belonging to
the same parent.
UDAs1-4 are defined as UserDefined Attributes in the $Agitator object. UDA1-3 are
String types, UDA4 (used for the script Expression) is a Boolean.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018
ApplicationObject Containment Practices for Wonderware Application Server Page 5 of 7
me.uda1 = mycontainer.tagname;
'Allows a script running in any of the children to reference to parent object.
me.uda2 = mycontainer.inlet.tagname;
'Allows a script running in any of the children to reference another child named Inlet
that belongs to the same parent.
me.uda3 = mycontainer.outlet.tagname;
'Allows a script running in any of the children to reference another child named outlet
that belongs to the same parent.
'me.uda4 allows the script to fire when me.uda4 transitions from false to true.
The following graphic shows the snapshot of deployment view showing couple of instances
created from $Tank Object. No script modification is required in the instances after creating the
new instances, since the scripts reference the contained name. This is one of the main
advantages of using containment.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018
ApplicationObject Containment Practices for Wonderware Application Server Page 6 of 7
The following graphic shows the snapshot from the ObjectViewer showing the values for
UDAs subscribing to object containment references.
Note: A reference to the instance of Tank Template can be accomplished in any other object
that is not part of the Tank Containment.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018
ApplicationObject Containment Practices for Wonderware Application Server Page 7 of 7
me.uda2 = Tank_001.Agitator.Tagname;
'Allows a script running in any other object that is not part of the Tank Containment.
https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018