Zenon Manual Programming Interfaces
Total Page:16
File Type:pdf, Size:1020Kb
zenon manual Programming interfaces v.7.11 ©2014 Ing. Punzenberger COPA-DATA GmbH All rights reserved. Distribution and/or reproduction of this document or parts thereof in any form are permitted solely with the written permission of the company COPA-DATA. The technical data contained herein has been provided solely for informational purposes and is not legally binding. Subject to change, technical or otherwise. Contents 1. Welcome to COPA-DATA help ...................................................................................................... 6 2. Programming interfaces ............................................................................................................... 6 3. Process Control Engine (PCE) ........................................................................................................ 9 3.1 The PCE Editor ............................................................................................................................................. 9 3.1.1 The Taskmanager ....................................................................................................................... 10 3.1.2 The editing area .......................................................................................................................... 10 3.1.3 The output window .................................................................................................................... 11 3.1.4 The menus of the PCE Editor ...................................................................................................... 11 3.1.5 The icon bar of the PCE Editor .................................................................................................... 14 3.2 Course of actions....................................................................................................................................... 15 3.2.1 Creating a task ............................................................................................................................ 15 3.2.2 Entering code ............................................................................................................................. 17 3.2.3 Function Show PCE ..................................................................................................................... 20 3.2.4 Executing tasks ........................................................................................................................... 20 3.3 VB Script - Introduction ............................................................................................................................. 21 3.3.1 Data types ................................................................................................................................... 21 3.3.2 Variables ..................................................................................................................................... 23 3.3.3 Constants .................................................................................................................................... 25 3.3.4 Operators ................................................................................................................................... 26 3.3.5 Conditional Statements .............................................................................................................. 28 3.3.6 Looping Through Code ............................................................................................................... 30 3.3.7 Types of procedures ................................................................................................................... 35 3.3.8 Coding Conventions .................................................................................................................... 37 4. Macro list .................................................................................................................................. 43 4.1 VBA toolbar and context menu detail view .............................................................................................. 45 4.2 VBA on 64-bit systems .............................................................................................................................. 49 4.3 Basics ......................................................................................................................................................... 49 4.3.1 Object PROPERTIES ..................................................................................................................... 49 4.3.2 Object METHODS ........................................................................................................................ 50 4.3.3 Object EVENTS ............................................................................................................................ 50 3 4.3.4 VBA object structure in zenon .................................................................................................... 51 4.3.5 How to use VBA macros ............................................................................................................. 53 4.3.6 How to insert an ActiveX element in zenon? ............................................................................. 55 4.3.7 Access from an external program .............................................................................................. 56 4.3.8 Functionality of online variables ................................................................................................ 57 4.3.9 List of status bits ......................................................................................................................... 60 4.3.10 Lasso for selecting dynamic elements in the Runtime ............................................................... 62 4.4 Macros in the Editor .................................................................................................................................. 63 4.4.1 Tool bar macro list ...................................................................................................................... 64 4.4.2 Linking macros ............................................................................................................................ 66 4.5 Functions in zenon .................................................................................................................................... 67 4.5.1 Execute VBA Macro .................................................................................................................... 68 4.6 Developing wizard in VBA ......................................................................................................................... 69 4.6.1 Using a wizard ............................................................................................................................ 70 4.6.2 Structure of a wizard .................................................................................................................. 71 4.6.3 Integration in VBA ...................................................................................................................... 71 4.6.4 Developing a wizard ................................................................................................................... 72 4.6.5 Updating wizards ........................................................................................................................ 78 4.7 Frequently asked questions ...................................................................................................................... 78 4.7.1 Why does the button stay pressed? ........................................................................................... 78 4.7.2 Macro is not performed with the first click ................................................................................ 79 4.7.3 Macros no longer work in the Runtime? .................................................................................... 79 4.7.4 Windows CE and VBA ................................................................................................................. 79 4.8 Examples ................................................................................................................................................... 79 4.8.1 MouseEvents and ActiveX Control initialization......................................................................... 79 4.8.2 Display variable information ...................................................................................................... 81 4.8.3 Read and write variable values .................................................................................................. 81 4.8.4 Read and write variables and implement online variables ........................................................ 82 4.8.5 Use dialog multiple times ........................................................................................................... 84 4.8.6 Alarm – Events and ActiveX Control handling ............................................................................ 86 4.8.7 Access to alarms ......................................................................................................................... 89 4.8.8 Set switch (working with process variables) .............................................................................. 91 5. VSTA ......................................................................................................................................... 94 5.1 Basics ........................................................................................................................................................