Writing scripts

Creating dynamos

DeltaV Operate provides an easy and fast way to create dynamos. The Build Dynamo Expert is available on the DeltaV Tools toolbar. Refer to the Build Dynamo Expert topic for more information on using this expert.

This chapter provides an example for creating your own Dynamos and Dynamo sets. Once you become more comfortable building Dynamos, you can learn quite a bit about writing VBA scripts that work with DeltaV Operate by examining the scripts behind the Dynamos that are shipped with DeltaV Operate.

Note
  • Avoid using dynamos on custom faceplates that require tag groups. The dynamo edit script does not allow use of tag groups. Although it is possible to configure dynamos using tag groups by manually changing the datalink path, such use is not supported. 

  • In DeltaV Operate Dynamo sets, Dynamos are assigned their own properties with Get and Set functions and subroutines. This is the methodology we suggest for building complex Dynamos.

Creating a New Dynamo

Dynamos are simply groups of objects; they can be as complex or as simple as you need them to be. Remember that loading Dynamos with more than 200 objects may cause performance to suffer.

DeltaV Operate provides an easy and fast way to create dynamos. The Build Dynamo Expert is available on the DeltaV Tools toolbar. Refer to Build Dynamo Expert for more information on using this expert.

Building a Dynamo Object

  1. Open a new picture.

  2. Insert an Oval.

  3. In the Properties window, change the Name property of the Oval to dynOval.

  4. Animate the VerticalFillPercentage property to any tag in the process database.

Building the Dynamo Form

  1. Right-click the dynOval object and select Edit Script from the pop-up menu.

  2. In the VBE, select UserForm from the Insert menu.

  3. If the Properties window is not already displayed, select Property Window from the View menu.

  4. In the Properties window, change the Name property of the form to frmDyn1.

  5. Select Additional Controls from the Tools menu.

  6. Select the iFIX Expression Editor Control and click OK.

  7. Select the Expression Editor control from the toolbox and add it to the form.

  8. Add a Command button on the form.

  9. Right-click the Command button and select View Code from the pop-up menu.

  10. Enter the following script:

    frmDyn1.hide
    
  11. Select "General" from the Object Drop Down List (in the upper left of the Code Window).

  12. Enter the following script:

    'FormVersion: 1.0
    
  13. Select the script window for dynOval.

  14. Choose Edit from the Procedure drop-down list.

  15. Enter the following script:

    Private Sub Oval1_Edit()
        Dim FillObj As Object
        frmDyn1.Show
    
        'FindLocalObject (below) is a subroutine in 
        'FactoryGlobals Global Subroutines. In this case, it  
        'finds the animation object that you created off of the 
        'oval in step 4 of Building the Dynamo Object.
    
        Set FillObj = FindLocalObject(Oval1, _
        "AnimatedVerticalFillPercentage")
        FillObj.Source = frmDyn1.ExpressionEditor1.EditText
    End Sub
    
  16. Close the VBE.

Creating a New Dynamo Set

  1. In DeltaV Operate, select New Dynamo Set from the File menu.

  2. Drag the Dynamo that you created earlier in this section, dynOval, into the new Dynamo set.

  3. Select Save from the File menu and name your Dynamo set.

For more information on Dynamos, refer to the Using Dynamos to Customize Pictures.