10.5.7 Dynamic Animation "Advanced" button

In the Dynamic -> Animation box, there is the little used “Advanced” button next to tag name.  This assigns a Local Tag File and a Local Script File to the animation.

The intent is to use this with a Widget, to make the widget generalizable and have the widget automatically call the local script and local tag file.  If two or more of these Widgets are on the same Graphic, each copy of the script and tag file will run independently.  

The script and tag file are not imbedded in the widget or animation, all three must be copied if moving to another project or SCADA node (i.e. the widget, script and tagfile).

This is also a way to assign multiple scripts and tag files to a single graphic.

To enhance the usability of the "Advanced" button and local scripts when they are associated with animation objects, there are two tags: %TTAGLS( and %TTAGLSA( found in the DaqTag list.  These tags allow a script to get the Tag name and Attribute Tag name of the animation object the local script is associated using the “Advanced” button in Dynamic -> Animation.   This means the same script can call different tags: the tag that is the main animation associated with the widget or animated object.  (It does not have to be a widget). This makes the widget even more general purpose.

The format  is [GETVAL @%TTAGLS(0)] and [GETVAL @%TTAGLSA(0)] to get the values of tagname and attribute tag, respectively. The zero level is the current level and most commonly used. To access Tag name and Attribute Tag name of an animation object nth-level up (assuming that we all understand multi-attribute animation in WebAccess), use %TTAGLS(n) and %TTAGLSA(n), where n is 0,1, 2, …..

Example

An example of using the Advanced button to assign a script and tag file to multiple occurrences of the same widget can be found in the $bafanbladesADV.dwt. The user does not have to create or modify scripts or tag files for this widget to rotate. And the user can draw this hundreds of times, connected to different IO tags, and they will all operate independently using repeated occurrences of the script and tag file, even on the same graphic.  

widget $bafanbladesADV.dwt

The widget shows the ON/OFF state of a Discrete Tag with color and rotation.  A Local Tag file with an analog tag named "rotate" is used to attach to Dynamic Animation Rotate since a static tag can not provide rotation. A Local Script is used to count from 0 to 359 if the On/Off tag is true.

Three animations are used

3. Color - connected to the IO Tag. (The original animation).

2. Rotate - connected to the local tag. (Animation on top of the 3. Color).

1. Color - Original Color attached to the IO tag to redraw the image with the combined animations. (Animation on top of both animations)

Below is an example of the un-connected Widget (i.e. Draw -> Modify Widget)

The "rotate" animation has a local tagfile and local script assigned to it using the "Advanced" button in Dynamic Animation.

Select ( 2) Rotate (-) from the Animation List and Press OK.

Rotate (-) from the Animation of  $bafanbladesADV.dwt uses a colon (:) to prevent Widget from changing the tag name.  This will always be "rotate" and not "tagnamerotate".

Note the use of a colon (:) in front of the tagname "rotate" ( :rotate ).  This colon prevents the Draw Widget command from inserting the tagname in this field.  This animation will always have the tagname rotate.
 

Clicking the "Advanced Button" allows the assignment and creation of a local tagfile (rotate will be a local tag) and a local script.

Advanced Button to assign Local Tag File and Local Script File to $bafanbladesADV.dwt

The Local Tag File is named after the widget, but could be any name.  In this example the Tag File has a single Tag, but there is no limit to the number tags that could be created.

Local Tag File  $bafanbladesADV.dwt

The Local Script File uses the DaqTag, %TTAGLS(1),  to read the tagname assigned to the level of animation above this one (the On/OFF IO tag assigned by the user) and the DaqTag, %TTAGLS(0), to read the tagname assigned to the current level of animation (rotate).

# This script is used with the $bafanbladesADV widget

# Editing this script will affect every display this widget is used on

# This uses the Advanced button in Dynamic Animation to assign

# this script and tag file to the widget locally

# See the Engineering Manual section 10.5.7 Dynamic Animation "Advanced" button

if {[GETVAL @%TTAGLS(1)] == 1} then {

SETVAL "@%TTAGLS(0)=%ROTATEPLUS 32"

}

Note the use of the @ inside the GETVAL.  This is an example of an "Indirect Tag". Essentially saying Get the Value of the Tag within the Tag named %TTAGLS(0). You don't want the value of %TTAGLS, the script needs the value of the Tag whose name is in %TTAGLS.

To supply a complete example, here are the Dynamic Animation of the two Color animations. Note the tagname is blank because the Draw Widget commend will insert the Tagname for the user.  Also, in this example, the Advanced button shows no Local Tag Files assigned to these levels of animation:

3 Color Red/Green ON/OFF - $bafanbladesADV.dwt

 

1. Color - Original Color  - $bafanbladesADV.dwt

 

Draw ->  Widget -> $bafanbladesADV.dwt and attach to IO Tag named "FANSTART101".

Here is the Animation List of the Widget. Note that the IO Tag appears in the Color animations and the :rotate is converted to the Tag named "rotate" without creating a "FANSTART101rotate".

Advanced widget - $bafanbladesADV.dwt assigned to tag FAN_START101

 

Drawing this Widget 3 times and viewing Dynamic -> List Dynamic Objects shows

                                *********************************

                                *       GRAPH PARAMETERS        *

                                *********************************

 

DESCRIPTION          :

UP LINK GRAPH FILE   :

DOWN LINK GRAPH FILE :

LOCAL TAG FILE       :

LOCAL SCRIPT FILE

        ON ENTRY     :

        WHILE SHOWING:

        ON EXIT      :

KEY MAPPING FILE     :

 

                                *********************************

                                *   DYNAMIC OBJECT ATTRIBUTES   *

                                *********************************

 

    TAG NAME                        TYPE      STYLE               EXTENT            

-------------------------------------------------------------------------------------

FAN_START101                     COLOR     DIGITAL      (  318,  677) (  419,  776)    

FAN_START101                     COLOR     DIGITAL      (  337,  692) (  404,  761)    

FAN_START102                     COLOR     DIGITAL      (  482,  677) (  582,  776)    

FAN_START102                     COLOR     DIGITAL      (  500,  692) (  568,  761)    

FAN_START103                     COLOR     DIGITAL      (  629,  677) (  729,  776)    

FAN_START103                     COLOR     DIGITAL      (  645,  692) (  715,  761)    

rotate                           ROTATE(-) ALARM        (  318,  677) (  419,  776)    

rotate                           ROTATE(-) ALARM        (  482,  677) (  582,  776)    

rotate                           ROTATE(-) ALARM        (  629,  677) (  729,  776)    

 

In VIEW, the graphic drawn using the $bafanbladesADV.dwt three times, shows the local tag "rotate" in three separate occurrences, each with a slightly different name (%0001%rotate, %0004%rotate and %0007%rotate).  Note the fans can be stopped and started independently. They rotate independently as well.  And, the user does not need to create or modify additional scripts or tag files!

Advanced widget - $bafanbladesADV.dwt assigned to tag FAN_START101, FAN_START102 and FAN_START103.  Local tag created three time also, %0001%rotate, %0004%rotate and %0007%rotate.