Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

ApplicationObject Containment Practices for Wonderware Application Server Page 1 of 7

<script language="javascript" nonce="abcdefghi"> /* Customization: Added by Infogain to


reload the page */ if (localStorage.getItem('loadedOnce') == 'true') { localStorage.removeItem
('loadedOnce'); } else { localStorage.setItem('loadedOnce', 'true'); document.location.reload
(true); } /* Customization Ended */ function OpenEmailArticleWindow(querystring)
{ LeftPosition = (screen.width) ? (screen.width)/10 : 0; TopPosition = (screen.height) ?
(screen.height)/10 : 0; settings =
'menubar=no,height=424,width=600,resizable=no,scrollbars=yes' hWin = window.open
(querystring, "SaveArticle", settings, true); hWin.focus(); if (hWin.opener == null)
hWin.opener = self; } /* Customization starts by Infogain Added the
OpenTermsOfUsageArticleWindow method to open terms of usage window in a popup. */
function OpenTermsOfUsageArticleWindow(querystring) { LeftPosition = (screen.width) ?
(screen.width)/10 : 0; TopPosition = (screen.height) ? (screen.height)/10 : 0; settings =
'menubar=no,height=424,width=600,resizable=yes,scrollbars=yes' hWin = window.open
(querystring+".html", "SaveArticle", settings, true); hWin.focus(); if (hWin.opener == null)
hWin.opener = self; } /* End of customization by Infogain */

Print to PDF (JavaScript:OpenTermsOfUsageArticleWindow Terms of Use (JavaScript:OpenTermsOfUsageArticleWindow


('termsOfUsage');) ('termsOfUsage'))
(#)

ApplicationObject Containment Practices


for Wonderware Application Server

Legacy Tech Note #

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.

To build a template for a Tank

1. Create a new template toolset called TankApplication.


2. Created a derived template from $UserDefined and rename it to Tank.
3. Create a derived template from $DiscreteDevice and rename it to Inlet.
4. Create a derived template from $DiscreteDevice and rename it to Outlet.
5. Create a derived template from $AnalogDevice and rename it to Level.
6. Create a derived template from $UserDefined and rename it to Agitator.
7. Drag $Tank, $Inlet, $Outlet, $Level and $Agitator to TankApplication toolset.
8. Drag $Inlet, $Outlet, $Level and $Agitator objects to $Tank object in the Template
Toolbox (Figure 1 below).

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

Figure 1: Tank Model

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

Figure 2: Reference Scripting for the Container Object

Reference Scripting for $Tank

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

Figure 3: Reference Scripting for Contained Objects

Reference Script Example for $Agitator Object

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

Figure 4: New Instances

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.

In the following graphic UDO.uda2 points to Tank01.Agitator.Tagname.

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

Figure 5: UDA Reference to Tank01.Agitator.Tagname

Reference Scripting for UDO Object

me.uda2 = Tank_001.Agitator.Tagname;
'Allows a script running in any other object that is not part of the Tank Containment.

Tech Notes Information


Doc ID: TN185
Doc Type Tech Note
Version: 6.0
Status: Published
Last Modified: April 07, 2008
Product • Application Server

https://okmgcs.km.invensys.com/gcs/index?page=content&id=TN185 12/31/2018

You might also like