1. Training Manual Revision E February 2006 Part Number 05-2039 W O N D E R W A R E ® T R A I N I N G InTouch® HMI 9.5 Fundamentals of Application Development Course 2. INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. © 2005 by Invensys Systems, Inc. All rights reserved. No part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording or otherwise), or for any purpose, without the express written permission of Invensys Systems, Inc. Except where noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or should be inferred. Invensys and the author(s) assume no responsibility for errors or omissions and no liability is assumed for damages resulting from the use of the information contained herein. Use of the Invensys software described in this document is subject to the terms of the applicable Wonderware Corporation or Invensys Systems, Inc., license. These terms include provisions that limit your rights such as use restrictions, disclaimers of warranties and limitations of Wonderware and Invensys liability. A copy of the applicable license will be displayed upon initial installation of the software. If a copy of the license is not displayed or you require an additional copy of the license, you may obtain one from Invensys' Wonderware business unit upon request by calling 1.949.727.3200 or by sending an e-mail to
[email protected]. Invensys; Wonderware; ActiveFactory; ArchestrA; DT Analyst; FactorySuite; FactorySuite A2; InBatch; InControl; IndustrialSQL Server; InTouch; InTrack; QI Analyst; SCADAlarm; SPCPro; SuiteLink; SuiteVoyager; WindowMaker; WindowViewer; Every system in your plant, working in concert; and the Visualize, Analyze, Optimize logo are trademarks or service marks of Invensys plc, its subsidiaries and affiliated companies. All other brands and product or service names may be the trademarks or service marks of their respective owners. 3. Table of Contents 1 InTouch® HMI 9.5 Fundamentals of Application Development Course Table of Contents Module 1 Introduction .................................................................................1-1 Section 1 – Course Introduction......................................................................... 1-3 Section 2 – Introduction to InTouch ................................................................. 1-11 Module 2 Development Environment.........................................................2-1 Section 1 – Introduction ..................................................................................... 2-3 Section 2 – Using WindowMaker..................................................................... 2-27 Lab 1 – Create New Application, Windows, and Graphics........................ 2-63 Module 3 Tagname Dictionary....................................................................3-1 Section 1 – Tags and Tag Features................................................................... 3-3 Lab 2 – Creating Tags............................................................................... 3-17 Module 4 Animation Links ..........................................................................4-1 Section 1 – Animation Links Overview............................................................... 4-3 Section 2 – Animating Objects........................................................................... 4-9 Section 3 – Animation Links – Quick Reference.............................................. 4-45 Lab 3 – Configuring Animation Links......................................................... 4-49 Section 4 – Using SmartSymbols .................................................................... 4-63 Lab 4 – Using SmartSymbols.................................................................... 4-81 Module 5 InTouch QuickScripts.................................................................5-1 Section 1 – QuickScript Types........................................................................... 5-3 Section 2 – Working with the Script Editor....................................................... 5-13 Section 3 – QuickScripts – Quick Reference................................................... 5-35 Lab 5 – Using InTouch QuickScripts ......................................................... 5-39 Module 6 Alarms..........................................................................................6-1 Section 1 – Alarms and Events.......................................................................... 6-3 Section 2 – The Distributed Alarm Object........................................................ 6-23 Lab 6 – Creating Alarms and Events......................................................... 6-39 Module 7 Real-time and Historical Trending.............................................7-1 Section 1 – Real-time Trends ............................................................................ 7-3 Lab 7 – Configuring Real-time Trends......................................................... 7-7 Section 2 – Historical Trends........................................................................... 7-11 Lab 8 – Configuring Historical Trends ....................................................... 7-27 Module 8 I/O Communication .....................................................................8-1 Section 1 – I/O Communication Protocols ......................................................... 8-3 Section 2 – Wonderware I/O Servers .............................................................. 8-13 Lab 9 – Configuring I/O Communication ................................................... 8-19 Section 3 – Troubleshooting I/O ...................................................................... 8-25 Module 9 Advanced Tag Functionality ......................................................9-1 Section 1 – Advanced I/O Functions.................................................................. 9-3 Section 2 – Indirect Tags ................................................................................... 9-7 Lab 10 – Creating and Using Indirect Tags................................................. 9-9 Section 3 – InTouch SuperTags ...................................................................... 9-15 Lab 11 – Defining SuperTags.................................................................... 9-27 Section 4 – DBDump and DBLoad .................................................................. 9-37 4. 2 InTouch® HMI 9.5 Fundamentals of Application Development Course Wonderware Training Section 5 – Optimizing the Tagname Dictionary ..............................................9-43 Lab 12 – Deleting Tags..............................................................................9-55 Module 10 Security ..................................................................................... 10-1 Section 1 – Security Models.............................................................................10-3 Lab 13 – Establishing Security.................................................................10-15 Section 2 – BulletProofing the Application .....................................................10-27 Module 11 Application Backup.................................................................. 11-1 Section 1 – Application Backup........................................................................11-3 Appendix A FactorySuite 2000 Licensing.....................................................A-1 Appendix B Wonderware Product Support...................................................B-1 Appendix C InTouch Glossary of Terms.......................................................C-1 Appendix D ActiveX Controls.........................................................................D-1 Appendix E InTouch-Related Tech Notes.....................................................E-1 Appendix F I/O Simulation .............................................................................F-1 Appendix G Script Functions ........................................................................ G-1 Appendix H Using InTouch on a Tablet PC...................................................H-1 Appendix I Keyboard Shortcuts for InTouch ............................................... I-1 5. Module 1 Introduction Section 1 – Course Introduction 1-3 Section 2 – Introduction to InTouch 1-11 6. 1-2 Module 1 – Introduction Wonderware Training Module Objectives Establish Course Agenda Launch InTouch® Create a new InTouch application Understand the Application Manager tools and features 7. Section 1 – Course Introduction 1-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Course Introduction This section will familiarize you with the objectives and agenda for the InTouch Fundamentals of Application Development Course. It also outlines Wonderware products and how InTouch meets the human-machine interface requirements for visualization. Course Description The InTouch® HMI 9.5 Fundamentals of Application Development Course is a 5-day, instructor-led class designed to teach the basic functionality of the Wonderware® visualization module. The purpose of this course is to give you the InTouch knowledge necessary to develop an HMI for their specific plant floor environment using basic InTouch elements. This HMI system will be developed using many of the InTouch software features/functionality such as WindowMaker, Tagnames, Animation, Cells and Symbols, SmartSymbols, Scripting, Alarms, RealTime and Historical Trending, Advance Tag Functionality, Security, Application Backup, and more. Course Objectives Upon completion of this course, you will be able to: Use WindowMaker to create windows and manipulate objects Create and import tags and use the Tagname Dictionary Define animation links and generate SmartSymbols Use the scripting editor to create QuickScripts Add alarm functionality to an application View user data in real-time and retrieve data from historical archives Establish communication with I/O aware programs and configure and troubleshoot I/O servers Implement InTouch security in an application Backup an application Develop a Human-Machine Interface (HMI) application for their specific plant floor environment using basic InTouch elements Audience Plant floor operators and managers, system administrators, system integrators and other individuals who need to use InTouch in their manufacturing processes. Prerequisites The prerequisites for this course are: At least 8 hours of hands-on experience with InTouch Knowledge of Microsoft Windows Manufacturing industry experience Section Objectives Outline the objectives of the full Course Agenda Highlight the hands-on labs for this course 8. 1-4 Module 1 – Introduction Wonderware Training Agenda Module 1 – Introduction Section 1 – Course Introduction This section will familiarize you with the objectives and agenda for the InTouch Fundamentals of Application Development Course. It also outlines Wonderware products and how InTouch meets the human-machine interface requirements for visualization. Section 2 – Introduction to InTouch This section details how to launch InTouch and how to use the three major components: Application Manager, WindowMaker, and WindowViewer. Module 2 – Development Environment Section 1 – Introduction This section will identify features of WindowMaker and the Application Explorer development environment, including defining toolbars and buttons in the WindowMaker interface. Section 2 – Using WindowMaker This section covers the creation and manipulation of graphic objects, lines and outlines, text objects, images and bitmaps. Lab 1 – Create New Application, Windows, and Graphics Module 3 – Tagname Dictionary Section 1 – Tags and Tag Features This section will define tags, tag types, tag creation, and tag modification. It will also demonstrate Tagname Browser filters and printing the Tagname Dictionary. Lab 2 – Creating Tags Module 4 – Animation Links Section 1 – Animation Links Overview This section will identify and define the basic animation link features such as the animation link types, as well as how to access the tag browser and tagname dot fields. Section 2 – Animating Objects This section describes InTouch animation link options. It also demonstrates importing windows and sharing animations across windows. The following information describes InTouch animation options. Your instructor will demonstrate the various animation link options. At the conclusion of this section, you will import a pre-configured InTouch window during an instructor-led task. The window is used to configure and share animation links across windows in subsequent labs. Section 3 – Animation Links – Quick Reference This quick reference guide summarizes the basic functionality of every animation link. Lab 3 – Configuring Animation Links 9. Section 1 – Course Introduction 1-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 4 – Using SmartSymbols SmartSymbols integrate object-oriented technology with InTouch graphics to transform them into reusable templates. Changes made to the templates automatically propagate throughout an application, even across multiple networked PC nodes. As a result, engineers spend less time creating, modifying, validating and re-validating HMI applications. Lab 4 – Using SmartSymbols Module 5 – InTouch QuickScripts Section 1 – QuickScript Types This section will explain and define the various InTouch QuickScript types. Section 2 – Working with the Script Editor This section describes common features and functions of the QuickScript Editor. The features and functions that are unique to a particular script type are described later in this section. Section 3 – QuickScripts – Quick Reference In this guide, the basic functionality of each type of QuickScript that can be created is summarized. Lab 5 – Using InTouch QuickScripts Module 6 – Alarms Section 1 – Alarms and Events This section explains and defines the different types alarms and events and how to add alarm functionality to applications. Section 2 – The Distributed Alarm Object The Distributed Alarm object displays both locally and remotely generated alarms. This display objects features include: built in scroll bars, resizeable display columns, multiple selection of alarms, update status bar, query status bar, context sensitive right-click menu, and alarm display colors based on alarm priority. Lab 6 – Creating Alarms and Events Module 7 – Real-time and Historical Trending Section 1 – Real-time Trends InTouch provides two types of trend display objects: Real-time and Historical. Both trend objects can be configured to display graphical representations of multiple tags over time. Lab 7 – Configuring Real-time Trends Section 2 – Historical Trends This section will introduce and explain InTouch historical trends, and explains the historical trend configuration options. Lab 8 – Configuring Historical Trends Module 8 – I/O Communication Section 1 – I/O Communication Protocols This section explains I/O communication protocols and demonstrates how to configure an InTouch access name. 10. 1-6 Module 1 – Introduction Wonderware Training Section 2 – Wonderware I/O Servers This section will describe the configuration of a Wonderware I/O Server (Modbus). Lab 9 – Configuring I/O Communication Section 3 – Troubleshooting I/O This section explains how to troubleshoot I/O communication between the I/O Server and InTouch, and between the I/O Server and the PLC. Module 9 – Advanced Tag Functionality Section 1 – Advanced I/O Functions This section explains InTouch advanced I/O functionality including the IOSetAccessName and IOSetItem functions, and Dynamic Reference Addressing. Section 2 – Indirect Tags This section explains the concept and practice of indirect tags, including discussion of the advantages and disadvantages. Lab 10 – Creating and Using Indirect Tags Section 3 – InTouch SuperTags This section will define SuperTags using the SuperTag template structure. Lab 11 – Defining SuperTags Section 4 – DBDump and DBLoad This section will explain the use of the DBDump and DBLoad Utilities. Section 5 – Optimizing the Tagname Dictionary There are several ways to edit existing links and tags. This section includes substituting, converting, and deleting tagnames as well as utilizing the InTouch Cross Reference Utility. Lab 12 – Deleting Tags Module 10 – Security Section 1 – Security Models This module provides an overview of three security models available to the InTouch developer. The focus is on the InTouch-based Security model. Lab 13 – Establishing Security Section 2 – BulletProofing the Application This section covers customization of the Runtime and development environments to bulletproof the application. It also explains how to automatically start an application. Module 11 – Application Backup Section 1 – Application Backup This section will explain how to save an application and optimize it for distribution/deployment. 11. Section 1 – Course Introduction 1-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Wonderware Products The next generation of Wonderware® products are the first to take advantage of the power and performance of Invensys' new ArchestrA® plant automation and information software architecture. The following Wonderware products offer increased functionality and flexibility and extensive connectivity: Industrial Application Server platform for system-wide, real-time data acquisition, alarm and event management, centralized security, data manipulation, remote deployment, and collaborative engineering InTouch® human-machine interface (HMI) software for process visualization and control IndustrialSQL Server™ plant data historian Functional Modules for seamlessly integrating new functional capabilities into Industrial Application Server applications using a modular approach, including the Production Events Module (PEM) for product and production history and genealogy InTrack™ resource and WIP tracking software InBatch™ flexible batch management software InControl™ real-time control software DT Analyst™ equipment downtime tracking and performance management software SuiteVoyager® industrial portal software for Internet/intranet visualization and content management InTouch for Terminal Services software for remote hosting of InTouch applications 12. 1-8 Module 1 – Introduction Wonderware Training Device Integration products offering a library of hundreds of I/O servers and DAServers QI Analyst™ for using real-time and historical data to monitor, analyze, and predict potentially harmful process variations, allowing for online adjustments for improved production quality and consistency ActiveFactory™ for accelerating and improving decision-making at all levels within the plant through a suite of advanced data analysis clients that leverage data stored in IndustrialSQL Server SCADAlarm™ event notification software for real-time alarm notification, data acquisition, and remote control from telecommunication devices to industrial automation software systems This industry-leading toolset features the robust, best-of-breed software modules that help users effectively develop and manage automation applications for continuous, discrete, process, hybrid and batch manufacturing environments. System Requirements To run InTouch, we recommend the following hardware and software. Any PC with a Pentium III with a minimum 700 MHz or higher processor for a single node system; recommended 1.2 GHz or higher 2GB of free hard disk space Minimum 256MB of random-access memory (RAM); recommended 512 MB RAM SVGA display adapter with 2MB RAM recommended Pointing device, such as mouse, trackball, or touch screen Network adapter must be installed Microsoft® Windows 2000 Professional with Service Pack 3 or higher OR Windows XP™ with Service Pack 1 or higher or Windows 2003 Server with Service Pack 1 or higher InTouch Installation Notes The Wonderware FactorySuite installation program is used to install InTouch. InTouch runs on Windows 2000, Windows XP, or Windows 2003 Server operating systems. The installation program creates directories as needed, copying files from the CD to your hard drive. Note: Older versions of InTouch applications need to be converted to InTouch 9.5. After the conversion process, these applications will no longer run with InTouch versions previous to 9.5. Detailed installation instructions are included in the InTouch Installation Guide. It is recommended that you read the InTouch Installation Guide prior to beginning the installation process. Note: Your online FactorySuite System Administrator's Guide provides detailed installation instructions for most products included your FactorySuite software package. InTouch uses Microsoft SQL Server™ Standard Edition for its alarm database. If Microsoft SQL Server 2000 is installed on the same system on which InTouch is being installed, the InTouch setup program may require you to reboot the system during the installation procedure. The reboot is required because Microsoft SQL Server 2000 installs MDAC™ version 2.6, but InTouch requires MDAC version 2.6 Service Pack level 2 (SP2). The InTouch setup program will install this Service Pack during installation. Once the system has been rebooted, InTouch installation will resume automatically. 13. Section 1 – Course Introduction 1-9 InTouch® HMI 9.5 Fundamentals of Application Development Course Due to this reboot, the off node communication account User Name and Password that were entered before this reboot must be re-entered after InTouch installation is resumed. This applies only if you are installing InTouch on Microsoft Windows 2000 operating system(s). If Microsoft SQL Server 2000 SP2, which installs MDAC version 2.6 SP2, is installed on your system prior to InTouch installation or if Microsoft SQL Server 2000 is not installed on your system, the InTouch setup program will not require a reboot during installation. If InTouch 7.11 is installed on your system and you have Alarm DB Logger set to run as a service, you must change the mode to manual before you uninstall InTouch and reboot your system. If you uninstall InTouch 7.11 with Alarm DB Logger in automatic mode, InTouch 9.5 installation will not complete properly. FactorySuite Licensing Your FactorySuite system license information can be viewed through the license viewing utility. This utility is launched from WindowMaker by selecting Help / About from the main menu. Technical Support Wonderware Technical Support offers a variety of support options to answer any questions on Wonderware products and their implementation. Prior to contacting technical support, please refer to the relevant chapter(s) in this training manual or your InTouch User's Guide for a possible solution. If you find it necessary to contact technical support for assistance, please have the following information available. The version of InTouch you are running The type and version of the operating system you are using. For example, Windows 2000, Windows XP, or Windows 2003 Server The exact wording of system error messages encountered Any relevant output listing from the Wonderware Logger, the Microsoft Event Viewer or any other diagnostic applications Details of the attempts you made to solve the problem(s) and your results Details of how to recreate the problem If this is an ongoing issue, the Wonderware Technical Support case number it has been assigned For more information on Technical Support, see your online FactorySuite System Administrator's Guide. Appendix E of this manual contains Technotes that pertain to the InTouch product. For the latest Technotes, refer to the www.wonderware.com/support web page. Conventions This course includes Instructor-Led content in addition to regular, applied labs. Instructor-Led steps are intended to be explanatory in nature and should prepare you for an upcoming lab. The steps should not duplicate or conflict with applied lab content. Instructor-Led steps appear as lettered steps (a, b, c). Screenshots within this manual are from a machine running the Microsoft Windows 2003 Server Operating System with XP themes turned on and with 1024 x 768 resolution. 14. 1-10 Module 1 – Introduction Wonderware Training 15. Section 2 – Introduction to InTouch 1-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Introduction to InTouch This section details how to launch InTouch and how to use the three major components: Application Manager, WindowMaker, and WindowViewer. Introduction Wonderware® InTouch® is the quickest and easiest way to create HMI applications for the Microsoft® Windows 2000, Windows XP, and Windows 2003 operating systems. InTouch applications span the globe in a multitude of vertical markets including food processing, semiconductors, oil and gas, automotive, chemical, pharmaceutical, pulp and paper, transportation, utilities, and more. By using InTouch, you can create powerful, full-featured applications that leverage key features of Microsoft Windows, including ActiveX® controls, OLE, graphics, networking and more. InTouch can also be extended by adding custom ActiveX controls, wizards, generic objects, and creating InTouch QuickScript extensions. InTouch Components InTouch consists of three major components: Application Manager, WindowMaker and WindowViewer. Note: The following figures are the toolbar icons used to open the InTouch components. Application Manager: Organizes the applications you create. The application pane contains a list of links (icons) to applications residing on that node. Information about the applications is displayed in the Name, Path, Resolution, Version, Application Version, Date Modified, and Description columns. The Application Manager is used to configure WindowViewer as an NT service, to configure Network Application Development (NAD) for client-based and server-based architectures, and to configure Dynamic Resolution Conversion (DRC). The DBDump and DBLoad database utilities are launched from the Application Manager. WindowMaker: The InTouch development environment, where object-oriented graphics are used to create animated, touch-sensitive display windows. These display windows can be connected to industrial I/O systems and other Microsoft Windows applications. The last used application is automatically opened when either WindowMaker is launched independently from outside the Application Manager (for example, from the Windows Start menu). Section Objectives Launch InTouch® Create a new InTouch application Understand the Application Manager tools and features 16. 1-12 Module 1 – Introduction Wonderware Training WindowViewer: The Runtime environment used to display the graphic windows created in WindowMaker. WindowViewer executes InTouch QuickScripts, performs historical data logging and reporting, processes alarm logging and reporting, and can function as a client and a server for both DDE and SuiteLink communication protocols. The last used application is automatically opened when either WindowViewer is launched independently from outside the Application Manager (for example, from the Windows Start menu). Application Manager Tools When InTouch is initially run, the Application Manager's toolbar and status bar are displayed by default. The following information describes each of the Application Manager's toolbar buttons. Button Description Executes the New command on the File menu to create a new application. Executes the WindowMaker command on the File menu to open the selected application in WindowMaker. Executes the WindowViewer command on the File menu to open the selected application in WindowViewer. Executes the DBLoad command on the File menu to run the DBLoad utility. This utility is used to load a Tagname Dictionary input file. Executes the DBDump command on the File menu to run the DBDump utility program. This utility is used to extract an application's Tagname Dictionary. Executes the Large Icons command on the View menu to display large icons for the listed applications. Executes the Small Icons command on the View menu to display small icons for the listed applications. Executes the List command on the View menu to change the dialog box to the list view mode. Executes the Details command on the View menu to change the dialog box to the details view mode. Opens the Node Properties dialog box where the computer's properties are set when using Network Application Development (NAD), Dynamic Resolution Conversion (DRC). 17. Section 2 – Introduction to InTouch 1-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Running InTouch for the First Time The first time you run INTOUCH.EXE, the INTOUCH.INI file is automatically created. This file is located in the same folder as the application, and contains the default configuration settings for that application. As you configure your application, your settings are written to the INTOUCH.INI file. a. Select Start / Programs / Wonderware / InTouch. The Welcome to InTouch Application Manager dialog box appears: b. Click Next. 18. 1-14 Module 1 – Introduction Wonderware Training c. To specify a different directory, enter the path to the directory in the input box, or click Browse to locate the directory. d. Click Finish. The Application Manager searches your computer for any existing InTouch applications. Application links are displayed by an icon containing the application's name. Other information is displayed in columns. For example: 19. Section 2 – Introduction to InTouch 1-15 InTouch® HMI 9.5 Fundamentals of Application Development Course Creating a New Application To create a new application a. Click the New tool on the Application Manager toolbar. The Create New Application dialog box appears: By default, the system displays the following path: C:Documents and SettingsUsernameMy DocumentsMy InTouch Applications . Enter the path to the base directory in which you want your application to be created or click Browse to locate the directory. b. For this class, enter c:applications in the directory field. c. Click the Set As Default Directory checkbox. All applications will be created in the specified directory. d. Click Next. 20. 1-16 Module 1 – Introduction Wonderware Training The Create New Application window displays, allowing you to define the directory in which your application will be created: e. Change the directory as shown in the next figure: f. Click Next to proceed. 21. Section 2 – Introduction to InTouch 1-17 InTouch® HMI 9.5 Fundamentals of Application Development Course g. Enter a unique name for the new application. This name will appear when the application is listed in the InTouch Application Manager window. h. In the Description box, enter a description of the application. Note: Confirm the InTouchView Application option is deselected. It is only applicable in the ArchestrA environment, with Industrial Application Server. i. Click Finish. The InTouch - Application Manager reappears displaying an icon, the path, and the Version, Mode, and Description of the new application: Note: When the application is first displayed in the Application Manager, the resolution and version are displayed as 0. After opening, the resolution and version details are updated. 22. 1-18 Module 1 – Introduction Wonderware Training Using the InTouch Application Manager Use the InTouch Application Manager to create new or open existing applications, rename or delete applications, and run the InTouch DBDump and DBLoad utilities. To open an application a. Select the application and click the WindowMaker toolbar icon, or; b. Double-click the application’s icon, or; c. Select the application and then press Enter, or; d. Right-click the application and choose WindowMaker as shown here. (WindowViewer cannot be executed for a new application.) When WindowMaker or WindowViewer is opened, the Application Manager closes. To rename an application a. Right-click the application in the list, then select Rename from the submenu. b. Enter the new name and press the Enter key. 23. Section 2 – Introduction to InTouch 1-19 InTouch® HMI 9.5 Fundamentals of Application Development Course To delete an application link The Application Manager displays links to applications in various locations on your system. If you delete an application link from the list, the actual InTouch files and directory are not deleted. Deleting the InTouch application requires a manual delete operation from Windows Explorer. a. Right-click the application in the list and then select Delete. b. A message box appears asking you to confirm the deletion. Click Yes or No. c. To display the link after it has been deleted from the Application Manager list, click Tools / Find Applications in the Application Manager main menu. 24. 1-20 Module 1 – Introduction Wonderware Training The Browse for Folder dialog box appears: d. Locate the directory to search and click OK. The InTouch Application Manager will reopen and display icons for all applications that were found within the selected directory. View an Application’s Properties a. Highlight an application in the list. b. Right-click the application and choose Properties. 25. Section 2 – Introduction to InTouch 1-21 InTouch® HMI 9.5 Fundamentals of Application Development Course The Properties dialog box appears: c. Click OK or Cancel to exit the Properties dialog box. 26. 1-22 Module 1 – Introduction Wonderware Training – Intentionally left blank – 27. Module 2 Development Environment Section 1 – Introduction 2-3 Section 2 – Using WindowMaker 2-27 Lab 1 – Create New Application, Windows, and Graphics 2-63 28. 2-2 Module 2 – Development Environment Wonderware Training Module Objectives Describe the features in the Development Environment Use WindowMaker to create windows and manipulate objects 29. Section 1 – Introduction 2-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Introduction This section will identify features of WindowMaker and the Application Explorer development environment, including defining toolbars and buttons in the WindowMaker interface. The WindowMaker Interface a. Select the new application created during the instructor-led discussion in “Creating a New Application” on page 1-15. b. Launch WindowMaker. Section Objectives Identify the features of WindowMaker and the Application Explorer Identify WindowMaker Interface elements Use WindowMaker 30. 2-4 Module 2 – Development Environment Wonderware Training A blank application appears in the development environment: The WindowMaker user interface (UI) adheres to Windows 2000 and Windows XP standards. WindowMaker supports features including (but not limited to) such features as right-click mouse support, floating and docking toolbars, pull down menus, and context-sensitive help. Right-click menus provide quick access to frequently used commands and a customizable color palette that provides 16.7 million color support (limited only by your video display). The WindowMaker development environment is configurable. When you initially open WindowMaker, most of the available elements are automatically displayed including all toolbars, the Application Explorer, and the status bar. You can show or hide any or all of these elements. You can move the toolbars and the Application Explorer to any location within the WindowMaker window. You can also display the optional ruler and turn the visible grid on and off. 31. Section 1 – Introduction 2-5 InTouch® HMI 9.5 Fundamentals of Application Development Course The following figure shows the elements of the WindowMaker development environment using the ReactorDemo application, and the Conveyor Window. When you create a new application and run WindowMaker for the first time, its program elements will automatically appear in the default configuration as shown: The Application Explorer WindowMaker's Application Explorer is a hierarchical graphical view of application elements. It displays the windows and items you have configured in your application and provides easy access to them. It also provides quick access to many of WindowMaker's most commonly used commands and functions. Additionally, the Application Explorer displays all installed add-on programs such as SQL Access Manager, SPCPro, and Recipe Manager. It also provides you with a customizable application launcher. Windows and other InTouch elements can be created and configured from the Application Explorer. 32. 2-6 Module 2 – Development Environment Wonderware Training Note: You can configure the Application Explorer to launch any other ArchestrA® program or Windows program. This powerful feature allows you to quickly switch between your HMI configuration, I/O Server configuration, and other control configurations. Warning: Do not add WindowViewer (view.exe) to the Application Explorer. If you add WindowViewer, new windows you create in WindowMaker may not be synchronized with the windows in WindowViewer. The proper way to launch WindowViewer is by executing the WindowViewer command on the File menu, or by clicking the Runtime fast switch in the WindowMaker menu bar. Using Application Explorer The Application Explorer window is configurable from within WindowMaker. a. To hide or show Application Explorer, click the Application Explorer tool on the View toolbar or the View / Application Explorer command. The Application Explorer toolbars within WindowMaker can be "docked" to any edge of the WindowMaker window or, "floated" anywhere within the WindowMaker window. When the Application Explorer is docked to an edge of the WindowMaker window, it automatically sizes itself accordingly and, if required, scroll bars are displayed. b. Move the Application Explorer pane by selecting its border and dragging it to a location within the main WindowMaker window. When the Application Explorer is floated within the WindowMaker window, its title bar is displayed and its size can be changed. Undocked and floating 33. Section 1 – Introduction 2-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Navigating in the Application Explorer You can expand or collapse the groups listed in the Application Explorer hierarchical graphical view. For example, if you double-click on a group, the icon expands and displays the group's members. When you double-click on a member, it will open that member. All groups that contain members are preceded with a plus sign . Click to expand the group and view its members, or click the to collapse the group and hide its members. Adding Applications to the Application Explorer One of the most powerful features of WindowMaker’s Application Explorer is its ability to launch other ArchestrA and third-party Windows applications from within WindowMaker. For example, you can run/configure an I/O Server program and develop your application simultaneously. You can launch third-party Windows programs that you frequently use such as Windows Notepad, Wordpad, Microsoft Excel, Microsoft Word, Microsoft Paint, among others. You can also configure the Application Explorer to open a specific document or spreadsheet in a program. Tip: The InTouch add-on programs, SQL Access, SPC Pro, and Recipe Manager are automatically added to the Application Explorer once they are installed. To add an application to the Application Explorer a. Right-click Applications and select New. The Application Properties dialog box appears: b. In the Name field, enter the name to be displayed in the Application Explorer. For this example, enter Notepad. 34. 2-8 Module 2 – Development Environment Wonderware Training c. Click the ellipsis button and select an application. The path to the Notepad application is C:WINDOWSsystem32notepad.exe in this example. d. Click Open. The Application Properties dialog box reappears: e. Click the Start Style drop-down list to select how the application will appear when it is started in WindowMaker. For this example, ensure Normal window is selected. f. Click OK. 35. Section 1 – Introduction 2-9 InTouch® HMI 9.5 Fundamentals of Application Development Course The application is added to the Application Explorer under the Applications icon. You can now run the application at any time from WindowMaker. g. Right-click the application and select Properties from the submenu to make changes to the application properties. 36. 2-10 Module 2 – Development Environment Wonderware Training Creating a New Window Your InTouch application is comprised of windows that can contain graphics, text objects, animations, and action scripts. When you first create the window, you define properties of the window itself such as background color, title, and screen position. The General Toolbar contains buttons for most of the commands in the File menu. a. Right-click Windows and choose New... The Window Properties dialog box appears: b. Enter Scratch in the Name field. The name can be up to 32 characters long. It can include embedded spaces, punctuation marks, and any other character on the keyboard except quotation marks ("). Note: By default, the settings in this dialog box will reflect those of any previously created windows. If you select this command while a window is open in WindowMaker, the settings will reflect those of the active window. If a Window script(s) is attached to the active window, a message box will appear asking if you want the window script(s) copied to the new window. c. Right-click any of the text entry fields in the dialog box. A submenu appears displaying the commands that can be applied to the selected text. The commands that are enabled depend on whether there is an entry in the selected text field. d. In the Comment box, enter any miscellaneous comments that you want associated with the window (optional). This information is for documentation purposes only and is not used by the application. 37. Section 1 – Introduction 2-11 InTouch® HMI 9.5 Fundamentals of Application Development Course e. Click the Window Color box to select the background color for the window. The color palette appears: The WindowMaker color palette is used to apply color to static and dynamic properties of lines, rectangles, round rectangles, ellipses, polylines, polygons, and text. It is also used to select a window background color and the transparent color for bitmaps, allowing objects to be viewed behind bitmaps.The color palette appears when a colored square in a dialog box is clicked or when one of the color tools is used to apply line, fill, or text color to a selected object. Creating a Custom Color The WindowMaker color palette allows you to define custom colors and add them to your palette. Palettes created in other windows applications can be imported and added to the standard palette. You can also export custom palettes to other windows applications. a. With the color palette open, right-click one of the blank squares in the Custom Palette. b. Click Edit Custom Color. Click to expand for Classic Colors Palette 38. 2-12 Module 2 – Development Environment Wonderware Training The Add a Color dialog box appears: c. You can select a color using the crosshairs in the main color box or with the arrow at the right. The selected color shows in the Color|Solid box. Click on OK to add that color to the Custom Palette section. d. Or, click the blotter tool and click the color to add to the Custom Palette section of the color palette. You can select any color anywhere within the WindowMaker window or outside of WindowMaker. 39. Section 1 – Introduction 2-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Additional Window Properties Window Type: Three options are available. Replace: Automatically closes any window(s) it intersects when it appears on the screen, including popup and replace type windows. Overlay: appears on top of currently displayed window(s) and can be larger than the window(s) it is overlaying. Clicking on any visible portion of a window behind an overlay window will make that window active. Popup: Similar to an overlay window, yet always stays on top of all other open windows (even if another window is clicked). Popup windows usually require a response from the user in order to be removed. e. The default setting (Replace) is used for the Scratch window. Frame Style: Three styles are available. Single: Displays a single line around the window. Title Bar is available; Size Controls are available. Double: Displays a 3-D effect border around the window. Title Bar not available; Size Controls are available. None: A window with no border. Title Bar not available; Size Controls are available. f. The default setting (Single) is used for the Scratch window. Title Bar: The title bar can be used to move the window by clicking and dragging. g. The default setting (checked) is used for the Scratch window. Size Controls: Enable the user to resize the window in WindowMaker. h. The default setting (checked) is used for the Scratch window. 40. 2-14 Module 2 – Development Environment Wonderware Training Dimensions: Enter the pixel location for each of the window's coordinates. X Location: The number of pixels between the left edge of the WindowMaker design area and the left edge of the window being defined. Y Location: The number of pixels between the top edge of the WindowMaker design area and the top edge of the window being defined. Window Width: The window's width in pixels. Note: Windows limits the minimum width of a window according to your display monitor. For example, for the standard VGA, the minimum is 102 pixels. Window Height: The window's height in pixels. (The minimum height of a window varies according to your display monitor.) Note: By default, the values in these fields will be set to the dimensions of the previously created window. They are also automatically modified when the window’s size is manually changed in WindowMaker. i. The default Dimensions settings are used for the Scratch window. Scripts... button: Opens the Window Script editor. Three types of scripts can be applied: On Show: Executes one time when the window is initially opened. While Showing: Executes continuously at the specified frequency while the window is open/active. On Hide: Executes one time when the window is closed. Note: If a Window Script is attached to the active window and a new window is created, the script(s) from the active window can be copied to the new window. j. Click OK. The new window is displayed within WindowMaker, and the toolbar icons are now active: 41. Section 1 – Introduction 2-15 InTouch® HMI 9.5 Fundamentals of Application Development Course WindowMaker Toolbars The icons on the WindowMaker toolbars are grouped by common functionality. For example, the Arrange toolbar contains tools that you can use to quickly apply most of the commands found on the Arrange menu. The toolbars within WindowMaker can be "docked" to any edge of the WindowMaker window, or "floated" anywhere within the WindowMaker window. When the toolbars are floating, the name of the toolbar displays in the title bar. When you hover your cursor over an icon, a Tool Tips box appears displaying the tool name: General Toolbar The General toolbar consists of icons that execute most of the window commands found on the File menu. The icons also include the Microsoft Windows clipboard tools found within the Edit menu. Button Description Executes the New Window command on the File menu and opens the Windows Properties dialog box to create a new window. Executes the Open Window command on the File menu to open the Windows to Open dialog box listing the names of existing windows that you can select to open. Executes the Close Window command on the File menu to open the Windows to Close dialog box listing the names of all currently open windows that you can select to close. Executes the Save Window command on the File menu to open the Windows to Save dialog box listing the names of all currently open windows that have been modified since they were last saved. Automatically saves all currently open windows that have been modified since they were last saved. This tool does not ask for confirmation on a per window basis. It saves all modified windows automatically. Executes the Duplicate command on the Edit menu to duplicate the currently selected object(s) in the window. Executes the Cut command on the Edit menu to cut the currently selected objects(s) from the window and copies them to the Windows Clipboard. Executes the Copy command on the Edit menu to copy the currently selected objects(s) and copies them to the Windows Clipboard. (Copied objects are not erased from the window.) Executes the Paste command on the Edit menu to paste any object that has been cut or copied to the Windows Clipboard. (The cursor changes to the paste mode. Click in the window to paste the copied or cut object.) Executes the Undo command on the Edit menu to reverse (undo) the last action or command applied to an object. Executes the Redo command on the Edit menu to reverse (redo) the last undo action or command applied to an object. Executes the Print command on the File menu to open the WindowMaker Printout dialog box used to print database and window information and QuickScripts. 42. 2-16 Module 2 – Development Environment Wonderware Training Wizards Toolbar The Wizards toolbar contains the tool used to access the wizard Selection dialog box and the SmartSymbol Wizard. You can add any installed wizard or ActiveX control to the toolbar. Format Toolbar The Format toolbar is grouped with tools that execute most of the text object formatting commands found on the Text menu. It also contains the tools used to access the color palette to select line, fill, text, window background and transparent object color. Button Description Displays the Wizard Selection dialog box used for selecting wizards to paste into your application. Displays the SmartSymbol Wizard used for selecting SmartSymbols to place into your application. Button Description Executes the Font command on the Text menu to open the Font dialog box used to select the font, its style and size. Executes the Bold command on the Text menu to apply bold styling to single or multiple text string selections and numeric value fields. Executes the Italic command on the Text menu to apply italic styling to single or multiple text string selections and numeric value fields. Executes the Underline command on the Text menu to apply underline styling to single or multiple text string selections and numeric value fields. Executes the Reduce Font command on the Text menu to reduce the point size of a sizeable font. Apply this command by selecting the text string(s) and clicking on the tool. Executes the Enlarge Font command on the Text menu to enlarge point size of a sizeable font. This command can be applied by selecting the text string(s) and clicking on the tool. Executes the Left Justified command on the Text menu to align the left edge of single or multiple text string selections and numeric value fields. Executes the Centered command on the Text menu to center single or multiple text string selections and numeric value fields. Executes the Right Justified command on the Text menu to align the right edge of single or multiple text string selections and numeric value fields. Opens the color palette used to select the color for a line object or an object's outline. Opens the color palette used to select an object's fill color. Opens the color palette used to select the color for a text object. Opens the color palette to select a window's background color. Opens the color palette to select a transparent color for a bitmap object. 43. Section 1 – Introduction 2-17 InTouch® HMI 9.5 Fundamentals of Application Development Course Drawing Toolbar The Drawing toolbar is grouped with all the tools used to draw both simple graphic objects (rectangles, ellipses, lines, or text objects) and complex objects (real-time trends, historical trends, bitmaps, and 3-dimensional buttons with labels). Button Description Selector mode used to select objects in the window. Rectangle tool used to draw rectangles or squares. Rounded rectangle tool used to draw rectangles or squares with rounded corners. Ellipse tool used to draw ellipses or circles. Line tool used to draw lines at any angle. Line tool used to draw horizontal or vertical lines. Line tool used to draw polylines. Shape tool used to draw polygons. Text tool used to enter text objects. Bitmap tool used to draw a bitmap container for pasting a bitmap directly from the Windows Clipboard or one of the following file types: .BMP, .JPG, .PCX or .TGA. Real time trend tool used to draw real time trend objects. Historical trend tool used to draw historical trend objects. Button tool used to draw a 3-dimensional button with a label. 44. 2-18 Module 2 – Development Environment Wonderware Training View Toolbar The View toolbar is grouped with tools that execute most of the window commands found in the View menu. These commands are used to control the state of the WindowMaker window. Snap to Grid When you are arranging objects in your windows, turning on the grid will cause your graphic to snap at the upper left pixel interval on the grid. If you select multiple objects, the snapping will be applied to the upper left corner of the first object selected in the group. With Snap to Grid on, you may select an object and hold down the SHIFT or CTRL key, press an arrow key (up, down, right, or left) in order to move an object in 20-pixel increments (SHIFT) or 40- pixel increments (CTRL). Use the arrow keys alone to move an object 10 pixels at a time. If Snap to Grid is off, you may select an object and hold down the SHIFT or CTRL key, press an arrow key (up, down, right, or left) in order to move an object in 10-pixel increments (SHIFT) or 50- pixel increments (CTRL). Use the arrow keys alone to move an object 1 pixel at a time. These features can be useful when making fine alignment and location adjustments. Button Description Show/hide the Application Explorer. Toggles the Hide All command on the View menu on and off to hide/show all docked toolbars. When the hide all mode is active, the overall size of WindowMaker remains the same. To return to normal mode, click the Hide/Restore All tool on the floating View Toolbar or click on the View / Hide All command. In the hide all mode, all floating toolbars remain visible and the View Toolbar automatically floats on top of WindowMaker. If any of the floating toolbars are docked in the hide all mode, the mode is automatically terminated. Toggles Full Screen command on the View menu on and off to switch the display mode from normal view to full screen. To return to normal mode, click the Full Screen tool on the floating View Toolbar or click on the View / Full Screen command. In the full screen mode, all WindowMaker program elements are hidden except any open windows. The Restore Toolbar automatically floats on top of WindowMaker. In the full screen mode, the coordinates of the client area will remain the same. For example, the top left is 0,0. The full screen mode automatically sets the coordinates after it maximizes the client area, hides the Title Bar and menu bar and adjusts the client area to mimic View's full screen mode. Toggles the Snap to Grid command on the Arrange menu on and off to show/hide the visible grid used to align objects. It works with the Arrange / Snap to Grid command. Turns the Ruler command on the View menu on and off to show/hide the ruler. 45. Section 1 – Introduction 2-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Tip: By default, the grid is set to 10 pixels and visible when you initially start WindowMaker. You can configure the pixel interval for the grid through the WindowMaker Properties dialog box. Click the Snap to Grid tool on the View toolbar to turn snap to grid on and off. Configuring the Grid a. Select Special / Configure / WindowMaker. The WindowMaker Properties dialog box appears: b. Enter the number of pixel spaces in the Spacing box. c. Select the Show Grid option if you want a visible grid in your windows when you enable WindowMaker's snap to grid function. d. Select OK to save the changes, or Cancel to exit the WindowMaker Properties dialog box. 46. 2-20 Module 2 – Development Environment Wonderware Training Ruler The WindowMaker ruler can be used to do precision alignment of the objects in your windows, and when determining the movement of an object during an animation sequence. The small tick marks are spaced 5 pixels apart. The medium tick marks are spaced 10 pixels apart. The numbered large tick marks are spaced 50 pixels apart. Pan and Zoom Toolbar The Pan and Zoom toolbar allows you to quickly move around a window and enlarge or reduce the magnification level. If your mouse has a scroll wheel, you can hold down the Ctrl key and scroll forward to zoom in and scroll backward to zoom out Button Description Zoom out from the area where you click. Zoom in on the area where you click. Zoom Normal returns to the default magnification level (100%). Rubber Band Zoom uses the mouse to select a specific area to zoom in on. Show / Hide thumbnail of your window on which you can drag a red box around to pan or resize the red box to zoom in and out. Pan moves the position of the viewing area. . . . . . . .Use the Zoom Entry Box to select or enter a magnification level. 47. Section 1 – Introduction 2-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Arrange Toolbar The Arrange toolbar is grouped with tools that execute most of the object arranging commands found on the Arrange menu. Arrange toolbar elements icons are activated if one or more objects are selected. Button Description Executes the Align Left command on the Arrange / Align submenu. Aligns the left edge of all selected objects with the left edge of the left most selected object. Executes the Align Center command on the Arrange / Align submenu. Aligns the vertical centerline of all selected objects with the centerline of the group of objects selected. Executes the Align Right command on the Arrange / Align submenu. Aligns the right edge of all selected objects with the right edge of the right most selected object. Executes the Align Top command on the Arrange / Align submenu. Aligns the top edge of all selected objects with the top edge of the top most selected object. Executes the Align Middle command on the Arrange / Align submenu. Aligns the middle of all selected objects with the middle of the group of objects. Executes the Align Bottom command on the Arrange / Align submenu. Aligns the bottom edge of all selected objects with the bottom edge of the lowest selected object. Executes the Align Centerpoints command on the Arrange / Align submenu. Aligns the centerpoint of all the selected objects with the centerpoint of the group of selected objects. Executes the Send to Back command on the Arrange menu to place all selected objects behind all objects that are not selected. Executes the Bring to Front command on the Arrange menu to place all selected objects in front of all objects that are not selected. Executes the Space Horizontal command on the Arrange menu to evenly space all selected objects horizontally between the left most and right most selected objects. Executes the Space Vertical command on the Arrange menu to evenly space all selected objects vertically between the top most and bottom most selected objects. Executes the Make Symbol command on the Arrange menu to combine multiple objects into a single unit called a symbol. Executes the Break Symbol command on the Arrange menu to break a symbol into its individual components. Executes the Make Cell command on the Arrange menu to combine multiple selected objects into a single unit called a cell. When combining cells, each cell will be retained. When the combined cell is broken, the original cells are restored. Executes the Break Cell command on the Arrange menu to break a selected cell. When combining cells, each cell will be retained. When the combined cell is broken, the original cells are restored. Executes the Rotate Clockwise command on the Arrange menu to rotate selected objects clockwise 90 degrees. Executes the Rotate CounterClockwise command on the Arrange menu to rotate selected objects counter clockwise 90 degrees. Executes the Flip Horizontal command on the Arrange menu to flip selected objects horizontally. Executes the Flip Vertical command on the Arrange menu to flip selected objects vertically. Executes the Reshape Object command on the Edit menu to reshape a polygon or polyline. 48. 2-22 Module 2 – Development Environment Wonderware Training WindowMaker Status Bar When an object is selected in a window, the WindowMaker status bar displays the object's upper left X and Y pixel coordinates and the object's pixel height and width. The X and Y pixel coordinates displayed are relative to the window the object is in, rather than the overall WindowMaker workspace. When multiple objects are selected, the status bar displays the width and height for the entire group. When a blank area of a window is clicked, the status bar displays the X and Y coordinates for the current location of the cursor in the window. Manual Positioning and Sizing In the WindowMaker status bar, there are controls for manually positioning and resizing objects. Select an object on the window, and then click in the controls to enter exact X,Y coordinates and W,H values. You can also select multiple objects and move or resize them as a group. Hold the Shift key down while drawing rectangles, rounded rectangles, and ellipses to constrain the height and width and to create exact squares and circles. Note: You must press ENTER to accept and apply manual positioning and sizing entries. Right-Click Window Menus To access the various commands that can be applied to a window, right-click a blank area of the open window and then click the appropriate command on the right-click menu. Click to edit the X or Y coordinate Click to edit the W or H values 49. Section 1 – Introduction 2-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Opening Windows When developing your application, you can open as many windows as your computer memory will support. a. Click the Open Window tool . The Windows to Open dialog box appears, listing the names of all windows in your application. By default, all currently opened windows will be checked. b. Click the check box next to the name of the window(s) to open. c. Click OK to close the dialog box and open the selected window(s). Note: To quickly open a single window, in the Application Explorer, double-click Windows to expand the list of all the window names in your application. Double-click the window name. You can also right-click the window name and select Open. Saving Windows Once you have created a window, you will need to save it before closing or exiting the application. All graphics, QuickScripts, properties, and so on, associated with the window are also saved. a. Click the Save Window tool . The Windows to Save dialog box appears listing the names of all windows that need to be saved. b. Click the check box next to the name of the window(s) to save. c. Click OK to save the Scratch window. Note: If you attempt to close a window that has been modified since it was last saved, you will be prompted to save your changes before WindowMaker will close the window. Note: To quickly save a single window, in the Application Explorer, right-click the window name and select Save. You can also right-click any blank area of the window and click Save Window. To quickly save all currently open windows, click the Save All Windows tool or select File / Save All Windows. 50. 2-24 Module 2 – Development Environment Wonderware Training Closing Windows a. Click the Close Window tool . The Windows to Close dialog box appears listing the names of all currently open windows. b. Click the check box next to the name of the window(s) to close. c. Click OK to close the dialog box and close the selected window(s). Note: To quickly close a single window, in the Application Explorer, right-click the window name and click Close. You can also right-click any blank area of the window and click Close Window. Deleting Windows Deleted windows cannot be restored unless you have saved them. You will be prompted to confirm the deletion of each window name you select. a. Select File / Delete Window. The Windows to Delete dialog box appears listing the names of all currently open windows. Click the check box next to the name of the window(s) to delete. Click OK to close the dialog box and delete the selected window(s). b. For this example, click Cancel to exit the Windows to Delete dialog box without deleting any windows. Note: To quickly delete a single window, in the Application Explorer, right-click the window name and select Delete. You can also right-click any blank area of the window and select Delete Window. Duplicating Windows To create a duplicate copy of an existing window, the window to be duplicated must be open. a. Select File / Save Window As from the main WindowMaker menu. The Window to save under new name dialog box appears, listing the names of all currently open windows. b. Select the window that you want to duplicate (only one window name can be selected.). For this example, select Scratch. The Save Window dialog box appears. c. Enter a valid name for the new window in the New Name box. d. Click OK to close the dialog box and create the duplicate window. For this example, click Cancel to exit the Save Window dialog box. Note: To quickly duplicate a window, in the Application Explorer, right-click the window name and click Save As. Using this method, the window to be duplicated will still need to be open. You can also right-click in any blank area of the window and click Save Window As. 51. Section 1 – Introduction 2-25 InTouch® HMI 9.5 Fundamentals of Application Development Course Other WindowMaker Properties Levels of Undo: Enter the number of undo/redo levels to save (up to 25 levels). Enter zero (0) to turn the undo/redo functionality off. Adjust total number of undo levels 52. 2-26 Module 2 – Development Environment Wonderware Training – Intentionally left blank – 53. Section 2 – Using WindowMaker 2-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Using WindowMaker This section covers the creation and manipulation of graphic objects, lines and outlines, text objects, images and bitmaps. Graphic Objects Once you have created a new window, it can be populated with graphic objects. WindowMaker provides you with numerous tools for editing and arranging the various graphic objects. Drawing Objects a. Maximize WindowMaker. b. Click the Rectangle icon in the Drawing toolbar. Move the cursor over the Scratch window. The cursor changes to a crosshair ( ). c. Click on the Scratch window and draw a small rectangle (click and hold the left mouse button and drag it down and to the right or left). Release the mouse button when its size is adequate. d. Click anywhere in the window outside the rectangle object to deselect the new rectangle. Section Objectives Create and manipulate objects in the development environment Install and configure wizards 54. 2-28 Module 2 – Development Environment Wonderware Training Selecting and Sizing Objects The term selected is a key concept of WindowMaker object and graphics editing. Placing the cursor over an object and left-clicking directly on the object selects it. Clicking on a blank area of the window deselects any currently selected object(s) in that window. When an object is selected, small boxes appear around its borders. The boxes are handles and are used to resize and/or reshape the object. In general, any command that you execute is applied to all selected objects (assuming that the command is valid for the object). a. Click anywhere within the rectangle. It is now selected. b. Press CTRL+D twice (the keyboard shortcut for Duplicate). Three rectangles should now be visible. Keyboard shortcut reminders 55. Section 2 – Using WindowMaker 2-29 InTouch® HMI 9.5 Fundamentals of Application Development Course Selecting All Objects in a Window a. Select all objects in the active window using one of the following methods. Click the Edit / Select All command Right-click a blank area of the open window and select Select All Press the F2 key b. Deselect the objects by clicking anywhere in the blank area of the window. Selecting Multiple Objects a. To select multiple objects, select your first object. Then press and hold down the SHIFT key and click the other objects to be selected. To deselect a specific object from a group of selected objects, while all objects are selected, hold down the SHIFT key and click the object to deselect. Selecting a Group of Objects a. Move the cursor to a blank area of your window. b. Click the left mouse button and drag the mouse. A dotted selection rectangle with a crosshair cursor appears: c. Drag the mouse until all of the objects that you want to select are completely surrounded. d. Release the mouse button. All of the objects that were completely within the rectangle will be selected. 56. 2-30 Module 2 – Development Environment Wonderware Training Deselecting a Group of Selected Objects If you hold down the SHIFT key while drawing a selection rectangle, all enclosed selected objects will become deselected. This technique may also be used to start a selection rectangle on top of another object. Other Drawing Notes Rounded Rectangles: You can adjust the radius on the corner of rounded rectangle objects. Hold down the SHIFT key and then use the (+) plus key on the numeric keypad to increase the radius or the (-) minus key on the numeric keypad to decrease the radius. Polylines: You can draw complex lines by single-clicking various locations within the window. Double-click to complete the shape, release the mouse and display the sizing handles. Each handle is moveable until after clicking outside of the object. After you click outside the object, the sizing handles display only for entire object (total height and width). You can adjust the radius on the corner of rounded rectangles 57. Section 2 – Using WindowMaker 2-31 InTouch® HMI 9.5 Fundamentals of Application Development Course To edit the polyline after clicking outside the object, select Edit / Reshape Object or right-click the polyline and select Reshape Object or select the object and click Ctrl-R to display the sizing handles on the points of the object. Polygons: You can draw complex shapes by single-clicking various locations within the window. Double-click to complete the shape/release the mouse and display the sizing handles. Each handle is moveable until after clicking outside of the object. After you click outside the object, the sizing handles display only for entire object (total height and width). To edit the polygon after clicking outside the object, select Edit / Reshape Object or right-click the polygon and select Reshape Object or select the object and click Ctrl-R to display the sizing handles on the points of the object. Use the polygon tool to create the triangle-shaped valve images in the following lab. Experiment with the other Drawing Toolbar buttons listed on page page 2-17 of this manual. Deleting Objects a. Select the object(s) to delete. b. Click Edit / Erase or select the object and press the DEL key. Note: Deleted objects are not copied to the Windows Clipboard. 58. 2-32 Module 2 – Development Environment Wonderware Training Lines and Outlines The style and width of a line object can be changed, including the outlines around ellipses, rectangles, polygons, bitmaps or images. A line style or width change can be applied to a single selected object or multiple selected objects. The Line menu is divided into two sections. The top section contains line widths and the bottom section contains line styles: Applying a Line Command a. Select the object and then click the desired line style or width on the Line menu. Tip: If you do not select an object when you select a line style, width or color, the change will be applied to the default settings for all line, shape, and text tools in the Drawing Toolbar. Note: Only the width of solid lines can be changed. Broken lines are a single pixel wide. Wider lines take longer to draw in Runtime. Removing an Object’s Outline a. Select one (or more) rectangle object(s). b. Select Line / No Line from the main WindowMaker menu. The object outline is removed. 59. Section 2 – Using WindowMaker 2-33 InTouch® HMI 9.5 Fundamentals of Application Development Course Arranging Objects WindowMaker provides tools to arrange objects in your windows. The Arrange Toolbar contains tools that can be used to quickly apply most of the commands found on the Arrange menu. Aligning Objects Objects can be aligned by their left or right edges, center, center points, top, middle, or bottom edges. Alignment Tools a. Select a rectangle object and drag it to another location. b. Repeat the previous step so that the rectangle objects are randomly aligned in the window. c. Select all the objects. d. Click either the Space Horizontal or Space Vertical alignment icons. The objects in the following figure have been evenly distributed both vertically and horizontally. 60. 2-34 Module 2 – Development Environment Wonderware Training e. Click either the Align Left, Align Center, or Align Right alignment icons. In the next figure, the Align Right tool has been selected and the rectangle objects have been moved to line up with the right side of the right-most object. Layering Objects Objects can be layered in your window by positioning them in front or behind each other. Positioning an Object Behind Another Object a. Select a rectangle object. b. Click the Send to Back tool icon or select Arrange / Send to Back from the main WindowMaker menu. The selected object(s) will be redrawn behind the object(s) not selected in your window. Positioning an Object in Front of Another Object a. Select the object. b. Click the Bring to Front tool or click Arrange / Bring to Front. The selected object(s) will be redrawn in front of the object(s) not selected in your window. 61. Section 2 – Using WindowMaker 2-35 InTouch® HMI 9.5 Fundamentals of Application Development Course Rotating Objects Most objects (including .bmp, .jpg, .pcx, .tga images and text objects) can be rotated in WindowMaker utilizing the Arrange Toolbar. Objects can be rotated clockwise or counter- clockwise in 90 degree increments. Any links attached to the object are rotated with the object. Note: Rotating objects in WindowMaker has nothing to do with dynamically rotating objects in Runtime. Text objects cannot be rotated while in Runtime. Bitmaps or images can be rotated by assigning them an Orientation animation link. Rotating Objects and Text using the Arrange Toolbar a. Select the object(s) or text. b. Select either the Rotate Clockwise toolbar button or the Rotate CounterClockwise toolbar button on the Arrange Toolbar. The selected object(s) will be rotated 90 degrees in the direction you choose. Object rotation is also accomplished from the main menu by selecting Arrange / Rotate Clockwise or CounterClockwise. Tip: To rotate an object 180 degrees, repeat this procedure. Mirroring and Flipping Objects Most WindowMaker objects can be flipped horizontally or vertically (including bitmaps, JPEG, PCX, and TGA images—text cannot be flipped, but can be rotated). When an object is flipped, it is transformed into its horizontal or vertical mirror image. Any links attached to the object are flipped with the object. a. Select the object(s). b. Click the Flip Horizontal tool button or the Flip Vertical tool on the Arrange Toolbar or select Arrange / Flip Horizontal (or Flip Vertical) from the main WindowMaker menu. The selected object(s) will flip. 62. 2-36 Module 2 – Development Environment Wonderware Training Creating Symbols and Cells Multiple objects can be combined into two different types of single units: Symbols and Cells. Symbols: A symbol unites several simple objects or other symbols into one object. If one of the objects selected has animation links attached to it, the links will be attached to the new symbol. (If the link paste buffer has links in it, you will be asked if you want to paste the links on the new symbol.). Cells: Support animation links in each cell element (but not to the cell itself). Multiple cells can be combined into a single cell. A cell’s objects maintain a fixed spatial relationship between its individual graphic elements. Cells cannot be rotated, while symbols can. The attributes of objects such as text, font, line width, radius and relative positions within a cell cannot be sized until the cell is broken into its individual components. When combining cells, each cell is retained. When a combined cell is broken, the original cells are restored. Note: You cannot make a symbol if more than one of the selected objects has animation links. If you combine two symbols into a new symbol, the original symbol structure is lost. Therefore, if you break the new symbol, it will be broken into the individual components of each original symbol. The two original symbols are lost. Creating a Symbol or Cell a. Select the objects to include in the symbol or cell. b. Click the Make Cell toolbar button or the Make Symbol toolbar button . Tip: Double-clicking a cell will cause the Substitute Tagnames dialog box to appear (not the Animation Links dialog box as with objects and symbols). Breaking a Symbol or Cell a. Select the symbol or cell. b. Click the Break Cell toolbar button or the Break Symbol toolbar button . Tip: To quickly create a symbol or cell, select all the objects, right-click one of the selected objects, point to Cell / Symbol, then click the appropriate command. Tip: To quickly break a symbol or cell, right-click the cell or symbol, then point to Cell/Symbol, then click the appropriate command. Note: If the symbol has links defined for it, the links are automatically saved to the link paste buffer. Symbol Cell Each animation link applies to all objects in the symbol, while different animation links can be attached to different tags (e.g., all objects’ line color is attached to the Status tag, while all objects’ Blink animation link is attached to the Hazard tag). Symbols retain their individual animation links. Cannot contain bitmaps, trends, buttons, wizards, or cells Can contain any object including bitmaps, trends, buttons, wizards, and other cells Can contain only simple objects Can contain other cells Can be resized and has small-sized handles Cannot be resized and has large handles 63. Section 2 – Using WindowMaker 2-37 InTouch® HMI 9.5 Fundamentals of Application Development Course Text Objects The font, font style, font size, justification, and rotation of any selected text object can be configured in WindowMaker. Text objects can also be rotated 360 degrees by 90 degree increments. Note: Orientation animation links cannot be applied to text objects. Therefore, text objects cannot be rotated in WindowViewer based upon a tagname. The Format Toolbar contains tools used to quickly apply most of the commands found on the Text menu to selected objects. Formatting Text Objects All WindowMaker text commands operate on single or multiple text string selections and numeric value fields. If no text object is selected when a command on the Text menu is executed, the command is automatically applied to the respective text tool's default setting on the Format Toolbar and the default setting of the Text tool on the Draw Object Toolbar. The text justification attribute settings are particularly important for text objects used for displaying dynamic values. Justification determines how fields of varying length will be displayed in Runtime. For example, if you are displaying a numeric value at the end of a text string that should appear centered or is right justified, the entire text string (including the value) will be centered again or justified again each time there is a change in the number of displayed digits. Creating a Text Object a. Click the Text tool in the Drawing Toolbar. b. Select any location for the text in your window. The cursor will change to a vertical line. c. Enter the text string. d. Click outside the text. The text is now surrounded by handles, indicating that it is now selected and configurable. 64. 2-38 Module 2 – Development Environment Wonderware Training Changing Font, Font Style, and Font Size a. Select the text you wish to change and then click the Fonts tool on the Format Toolbar. The standard Windows Font dialog box appears. b. Select the desired font from the Font list (the font name will appear in the Font field). When a font size is selected, a sample of the font in the selected style and size will appear in the Sample field (see above example). c. Click OK. Note: A font's point size will be enlarged or reduced in accordance with the range of point sizes available for the selected font. The System font, for example, cannot be sized. Choose a Windows True-Type font such as Arial before changing the size. Editing Text Objects a. Select the text object. b. Choose either Special / Substitute Strings or right-click the text object and select Substitute Strings or press the Ctrl+L keys. The Substitute Strings dialog box appears. c. In the New String box, enter the new text string. d. Click OK. 65. Section 2 – Using WindowMaker 2-39 InTouch® HMI 9.5 Fundamentals of Application Development Course The new text string appears in the window: Tip: You can also use the Substitute String command on strings that are included in a symbol or cell and to change the label on buttons drawn with the Button tool. 66. 2-40 Module 2 – Development Environment Wonderware Training Replacing a Portion of a Text Object If you change a portion of a text object's text, InTouch can globally change all selected text objects using the same text. a. Select all text objects. b. Select Special / Substitute Strings. The Substitute Strings dialog box appears: c. Click Replace. The Replace Text dialog box appears: d. Enter the portion of the string to replace in the Old Text field. e. Enter the replacement text in the New Text field. f. Click OK. 67. Section 2 – Using WindowMaker 2-41 InTouch® HMI 9.5 Fundamentals of Application Development Course The Substitute Strings dialog box reappears showing the change made to the selected text strings: g. Click OK. The selected text objects will automatically be modified. Tip: If you right-click any of the text entry boxes in any dialog box, a menu appears displaying the commands that you can apply to the selected text. 68. 2-42 Module 2 – Development Environment Wonderware Training Configuring Default Fonts You can configure WindowMaker to use default fonts for text objects and button strings. The default font and its characteristics (style, color, size) are automatically used when creating new text objects or buttons. a. Double-click on Configure / WindowMaker in the Application Explorer. The WindowMaker Properties dialog box appears: b. Select either Text or Button. Set default fonts for text objects and button objects 69. Section 2 – Using WindowMaker 2-43 InTouch® HMI 9.5 Fundamentals of Application Development Course The Font window appears: c. Select a Windows True-Type font to assign a default font that can be resized. d. Select OK to save the changes, or Cancel to exit the WindowMaker Properties dialog box. 70. 2-44 Module 2 – Development Environment Wonderware Training Images and Bitmaps All graphic images and formats such as pictures, screen captures, .jpg, .pcx and .tga file types created in other Windows programs must be pasted into a bitmap container in WindowMaker. Some key points to remember: WindowMaker sees a bitmap as a unique object You cannot include bitmaps in symbols You can include bitmaps in a cell You can configure a bitmap with a transparent color so it can float over other objects By doing so, the window background color or any objects behind the bitmap will show through in the areas where the transparent color filter is applied. (Only one transparent color may be used per bitmap.) You can edit a bitmap using Microsoft Paint program included with Windows without leaving WindowMaker Right-click on a bitmap and select Edit Bitmap to launch Microsoft Paint and edit the bitmap Note: You cannot use WindowMaker while editing the bitmap in Paint. To return to WindowMaker, exit Microsoft® Paint. Your changes are saved back to the bitmap object in WindowMaker, not the original bitmap file that was imported. Importing a Bitmap, JPEG, PCX, or TGA File a. Click the Bitmap tool . The cursor turns into a + symbol. b. Draw a bitmap container in your window (any size). The following figure displays the bitmap object in the Scratch window: c. Right-click on the bitmap container. 71. Section 2 – Using WindowMaker 2-45 InTouch® HMI 9.5 Fundamentals of Application Development Course A drop-down menu appears: d. Select Import Image to paste an image into the container. The Select Image File dialog box appears: e. Select the file to import as a bitmap. In the previous figure, the setup.bmp image is selected from the WINNT/System32 folder on the C: drive. f. Click Open. 72. 2-46 Module 2 – Development Environment Wonderware Training The image is pasted into the bitmap object: g. To return the bitmap to its original size, right-click it and select Bitmap - Original Size. The bitmap is redrawn to its original size: h. Delete the bitmap object. Pasting a Bitmap from the Windows Clipboard Graphic files can be copied directly from the Windows clipboard into an InTouch bitmap object. This example will use the InTouch splash screen. a. Open Microsoft Paint (Programs / Accessories / Paint). b. Select File / Open from the main Paint menu. 73. Section 2 – Using WindowMaker 2-47 InTouch® HMI 9.5 Fundamentals of Application Development Course c. Browse to Program Files / Wonderware / InTouch for the intouch.bmp file. d. Click Open. The graphic appears in the Paint window with sizing handles: 74. 2-48 Module 2 – Development Environment Wonderware Training e. Press Ctrl+A to select the graphic image. f. Press Ctrl+C to copy the image to the Windows clipboard. Note: To save the bitmap while in Microsoft Paint and return to WindowMaker, click on File / Save or File / Exit. Both commands serve the same function. g. Switch to WindowMaker. h. Use the Bitmap tool to create a bitmap container on the Scratch Window. i. Select the bitmap container. j. Right-click the container and select Paste Bitmap from the submenu. The bitmap from the Windows Clipboard is pasted into the bitmap container. Note: The Paste Bitmap command is only available when there is an image in the windows clipboard. The bitmap is now available for resizing manually or with Bitmap - Original Size. 75. Section 2 – Using WindowMaker 2-49 InTouch® HMI 9.5 Fundamentals of Application Development Course Creating a Transparent Bitmap A bitmap or image can be defined with a transparent color so background objects or graphics behind it will be visible. By defining a transparent color, the window's background or any objects behind the bitmap will show through in the areas where the transparent color is used. Use the intouch.bmp image you just pasted. a. Right-click the object and select Bitmap - Original Size. The bitmap changes to its original size. b. Reposition the bitmap and resize the window to ensure that it is fully visible. c. Select the bitmap. d. Click the Transparent Color tool on the Format toolbar. The Color Palette appears. e. Right-click a blank color square in the Custom Palette section at the bottom of the color palette. The Edit Custom Color menu appears. f. Select the Blotter icon. 76. 2-50 Module 2 – Development Environment Wonderware Training The Edit Custom Color menu closes: g. Click the white box within the InTouch graphic. The color is copied to the color square selected in the transparent color palette. h. Click the white square within the Palette to apply the transparent color to the bitmap. The bitmap changes to reflect the transparent color selection: Note: Only one transparent color can be applied per bitmap. 77. Section 2 – Using WindowMaker 2-51 InTouch® HMI 9.5 Fundamentals of Application Development Course Editing Bitmap Images You can edit a bitmap using the Microsoft Paint program included with Windows without leaving WindowMaker. Microsoft Paint can be activated automatically by right-clicking on a bitmap object. While in Microsoft Paint, the bitmap can be edited. Note: You cannot use WindowMaker while editing the bitmap in Paint. To return to WindowMaker, exit Microsoft Paint and Save the image to your hard disk. a. Delete the bitmap image with transparency created above. b. Place a new bitmap container in the Scratch window. c. Import the Program Files / Wonderware / InTouch intouch.bmp file again. d. Select Bitmap - Original Size and center the bitmap in the Scratch window. e. Select Edit / Edit Bitmap or right-click on the bitmap image and select Edit Bitmap. 78. 2-52 Module 2 – Development Environment Wonderware Training Microsoft Paint launches, with a temporary filename automatically assigned: 79. Section 2 – Using WindowMaker 2-53 InTouch® HMI 9.5 Fundamentals of Application Development Course f. Use various features of Microsoft Paint to customize the bitmap file. In this example, add Company Logo Here with the text tool and modify the font properties. g. Close Microsoft Paint. You are prompted to save the temporary file. h. Click Yes. Your changes are saved back to the bitmap object in WindowMaker, not the original bitmap file that was imported. i. Return to WindowMaker. 80. 2-54 Module 2 – Development Environment Wonderware Training Your window should resemble the following figure: Tip: To make the original white block transparent but not the white text transparent, edit the bitmap, fill the white box with a unique color not used elsewhere in the logo, and use this unique color as the transparent color in your InTouch window. 81. Section 2 – Using WindowMaker 2-55 InTouch® HMI 9.5 Fundamentals of Application Development Course Wizards Wizards are pre-drawn, individual graphical components that are embedded in the InTouch window during development for use in a Runtime application. Wizards save a considerable amount of time during application development because they are easy to use and easy to configure. By using Wizards, you do not spend time drawing the individual components for the object, entering the value ranges for the object, or animating the object. For example, in the case of a Slider wizard, configuration options include items such as the tagname link, the minimum and maximum range labels for the slider, the fill color, and so on. Once the required configuration information is entered, the Wizard is ready to use in Runtime. Complex Wizards can be developed to provide "behind the scenes" types of operations. These operations may include creating complete display windows, creating or converting a database, and configuring other applications such as the InTouch Recipe Manager and SPCPro add-on programs. Installing or Removing Wizards Installation and removal of wizards is not the same as pasting them into the InTouch window, but includes them in an active list of available objects. a. Select Special / Configure / Wizard/ActiveX Installation from the WindowMaker menu. 82. 2-56 Module 2 – Development Environment Wonderware Training The Wizard/ActiveX Installation dialog box appears with the Wizard Installation property sheet active: Note: Use of third-party applications may require additional wizards to be installed. The upper pane contains the list of available Wizard objects and the lower pane contains any Uninstalled objects. In the Installed Wizards list, select a wizard(s) to remove from your application and then click the Remove button. The uninstalled objects are available for installation by highlighting them and clicking the Install button (it becomes active after the object is selected). 83. Section 2 – Using WindowMaker 2-57 InTouch® HMI 9.5 Fundamentals of Application Development Course b. Select the ActiveX Control Installation tab. The Available list is also in the lower pane. c. Use the Remove button to remove an ActiveX Control and move it to the list of available ActiveX Controls. (Do not remove any wizards in this example.) d. Click Cancel to return to WindowMaker. 84. 2-58 Module 2 – Development Environment Wonderware Training Placing Wizard Objects in a Window a. Click the Wizard Hat toolbar icon . The Wizard Selection dialog box appears: Tip: To add the wizard to the Wizards/ActiveX Toolbar, click Add to toolbar. Once a wizard is added to the Wizards/ActiveX Toolbar, it can be selected and pasted into your open window at any time. b. Select Switches. 85. Section 2 – Using WindowMaker 2-59 InTouch® HMI 9.5 Fundamentals of Application Development Course The available switch wizards appear in the main view pane: c. Select the Fixture Switch wizard. d. Click OK. The dialog box closes and the Scratch window appears. The cursor changes to a corner symbol when you return to the window. e. Click the location in the window where you want to paste the wizard. 86. 2-60 Module 2 – Development Environment Wonderware Training The wizard appears with its handles: f. Double-click the wizard to view its configurable attributes. g. Click Cancel to exit the Discrete Switch Wizard dialog box. Wizards and ActiveX objects will be configured in some detail later in this course. Note: Some toolbar functions may be used to modify applicable wizards directly, such as the Reduce Font tool, Line Color tool, Fill Color tool, among others. 87. Section 2 – Using WindowMaker 2-61 InTouch® HMI 9.5 Fundamentals of Application Development Course Removing Wizards from the Toolbar After adding Wizards and ActiveX controls to the Wizard toolbar, the Remove from toolbar button in the main Wizard Selection dialog box is active. a. Click Remove from Toolbar to display the Remove Wizard from Toolbar dialog box. b. Select the wizard(s) to remove from the toolbar. c. Click OK. 88. 2-62 Module 2 – Development Environment Wonderware Training – Intentionally left blank – 89. Lab 1 – Create New Application, Windows, and Graphics 2-63 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 1 – Create New Application, Windows, and Graphics Introduction This lab explains how to create and manipulate objects within WindowMaker, including creating an application, a new window, and new graphics. Objectives Upon completion of this lab, you should be able to: Create a new application Create a new window Create new graphics 90. 2-64 Module 2 – Development Environment Wonderware Training Create a New Application Note: The Application that appears in the following steps was created during the Instructor-Led steps earlier in this module. If you did not create it, do so now. Otherwise, move to the section in this lab entitled, “Create a New Window” on page 2-66. 1. Select Start / Programs / Wonderware / InTouch . The Application Manager appears: 2. Click the New tool on the Application Manager toolbar. The Create New Application dialog box appears, allowing you to specify a default directory for storing applications. 3. Enter c:applications in the directory field. 4. Click the Set as Default Directory checkbox. 5. Click Next. 91. Lab 1 – Create New Application, Windows, and Graphics 2-65 InTouch® HMI 9.5 Fundamentals of Application Development Course 6. Create a directory where the application will be created. 7. Click Next. 8. Enter InTouch Basic in the Name: field and a description (optional) in the Description box. Note: Confirm the InTouchView Application option is deselected. It is only applicable in the ArchestrA environment, with Industrial Application Server. 9. Click Finish. 92. 2-66 Module 2 – Development Environment Wonderware Training The InTouch - Application Manager reappears displaying an icon, the path, and the Version, Mode, and Description of the new application: Note: When the application is first displayed in the Application Manager, the resolution and version are displayed as 0. After they are opened, the resolution and version details are updated. Create a New Window Note: The Window that appears in the following steps was described during the Instructor-Led steps earlier in this module. If you did not create it, do so now. Otherwise, move to the section in this lab entitled, “Click the bottom right corner of the window and drag it to resize the window.” on page 2-68. 10. Double-click the InTouch Basic application. 93. Lab 1 – Create New Application, Windows, and Graphics 2-67 InTouch® HMI 9.5 Fundamentals of Application Development Course A blank application appears in the development environment: 11. Click the New Window icon . The Window Properties dialog box appears: 12. Enter Scratch in the Name: field. 13. Click OK. 94. 2-68 Module 2 – Development Environment Wonderware Training The new window displays in WindowMaker: 14. Click the bottom right corner of the window and drag it to resize the window. Create New Graphics This task demonstrates creating a simple valve object and button within the new window. Open the Scratch Window if it is not already open. 15. Click the Polygon toolbar icon and draw a triangle. 95. Lab 1 – Create New Application, Windows, and Graphics 2-69 InTouch® HMI 9.5 Fundamentals of Application Development Course 16. Select the triangle and click the Duplicate toolbar icon . 17. Click the Rotate / Flip tools in the Arrange toolbar . Tip: Hold down the SHIFT key when you click an object to prevent the object from moving. Next you will position the two halves of the valve as shown using the arrow keys or the mouse. 18. Hold down the SHIFT key or CTRL key and use the arrow keys to move the object 10 or 50 pixels respectively. 96. 2-70 Module 2 – Development Environment Wonderware Training 19. Select the Rectangle toolbar icon . 20. Draw a long rectangle and position it similar to the following figure. 21. Pull down the Arrange menu from the main WindowMaker window. Notice that the menu command Snap to Grid is checked: Deselecting the Snap to Grid property makes it possible to arrange your objects more precisely. The dot pattern on the Scratch window disappears when Snap to Grid is turned off, which allows an object to move one pixel. Toggle the grid on and off with the Arrange menu or by clicking on the grid button on the View toolbar. 22. Select the stem object and click Send to Back . This positions the stem object behind the other objects and makes a cleaner object. 23. Click the Ellipse toolbar icon. 97. Lab 1 – Create New Application, Windows, and Graphics 2-71 InTouch® HMI 9.5 Fundamentals of Application Development Course 24. Add the valve handle using the ellipse shape and position it similar to the following figure: 25. Select the Text toolbar icon . 26. Add the text Valve1 to a location just below the valve object. 27. Right-click the text object and select Fonts. The Font dialog box appears: 98. 2-72 Module 2 – Development Environment Wonderware Training 28. Select the Arial font, Bold, 12 point. Making the font True-Type ensures the text will remain consistent if it is run on another system or is resized. 29. Click OK. The valve is now composed of four separate objects and a text object. 30. Press the F2 key to select all objects in the window. 31. Click the Make Symbol toolbar icon . The entire symbol can now be resized by clicking and dragging the corner handles. 32. Click the Button toolbar icon and draw a button below the valve symbol. 33. Select the button and press Ctrl+L. 99. Lab 1 – Create New Application, Windows, and Graphics 2-73 InTouch® HMI 9.5 Fundamentals of Application Development Course The Substitute Strings dialog box appears: 34. In the New String field, enter DiscTag1. 35. Click OK. 36. Edit the Font properties of the button to match the text string: Select Arial, Bold, 12 point. The Scratch window should now look similar to the following figure: 37. Save the Scratch window . 100. 2-74 Module 2 – Development Environment Wonderware Training – Intentionally left blank – 101. Module 3 Tagname Dictionary Section 1 – Tags and Tag Features 3-3 Lab 2 – Creating Tags 3-17 102. 3-2 Module 3 – Tagname Dictionary Wonderware Training Module Objectives Explain InTouch tags and the Tagname Dictionary Define tag types Create tags with the Tag Editor Modify tag and Tagname Browser filter configurations 103. Section 1 – Tags and Tag Features 3-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Tags and Tag Features This section will define tags, tag types, tag creation, and tag modification. It will also demonstrate Tagname Browser filters and printing the Tagname Dictionary. Tags A Tag is simply defined as a value. The value represents a tank level, temperature, communication status, switch position, and other real-time values in your processes. Each tag has a variety of attributes such as tagname, min/max values, and access name. InTouch requires different information for different tag types. For instance, for I/O-type tags, InTouch requires more information in order to be able to acquire the value from an external data source and convert it for internal use. The information about the tag is contained within the Tagname Dictionary. The Tagname Dictionary (Runtime database) is the heart of InTouch. It contains the current value of all of the tags in the database. In order to create the Runtime database, InTouch requires information about all of the variables being created. Each tag must be assigned a tagname and type. During Runtime, an InTouch application accesses the Tagname Dictionary and provides specific tag information via animation links, scripting, and so on. When tags change (e.g. created, value change, configuration change), the changes are stored in the Tagname Dictionary. Manual creation and configuration of tags is performed using two interfaces of the Tagname Dictionary: The Tag Editor and the Tag Browser. Tagname Naming Conventions A Tagname identifies a tag to InTouch and to the user. Tagnames can be up to 32 characters long and may begin with an alpha character (A-Z or a-z) or numeric character (0-9). The remaining characters can be A-Z, a-z, 0-9, !, @, -, ?, #, $, %, _, and &. If a tagname starts with a numeric character, it must also be followed by at least one alpha character other than “e” or “E” or “x”. Tagnames cannot have spaces. Note: The Backslash Character () is valid for Supertags only (discussed in Module 9, “Advanced Tag Functionality,”). Tagnames may not take the form of any valid numeric expressions. For example, 123E4 or strings that could be hexadecimal numbers such as 0xABCDEF are not permitted. Indexing Tagnames can be auto-indexed, provided the tagname includes a number. For example, if you enter and save tagname R4001 and then click New, the tagname will automatically be indexed to R4002. Section Objectives Introduce the Tagname Dictionary Create, define and modify Tags Define and configure Tagname Browser Filters Print Tagname Dictionary 104. 3-4 Module 3 – Tagname Dictionary Wonderware Training Character Separators If a tagname contains a character used to separate numbers, it is auto-indexed by the first whole number InTouch finds, for example N7-0 would be indexed as N7-1. Only positive changes (increments) are permitted, such as R4002-to-R4003 followed by R4003-to-R4004. Use caution when including dashes (-) in tagnames. Dashes are valid for use in tagnames that do not start with numbers, but they are also used as the negation and subtraction operator in mathematical expressions or logic. The dash can create ambiguity in certain situations. For example, if you use A=B-C in an expression, the expression means that A equals B minus C. However, InTouch assumes that you want to assign a tagname named B-C to a tagname named A. You can prevent this confusion by separating the tagnames from the operators with blank space(s), for example, A = B - C. Consider this example: X-101=FT-101*SP-101. In the expression, FT-101 is being multiplied by SP-101 and assigned to X-101 because no spaces were used. Tag Types InTouch tags are either Memory-type tags or I/O-type tags. For example, if the tag reads or writes values coming to or from external application, such as an I/O Server, it is an I/O type tag. When you are defining tags in the InTouch database, you must assign a specific type to each tag according to its usage. Memory Type Memory tag types are used internally (within your InTouch application). They are used to create system constants and simulations. They can also be used to create calculated variables that are accessed by other Windows programs. For example, in a process simulation, memory tags are used to control the actions of a background QuickScript by defining a memory tag called COUNT that is changed by an Action QuickScript. The Quick Script causes various animation effects to occur for the current STEP of a process. Note: QuickScripts are explained in Module 5, “InTouch QuickScripts.” There are four Memory types. Memory Discrete: Internal discrete tag with a value of either 0 (False, Off or Low) or 1 (True, On or High). Memory Integer (Analog): A 32-bit signed integer value between -2,147,483,648 and 2,147,483,647. Memory Real (Analog): Floating (decimal) point value. The floating point value may be between -3.4e38 and 3.4e38. All floating point calculations are performed with 64-bit resolution, but the result is stored in 32-bit. Memory Message: Text string tag that can be up to 131 characters long. 105. Section 1 – Tags and Tag Features 3-5 InTouch® HMI 9.5 Fundamentals of Application Development Course I/O Type All tags that read or write their values to or from an external source are I/O type tagnames. This includes all inputs and outputs from programmable controllers, process computers and data from network nodes. I/O tags are accessed either through the Microsoft Dynamic Data Exchange (DDE) or Wonderware SuiteLink (recommended for network communication and diagnostics) communication protocols. When the value of a read/write I/O type tagname changes, it is immediately written to the remote application. The tag may also be updated from the remote application when the item to which the tagname is linked changes in the remote application. By default, all I/O tagnames are set to Read/Write. However, you can restrict them to read only by selecting the Read Only option in the Tagname Dictionary dialog box. There are four I/O Types. I/O Discrete: Discrete input/output tag with a value of either 0 (False, Off) or 1 (True, On). I/O Integer (Analog): A 32-bit signed integer value between -2,147,483,648 and 2,147,483,647. I/O Real (Analog): Floating (decimal) point tag. The floating point value may be between -3.4e38 and 3.4e38. All floating point calculations are performed with 64-bit resolution, but the result is stored in 32-bit. I/O Message: Text string input/output tag that can be up to 131 characters long. Miscellaneous Tag Types There are several special tag types that you can assign to tags that perform complex functions, such as creating dynamic alarm displays, historical trends, monitoring or controlling the tag that each historical trend pen is plotting, and so on. Note: Group Var (Alarms), HistTrend/Tag ID, Indirect Tags, and SuperTags are included in Module 6, “Alarms,” Module 7, “Real-time and Historical Trending,” and Module 9, “Advanced Tag Functionality,” respectively. They are introduced here for purposes of context. Group Var The Group Var type is used for a tag with an assigned Alarm Group to create dynamic alarm displays, disk logs and print logs. Group Var type tags are used to create alarm windows or alarm logs that display all alarms associated with a specific group variable. You can also control the alarms that are displayed or logged by assigning a different Alarm Group to the Group Var tag. You can also use a Group Var type tag to create application buttons the operator can click to selectively display alarms for different areas of a plant within the same alarm window. All of the .fields associated with Alarm Groups can be applied to Group Var tagnames. Hist Trend InTouch requires a Hist Trend type tag when you create a historical trend. All of the .fields associated with historical trends can be applied to Hist Trend tags. 106. 3-6 Module 3 – Tagname Dictionary Wonderware Training Tag ID This is a special type that is used with historical trend objects. You use Tag ID type tagnames to retrieve information about tagnames being plotted in a historical trend. In most cases, you would use Tag ID tagnames to display the name of the tagname assigned to a specific pen or to change the tagname assigned to the pen. You can process a statement in a QuickScript to assign a new tagname to any pen in any historical trend. For example, the following statement could be used in your QuickScript: MyHistTrendTag.Pen1=MyLoggedTag.TagID; When this QuickScript is executed, Pen1 in the historical trend associated with the Hist Trend tagname "MyHistTrendTag" would begin trending the historically logged data for the "MyLoggedTag." Indirect and SuperTags Indirect Tags and Super Tags are two more types of tags that are discussed in detail in Module 9 of this manual. Creating Tags Tags and their tagnames (and other attributes) are created using the Tagname Dictionary’s Tagname Editor. a. Select Special / Tagname Dictionary from the main WindowMaker menu or double-click on the Tagname Dictionary in the explorer. The first time you access the Tagname Dictionary, the definition for the internal system tagname $AccessLevel is displayed. This is the first tag in the Tag Browser list. After saving the tag definition in the Tagname Editor, the last edited tagname's definition is displayed. 107. Section 1 – Tags and Tag Features 3-7 InTouch® HMI 9.5 Fundamentals of Application Development Course b. Click the > buttons to browse through the tagname definitions currently stored in your Tagname Dictionary (The browse buttons are inactive when there are no previous or next tagnames to display). c. Click New. The Tagname field clears: d. In the Tagname: field, enter RealTag. e. Click the Type:... button. The Tag Types dialog box appears: f. Select Memory Real. g. Click OK. h. Define RealTag further with these values: Enter 250 in the Initial Value field Enter 0 in the Min Value field Enter 500 in the Max Value field Leave the other values the same 108. 3-8 Module 3 – Tagname Dictionary Wonderware Training The Tagname Dictionary dialog box should now appear like the following figure: i. Click Save. The Tagname Dictionary is now ready for another tag to be defined. Note that the previous tag values remain in their respective fields. Replace the existing values with the new tag information. 109. Section 1 – Tags and Tag Features 3-9 InTouch® HMI 9.5 Fundamentals of Application Development Course Tagname Editor Configuration Options Tagname: Tagnames have a limit of 32 characters. A tagname may begin with a numeric character that is not followed by the letter E, or InTouch will read it as exponential. Group: Assigns the tag to a specific Alarm Group. Clicking this button displays the Alarm Group dialog box, from which the Alarm Group is selected. (Alarms and alarm groups are configured in Module 6, “Alarms.”) If you do not assign the tag to a specific Alarm Group, InTouch assigns it to the root group, $System by default. Once you create a tag and assign it to an Alarm Group, if you do not close the dialog box, all subsequent tags that you define will be assigned to the same Alarm Group, unless changed. For I/O type tags, select Read Only if you wish to restrict the tag to read-only capabilities in Runtime. Select Read Write to grant the I/O tag both read and write capabilities in Runtime. Comment: Contains any miscellaneous comment you want the system to store regarding your tag (up to 50 characters). Alarm Comment: You can configure your alarm windows to display these comments when the tag is in alarm. The distributed alarm system can be configured to use the tag’s Alarm Comment field to store an operator’s comments regarding an acknowledged alarm. Log Data: Logs the tag data to the historical log file during Runtime when its engineering unit value changes more than the specified Log Deadband value or, by default, once an hour, regardless of change. For tag values to be logged, historical logging must be enabled by selecting Special / Configure Historical Logging from the main WindowMaker menu. If this option is disabled later (tag value NOT logged), the data previously logged for the tag will be inaccessible to InTouch in historical trend displays. If the option is re-enabled, all logged data is accessible, but a historical trend would display a gap in the trend trace. Also, if you make logging changes in WindowMaker while WindowViewer is running, the changes do not take affect until WindowViewer is restarted. Log Events: Logs all data changes to the tag that are initiated by the operator, I/O, a QuickScript or by the system. When you define a tagname to do event monitoring, an event message is logged to the Alarm System each time the tagname's value changes. The event message logs how the value changed and whether the change was initiated by the operator, I/O, scripts or the system. When the Log Events option is selected, the Priority field becomes active. Valid entries in this field are 1 to 999, where 1 is the highest and 999 is the lowest priority. Retentive Value: Retains the current value of the tag when WindowViewer is closed. This value will be used as the initial value for the tag when WindowViewer is restarted. Retentive values cannot be selected or cleared for new or existing tags when WindowViewer is running. Retentive Parameters: Retains any changes the operator makes to the value of any alarm limit fields for the tag. This value will be used as the initial value for the alarms when WindowViewer is restarted. Note: Since changes are logged immediately, it is strongly recommended that you only select the above two retentive options for values that do not change often. 110. 3-10 Module 3 – Tagname Dictionary Wonderware Training Tag Details Many tags require greater level of detail to be properly handled. A specific Details area is displayed for each type of tag to define the details and alarm types for the tag type. Note: Do NOT click Cancel or Close at this time. Initial Value: Value of the tag at start-up until it receives a different value or it is overridden by a Retentive value. Eng Units: Engineering Units. A notation for the tag that is reserved to indicate a unit of measurement, i.e. PSI. Min/Max Value: Expected range for tag. Note: The minimum/maximum values of Memory Tags do not limit the range of a tag. Limiting of a tag must be done via Input Animation links. Deadband: Minimum value the tag must change by for its value to be refreshed. This is usually used for I/O tags that update frequently. Log Deadband: Minimum value the tag must change by for its value to be logged historically. Other Notes The names of any SuperTags created in the TemplateMaker also appear in the Tag Details area and member tags can be selected as the tag type. Note that SuperTags can contain as many as 64 member tags using 2 nesting levels). For SuperTags NOT created using the SuperTag TemplateMaker, for instance SuperTags created in an animation link tagname or expression input box, a QuickScript, or created in an external file and then loaded the DBLoad utility, the name SuperTag appears in the Type field. Note: If a tag is currently linked to an object or used in a QuickScript, it cannot be changed. SuperTags are explained in Module 9, “Advanced Tag Functionality.” 111. Section 1 – Tags and Tag Features 3-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Tag Browser The Tag Browser displays all tags contained within the Tagname Dictionary. The Tag Browser is your primary tool for viewing and selecting local and remote tagnames and tagname .fields from FactorySuite applications or any other tag source that supports the InTouch Tagname Dictionary interface. It enables selection of existing tags, addition of new tags and viewing of basic Tagname Dictionary information. The Tag Browser is also used to access the Tag Editor to perform editing, replication and configuration of remote references to remote tag sources. The first time the Tag Browser is accessed, by default, will be selected for the tag source. This means that the tagnames in the local application's Tagname Dictionary will be displayed. Thereafter, the last accessed tag source's tagnames will be displayed. The Tag Browser operates in either a Dictionary or selection mode. The mode is determined by the method used to access it. Note: The unlimited selection mode is discussed further in “Selecting Dot Fields from the Tag Browser” on page 5-21. j. Click Select... in the Tagname Dictionary window. The Select Tag dialog box appears in Dictionary mode: k. Click the List View button to see a list of the tags without Details. Tagnames displayed in Details View, with column information 112. 3-12 Module 3 – Tagname Dictionary Wonderware Training The Select Tag window displays without tag details: Filtered Selection Mode If you click Select in the Tagname Dictionary dialog box, the tagnames displayed (and available for selecting) are limited to the current InTouch application. The same condition is true if, during Runtime, an operator selects a new tag for a historical trend pen. a. Click the Select... button in the Tagname Dictionary. When the Tag Browser is accessed from the Tagname Dictionary and a tagname is selected from the list, its Tagname Dictionary Tag Editor appears after you click OK. The primary methods that display the Tag Browser in the filtered selection mode include: Clicking the Select button in the Tagname Dictionary when adding or editing tags When WindowMaker is running, double-clicking a cell in the Unit# column in a Recipe Manager Unit Template definition In Runtime, clicking any Pen# button in the Historical Trend Setup dialog box In this instance, the Tag Browser only displays the tags that are defined with the Log Data option selected in the Tagname Dictionary This functionality is only enabled when the Allow Runtime Changes option has been selected for the historical trend during development In Runtime, clicking any object linked to the HTSelectTag() function Tagnames displayed in List View, no Details 113. Section 1 – Tags and Tag Features 3-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Defining Tag Browser Filters By defining browser filters, you can sort any tagname list and display only the tags that meet the specified criteria. Tags can be sorted based on Tagname, Tag Type, Access Name, Alarm Groups and Comments. You can use one or a combination of any of these items to set the criteria for your display. You can also save each filter instance and reuse it at any time. For example, if you have 40,000 tags defined in your Tagname Dictionary and you want to see the 20 that are assigned to a particular Access Name, create a filter to specify the Access Name and/ or Alarm Group as the criteria that the tags must meet to display in the Tag Browser. Use these procedures to define the filters (search criteria) to populate the Tag Browser. a. At the bottom of the Select Tag window, click the Define Filter button . The Define Tag Filter dialog box appears: Filter Name: A unique name that identifies the filter that you are defining. As you define filters, the Filter Name you enter is added to the Filter Name drop-down list. Tagname: Tagname expression to use as a filter. If left blank, the system ignores this field in the filter definition. Access Name: The local Access Name expression to use as a filter. If left blank, the system ignores this field in the filter definition. Alarm Group: The name of the Alarm Group expression to use as a filter. If left blank, the system ignores this field in the filter definition. Comment: The comment expression to use as a filter. If left blank, the system ignores this field in the filter definition. OK: Exit the dialog box. The Filter Name appears in the Filter list in the Tag Browser and you can select it to display only the tagnames meeting the criteria specified in the filter. Note: All of the Filter Option fields (Tagname, Tag Type, Access Name, Alarm Group and Comment) support wildcard expressions to limit the scope of your search. If no filter is used, all of the tagnames in the currently displayed tag source will be displayed. 114. 3-14 Module 3 – Tagname Dictionary Wonderware Training Deleting a Search Filter a. Open the Filter drop-down list and select the filter name in the list that you want to delete. b. Click Delete. The filter is immediately deleted. Printing the Tagname Dictionary Printing the Tagname Dictionary details can help determine tagname usage. In addition to printing a .CSV (comma separated values) file, you can print listings of the Tagname Dictionary details, alarm information, link details and scripts. a. Click File / Print from the WindowMaker main menu. The WindowMaker Printout dialog box appears: b. Check Database Entries to print all database information. When selected, the following options become active: Details: Includes the database details in your report. Alarm Information: Includes the database alarm information in your report. With Window Cross-Reference: Prints all database entries with window cross- references. Level of Detail: Link Details to print the location and animation link details where the tagname was used Window Names Only to print only the name of the cross-referenced windows(s) 115. Section 1 – Tags and Tag Features 3-15 InTouch® HMI 9.5 Fundamentals of Application Development Course c. Check Windows to print a listing of the database entries used in the application windows. The following options become active: All Prints the database entries for all windows in the application. Selected Prints only the database entries for specific windows. Checking Selected opens the Windows to Print dialog box. Select the windows to print and click OK (By default, all window names will be selected when the dialog box appears). With Link Details: Prints the link details for the window(s). Window Scripts: Prints the scripts associated with the window(s). Database entries used in window: Prints the tagnames used in the window(s). All Scripts: Prints all Scripts for the selected window(s). Application Scripts: Prints the application scripts. Condition Scripts: Prints the condition scripts associated with the window(s). Data Change Scripts: Print the data change scripts associated with the window(s). Key Scripts: Prints the key scripts associated with the window(s). Quick Functions: Prints your QuickFunctions. ActiveX Event Scripts: Prints any ActiveX Event Scripts used. d. Click Next in the WindowMaker Printout window. The Select Output Destination dialog box appears, allowing you to select your output destination (to Printer or to Text File): e. If you send the output to a Text File, browse with the ellipses icon or type the file name and directory string. f. If you send the output to a Printer, browse to select the correct printer. Note: Printing the window in this manner will NOT produce a graphical representation of the window. It will instead print a textual/detailed description of the window. 116. 3-16 Module 3 – Tagname Dictionary Wonderware Training – Intentionally left blank – 117. Lab 2 – Creating Tags 3-17 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 2 – Creating Tags Introduction This lab demonstrates how to use the Tag Editor to create, identify, and define new tags. Objectives Upon completion of this lab, you should be able to: Create a Memory Real Tag Create a Memory Integer Tag Create Memory Discrete Tags Create a Memory Message Tag 118. 3-18 Module 3 – Tagname Dictionary Wonderware Training Create a Memory Real Tag 1. Click Special / Tagname Dictionary on the WindowMaker menu bar. 2. Ensure Details is selected. 3. Click New. Note: If you created RealTag during the instructor-led portion, do not click New. Instead click Select... to locate and modify your existing RealTag. 4. Enter RealTag in the Tagname: field. 5. Configure the tag type and details to match the following figure: 6. Click Save. Create a Memory Integer Tag 7. Click New. 8. Enter IntTag in the Tagname field. 9. Configure the tag type and details to match the following figure: 10. Click Save. The tagname IntTag is now created and defined as a Memory Integer tag. 119. Lab 2 – Creating Tags 3-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Create Memory Discrete Tags 11. Click the New button in the Tagname Dictionary. 12. Create a Memory Discrete tag with the attributes shown in the following figures: 13. Click Save. 14. Click New. The tagname is automatically changed to DiscTag2: 15. Click Save. 120. 3-20 Module 3 – Tagname Dictionary Wonderware Training Create a Memory Message Tag 16. Using the previous steps, create a Memory Message tag with the attributes shown in the following figures: 17. Click Save. 18. Click Close. Note: Clicking Close also saves the tag configuration. 121. Module 4 Animation Links Section 1 – Animation Links Overview 4-3 Section 2 – Animating Objects 4-9 Section 3 – Animation Links – Quick Reference 4-45 Lab 3 – Configuring Animation Links 4-49 Section 4 – Using SmartSymbols 4-63 Lab 4 – Using SmartSymbols 4-81 122. 4-2 Module 4 – Animation Links Wonderware Training Module Objectives Identify basic animation link features Define animation link types Access the tag browser and tagname dot fields Animate objects Generate and edit SmartSymbols 123. Section 1 – Animation Links Overview 4-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Animation Links Overview This section will identify and define the basic animation link features such as the animation link types, as well as how to access the tag browser and tagname dot fields. Introduction Graphic objects or symbols are "brought to life" in Runtime by using animation links. Animation links make an object or symbol change in appearance to reflect changes in the value of a tag or an expression. For example, you can create a pump symbol that displays red when it is off and green when it is on. You can also make the pump symbol a touch-sensitive pushbutton that the operator can click with the mouse to turn the pump on and off. You can use these and many other special effects by defining animation links for your objects or symbols. InTouch supports two basic types of links: Touch Links and Display Links. Touch Links: Enable operator input into the system. Value sliders or pushbuttons are examples of Touch Links. Display Links: Enable output to the operator. Color fill, location, or blink links are examples of Display Links. Most animation links share the following common features: Object Type dialog box Common color palette Quick access to the Tag Browser Quick access to the Tagname .Fields Support for key equivalents (Touch Links only) Right-click mouse support in the Tagname or Expression input boxes (displays a menu with commands that can be applied to the selected text) Object Type Dialog Box The Object Type dialog box appears at the top of the animation link selection dialog box. It is common to all links created. It displays the description of the type of object that you have selected for animation link attachment. The dialog box below is for the Round Rectangle object type. If multiple links have been attached to an object, the Prev Link and Next Link are enabled in order to quickly scroll forward or backwards through the link dialog boxes for each link attached to the object. Note: Links are stored in the order in which they were originally attached to the object. Section Objective Identify basic animation link features Define animation link types Access the tag browser and tagname dot fields 124. 4-4 Module 4 – Animation Links Wonderware Training Animation Link Selection Dialog Box Multiple links can be defined for your objects or symbols, enabling creation of almost any screen animation effect imaginable. You animate such changes as color, size, location, fill level, and visibility. a. Add an Ellipse object to the Scratch window. b. Double click the Ellipse object in the Scratch window. The Animation Link Selection dialog box appears. It is used to configure all types of object and graphical animation. c. Click Cancel to exit the dialog box. (You will use it later in the labs.) d. As a result of clicking Cancel, no modifications to the Ellipse object will be retained. Applying Color Links Color can be applied to the dynamic properties of lines, rectangles, round rectangles, ellipses, polylines, polygons, and text. The color palette is used to select the colors to be linked to the value of the tagname or the tagname’s alarm state, among other features. You can also create custom color palettes. When a color link is attached to an object or symbol, click on a color box in a link dialog box to open the color palette. Click the desired color in the palette. The palette closes and the selected color will appear in the color box. Click to expand for Classic Colors Palette 125. Section 1 – Animation Links Overview 4-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Accessing the Tag Browser When creating animation links, access the Tag Browser to quickly view all of the tags defined in your application. If you select the tag to be assigned to your link from the Tag Browser, it is automatically inserted into the Tagname or Expression box. a. Double-click the Button object in the Scratch window. The Animation Links Selection dialog box appears: b. Click the Touch Pushbuttons / Discrete Value button. The Object Type dialog box appears: c. Click the Clear button to remove any text in the Tagname field. d. Double-click in the Tagname field. 126. 4-6 Module 4 – Animation Links Wonderware Training The Tag Browser appears: e. Select the target tag and click OK. The tag will be inserted into the Tagname or Expression box. Note: This animation, Discrete Value, requires a discrete tag to be selected. Cutting, Copying, Pasting, and Clearing Object Links WindowMaker's link paste buffer is a temporary storage area, storing links that can be cut or copied from an object. (The buffer only stores the links for your most recent cut or copy action.) The links stored in the link paste buffer can be pasted to any object or symbol. If multiple objects are selected, the links are pasted to each individual object. If a pasted link has no apparent value to the object (e.g., a line color link on a text object), the link is not pasted. a. Select the object to which you want to apply the links. b. From WindowMaker, click Edit / Links then select Cut, Copy, Paste, or Clear. 127. Section 1 – Animation Links Overview 4-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Accessing Tagname Dot Fields A Dot Field contains properties of a tag that extend beyond properties such as tagname or value. Note: Dot Fields are used extensively in Module 6, “Alarms”. They are included here as a part of the Tag Browser interface overview. To use a .field with the selected tagname, open the Dot Field drop-down list, select the .field and then click OK. The Dot Field list is accessed through the tag browser when configuring animation links or during script editing. The following figure displays the Dot Field: drop-down list from within the tag browser: To display a tag's database definition, enter the tagname in the Tagname or Expression box of the Object Type dialog box and double-click it. The Tagname Dictionary dialog box will appear displaying the tagname's definition. Accessing Tagname Dot Fields Through the Choose Field Name Dialog Box a. Double-click the Ellipse object in the Scratch window. The Animation Link Selection dialog box appears. b. Click the Miscellaneous / Visibility button. The Object type dialog appears. c. Enter $AccessLevel. (include the period) in the Expression field. d. Double-click to the right of the period (.) in the Expression: field. 128. 4-8 Module 4 – Animation Links Wonderware Training The Choose field name... dialog box appears: This dialog box displays all tagname .fields. Note that not all .fields are valid for all tags. e. Select the AlarmEnabled .field. The dialog box will close and the selected .field is automatically inserted into the Tagname or Expression input box. f. Click the upper Cancel button to exit the Object type dialog box. g. As a result of clicking Cancel, no modifications to the Ellipse object will be retained. (No modifications are needed at this point. You will make changes during a later lab.) 129. Section 2 – Animating Objects 4-9 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Animating Objects This section describes InTouch animation link options. It also demonstrates importing windows and sharing animations across windows. Introduction The following information describes InTouch animation options. Your instructor will demonstrate the various animation link options. At the conclusion of this section, you will import a pre-configured InTouch window during an instructor-led task. The window is used to configure and share animation links across windows in subsequent labs. Section Objectives Identify animation link options Animate objects by applying the links Import and share animations across windows 130. 4-10 Module 4 – Animation Links Wonderware Training Using the Animation Links Selector Dialog Box Animation links are configured from the Animation Links Selection dialog box. Link buttons attach your link to the selected object If a link is not applicable for the selected object, the button is disabled Only checking the link check box does not result in a configured link Click the link name button to select the link and open its Detail Definition dialog box Uncheck the link checkbox to remove a configured link from the selected object The check box is automatically selected when you click the link name button and accept the link configuration Note: You will not be able to modify the definition of the default link unless you click the button. Click OK to accept all links for the object and close the dialog box When creating animation links, tagname(s) entered in the animation link's Tagname or Expression field should already be defined in the Tagname Dictionary If it is not defined, a message box will appear asking you to define the tag. If you click Yes, the Tagname Dictionary will appear and the tag can be defined. 131. Section 2 – Animating Objects 4-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Touch Links Touch Links are used on objects or symbols to make them "touch-sensitive" (i.e. active) in Runtime. They enable operator input into the system. For example, the operator may turn a valve on or off, enter a new alarm setpoint value, run a complex logic script, log on using text strings, and so on. Touch links are easily identified at Runtime. A halo surrounds a touch-sensitive object when the cursor passes over it. The TAB key can be used to move from touch-sensitive object to touch- sensitive object. If a touch link object or symbol contains text objects that are placed on top of each other, the top text object will be used to display the data value. The operator activates a touch-sensitive pushbutton by clicking it, touching the object (when using a touch screen), pressing an assigned key equivalent or pressing the Enter key when the object is active. Note: If the object or symbol used for these links (with the exception of 3-D buttons) contains a text field, all attributes currently set for text, (such as justification, style, font) are applied when the text object is displayed in WindowViewer. When a text field is used for inputting the value, the output value will also be displayed unless the Input Only option in the respective tag's Detail area of the Tagname Editor dialog box is enabled. 132. 4-12 Module 4 – Animation Links Wonderware Training User Inputs Used to create touch-sensitive objects that enable operator input into the system. Examples: Pushbuttons to change discrete states, analog values, or security logons. There are three types of User Input touch links. User Inputs – Discrete Tagname: Enter a Discrete-type tagname. Key equivalent area: Assign a keyboard equivalent to the link. Clicking the Key button displays the Choose key... dialog box. Note: Select CTRL and/or SHIFT if the operator needs to hold down either or both of these keys when pressing the key equivalent. Msg to User: Enter the message to appear in the input dialog box when the input link is activated. User Inputs Description Discrete Used to control the value of a discrete tag. When this link is activated, a dialog box appears prompting the operator to make a selection. Analog Used to input the value of an analog (integer or real) tag. When the link is activated, an input box for entering the value will appear or an optional on-screen keypad will appear. String Used to create an object into which a string message may be input. When the link is activated, an input box for entering the message value or an optional on-screen keyboard will appear. 133. Section 2 – Animating Objects 4-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Set Prompt and Reset Prompt: Enter the messages the operator will see on the discrete value dialog box On and Off buttons. On Message and Off Message: Enter the messages to appear in the text field (if any) associated with the object when the object is in the on or off state. Input Only: Prevents the input from being displayed in a text field associated with the object. This option only applies to an object that has a text field associated with it. User Input – Analog Note: If a text field is being used for this link, it must be formatted properly in order to accurately display the analog (integer or real) output value. Tagname: Enter an analog (integer or real) type tagname. Key equivalent area: Assign a keyboard equivalent to the link. Msg to User: If you are displaying the optional keypad when this link is activated, enter the prompt message to appear in the keyboard. Keypad? Area: Yes: Displays an on-screen numeric keypad for inputting the new value of the string. Note: If a touch screen is being used and the keyboard is unavailable to users, you should select Yes in the Keypad? area. Min Value: Enter the minimum input value for the tag. Max Value: Enter the maximum input value for the tag. The Min/Max values limit the range of values the operator may input within the values of the actual tag. Input Only: Prevents the input from being displayed in a text field associated with the object. This option only applies to an object that has a text field associated with it, such as a 3 dimensional button. 134. 4-14 Module 4 – Animation Links Wonderware Training User Inputs – String Tagname: Enter a Message Type tagname. Key equivalent area: Assign a key equivalent to the link. Keypad? area: Yes: Displays an on-screen keyboard for inputting the new string. Msg to User: If you are displaying the optional keypad when this link is activated, enter the prompt message to appear in the keyboard. Echo Characters? If you want the input string to appear on the screen as it is typed, select Yes. If the data is sensitive (for example, a password) and should not be visible on the screen, select No. Password Char: Assign the character that should display to obscure password input. Input Only: Prevents the input from being displayed in a text field associated with the object. This option only applies to an object that has a text field associated with it, such as a 3 dimensional button. Note: When WindowViewer is started, the string will display the text you entered in the Initial Value box when you defined the tag link to this object. Encrypt: Should not be checked for a tag which is to be used as an input to the logon dialog box. If the tag is encrypted, and used as password for security, it will not work. When the user enters the value of the tag it is encrypted, and when an encrypted string is used for logging on, it will fail. Tip: You can use the script function StringCompareEncrypted() to compare password strings for additional security. 135. Section 2 – Animating Objects 4-15 InTouch® HMI 9.5 Fundamentals of Application Development Course On-Screen Keyboards (and Keypads) Three different keyboards are supported in InTouch: the traditional InTouch keyboard, a new Wonderware resizeable keyboard that also supports configurable fonts, and the Microsoft supplied Windows keyboard. The on-screen keyboards are configured on the General tab of the WindowViewer Properties dialog box. Note: The keyboard you select also applies to the numeric keypad for user input analog links. For example, if you choose the new Wonderware resizeable keyboard, the keypad will also be resizeable. If you choose the Windows keyboard, no separate keypad will be used because it is included on the standard Windows keyboard. 136. 4-16 Module 4 – Animation Links Wonderware Training To use an on-screen keyboard, follow steps similar to these: a. Configure which keyboard should be used, in Special / Configure / WindowViewer / General tab. b. Place a Text object in your window. c. Assign the animation link Touch Link / User Inputs / String. d. Configure the animation with a Memory Message tag in the Tagname and Keypad? Yes. e. Go to Runtime f. Click on the Default Text object. The keyboard appears. InTouch Keyboard 137. Section 2 – Animating Objects 4-17 InTouch® HMI 9.5 Fundamentals of Application Development Course InTouch Keypad 138. 4-18 Module 4 – Animation Links Wonderware Training Windows Keyboard The advantage of using the Windows keyboard is that it supports international settings. However, it is not resizeable so it may be too small for touch screens, and it does not support a separate numeric keypad. Resizeable Keyboard and Keypad Clicking the Options button when configuring the Resizeable Keyboard opens the Font dialog box where you can define the font that the keyboard will use. Configure in Special / Configure / WindowViewer Resizeable in Runtime 139. Section 2 – Animating Objects 4-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Sliders Slider Touch Links are used to create objects or symbols that can be moved around the window with a mouse or other pointing devices (e.g., a finger on a touch screen). As the object or symbol is moved, it alters the value of the tag linked to it. This link provides the ability to create devices for setting system values. An object may have a horizontal slider touch link, a vertical slider touch link, or both. By using both links on a single object, the value of two analog tags can be altered simultaneously. Vertical and Horizontal Sliders At Top / At Bottom: Enter the value for the tag at its farthest position Up / Down: Enter the number of pixels the slider can move At Left End / At Right End: Enter the value for the tag at its farthest position To Left / To Right: Enter the number of pixels the slider can move Tagname: Enter an analog (integer or real) type tagname. Reference Location: Location on the object where the cursor will lock when moving the object. Tip: Click Ruler to have a visual indication of the number of pixels to move an object. 140. 4-20 Module 4 – Animation Links Wonderware Training Touch Pushbuttons Touch Pushbutton - Touch Links are used to create object links that immediately perform operations when clicked with the mouse or touched (touch screen). These operations can be Discrete Value Changes, Action Script executions, Show or Hide Window commands. There are four types of Touch Pushbutton links. Touch Pushbuttons – Discrete Value Tagname: Enter a discrete-type tagname. Key equivalent area: You can assign a specific key on the keyboard to activate certain animation links. The key equivalent is only operational when the object with the link is visible or selected. If the object has a Visibility or Disable link, the key equivalent is not active when the object is invisible or disabled. You can define the same key in multiple windows. However, the definition in the most recently opened window will be the active one. In the case of overlay windows, the key will be active in the window on top. Note: If any object or action pushbutton in the active window is assigned to the same key used for a Key Action Script, the key equivalent link on the key in the active window will take precedence over the execution of the Key Action Script. Key: Assigns a key equivalent to the link. User Input Description Discrete Value Used to make any object or symbol into a pushbutton that controls the state of a discrete tagname. Pushbutton actions include Direct (momentary on), Reverse (momentary off),Toggle, Reset, and Set. Action Allows any object, symbol or button to have up to thirteen different action scripts linked to it (see Module 5, “Touch Action Scripts,” page 4-11.) Action scripts are used to set tags to specific values, show and/or hide windows, start and control other applications, execute functions, and so on. Show Window Allows an object, symbol or button to open one or more windows when it is clicked. Hide Window Allows an object, symbol or button to close one or more windows when it is clicked. 141. Section 2 – Animating Objects 4-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Action area: Direct: Sets the tag value equal to 1 (True, On, Yes) as long as the pushbutton is pressed and held down. The value automatically resets to 0 (False, Off, No) when the button is released. Reverse: Sets the tag value equal to 0 (False, Off, No) when the pushbutton is pressed and held down. The value automatically resets to 1 (True, On, Yes) when the button is released. Toggle: Reverses the state of the discrete tag when it is pressed, e.g., if the tag is equal to 1 and the button is pressed, it is set to 0 and vice-versa. Reset: Sets the value equal to 0 (False, Off, No) when the pushbutton is pressed. Set: Sets the value equal to 1 (True, On, Yes) when the pushbutton is pressed. Touch Pushbuttons – Action Action scripts are covered further in the next chapter. This is an example of the action script dialog that appears when you assign a Touch Pushbutton - Action. Scripts are covered in detail in Module 5, “InTouch QuickScripts.” 142. 4-22 Module 4 – Animation Links Wonderware Training Touch Pushbuttons – Show Window When you assign the animation Touch Pushbutton - Show Window, the dialog box will appear with a list of all the windows in your application. Touch Pushbuttons – Hide Window When you assign the animation Touch Pushbutton - Hide Window, the dialog box will appear with a list of all the windows in your application. 143. Section 2 – Animating Objects 4-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Appearance of Hotlinks in Runtime Hotlink behavior allows the “halos” around hotlinks in Runtime to be enabled or disabled, to show around ActiveX controls, or configured to follow the shape of the hotlink object as shown below. Note: Halos do not follow the shape of an object if the object is a cell or symbol. The hotlink behavior is configured on the General tab of the WindowViewer Properties dialog box: Halo follows object shape Show Halo around Hotlink Set options 144. 4-24 Module 4 – Animation Links Wonderware Training Display Links Display Links provide output to the operator. There are eight types of display links as circled in the previous figure. 145. Section 2 – Animating Objects 4-25 InTouch® HMI 9.5 Fundamentals of Application Development Course Line, Fill, and Text Color Color links are used to animate the Line Color, Fill Color, and Text Color attributes of an object. Note: You must use solid colors for line and text color links. If you select a dithered (mixed) color, WindowMaker will select the closest solid color. To avoid dithered colors, your video card must have at least 2MB and your color depth settings must be higher than 256 colors, such as 32K or 65K (sometimes called "high color” or “true color".) Each of these color attributes may be made dynamic by defining a color link for the attribute. The color attribute may be linked to the value of a discrete expression, analog expression, discrete alarm status or analog alarm status. There are four types of line, fill, and text color links: User Input Description Discrete Used to control the fill, line, and text color attributes of an object or symbol that is linked to the value of a discrete expression. Analog Line, fill, and text color of an object or symbol can be linked to the value of an analog tag (integer or real) or an analog expression. Ten value ranges are defined by specifying nine breakpoints. Ten different colors can be selected which will be displayed as the value range changes. Discrete Alarm Text, line, and fill color of an object can be linked to the alarm state of a tag, Alarm Group or Group Variable. This color link enables a choice of two colors: one for the normal state and one for the alarm state of the tag. This link can be used for both analog and discrete tags. If used with an analog tag, it responds to ANY alarm condition of the tag. Analog Alarm Text, line, and fill color of an object can be linked to the alarm state of an analog tag, Alarm Group or Group Variable. This allows a specific color to be set for the normal state and a separate color for each alarm condition defined for the tag. 146. 4-26 Module 4 – Animation Links Wonderware Training Discrete Line / Fill / Text Color Note: All Line / Fill / Text Color links are configured in the same way. Expression: Enter a discrete tagname or an expression that equates to True or False. An expression can be up to 1023 characters. If you need to use a larger expression, create a QuickFunction and call it in your expression. Discrete expressions can also contain Analog Tagnames. For example, TankLevel >= 75. When the value of the tag TankLevel is greater than or equal to 75, the fill color of the object changes. Right-click the Expression field to view the commands that can be applied to selected text. Colors area: Click each color box and select a color from the palette for each tag state. 147. Section 2 – Animating Objects 4-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Analog Line / Fill / Text Color Expression: Enter an Analog integer or real tagname, or an expression that equates to an analog value. Break Points: Specify the breakpoint values (decimals are valid for real-type tags) where the object will change color. Use the Tab key to move from value to next value. Color: Click each color box to select a color for each breakpoint. Discrete Alarm Line / Fill / Text Color Tagname: Enter the discrete tagname whose alarm status is to be associated with the object. Colors area: Click each color box to select a color for each state. 148. 4-28 Module 4 – Animation Links Wonderware Training Analog Alarm Line / Fill / Text Color Tagname: Enter the analog (integer or real) tagname whose alarm status is to be associated with the object. Alarm Type area: Select the alarm type to associate with the object. Three mutually exclusive types of analog color links available. Value Alarm – Up to five different colors can be selected, depending on the status of the value alarms defined for the tag. Deviation – Up to three different colors can be selected, depending on the status of the deviation alarms defined for the tag. 149. Section 2 – Animating Objects 4-29 InTouch® HMI 9.5 Fundamentals of Application Development Course ROC (Rate-of-Change) – Two different colors can be selected, depending on the status of the rate-of-change alarm defined for the tag. 150. 4-30 Module 4 – Animation Links Wonderware Training Object Size Links Object Size links are used to vary the height and/or width of an object according to the value of an analog (integer or real) tag or analog expression. Size links provide the ability to control the direction in which the object enlarges in height and/or width by setting the anchor for the link. Both height and width links can be attached to the same object. Note: Height and width links are created the same way. Height or Width Link Expression: Enter an analog (integer or real) tagname or an expression that equates to an analog tag value. Value at Max Height / Width: Enter the tag value or expression that will result in the object reaching its maximum size. Value at Min Height / Width: Enter the tag value or expression that will result in the object reaching its minimum size. Max % Height / Width: Enter a percentage value (0-100) of its size that the object will be when the tag or expression reaches the value at maximum size. 151. Section 2 – Animating Objects 4-31 InTouch® HMI 9.5 Fundamentals of Application Development Course Min % Height / Width: Enter a percentage value (0-100) of its size that the object will be when the tag or expression reaches the value at minimum size. Note: The percent height figures are expressed as a percentage of the actual drawn size of the object, which is 100%. Anchor: The point from which the object will enlarge in size. Location Location Links are used to make an object automatically move horizontally, vertically, or in both directions in response to changes in the value of an analog tag or expression. Note: Horizontal and Vertical Location links are created the same way. Vertical or Horizontal Expression: Enter an analog (integer or real) tagname or an expression that equates to an analog value. At Top / Left End: Enter the tag value when the object is located at its farthest position. At Bottom / Right End: Enter the tag value when the object is located at its farthest position. Up / To Left: Enter the number of pixels the object can move away from its drawn position. Down / To Right: Enter the number of pixels the object can move away from its drawn position. 152. 4-32 Module 4 – Animation Links Wonderware Training Percent Fill Links Percent Fill Links are used to vary the fill level of a filled shape (or a symbol containing filled shapes) according to the value of an analog tagname or an expression that computes to an analog value. For example, this link may be used to show the level of liquids in a vessel. An object or symbol may have a horizontal fill link, a vertical fill link or both. Note: Vertical and Horizontal Percent Fill links are created the same way. Vertical or Horizontal Expression: Enter an analog (integer or real) tagname or an expression that equates to an analog value. Value at Max Fill: Enter the value that will result in the object being filled to its maximum level. Value at Min Fill: Enter the value that will result in the object being filled to its minimum level. Max % Fill: Enter a percentage value (0-100) that the object will be filled when the expression reaches the level set in the Value at Max Fill box. If the value of the expression is greater than this number, it will be ignored. Min % Fill: Enter a percentage value (0-100) that the object will be filled when the expression reaches the level set in the Value at Min Fill box. If the value of the expression is less than this number, it will be ignored. 153. Section 2 – Animating Objects 4-33 InTouch® HMI 9.5 Fundamentals of Application Development Course Direction: Fill starts here and moves from bottom to top / top to bottom / left to right / right to left Background Color: Select a color. This Background Color selection is for the color of the unfilled portion of the object. The actual fill color is the color selected for the object when it is drawn. If both Vertical Percent Fill and Horizontal Percent Fill links are linked to the same object, the last color selected in either of their link dialog boxes will be used as the background color. Miscellaneous Links There are five miscellaneous links: Visibility Expression: Enter a discrete tagname or an expression that equates to a discrete value. Visible State: On: Object is visible when the value of the expression is TRUE. Off: Object will be visible when the value of the expression is FALSE. Misc Link Description Visibility Used to control the visibility of an object based on the value of a discrete tag or expression. Blink Used to make an object blink based on the value of a discrete tag or expression. Orientation Used to make an object rotate based on the value of a tag or expression. Disable Used to disable the touch functionality of objects based on the value of a tagname or expression. Tooltip Used to display a standard Windows tooltip in Runtime when the cursor rests on an object. You can use either a Memory Message tag or Static Text for the tooltip. 154. 4-34 Module 4 – Animation Links Wonderware Training Blink Expression - Blink When: Enter a discrete tagname or an expression that equates to a discrete value. Blinked Attributes area: Blink Invisible: Object/symbol blinks by disappearing and appearing in the window. Blink visible with these attributes: Object/symbol remains visible in the window and the color change attributes selected creates the blinking effect. Text Color, Line Color and Fill Color: Select a color. Selecting a fill blink color that is the same as the object's fill color will not allow the object to blink. 155. Section 2 – Animating Objects 4-35 InTouch® HMI 9.5 Fundamentals of Application Development Course Blink Speed: Slow, Medium, and Fast speeds are configurable by selecting the Special / Configure / WindowViewer command. The WindowViewer Properties dialog box General tab field contains the Blink Frequency group. Note: Any changes made to these settings are global and will affect the blink speeds of all blink links throughout your application. 156. 4-36 Module 4 – Animation Links Wonderware Training Orientation Expression: Enter an analog (integer or real) tagname or an expression that equates to an analog value. Value at Max CCW: Enter the value the expression must be for the object to be rotated to its maximum counter-clockwise position. If the value of the expression is greater than this number, it will be ignored. Value at Max CW: Enter the value the expression must be for the object to be rotated to its maximum clockwise position. If the value of the expression is greater than this number, it will be ignored. CCW Rotation: Enter the degrees the object will rotate counter-clockwise when the Value at Max CCW is reached. CW Rotation: Enter the degrees the object will rotate clockwise when the Value at Max CW is reached. Objects are rotated clockwise or counter-clockwise based on the original position in which they were drawn in WindowMaker. Tip: To force an object to a specific angle, simply set Value at Max CCW to 360, Value at Max CW to 0, CCW Rotation to 360 and CW Rotation to 0. Then enter the angle value (e.g., 90) in the Expression box. Remember, without a tagname, this expression will never change and the object will always hold its 90 degree position. Note: The text object orientation can be set in WindowMaker in 90 degree increments, but not rotated in WindowViewer on a tagname value. X Position: Enter the number of pixels the rotation center-point is to be moved horizontally from the center-point of the object. Positive values are to the right of center. The orientation link uses the center of the object or symbol as the center of rotation. Y Position: Enter the number of pixels the rotation center-point is to be moved vertically from the center-point of the object. Positive values are below the center point. Negative values are above the center point. 157. Section 2 – Animating Objects 4-37 InTouch® HMI 9.5 Fundamentals of Application Development Course Disable The disable link is very useful when you are applying security to your application. For example, you can disable objects based on the logged on operator's access level or name. When Disable is used, any InTouch links will be disallowed while the Disable condition is true. The Disable link is used in Module 10, “Security.” Expression: Enter a discrete tagname or an expression that equates to a discrete value. Using the expression shown in the previous figure, if no one is logged on, the object or button is secured from tampering. Disabled State: Turns the functionality of the object on or off when the discrete tag or expression is true. A disabled state of On means the touch functionality of the object or button are turned off and cannot be clicked as long as the expression is true. A disabled state of Off means the touch functionality of the object or button is turned off and cannot be clicked as long as the expression is false. Tooltip The Tooltip animation displays a standard Windows tooltip in Runtime when the cursor rests on an object. You can either assign a Message tag in the Expression field, or a Static text for the tooltip. Example: $AccessLevel == 0 OR $Operator == “None” 158. 4-38 Module 4 – Animation Links Wonderware Training Value Display Links Value Display Links allow text objects to display the value of a discrete, analog, or string tagname. There are three types: Value Display - Discrete Expression: Enter a discrete tagname or an expression that equates to a discrete value. On Message: Enter the message that will be displayed when the value of the discrete expression equals 1 (TRUE, On, Yes). Off Message: Enter the message that will be displayed when the value of the discrete expression equals 0 (FALSE, Off, No). The messages will be displayed in the location of the original text object using the font, size, color, alignment and linked attributes set for that object. The original contents of the field have no effect on the displayed message at Runtime. You can also use a Value Display Output -> String Expression link to display the on and off messages for a discrete tag. For the link, you would enter the following expression: DText (Pump, Pump.OnMsg, Pump.OffMsg); In this expression, the .OnMsg and .OffMsg strings will be extracted from the InTouch Tagname Dictionary definition for the discrete tag Pump. Value Display Type Description Discrete Uses the value of a discrete tag or a discrete expression to display an On or Off user defined message in a text object. Analog Displays the value of an analog tag or an analog expression in a text object. String Displays the value of a message tag or a string expression in a text object. 159. Section 2 – Animating Objects 4-39 InTouch® HMI 9.5 Fundamentals of Application Development Course Analog Expression: Enter an analog (integer or real) tagname or an expression that equates to an analog value. You can also use a discrete-type tag in this expression. It will simply display a 1 or 0. String Expression: Enter a message tagname or an expression that equates to a message tag. In the above example, the script Text() is used to convert the value of the integer tag TankLevel to a string. Example: “The Tank Level is:” + Text(TankLevel, “#”) 160. 4-40 Module 4 – Animation Links Wonderware Training Importing and Exporting Windows Importing windows from one InTouch application to your current application can save development time. Importing windows also provides you with a quick and easy method for creating remote tagname references. This enables reuse of any previously-created windows, objects and window scripts. When you move windows from one InTouch application to another, you must use the File / Import command. Note: If you attempt to copy InTouch window files by using any other methods (e.g., Windows Explorer copy commands), you may corrupt your application's Tagname Dictionary. a. Close any open windows. b. Click File / Import on the WindowMaker menu. The Import from directory dialog box appears. For this example, you will import a window included with the pre-configured application at wwimport (your instructor will supply the node name of the machine on which the wwimport file resides). c. Click OK. 161. Section 2 – Animating Objects 4-41 InTouch® HMI 9.5 Fundamentals of Application Development Course The Application Data Import Options dialog box appears: d. Select Windows from within the Import Options area. Each import option has detailed import lists. e. Click the Select button for the Windows option. The Windows to Import... window appears: f. Select the Links window. (The Links window is used in the following lab.) g. Click OK. The Application import dialog box reappears. h. Click Import. 162. 4-42 Module 4 – Animation Links Wonderware Training The Links Window is successfully imported into your InTouch application: Exporting Windows Exporting windows is very useful when creating or maintaining a library application or to quickly create remote tag references in another application. When a window is exported, the window file is copied to the selected directory along with an index file. This directory can then be used as a source for importing windows into another application. Note: If you attempt to copy InTouch window files by using any other copy methods (e.g., Windows Explorer copy commands), you may corrupt your application's Tagname Dictionary. Close all windows in your current application. a. Click File / Export Window. The Export to directory... dialog box appears. b. Select the application directory (folder) to which you want to export the window(s). The Windows to Export dialog box appears, enabling selection of the windows in your application. c. Select the window(s) to export and click OK. 163. Section 2 – Animating Objects 4-43 InTouch® HMI 9.5 Fundamentals of Application Development Course Converting Tagnames The following information is included because tag conversion is normally a part of an InTouch import operation. The Links window just imported consists only of graphics and does not include tags, so no conversion is necessary. Note: Tag conversion is demonstrated in Lab 5, “Using InTouch QuickScripts.” When windows are imported/exported to/from your current application, or tags indexed (to take them out of service), all tags associated with that window are transferred with the window. They are not, however, added to your new application's database. Instead, the tagnames are marked as placeholder (index) tags. Note: If tags are not defined in your local Tagname Dictionary when a window is imported, you will be prompted to define them before they can be converted. Click OK if this is the case. The Tagname Dictionary dialog box will appear and each tagname can be defined. The placeholders ?d:, ?i:, ?r:, ?m:, ?g:, ?h:, and ?t: preceding the tagnames indicate the type the tagname was originally defined as: dDiscrete type iInteger type rReal type mMessage type gGroup type hHist Trend type tTag ID type Substituting Tagnames When an object is duplicated, it becomes an exact replica of the original including links, animation, and scripts. However, if you need to use a different tag for an object that has been duplicated, you must change the tagname. In WindowMaker, this operation is called substituting a tagname. Tagnames for objects can be changed at any time, individually or as a group. a. Select the object(s) whose tagname(s) you want to change. b. Press Ctrl+E (Special / Substitute Tags...). c. Enter a new tagname in the New Name box and click OK. The tagname(s) associated with the selected object(s) will automatically be changed. 164. 4-44 Module 4 – Animation Links Wonderware Training – Intentionally left blank – 165. Section 3 – Animation Links – Quick Reference 4-45 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 3 – Animation Links – Quick Reference This quick reference guide summarizes the basic functionality of every animation link. Touch Links Touch Link Types User Inputs Discrete, Analog, String Sliders Vertical, Horizontal Touch Pushbuttons Discrete Value, Action, Show Window, Hide Window User Input Description Discrete Used to control the value of a discrete tagname. When this link is activated, a dialog box will appear prompting the operator to make a selection. Analog Used to input the value of an analog (integer or real) tagname. When the link is activated, an input box will appear and the value may be entered from the standard keyboard or an optional on-screen keypad. String Used to create an object into which a string message may be input. When the link is activated, an input box for entering the message value or an optional on screen keyboard will appear. Slider Touch Link Description Vertical / Horizontal Used to create objects or symbols that can be moved around the window, vertically or horizontally, with a mouse or other pointing devices (e.g., a finger on a touch screen). As the object or symbol is moved, it alters the value of the tagname linked to it. This provides the ability to create devices for setting values in the system. Touch Pushbuttons Description Discrete Value Used to make any object or symbol into a pushbutton that controls the state of a discrete tagname. Pushbutton actions include Direct (momentary on), Reverse (momentary off),Toggle, Reset, and Set. Action Allows any object, symbol or button to have up to thirteen different action scripts linked to it (see Module 5, “Touch Action Scripts,” page 4- 11.) Action scripts are used to set tags to specific values, show and/or hide windows, start and control other applications, execute functions, and so on. Show Window Allows an object, symbol or button to open one or more windows when it is clicked. Hide Window Allows an object, symbol or button to close one or more windows when it is clicked. 166. 4-46 Module 4 – Animation Links Wonderware Training Display Links Display Links Types Line, Fill & Text Color Discrete, Analog, Discrete Alarm, Analog Alarm Object Size Height, Width Location Horizontal, Vertical Percent Fill Horizontal, Vertical Miscellaneous Visibility, Orientation, Blink, Disable, Tooltip Value Display Discrete, Analog, String Color Link Description Discrete Used to control the fill, line and text color attributes of an object or symbol that is linked to the value of a discrete expression. Two colors may be selected, one for the True state, and one for the False state. Analog Line, fill, and text color of an object or symbol can be linked to the value of an analog tagname (integer or real) or an analog expression. Ten value ranges are defined by specifying nine breakpoints. Ten different colors can be selected which will be displayed as the value range changes. Discrete Alarm Text, line, and fill color of an object can be linked to the alarm state of a tagname, Alarm Group or Group Variable. This color link allows a choice of two colors: one for the normal state and one for the alarm state of the tagname. This link can be used for both analog and discrete tagnames. If used with an analog tagname, it responds to any alarm condition of the tagname. Analog Alarm Text, line, and fill color of an object can be linked to the alarm state of an analog tagname, Alarm Group or Group Variable. This allows a specific color to be set for the normal state and a separate color for each alarm condition defined for the tagname. Object Size Description Analog (integer or real) tagname or analog expression Used to vary the height and/or width of an object according to the value of an analog (integer or real) tagname or analog expression. Size links provide the ability to control the direction in which the object enlarges in height and/or width by setting the ‘anchor’ for the link. Both height and width links can be attached to the same object. Location Links Description Analog Used to make an object automatically move horizontally, vertically or in both directions in response to changes in the value of an analog tagname or expression. Percent Fill Description Horiz/Vert Fill Used to vary the fill level of a filled shape (or a symbol containing filled shapes) according to the value of an analog tagname or an expression that computes to an analog value. For example, this link may be used to show the level of liquids in a vessel. An object or symbol may have a horizontal fill link, a vertical fill link or both. 167. Section 3 – Animation Links – Quick Reference 4-47 InTouch® HMI 9.5 Fundamentals of Application Development Course Misc Link Description Visibility Used to control the visibility of an object based on the value of a discrete tagname or expression. Blink Used to make an object blink based on the value of a discrete tagname or expression. Orientation Used to make an object rotate based on the value of an analog tagname or expression. Disable Used to disable the touch functionality of objects based on the value of a discrete tagname or expression. Tooltip Used to display a standard Windows tooltip in Runtime when the cursor rests on an object. Value Display Description Discrete Uses the value of a tag or discrete expression to display an On or Off user-defined message in a text object. Analog Displays the value of a tag or an analog expression in a text object. String Displays the value of a tag or a string expression in a text object. 168. 4-48 Module 4 – Animation Links Wonderware Training – Intentionally left blank – 169. Lab 3 – Configuring Animation Links 4-49 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 3 – Configuring Animation Links Introduction In this lab, you will use the Animation Selection dialog box to create animation links and configure specific actions that will take place based upon the status of certain events. Objectives Upon completion of this lab, you should be able to: Open the Links Window Share graphics between windows Animate the Valve1 Symbol Animate the Disc1 Button Animate a Slider Animate the RealTag Text field Add a Percent Fill link Configure Ellipse Object Links Configure Escalator Object Links Preparation The Links window should have been imported to your application from the wwimport directory on the instructor (or other) machine. If you have not completed this step, follow the instructions in the instructor-led task “Importing and Exporting Windows” on page 4-40. 170. 4-50 Module 4 – Animation Links Wonderware Training Open the Links Window 1. In the Application Explorer tree structure of WindowMaker, click the + next to Windows to expand the list of available windows. 2. Double-click Links to open the newly imported window. The Links window appears similar to the following figure. Note: DO NOT break any cells or symbols to complete this lab. 171. Lab 3 – Configuring Animation Links 4-51 InTouch® HMI 9.5 Fundamentals of Application Development Course Share Graphics Between Windows 3. Open the Scratch window. 4. Copy the Valve symbol and its button. Note: If necessary, convert the Valve objects, including the text object, to a symbol. This can be done before or after the copy/paste operation. 5. Close the Scratch window. 6. Paste the Valve and its button in the Links Window. Your pointer will display as: 7. Click once in the upper left area of the Links window to place the valve. 8. Adjust positioning and size. 172. 4-52 Module 4 – Animation Links Wonderware Training Animate the Valve1 Symbol 9. Double-click the Valve1 symbol. 10. Click the Line Color – Discrete button. The Object type: Symbol dialog box appears: 11. Double-click in the Expression field. The Tag Browser dialog box appears: 12. Select the DiscTag1 tag. 13. Click OK. 173. Lab 3 – Configuring Animation Links 4-53 InTouch® HMI 9.5 Fundamentals of Application Development Course The tagname appears in the Expression field: 14. Click the 1,TRUE,On: color box and assign GREEN with the color palette. 15. Click the 0,FALSE,Off: color box and assign RED with the color palette. 16. Click the bottom OK button. 17. Attach the Fill Color and Text Color of the symbol to the DiscTag1 tag using the previous steps. 18. Click OK when finished with each animation link, and click the top OK when all three are assigned. 174. 4-54 Module 4 – Animation Links Wonderware Training Animate the DiscTag1 Button 19. Double-click the DiscTag1 button. 20. Define it as a Touch Link / Touch Pushbutton / Discrete Value with a Direct action. 21. Assign it to DiscTag1. 22. Click the top OK button. Animate the Valves and Buttons 23. Select the Valve1 symbol and the DiscTag1 button. 24. Duplicate the valve symbol and button by clicking the duplicate button. Place the valves side by side: 25. Select the second valve and its button, and choose Special / Substitute Strings (CTRL+L). 26. Change the text to DiscTag2 and the button label to Valve2. 27. Click OK. 175. Lab 3 – Configuring Animation Links 4-55 InTouch® HMI 9.5 Fundamentals of Application Development Course The valves and buttons should appear similar to the following figure: 28. Double-click Valve2 and define Line Color, Fill Color, and Text Color to DiscTag2. Use BLUE for the 1,TRUE, On colors and BLACK for the 0,FALSE,Off colors. Note: Since all animation links from the Valve1 symbol and DiscTag1 button are preserved in the new objects, clicking the lower OK in the Tag Editor dialog box returns you to the Animation Links Selector dialog, from where you can easily select another tag animation link. When the animation links are completed, click OK in the upper part of the dialog box to save the links and close the dialog box. 29. Define the DiscTag2 button as a User Inputs - Discrete and assign it to DiscTag2. 30. Set Prompts and Messages as shown and click OK. 176. 4-56 Module 4 – Animation Links Wonderware Training 31. Switch to Runtime by clicking once on Runtime! in the upper right corner of the screen. 32. Click the DiscTag pushbuttons. The valves should change color based on their On/Off status. 33. Return to Development mode by clicking once on Development! 177. Lab 3 – Configuring Animation Links 4-57 InTouch® HMI 9.5 Fundamentals of Application Development Course Animate the Slider 34. Double-click the pointer object. 35. Click the Horizontal button in the Sliders area of the Animation Selection dialog box. 36. Configure the slider with the attributes shown in the following figure: 37. Click OK. 38. To validate the To Right / Horizontal Movement, select the indicator bar. The width of the bar appears at the bottom of the WindowMaker window. 178. 4-58 Module 4 – Animation Links Wonderware Training Animate the RealTag Text Field 39. Double-click the RealTag = # text field. 40. Click the Analog button in the Touch Links / User Inputs section of the Animation Selection dialog box. 41. Configure the link to match the following figure: 42. Click OK. Add a Percent Fill Link 43. Double-click the blue Value Indicator bar on the Slider object. 44. Select Percent Fill / Horizontal. 179. Lab 3 – Configuring Animation Links 4-59 InTouch® HMI 9.5 Fundamentals of Application Development Course 45. Define the Horizontal Percent Fill link to match the following figure (background color is optional). 46. Click the top OK button. 47. Switch to Runtime. 48. Slide the pointer by clicking and holding the left mouse button. The values along the indicator bar should match the values displayed for the tag. 49. Click on the value display. The frame becomes active and an input field appears: 50. Enter a value different than the one displayed and press Enter (in this example, the value is set at 200). 180. 4-60 Module 4 – Animation Links Wonderware Training The value indicator should move. You should see the percent fill link work on the indicator bar. The RealTag = display now displays 200. 51. Return to Development. Configure Ellipse Object Links 52. Double-click the Ellipse object and assign the following Link attributes: Link Selection Object Size - Height Expression RealTag Value at Max Height 1000 Value at Min Height 0 Max % Height 100 Min % Height 0 Anchor Middle Link Selection Object Size - Width Expression RealTag Value at Max Width 1000 Value at Min Width 0 Max % Width 100 Min % Width 0 Anchor Center Link Selection Fill Color - Analog Expression RealTag Break Points 100, 200, 300, 400, 500, 600, 700, 800, 900 Color 9 colors of your choice 181. Lab 3 – Configuring Animation Links 4-61 InTouch® HMI 9.5 Fundamentals of Application Development Course The following figure shows the Fill Color - Analog configuration: 53. Switch to Runtime. 54. Move the pointer back and forth across the slider. The circle grows, shrinks, and changes colors as the pointer moves. 55. Switch to Development. Configure Escalator Object Links 56. Select the Escalator object. 57. Click the Send to Back button. Notice the image contains several objects. 182. 4-62 Module 4 – Animation Links Wonderware Training 58. Select the Steps object (multiple cubes). 59. Configure the Steps object with the following Link attributes: 60. Select the Railing object (large cell). 61. Click the Bring to Front button. 62. Switch to Runtime and watch the steps appear to move. Link Selection Location - Vertical Expression $Second MOD 10 At Top Value 10 At Bottom 0 Up 25 Down 0 Link Selection Location - Horizontal Expression $Second MOD 10 At Left End 0 At Right End 10 To Left 0 To Right 25 183. Section 4 – Using SmartSymbols 4-63 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 4 – Using SmartSymbols Introduction SmartSymbols integrate object-oriented technology with InTouch graphics to transform them into reusable templates. Changes made to the templates automatically propagate throughout an application, even across multiple networked PC nodes. As a result, engineers spend less time creating, modifying, validating and re-validating HMI applications. Using the SmartSymbol Manager, application developers can create templates from graphics that can connect to ArchestrA Objects, local InTouch tags, and InTouch tags through remote references. These symbol templates are saved in the SmartSymbol Library and can be instantiated by selecting them and dropping them onto an InTouch window. Any graphic in an InTouch window that has been made into a cell can be converted into a SmartSymbol. In addition, libraries of SmartSymbols can be exported to other applications and plants, enabling companies to standardize on graphics throughout the entire organization. Once a SmartSymbol instance is deployed, if users need to change an instance, they simply modify the SmartSymbol template and the change automatically propagates throughout the application, to every window in which the SmartSymbol instance is used. This makes changing, upgrading and modifying applications very fast and easy. Validating and re-validating applications after modification is also simplified with SmartSymbols. SmartSymbol Generation Any graphic can become a SmartSymbol, once it is converted to a cell. However, the most versatile SmartSymbol has tag data references and animation. You may decide to go through your existing InTouch applications to identify similar or identical graphical objects to determine what you should build into your SmartSymbol library. Or, you may decide to create all of your SmartSymbols prior to building any applications. Either way, you must start with a graphic. Section Objectives Generate a SmartSymbol Edit a SmartSymbol Use the SmartSymbol Manager 184. 4-64 Module 4 – Animation Links Wonderware Training Configure the Graphic a. Create or place a graphic in a window. b. Assign a tagname or tagnames to the graphic. c. Configure animation for the graphic. d. Select the entire graphic and choose Make Cell. Generate SmartSymbol a. Right-click on the graphic, and select SmartSymbol / Generate SmartSymbol. The new symbol will appear in the SmartSymbol - Management Mode window, with a name of NewSymbol. b. Click once on NewSymbol and change the name. c. Click Close. WindowMaker prompts you to replace the original cell with the new SmartSymbol: d. Click Yes. 185. Section 4 – Using SmartSymbols 4-65 InTouch® HMI 9.5 Fundamentals of Application Development Course The SmartSymbol now displays open handles in your window. This indicates it is a SmartSymbol, and not just a cell. SmartSymbol Wizard a. Click the SmartSymbol Wizard icon to place a SmartSymbol into your application window. Your cursor changes . b. Highlight the SmartSymbol you wish to place in your application in the InTouch SmartSymbol - Select Mode window, and click OK. 186. 4-66 Module 4 – Animation Links Wonderware Training The SmartSymbol Properties window displays: Template References: The tagname associated with the SmartSymbol you originally generated (Template). Instance References: The tagname associated with the SmartSymbol placed in your InTouch window (Instance). c. In the SmartSymbol Properties window, click the Show Text Strings checkbox. d. Click the ellipses button in the Instance References column. This will access the Tagname Browser. e. Select the appropriate tagname. f. Press the tab key after selecting the Tagname to ensure the selected Tagname is accepted. g. Click OK. 187. Section 4 – Using SmartSymbols 4-67 InTouch® HMI 9.5 Fundamentals of Application Development Course h. The SmartSymbol will appear in your application window. Replace Alternatively, if several Tagnames and Text Strings require the same Instance Reference change, use the Replace feature. a. Click the SmartSymbol Wizard icon to place a SmartSymbol into your application window. Your cursor changes . b. In the SmartSymbol - Select Mode window, highlight the SmartSymbol you wish to place in your application. 3. Click OK. 188. 4-68 Module 4 – Animation Links Wonderware Training The SmartSymbol Properties dialog appears: d. Click the Replace button. The Replace dialog box displays: e. Enter text in the Find what and Replace with fields. f. Click Replace All. 189. Section 4 – Using SmartSymbols 4-69 InTouch® HMI 9.5 Fundamentals of Application Development Course g. Click Cancel when finished. The Tagname and Text String Instance References have changed. h. Click OK. The SmartSymbol displays with the updated Tagname: 190. 4-70 Module 4 – Animation Links Wonderware Training Edit SmartSymbols and Propagate Changes Once you have placed several SmartSymbols into various windows in your application, you may find a change or addition is needed. Rather than finding each instance of that SmartSymbol and applying the change manually, you can instead edit the SmartSymbol, and propagate the changes throughout your application windows. Start SmartSymbol Edit a. Right-click on a blank area of any InTouch application window. b. Choose Start SmartSymbol Edit. (This example shows a SmartSymbol already in the window. At the end of the example, you will see that it changes to reflect the edits made.) 191. Section 4 – Using SmartSymbols 4-71 InTouch® HMI 9.5 Fundamentals of Application Development Course The InTouch SmartSymbol - Select Mode dialog box displays: c. Select the SmartSymbol you wish to edit. d. Click OK. e. Click your cursor on an open area of the window to temporarily place the SmartSymbol during editing. f. Click Break Cell if needed. g. Make your desired changes/additions to the SmartSymbol. 192. 4-72 Module 4 – Animation Links Wonderware Training h. Select the entire object. i. Click the Make Cell icon to make it back into a cell. Cell handles display around the edited SmartSymbol: Added elements and increased total size of SmartSymbol Make Cell when changes complete 193. Section 4 – Using SmartSymbols 4-73 InTouch® HMI 9.5 Fundamentals of Application Development Course End SmartSymbol Edit j. Right-click the cell and choose SmartSymbol / End SmartSymbol Edit. 194. 4-74 Module 4 – Animation Links Wonderware Training Commit Edit k. A list of all windows in your application containing the SmartSymbol displays. Verify the edit should be instantiated to the SmartSymbols on these windows, and choose Commit Edit. Note: When editing a SmartSymbol, keep in mind the following: Increasing the footprint, or total space the SmartSymbol occupies on the window while in edit mode will only affect the footprint of instantiated SmartSymbols if you select Update Size of Symbols in Application. If you do not select Update Size, they will maintain their original size, and the image will automatically adjust to fit within the original space. When you want to update the size of SmartSymbol footprint, select the Anchor Point for rolling out the change Change rolls out to each instance of the symbol 195. Section 4 – Using SmartSymbols 4-75 InTouch® HMI 9.5 Fundamentals of Application Development Course Manage SmartSymbols The SmartSymbol Manager is used for several purposes, including: View SmartSymbol Attributes Organize your SmartSymbols into folders Copy and Delete SmartSymbols Import / Export SmartSymbols View SmartSymbol Attributes When a SmartSymbol is generated, it has certain attributes assigned to it, such as Tagnames and text (strings). These attributes can be changed when instantiating an instance of a SmartSymbol. To view SmartSymbol attributes: a. Click Special / SmartSymbols / Manage SmartSymbol. b. Select a SmartSymbol. c. Click the Attribute List tab on the lower left panel of the window. The attributes for the selected SmartSymbol display: 196. 4-76 Module 4 – Animation Links Wonderware Training Organize SmartSymbols SmartSymbols may be organized in folders by type, category, room, product line, or whatever organization method is meaningful in your company. To organize SmartSymbols, begin by accessing the SmartSymbol Manager. a. Click Special / SmartSymbols / Manage SmartSymbol. The SmartSymbol - Management Mode window displays: b. Click on InTouch Symbols to give the folder focus. c. Click File / New Folder. d. Name the new folder based upon the organization method you have chosen. 197. Section 4 – Using SmartSymbols 4-77 InTouch® HMI 9.5 Fundamentals of Application Development Course e. Drag the SmartSymbol from the InTouch Symbols folder into the appropriate folder. Rename, Copy, Delete, and Recover SmartSymbols Renaming, copying, deleting, and recovering SmartSymbols can all be accomplished in the SmartSymbol Manager. To Rename a SmartSymbol a. Click on the SmartSymbol to give it focus. b. Click Edit / Rename. c. Type in the new name, and press Enter. d. The SmartSymbol displays with the new name. To Copy a SmartSymbol a. Click on the SmartSymbol in the SmartSymbol Manager to give it focus. b. Click Edit / Copy. c. Click on the folder where you want the new SmartSymbol to appear. d. Click Edit / Paste. 198. 4-78 Module 4 – Animation Links Wonderware Training The new SmartSymbol appears. If placed in the same folder as the original, it will be named Copy of . To Delete a SmartSymbol a. Click on the SmartSymbol to give it focus. b. Click File / Delete. The Confirm Symbol Delete window displays. To Recover a Deleted SmartSymbol a. Click on an orphaned instance of that SmartSymbol in an InTouch application window. Note: If a deleted SmartSymbol was never instantiated to an InTouch application window, it cannot be recovered. b. Click Special / SmartSymbol / Recover SmartSymbol. c. The SmartSymbol will generate and display in the SmartSymbol - Management Mode window, with a name of New Symbol. Rename it as appropriate. 199. Section 4 – Using SmartSymbols 4-79 InTouch® HMI 9.5 Fundamentals of Application Development Course Export SmartSymbol Library Your SmartSymbol library can be exported for use in other InTouch applications. a. Access the SmartSymbol Manager. b. Click File / Export. c. Name your SmartSymbol exported file as desired, and place in the desired directory. d. Click Save. The exported SmartSymbol library is now available to import into any InTouch application. Import SmartSymbol Library e. Open the InTouch application you wish to import the SmartSymbols library into. f. Make sure all InTouch Application Windows are closed. g. Click Special / SmartSymbol / Manage SmartSymbols. h. Click File / Import. i. Click on the .www file you wish to import, and click Open. If any SmartSymbols exist in your application with the same name as those being imported, you may choose to Skip them, Overwrite them, or Rename them. j. Click OK. 200. 4-80 Module 4 – Animation Links Wonderware Training – Intentionally left blank – 201. Lab 4 – Using SmartSymbols 4-81 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 4 – Using SmartSymbols Introduction The following lab explains creation and manipulation of SmartSymbols. You will create a new SmartSymbol, edit the SmartSymbol, manage the SmartSymbol and others. In Module 2, a Symbol was generated by creating a graphical object to represent a physical plant object (a valve). In Module 3, a Memory Discrete Tagname was defined for the valve called DiscTag1 to simulate the opening and closing of the valve. In Module 4, you used the animation links to graphically show the valve in an on or off status, as the DiscTag1 value changed from on to off. You also copied the valve and assigned DiscTag2 to it. Now you need to change both valve symbols to show a sensor. Rather than editing each symbol, in the following lab you will change one symbol into a cell, and then into a SmartSymbol and use the new SmartSymbol in your Links window. Objectives Upon completion of this lab, you should be able to: Generate a new SmartSymbol Instantiate the new SmartSymbol Edit the SmartSymbol and propagate changes Manage SmartSymbols 202. 4-82 Module 4 – Animation Links Wonderware Training SmartSymbol Generation Generate SmartSymbol In this lab, you will begin by changing the existing Valve1 graphic into a SmartSymbol. 1. Open the Links window in your InTouch application, if it is not already open. 2. Click on the Valve1 symbol to select it. 3. Hold the Shift key and click on the DiscTag1 button. 4. Click the Make Cell icon . 5. Right-click the new cell, and select SmartSymbol / Generate SmartSymbol. 6. The new SmartSymbol will appear in the SmartSymbol - Management Mode window, with a name of NewSymbol. 7. Click once on NewSymbol. The name field will become editable: 8. Change the name to Valve. 9. Click Close to close the SmartSymbol - Management Mode window. 203. Lab 4 – Using SmartSymbols 4-83 InTouch® HMI 9.5 Fundamentals of Application Development Course WindowMaker prompts you to replace the original cell with the new SmartSymbol. 10. Click Yes. 11. Valve1 in your Links window is now a SmartSymbol, displaying open handles when selected. Edit SmartSymbols and Propagate changes Now you will change the Valve SmartSymbol to show a Sensor. Start SmartSymbol Edit 12. Close the Links window and open the Scratch window. 13. Right-click on a blank area of the window. 14. Choose SmartSymbol / Start SmartSymbol Edit. 204. 4-84 Module 4 – Animation Links Wonderware Training 15. Click your cursor on a blank area of the window to temporarily place the SmartSymbol during editing. 16. Select the Valve SmartSymbol and click OK. The Valve SmartSymbol displays. 17. Click the Wizards icon . 18. Click Symbol Factory, select the Symbol Factory Wizard, and click OK. 19. Click your cursor just above the Valve 1 text. 20. Find Sensor1 within the Sensors Category. Hint: with a Category selected, type SEN. The highlighted Category will jump to Sensors. 205. Lab 4 – Using SmartSymbols 4-85 InTouch® HMI 9.5 Fundamentals of Application Development Course 21. Click Options. 22. Click the Flip Horizontal checkbox, and click the +90 button. 23. Click OK in the Symbol Options window, and OK in the Symbol Factory window. The Sensor displays: Note: You can rotate the Sensor after it has been placed, by breaking the cell and choosing rotate, or by double-clicking the Sensor and going to Options. The latter method will rotate the object within its original footprint, which may not be the desired effect. 24. Select both of the objects, and click the Make Cell icon. 206. 4-86 Module 4 – Animation Links Wonderware Training End SmartSymbol Edit 25. Right-click the cell and choose SmartSymbol / End SmartSymbol Edit. Commit Edit A list of all windows in your application containing the edited SmartSymbol displays. Verify the edit should be propagated to the SmartSymbols on these windows. Any changes to Tagnames are also displayed for verification in the New Symbol References column. The Library Symbol References column values match those in the New Symbol References column, therefore no changes were made. 26. Click the Commit Edit button. 27. Close the Scratch window. Save if prompted. 28. Open the Links window. Notice that Valve2 has not changed. Now, you are on your own. Why didn’t Valve2 show the new Sensor? Hint: Refer to “Replace” on page 4-67. 207. Lab 4 – Using SmartSymbols 4-87 InTouch® HMI 9.5 Fundamentals of Application Development Course Manage SmartSymbols In this section of the lab, you will: View SmartSymbol Attributes Organize SmartSymbols Rename, Copy, Delete, and Recover SmartSymbols Export and Import SmartSymbols View SmartSymbol Attributes 29. Access the SmartSymbol Manager (Special / SmartSymbol / Manage SmartSymbol). 30. Click the Valve SmartSymbol to give it focus. 31. Click the Attribute List tab. The attributes for the Valve SmartSymbol display. 208. 4-88 Module 4 – Animation Links Wonderware Training Organize SmartSymbols 32. Click the InTouch Symbols folder to give it focus (while still in the SmartSymbol Manager). 33. Click File / New Folder. 34. Type Valves and press Enter. 35. Drag the Valve symbol into the new Valves folder. 209. Lab 4 – Using SmartSymbols 4-89 InTouch® HMI 9.5 Fundamentals of Application Development Course Rename, Copy, Delete, and Recover SmartSymbols Rename a SmartSymbol 36. Click on the Valve SmartSymbol to give it focus. 37. Click Edit / Rename. 38. Type the following new name: Valve with Sensor. 39. Press Enter. The Valve is renamed: 210. 4-90 Module 4 – Animation Links Wonderware Training Copy a SmartSymbol 40. Click on the Valve with Sensor SmartSymbol to give it focus. 41. Click Edit / Copy. 42. Click Edit / Paste. 43. Rename the new valve to the following: Valve without Sensor. 44. Press Enter. Now, on your own, Edit the new Valve Without Sensor SmartSymbol, removing the Sensor. Refer to “Edit SmartSymbols and Propagate changes” on page 4-83 for reference. Hint: Use Break Cell while editing. Delete a SmartSymbol 45. Access the SmartSymbol Manager. 46. Click on the Valve with Sensor SmartSymbol to give it focus. 47. Click File / Delete. 48. Click Yes at the Confirm Symbol Delete dialog box. 211. Lab 4 – Using SmartSymbols 4-91 InTouch® HMI 9.5 Fundamentals of Application Development Course Recover a Deleted SmartSymbol 49. Open the Links window in your InTouch application. 50. Click on the Valve1 graphic to give it focus. 51. Click Special / SmartSymbol / Recover SmartSymbol. A SmartSymbol will be generated from the cell, and will display in the SmartSymbol - Management Mode window, with a name of New Symbol. 52. Rename the new SmartSymbol as Valve with Sensor, and press Enter. 53. Move the Valve with Sensor to the Valves folder. Export SmartSymbols. 54. Click File / Export from the SmartSymbol Manager. 55. Save your SmartSymbol library as C:ApplicationsMySmartSymbols.www —your SmartSymbol library is now available to import into any InTouch application. Import SmartSymbols 56. Close any windows in your InTouch application, saving them if needed. 57. Click Special / SmartSymbol / Manage SmartSymbols. 58. Click File / Import. 59. Navigate to the folder location provided by your Instructor. 60. If the Import Preferences window displays, click the Rename imported symbol checkbox. 61. Fill in the Append to symbol name as follows: _Instructor. 62. Click OK. 63. Review the imported SmartSymbols in the SmartSymbol Manager. 212. 4-92 Module 4 – Animation Links Wonderware Training – Intentionally left blank – 213. Module 5 InTouch QuickScripts Section 1 – QuickScript Types 5-3 Section 2 – Working with the Script Editor 5-13 Section 3 – QuickScripts – Quick Reference 5-35 Lab 5 – Using InTouch QuickScripts 5-39 214. 5-2 Module 5 – InTouch QuickScripts Wonderware Training Module Objectives Introduce QuickScripts Introduce QuickScript types Provide QuickScript examples Use the scripting editor to create QuickScripts Create a wide variety of customized and automated system functions using QuickScripts 215. Section 1 – QuickScript Types 5-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – QuickScript Types This section will explain and define the various InTouch QuickScript types. Introduction QuickScript is the name of the scripting language and functionality used in the InTouch environment. The actual scripting language is very similar to PLC languages like IEC611-31 and Structured Text. InTouch QuickScript capabilities allow you to execute commands and logical operations based on specified criteria being met, such as when a key is pressed, a window opens, or a value changes. All InTouch QuickScripts are event-driven, such as a data change, a condition, a mouse click, or a timer. The order of processing is application specific. While it may appear that there is some inherent order in the way multiple scripts initiated by the same event are scheduled, there is no guarantee of any specific order. Therefore, when using QuickScripts, you should not build any dependency on the order of processing. Section Objective Explain and define the various InTouch QuickScript types Script Type Description Application Scripts linked to the entire application Window Scripts linked to a specific window Key Scripts linked to a specific key or key combination on the keyboard Touch Action Scripts associated with an object linked to a Touch Link - Touch Pushbutton - Action animation link Data Change Scripts linked to a tagname and/or tagname.field only Condition Scripts linked to a discrete tagname or expression ActiveX Event Scripts that execute ActiveX control events in Runtime QuickFunctions Scripts you create that can be called from other InTouch QuickScripts or animation link expressions. QuickFunctions can be either synchronous or asynchronous, while all other script types are synchronous only 216. 5-4 Module 5 – InTouch QuickScripts Wonderware Training Application Scripts Application Scripts are linked to the entire application. They can be used to start other applications, create process simulations, calculate variables, and so on. There are three types of Application Scripts. On Startup: Executes once when the application is initially started up. Executes before any window opens or any Runtime initialization occurs. You cannot refer to ActiveX methods, properties or events in an On Startup script. I/O communications are initialized after the Application On Startup script executes. I/O-type tags or remote tagname references cannot be referred to in an On Startup script. While Running: Executes repeatedly at the specified frequency while the application is running. When a While Running script is selected, the Every Msec field becomes active. The field contains the number of milliseconds that must elapse before the script executes. The script will repeatedly execute at the specified frequency. To execute the script immediately, create an identical On Startup script. As long as the condition or event for the While Running script is met, the script will repeatedly execute at the specified frequency. On Shutdown: Executes once when the application is closed. I/O-type tags and remote tagname references will not update in an On Shutdown script. On Shutdown script cannot be used to startup other applications. 217. Section 1 – QuickScript Types 5-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Window Scripts Window Scripts function within a specific window. There are three types of Window scripts. On Show: Executes once when the window is initially opened. While Showing: Executes repeatedly at the specified frequency while the window is showing. When While Showing is selected, the Every Msec field becomes active. The field contains the number of milliseconds that must elapse before the script executes. To execute the script immediately, create an identical On Show script. As long as the condition or event for the While Showing script is met, the script will repeatedly execute at the specified frequency. On Hide: Executes once when the window is hidden. 218. 5-6 Module 5 – InTouch QuickScripts Wonderware Training Key Scripts Key Scripts execute on a specific key or key combinations on the keyboard. They can be used to create global keys for the application, such as returning to a main menu window, logging off the operator, and so on. There are three types of Key Scripts: On Key Down: Executes once when the key is initially pressed. While Down: Executes repeatedly at the specified frequency while the key is held down. When While Down is selected, the Every Msec field is active. The field contains the number of milliseconds that must elapse before the script executes. To execute the script immediately, create an identical On Key Down script. As long as the condition or event for the While Down script is met, the script will repeatedly execute at the specified frequency. On Key Up: Executes once when the key is released. Note: The key equivalents used in the local active windows for Touch Pushbutton - Action scripts override any global Key Scripts with the same key equivalents. 219. Section 1 – QuickScript Types 5-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Touch Action Scripts Touch Action Scripts are similar to Key Scripts, except they are associated with an object linked to a Touch Link - Touch Pushbutton - Action (access the script editor through the animation link selection dialog box.) They are executed when the operator clicks or presses the object or button assigned to the link. There are thirteen types of Touch Action Scripts. The following Touch Action Scripts execute once when the key or button is initially pushed down: On Left Click/Key Down On Right Click On Center Click The following Touch Action Scripts execute repeatedly at the specified frequency while the key or button is held down. When this is selected, the Every Msec field is active. The field contains the number of milliseconds that must elapse before the script executes. While Left/Key Down While Right Down While Center Down The following Touch Action Scripts execute once when the key or button is released: On Left/Key Up On Right Up On Center Up The following Touch Action Scripts execute when the mouse button is double clicked. The key equivalent feature disables when these are selected, since there is no keyboard equivalent for a mouse button double-click action. On Left Double Click On Right Double Click On Center Double Click 220. 5-8 Module 5 – InTouch QuickScripts Wonderware Training The following Touch Action Scripts executes one time when the cursor rests over an object. Script is delayed with the After X msec field. After X msec is the length of time the cursor must be over the object before the script executes. The key equivalent feature is disabled when this condition type is selected, since there is no keyboard equivalent for moving the mouse cursor over an object. On Mouse Over Note: If any object or action pushbutton in the active window is assigned to the same key used for a Key Script, the key equivalent link on the key in the active window will take precedence over the execution of the Key script. Assigning a Key Equivalent to a Script The Key Script editor is different from the other QuickScript editors. Since you are creating scripts that apply to a key, you must specify the key(s) the operator will press to execute the script. Assigning key equivalents to scripts is discussed in Module 4 Section 2, “Animating Objects.” Data Change Scripts Data Change Scripts are linked to a tagname and/or tagname.field only. They are executed once when the value of the tagname or tagname.field changes by a value greater than the value deadband defined in the Tagname Dictionary. Since Data Change Scripts are executed based on a change in a data value, you must specify a tagname or tagname.field in the Tagname[.field] box. Condition Scripts Condition Scripts are linked to a discrete tag or expression that equates to TRUE or FALSE. This type of script is the most widely used script type. Discrete expressions containing analog tagnames can also be used. 221. Section 1 – QuickScript Types 5-9 InTouch® HMI 9.5 Fundamentals of Application Development Course Since Condition Scripts are executed based on a condition being met, you must specify the condition (a discrete tag or expression) in the Condition box. The expression would equate a condition related to a tag to TRUE or FALSE. For example: TankLevel >= 75. When the value of TankLevel is greater than or equal to 75, the script will execute. Note: The value for the condition must transition to become true or false before the script will execute. For example, if the initial value when WindowViewer starts is true, the value must become false and then true again for an On True script to execute. There are four types of scripts that can be applied to a condition: On False: Executes once when the condition transitions to false. While False: Executes repeatedly while the condition is false. Frequency of execution is based upon the value of the Every Msec field. On True: Executes once when the condition transitions to true. While True: Executes repeatedly while the condition is true. Frequency of execution is based upon the value of the Every Msec field. Both While True and While False scripts begin executing after the specified number of milliseconds have elapsed. To cause immediate execution, create duplicate On True and/or On False scripts. All four script types can be applied to the same condition. ActiveX Event Scripts Most ActiveX controls have events associated with them. For example, click, double-click, mouse down, and key press are typical events used in many ActiveX controls. InTouch ActiveX Event scripts support event actions. You can associate one ActiveX Event script to each event. Execute ActiveX control events in Runtime (WindowViewer). Note: Implementation of ActiveX functionality is detailed in the InTouch® HMI 9.5 Advanced Application Development Course. 222. 5-10 Module 5 – InTouch QuickScripts Wonderware Training QuickFunctions QuickFunctions are scripts that are called from other scripts and animation link expressions. The code is stored in one location, allowing all script instances to be updated with one edit session. Reusing QuickFunctions decreases your application maintenance by reducing the amount of duplicate code that is copied and pasted over and over into scripts. The reused code is stored in one script and in one location, thereby supporting update of all script instances with one edit session. QuickFunctions can be defined as asynchronous, so that, when executed, they will run in the background of the main WindowViewer (Runtime) process. This functionality allows WindowViewer to separate time consuming operations (such as SQL database calls) from the main program flow. When a resource-consuming operation needs to be performed, an asynchronous QuickFunction provides an efficient method for all animation links and other InTouch functionality to remain active while the operation executes. Animation link expression boxes are limited to 1023 characters. However, you can create a more complex QuickFunction and then call it from an animation link expression box. This enables the developer to use the CALL statement to call a complex script that contains a RETURN statement that returns the result back to the expression. For example, when several tagnames of 30 characters each are added (using "&" and ":") together, you can only use 8 tagnames (plus spaces) in the expression. However, by using the statement, CALL MYSCRIPT($Second), in the expression, you can execute a QuickFunction that might contain hundreds of 30 character tagnames. This QuickFunction will use the RETURN statement to provide a value back to the expression. Note: A "trigger" tagname must be used as a parameter for the QuickFunction to force an Animation Link to update. For example, using the tagname $Second as the parameter for the QuickFunction will cause the expression for the Animation Link to be evaluated every time $Second changes value. This results in the QuickFunction being called every second. Once you create a QuickFunction and save it, you can immediately call it from any other script or expression by its name. The name can be up to 31 characters in length. Blank spaces and duplicate names cannot be used. This is the name that other QuickScripts or expressions will use to call the QuickFunction. This name will also appear in the Choose function dialog box when you click either the All or the Quick buttons in the QuickScript editor. 223. Section 1 – QuickScript Types 5-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Arguments fields contain each argument name for your QuickScript. The valid data types include the following. The following are reserved keywords that should not be used as argument names: Return, Call, Dim, As, Integer, Real, Discrete, Message. Argument names are local variables that exist only within the QuickFunction in which they are defined. You can use up to 16 arguments per QuickFunction. The argument names can be up to 31 characters in length and spaces cannot be used. The argument names must also begin with an alpha character (A-Z). Duplicate names cannot be used. Do not use tagnames for argument names. Tagnames take precedence over argument names that are the same name and your QuickScript will not execute properly. An argument name does not consume a tag count because they are treated as local variables. QuickFunction Arguments Script parameters are passed by value. Argument expressions can be any script expression that returns an integer, real, discrete, or message data type value. All argument expression values are resolved by the calling script before executing the QuickFunction. Examples: CALL Stuff (5.6, 237, "PI"); In this expression, the real constant 5.6 is passed as argument1, the integer constant 237 as argument 2, and the message constant "PI" as argument 3. CALL Temp (IntegerTag); IntegerTag is passed as argument expression value. CALL ValveOpen (Tag.MaxEU -5); Calculated value (Tag.MaxEU -5) is passed as an argument expression value. Argument Data Type Matching There must be a strict left- to right correspondence between the data types of the calling statement's argument list and the data types of the saved QuickFunction being called. There must also be an exact number of arguments to match the number of arguments in the saved QuickFunction argument list as well. Coercion is used to type-cast Real values to Integer and Integer values to Real. This ability to modify the type of a value allows any analog argument to be passed to any other analog types. For example, if you pass a Real value of 1.23 to an Integer argument it will use only the 1 and the .23 will be lost. Similarly, if you pass an Integer value of 1 to a Real argument it will promote the 1 to 1.0. However, despite this coercion capability we recommend that you make a strict match of calling argument types to the corresponding QuickFunction argument list. Data Type Description Integer Used to pass integer variable, tagname, or constant values Real Used to pass real variable, tagname, or constant values Discrete Used to pass discrete variable, tagname, or constant values Message Used to pass string variable, tagname, or constant values up to 131 characters 224. 5-12 Module 5 – InTouch QuickScripts Wonderware Training Valid QuickFunction Syntax QuickFunctions return a value. The QuickFunction statement syntax and form are as follows: CALLQuickFunctionName ( [arg1, ... arg16] ); where: CALL is the required keyword in all QuickScripts and expressions to call a QuickFunction. QuickFunctionName is a 1 to 31 character string that corresponds to the name assigned to the saved QuickFunction. ( [arg1, ...arg16] ) are 0 to 16 comma separated argument expressions enclosed in parentheses. Using the Return Statement A QuickFunction is a script that can be called from another script (calling script). The following is an example of a script that is calling a QuickFunction: RETURNRESULT = CALL MyFunction( StartHour, EndHour); The RETURN statement is used by a QuickFunction to force a value to be returned to the calling script. When RETURN is encountered, an immediate end to the execution of the QuickFunction occurs. At this point, the QuickFunction returns a value back to the calling script. The data type returned can be a discrete, integer, real or message. In the example above, the tag RETURNRESULT can be a discrete, message, integer, or real type tag to receive the transferred value. In the following example, if the tagname ConvertType is equal to 0, the expression abs( (Max / Maxprogress) * 100 ) is calculated and this data type real result is returned to the calling script. IF ConvertType == 0 THEN RETURN abs( (Max / Maxprogress) * 100 ); ELSE RETURN 0; ENDIF; The data type of the return value is determined by the context. For example: RETURN AnalogTag; If the Tagname, AnalogTag, is defined as a Memory Integer, the RETURN statement will send an analog value back to the calling location. Only one value can be returned. 225. Section 2 – Working with the Script Editor 5-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Working with the Script Editor This section describes common features and functions of the QuickScript Editor. The features and functions that are unique to a particular script type are described later in this section. Open the QuickScript Editor Opening a QuickScript Editor to create a new script can be performed from the Special menu, or from the Application Explorer. From the Application Explorer: a. Right-click the QuickScript type and select Open or New. Some QuickScript types do not include the New command on the sub-menu. Note: Existing QuickScripts are displayed in the Application Explorer hierarchy view under their respective QuickScript type icons. Section Objectives Introduce the QuickScript Editor Identify the different script functions and keywords 226. 5-14 Module 5 – InTouch QuickScripts Wonderware Training The InTouch QuickScript Editor displays the same basic interface for all script types: The QuickScript Toolbar The QuickScript toolbar performs basic editing functions. The QuickScript Editor can be resized to increase the area for typing in scripts. Resize the editor by dragging the borders, or click the Maximize button to maximize the Editor in monitor screen. Toolbar Icon Description Cut selected text from the script Copy selected text from the script Paste text into the script from the clipboard Insert a tag from the Tagname Dictionary Insert a window name from the current application Insert an ActiveX Control via the ActiveX Control Browser Print script 227. Section 2 – Working with the Script Editor 5-15 InTouch® HMI 9.5 Fundamentals of Application Development Course QuickScript Editor Common Commands Script Menu Options The Script menu contains the common windows commands New, Save, Print, and Exit. In addition, the Erase command is used to completely delete the script. Script Menu Options Undo: Your last editing operation is reversed. Select All: The entire script is selected. Cut: Select the text to remove. The cut text is deleted from the script and copied to the Windows Clipboard. You can now paste the cut text into another location in this script or into another script. Copy: Select the text to be removed. The text is copied to the Windows Clipboard. You can now paste the copied text into another location in this script or into another script. Note: When text is cut or copied, it is automatically written to the Windows Clipboard. This information remains on the Clipboard until a subsequent cut or copy command is performed. Paste: The contents of the Windows Clipboard is pasted into your script at the cursor location. Clear: All text in the script is erased. However, the script is not deleted from your application. If you select this command, cancel the script editor and then reopen it, the script will open. To completely delete the script, you must use the Script / Erase command or select the entire script. Note: The Script / Erase command is available for some QuickScript types. Deleted text is not written to the Windows Clipboard. Find: Launches the Replace dialog box. 228. 5-16 Module 5 – InTouch QuickScripts Wonderware Training Using the Script Editor Screen Equivalency and Mathematical Operator Buttons Equivalency and mathematical operator buttons are located at the bottom of the QuickScript Editor. The buttons are used to quickly insert the displayed keyword, function or symbol into your script at the cursor location. Indent/Unindent Script Text Position the cursor at the beginning of the line to indent and then press the TAB key. To remove the indent, hold down the shift key and press the TAB key. Insert Menu Options Functions can be accessed and inserted by selecting the Insert / Functions command on the Script Editor menu. Then select the name of the function category. You can also insert Tagnames, Windows, and ActiveX controls from the Insert menu. Equivalency and Mathematical Operator Buttons AND, OR, NOT IF, THEN, ELSE 229. Section 2 – Working with the Script Editor 5-17 InTouch® HMI 9.5 Fundamentals of Application Development Course Built-in Script Functions InTouch provides numerous built-in functions that can be linked to objects or pushbuttons or used in scripts to perform a multitude of tasks. For example, acknowledging alarms, hiding windows, changing the tagname being trended by a pen, and so on.These functions are accessible through the Insert/Functions main menu or by clicking the various buttons in the Functions section of the Script Editor. Once you select a function in its respective dialog box, the function and its required arguments are automatically pasted into your script at the cursor location. After the function is pasted into your script, highlight the argument to modify and enter the new value.Each built-in Script Function is explained in Appendix G. The functions are listed in the order of the command buttons on the script editor. Available Functions command buttons include the following: Note: Individual script functions are described in the order of the (script editor) button appearance in Appendix G, “Script Functions.” Function Description All The Choose function dialog box appears displaying all available functions including the functions for each installed add-on program (Recipe Manager, SPC Pro and SQL Access Manager). String The Choose function dialog box appears displaying all available string functions. Math The Choose function dialog box appears displaying all available mathematical functions. System The Choose function dialog box appears displaying all available system functions. For example, the functions to start and/or activate another application, read and/or write file and disk information, and so on. Add-ons The Choose function dialog box appears displaying all available functions for each installed add-on program (Recipe Manager, SPC Pro and SQL Access Manager). Misc The Choose function dialog box appears displaying all available miscellaneous functions. For example, the functions for alarms, historical trending, windows controls, ActiveX controls, and so on. Quick The Choose function dialog box appears listing the names of all the QuickFunctions available for calling from the current script. Help The Choose function to Obtain Help for dialog box appears listing all available functions. Click a function to open its respective Help topic. 230. 5-18 Module 5 – InTouch QuickScripts Wonderware Training Insert a Function into a Script a. In the Functions area of the QuickScript Editor, click the All function button. The Choose function dialog box appears: b. Click Next Page to see additional functions. 231. Section 2 – Working with the Script Editor 5-19 InTouch® HMI 9.5 Fundamentals of Application Development Course The rest of the available functions display: After selecting the function, the dialog box closes and the function is inserted into your script at the cursor location. 232. 5-20 Module 5 – InTouch QuickScripts Wonderware Training c. To quickly access the Tag Browser, double-click a blank area in the QuickScript window. d. To access a specific tagname's definition in the Tagname Dictionary, enter the tagname in the QuickScript window and then double-click it. Insert a Tagname Dot Field into a Script a. Select Insert / Tagname: The Tag Browser appears in the unlimited selection mode. Note: The tags defined in the last tag source accessed through the Tag Browser will be displayed. To change the tag source, click the Tag Source arrow and select a different tag source in the list. Click the Define Tag Sources button to add or remove a tag source from the Tag Source list. b. Select the tagname and then click the Dot Field arrow. c. Select the .field to use with the tagname in the list. d. Click OK. The selected tagname.field will be inserted into your QuickScript at the cursor location. Tip: To quickly insert a tagname .field, enter the tagname followed by a period (.) and then double- click to the right of the period. The Choose field name dialog box will open. Click the .field that you want to use. The dialog box will close and the selected .field will automatically be inserted into your QuickScript at the cursor location. Double-click to launch the Tag Browser 233. Section 2 – Working with the Script Editor 5-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Selecting Dot Fields from the Tag Browser Unlimited selection mode enables tagname .fields selection for the selected tag. When a tag and/ or its Dot Field is selected, it is automatically entered into the InTouch QuickScript, the animation link tagname or the expression box or other location from which you accessed the Tag Browser. The tagnames defined in a local or remote tag source can be displayed and selected in this mode. The unlimited selection mode is accessed by double-clicking in a blank area in any InTouch QuickScript window, animation link tagname or expression box or, a blank New Name box in the Substitute Tagnames dialog box. Unlimited selection mode also allows you to select tags from defined tag sources such as the Industrial Application Server. Selecting a Dot Field a. Click Special / Scripts / Windows Scripts. b. Double-click the blank area. c. Click the Dot Field arrow to open the list of .fields that can be associated with the type of the selected tag. By default, will initially be displayed for all types of tagnames. d. Click the .field in the list to append to the selected tag. The primary methods that display the Tag Browser in the unlimited selection mode include: Double-clicking an animation link tagname or expression input box. Double-clicking an ActiveX control or Wizard tagname or expression input box. Double-clicking a blank area in any InTouch QuickScript window. In the InTouch QuickScript editor, selecting the Tagname command on the Insert menu. Pressing the ALT + N keys in the InTouch QuickScript editor. Double-clicking a blank New Name box in the Substitute Tagnames dialog box. Double-clicking the Tagname.FieldName input box in the SQL Access Bind List Configuration dialog box. 234. 5-22 Module 5 – InTouch QuickScripts Wonderware Training The Tag Browser's status bar provides status on the following items for the currently displayed tag source: Total number of items in the application The name of the currently selected item Tagname .field selected, if any The Access Name associated with the tag source Note: Dot fields will be implemented in Module 6, “Alarms.” Find or Replace within a Script a. Select Edit / Find. The Replace dialog box displays: b. Enter the item to find (or replace) and click Find Next. c. Enter the new item in the Replace with box to replace the old tagname and click Replace or Replace All. d. The Match case option finds specific upper or lowercase instances of the item. e. Click Cancel when finished. Tip: If you only want to replace certain instances of an item, click Find Next. InTouch will begin searching your script for the old item. When the old item is found, it will be highlighted. Click Replace to replace it with the new item or click Find Next to skip it and continue searching. To replace all occurrences of a specific item, click Replace All at any time during the search. Insert a Window Name into a Script a. Select Insert / Window or click the Insert Window icon. The Window Name to Insert dialog box appears, displaying the names of all the windows in your application. b. Click the desired window name. The dialog box closes and the window name is automatically inserted into your script at the cursor location. 235. Section 2 – Working with the Script Editor 5-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Validate a Script a. Click Validate to verify that your script syntax is accurate. This can be done at any time. Validation is automatically performed when you click OK or Save. If the system encounters errors when validating a script, a corresponding error message box will open. If no message appears, the script is accepted. Save a Script a. Click Save to save the first script if many scripts are to be configured. b. Then click Script / New to write a new script. Action, Application, and Window scripts do not support this function. Restore a Script a. If you change a script and then decide to clear your changes and restore the original script, click the Restore button. A script cannot be restored once it has been saved. Application and Window scripts do not support this function. Exit the Script Editor All script editors can be exited by clicking OK, or by clicking the X button in the upper-right of the caption bar. In some editors, selecting Script / Exit closes the script editor. Clicking OK or Script / Exit will cause the script editor to close, and the script to be validated and saved unless an error is encountered. Clicking X will cause the script editor to close. Any changes made will be discarded. No validation will occur. Specify a Script's Execution Frequency In the While Running/Showing/Down Every 0 Milliseconds boxes, enter the number of milliseconds that must elapse before the script executes. When creating an Application While Running script, Window While Showing scripts, Condition While On True/On False scripts or Key and Touch Pushbutton Action While Down scripts, you must specify the frequency (in milliseconds) that they will be executed. Note: WindowViewer will make every attempt possible to run these types of scripts as fast as the specified time. However, performance cannot be guaranteed. Also, scripts can never run any faster than the Tick Interval setting specified in WindowViewer's properties. 236. 5-24 Module 5 – InTouch QuickScripts Wonderware Training IF-THEN-ELSE and Comparisons The IF-THEN-ELSE statement is used to conditionally execute various instructions based on the state of an expression. The following comparison operators are used to set up the conditions in an IF-THEN-ELSE statement. Greater than =Greater than or Equal to ==Equivalency ("is equivalent to") Not Equal to Below are some examples of complex scripts using comparison operators. Note: Each IF must have a matching ENDIF and a semicolon must be entered at the end of each statement line. IF-THEN statement with no ELSE clause IF a 0 THEN a = a + 100; ENDIF; IF-THEN-ELSE statement with one ELSE clause IF temp > 500 THEN Disc = 1; Real = 43.7; ELSE Disc = 0; Real = 93.4; ENDIF; IF-THEN-ELSE statement with one ELSE IF clause and no ELSE clause IF temp > 500 THEN Disc = Disc * 10; ELSE IF temp > 250 THEN x = y / z; a = abc + def; ENDIF; ENDIF; 237. Section 2 – Working with the Script Editor 5-25 InTouch® HMI 9.5 Fundamentals of Application Development Course IF-THEN-ELSE statement with one ELSE IF clause and one ELSE clause IF temp > 500 THEN Disc = Disc - 10; ELSE IF temp < 250 THEN Disc = Disc + 10; ELSE Disc = Disc + 50; Real = 100; ENDIF; ENDIF; IF-THEN-ELSE statement with multiple ELSE IF clauses and one ELSE clause IF temp > 100 THEN temphihi = 1 Disc = 50; ELSE IF temp > 80 THEN temphi = 1; ELSE IF temp < 10 THEN templo = 1; ELSE IF temp < 30 THEN templolo = 1; ELSE tempok = l; ENDIF; ENDIF; ENDIF; ENDIF; 238. 5-26 Module 5 – InTouch QuickScripts Wonderware Training IF-THEN-ELSE statement that tests for Condition 1 or Condition 2 IF (pump1 < 50.0) OR (pump2 < 50.0) THEN alarm1 = 1; ELSE alarm1 = 0; ENDIF; IF-THEN-ELSE statement that tests for Condition 1 and Condition 2 IF (pump1 < 50.0) AND (pump2 < 50.0) THEN alarm2 = 1; ELSE alarm2 = 0; ENDIF; IF-THEN-ELSE statement that tests for equivalency: IF a > 50 THEN IF b == 100 THEN c = 0; ENDIF; ENDIF; Notes – Math Functions Math functions are used on integer or real tag types. In the math functions, the ResultNumericTags and InputNumericTags can be either Real or Integer and freely interchanged. Keep in mind, however, that returning a non-integer result of a function to an Integer tagname will result in the truncation of the result, i.e. the portion to the right of the decimal point will be lost (not rounded). Notes – System Functions System functions are used to perform actions such as activating another Windows application, copying, deleting or moving files and retrieving information regarding your InTouch application. System functions read and write data from three file types: File information, Application information, and System information. Notes – WW I/O Functions DDE-related functions should not be used as a replacement for normal InTouch DDE communications. Whenever possible, you should create an I/O type tag to send data to or get data from an external application. The WW DDE functions are intended to support applications that cannot communicate using the DDE Advises supported by InTouch. For example, some applications support only DDE Executes or Pokes. The WWExecute(), WWPoke() and WWRequest() functions use the same Windows functions as Microsoft Visual Basic (DDEML). A single function actually does several things. For example, a WWPoke() will perform a DDE Initiate, a DDE Poke and a DDE Terminate all in one function. This makes WW DDE functions less error prone, but also less efficient in processing many DDE messages. As a general guideline for the use of these functions, avoid: 239. Section 2 – Working with the Script Editor 5-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Looping these functions (calling them over and over). Calling several of the DDE functions in a row and in the same script. Using them to call a lengthy task in another DDE application. If the DDE command executes a lengthy task in another application, it might use up all of the available processor time. Still, even if communication difficulties occur, no loss of data will occur. If the I/O Server cannot send messages to InTouch, it will continue to try. 240. 5-28 Module 5 – InTouch QuickScripts Wonderware Training Importing QuickScripts Importing QuickScripts from one InTouch application to another can save development time. It allows you to reuse your previously created QuickScripts. To move QuickScripts from one InTouch application to another, you must use the File / Import command. a. Close all windows in your current application. b. Click File / Import. The Import from directory dialog box appears: c. Select the application directory (folder) containing the QuickScript(s) to import. d. Click OK. The Application Data Import Options dialog box appears. e. Select Condition Scripts. 241. Section 2 – Working with the Script Editor 5-29 InTouch® HMI 9.5 Fundamentals of Application Development Course f. Click Select. The Select a Condition Script dialog box appears: g. Select the QuickScript(s) to import then click OK to close the dialog box. h. Click Import. The system will automatically begin to import the selected QuickScript(s) into your current application. Note: Placeholders (such as ?d: in the above example) are discussed in “Converting Placeholder Tagnames” on page 5-30. Importing ActiveX Event Scripts ActiveX Event scripts are used to make something happen as the result of an ActiveX Control event. For example, click, double-click, mouse down and key press are typical events used in many ActiveX controls. InTouch ActiveX Event scripts are provided to support event actions. You can associate one ActiveX Event script to each event. You execute ActiveX control events in Runtime (WindowViewer). You can use InTouch QuickScript functions to handle ActiveX control events, call control methods, and control properties. You can execute ActiveX methods through InTouch QuickScript functions. You can associate an ActiveX event with an ActiveX Event Script that executes when the event occurs. In Runtime, the tagnames and QuickScripts you defined in WindowMaker control the behavior of your ActiveX controls. When ActiveX Event scripts are imported from one application to another, all ActiveX Events scripts are imported. Additionally, in order for an imported ActiveX Event script to function properly in the new application, the same ActiveX control and the same event for which the script was originally created must also be used in the new application. If the window containing an ActiveX control is closed, its ActiveX Event scripts or any other InTouch QuickScripts containing script functions associated with that ActiveX control will not execute properly. Note: ActiveX Controls and Event scripting are introduced in Appendix D of this manual, and discussed in depth in the InTouch Advanced class. 242. 5-30 Module 5 – InTouch QuickScripts Wonderware Training Converting Placeholder Tagnames When a QuickScript is imported into a new application, all of the tagnames referenced in the QuickScript are imported with it, but they are not added to your Tagname Dictionary. Instead, they are automatically converted to placeholder tagnames. You must convert the placeholder tagnames in order to use them. If they are not currently defined in the new application's Tagname Dictionary, you will be asked to define each of them. When the tagnames in an imported QuickScript are converted to placeholder tagnames, three index characters are added to the beginning of each tagname. For example, when a discrete tagname is imported, the tagname is prefixed with the following three characters: ?d:. When a tagname of 30, 31, or 32 characters in length is imported, the three indexing characters will still be added to the beginning of each tagname. However, the addition of these three characters will not truncate the length of your existing tagname. For example, for placeholder tagnames only, a 32 character tagname is increased to 35 characters. These three additional spaces are allotted only for placeholder tagnames. This increase in tagname length is not supported for standard tagnames. Imported Script containing placeholders Convert placeholders 243. Section 2 – Working with the Script Editor 5-31 InTouch® HMI 9.5 Fundamentals of Application Development Course When you select a script to edit and click Convert, the Convert dialogue box appears: You will be prompted to define any tags that are not currently in your tagname dictionary. Note: Tagname conversion is demonstrated in the following lab. Script Editor Printing A Print icon is available in the script editor for printing the current script. You must have a printer connected on your network. The print function will print all the scripts conditions assigned. Printing Scripts All scripts in each InTouch QuickScript category can be printed. a. In WindowMaker, click File / Print. The WindowMaker Printout dialog box appears: 244. 5-32 Module 5 – InTouch QuickScripts Wonderware Training Select which database entries, windows, and/or scripts to print. b. To print window scripts, select Windows, and then select Window Scripts. c. Select All In the Which Windows? area to print the scripts for all windows in the application. d. Select the Selected option to print a specific window's script. The Windows to Print dialog box appears: e. Select the window(s) whose script you want to print and then click OK. Note: If you select a window that does not have a script linked to it, the following heading will be printed on the report: Window Scripts for Window Name: none. f. To print all scripts for a QuickScript type, select the QuickScript type and then click OK. g. After choosing all print selections, click Next. 245. Section 2 – Working with the Script Editor 5-33 InTouch® HMI 9.5 Fundamentals of Application Development Course h. The Save Application Data to File window appears: i. Select an output to printer or to text file. 246. 5-34 Module 5 – InTouch QuickScripts Wonderware Training – Intentionally left blank – 247. Section 3 – QuickScripts – Quick Reference 5-35 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 3 – QuickScripts – Quick Reference Introduction In this guide, the basic functionality of each type of QuickScript that can be created is summarized. QuickScripts Application Scripts Application Scripts are linked to the entire application. They can be used to start other applications, create process simulations, calculate variables, and so on. Window Scripts Window Scripts function within a specific window. Script Type Description Application Scripts linked to the entire application Window Scripts linked to a specific window Key Scripts linked to a specific key or key combination on the keyboard Touch Action Scripts associated with an object linked to a Touch Link - Touch Pushbutton - Action animation link Data Change Scripts linked to a tagname and/or tagname.field only Condition Scripts linked to a discrete tagname or expression ActiveX Event Scripts that execute ActiveX control events in Runtime QuickFunctions Scripts you create that can be called from other InTouch QuickScripts or animation link expressions. QuickFunctions can be either synchronous or asynchronous, while all other script types are synchronous only. Script Type Description On Startup Executes once when the application is initially started up While Running Executes repeatedly at the specified frequency while the application is running On Shutdown Executes once when the application is closed Script Type Description On Show Executes once when the window is initially opened While Showing Executes repeatedly at the specified frequency while the window is showing On Hide Executes once when the window is hidden 248. 5-36 Module 5 – InTouch QuickScripts Wonderware Training Touch Action Scripts Touch Action Scripts are similar to Key Scripts, except they are associated with an object linked to a Touch Link - Touch Pushbutton - Action. The script editor is accessed through the animation link selection dialog box. They are executed when the operator clicks or presses the object or button assigned to the link. Data Change Scripts Data Change Scripts are linked to a tagname and/or tagname.field only. They are executed once when the value of the tagname or tagname.field changes by a value greater than the value deadband defined in the Tagname Dictionary. Condition Scripts Condition Scripts are linked to a discrete tag or expression that equates to TRUE or FALSE. This type of script is the most widely used script type. Discrete expressions containing analog tagnames can also be used. ActiveX Event Scripts Most ActiveX controls have events associated with them. For example, click, double-click, mouse down, and key press are typical events used in many ActiveX controls. InTouch ActiveX Event scripts support event actions. You can associate one ActiveX Event script to each event. Execute ActiveX control events in Runtime (WindowViewer). Script Type Description On Left Click/Key Down Executes once when the key or button is initially pushed down While Left/Key Down Executes repeatedly at the specified frequency while the key or button is held down On Left/Key Up Executes once when the key or button is released On Left Double Click Executes when the mouse button is double clicked On Right Click Executes once when the key or button is initially pushed down While Right Down Executes repeatedly at the specified frequency while the key or button is held down On Right Up Executes once when the key or button is released On Right Double Click Executes when the mouse button is double clicked On Center Click Executes once when the key or button is initially pushed down While Center Down Executes repeatedly at the specified frequency while the key or button is held down On Center Up Executes once when the key or button is released On Center Double Click Executes when the mouse button is double clicked On Mouse Over Executes the script one time when the cursor rests over an object Script Type Description On False Executes once when the condition transitions to false While False Executes repeatedly while the condition is false On True Executes once when the condition transitions to true While True Executes repeatedly while the condition is true 249. Section 3 – QuickScripts – Quick Reference 5-37 InTouch® HMI 9.5 Fundamentals of Application Development Course QuickFunctions QuickFunctions are scripts that you can write or call from other scripts or expressions. They are stored in the application in which they are created. Calling QuickFunctions from other scripts or expressions allows you to create a script once and then reuse it. QuickFunction valid data types are as follows. Data Type Description Integer Used to pass integer variable, tagname, or constant values Real Used to pass real variable, tagname, or constant values Discrete Used to pass discrete variable, tagname, or constant values Message Used to pass string variable, tagname, or constant values up to 131 characters 250. 5-38 Module 5 – InTouch QuickScripts Wonderware Training – Intentionally left blank – 251. Lab 5 – Using InTouch QuickScripts 5-39 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 5 – Using InTouch QuickScripts Introduction In this lab, you will create a wide variety of customized and automated system functions using InTouch scripting. Objectives By the conclusion of this lab, you should have an understanding of how to import a basic script, the tag conversion process, pushbutton animation, and how to write custom scripts. You should also have an understanding about how scripts can impact an application. To do this, the following tasks must be accomplished successfully: Import the Hopper window Convert Hopper window tags Animate the Hopper window pushbuttons Create Condition Scripts Create the GATE CONTROL Window Script Use QuickScript Functions Write a Custom Report Script 252. 5-40 Module 5 – InTouch QuickScripts Wonderware Training Import the Hopper Window 1. Import the Hopper window using the File / Import command. 2. Select the appropriate directory. Your instructor will provide the file location. When the directory is selected, the Windows to Import dialog box appears. 3. Select the Hopper window. 4. Click OK, then Import. The Hopper window appears in the Application Explorer: 5. Double-click the Hopper window. 253. Lab 5 – Using InTouch QuickScripts 5-41 InTouch® HMI 9.5 Fundamentals of Application Development Course The Hopper window appears in WindowMaker: The following information describes the graphics in the Hopper window. The hopper graphic is 419 pixels high. The blue pointer (top right) is a value slider that places values from 0-100 in the tag HopperSetPoint when it is moved up and down along the side of the hopper. A value display with a vertical location link shows the current value of HopperSetpoint. The red (bottom right) pointer has a vertical location link on both the pointer and the value display. Both are assigned to the tag HopperLevel. The hopper has a polygon on the front with a percent fill link assigned to fill 0-100% when the HopperLevel tag rises or falls (0-100). The conveyor wheels ( , ) have links assigned to $Second and a memory discrete tag called Conveyor_on. The wheels will only appear to turn when Conveyor_on is equal to 1. The fill material is linked in much that same way as the conveyor wheels. The fully linked Conveyor_on Toggle pushbutton allows us to set and reset the Conveyor_on tag. Gate Control, Calculator, and Report buttons. Scripting the buttons and other window elements will enable more control over the existing graphics including incrementing the hopper level with a button click, triggering the opening and closing of the hopper gate, and so on. 254. 5-42 Module 5 – InTouch QuickScripts Wonderware Training Convert The Hopper Window Tags 6. Press the F2 key to select all objects. 7. Click Special / Substitute Tags. 8. The Substitute Tagnames… dialog box appears. The imported tags are considered Placeholders by InTouch and contain the placeholder values at the beginning of the tagnames. 255. Lab 5 – Using InTouch QuickScripts 5-43 InTouch® HMI 9.5 Fundamentals of Application Development Course 9. Click Convert. 10. Click Local. 11. The tags’ Placeholder values are removed. Click OK. 12. Since the tags do not yet exist, InTouch will prompt you to define them. Click OK. 256. 5-44 Module 5 – InTouch QuickScripts Wonderware Training 13. Define each tag as follows. Click Save, then Close after setting each tag’s attributes. The Conveyor_on tag definition will look similar to the following figure: After all the new tags are defined, the Substitute Tags dialog box reappears. 14. Click OK to exit the dialog box and save the tag configuration. Animate Hopper Window Pushbuttons 15. Double-click the HopperLevel = 0; button. The Animation Selection dialog box appears. 16. Select the Touchlinks - Touch Pushbutton - Action animation link. The Touch -> Action Script Editor appears. 17. Ensure the Condition Type = On Left Click/Key Down is selected. This script provides an action after the button is pushed. Tag Type Initial Value Min Value Max Value Conveyor_on Memory Discrete Off N/A N/A Gate Memory Discrete Off N/A N/A GateCount Memory Integer 0 0 100 HopperLevel Memory Real 0 0 100 HopperSetpoint Memory Real 0 0 100 257. Lab 5 – Using InTouch QuickScripts 5-45 InTouch® HMI 9.5 Fundamentals of Application Development Course 18. Configure the Action Script as follows: 19. Click the Validate button to check for any errors. 20. Click OK to leave the script editor and save the script. 21. Click OK to close the Animation Selection dialog box. 22. Double-click the HopperLevel + 10 button. 258. 5-46 Module 5 – InTouch QuickScripts Wonderware Training The Animation Selection dialog box appears. 23. Select Touchlinks - Touch Pushbutton - Action animation link. The Touch -> Action Script editor appears. 24. Use Edit / Clear to remove the previous script. 25. Enter the script shown in the following figure. 26. Click Validate. Use to add tagname HopperLevel Use mathematical symbolsUse IF, THEN, ELSE, and ENDIF buttons 259. Lab 5 – Using InTouch QuickScripts 5-47 InTouch® HMI 9.5 Fundamentals of Application Development Course 27. Select Condition Type: While Left/Key Down. 28. Enter the script shown in the following figure: 29. Press Validate after each script. 30. Click OK to exit the Touch -> Action Script editor. 31. Click OK to exit the Animation Links Selection dialog box. 32. Switch to Runtime. 260. 5-48 Module 5 – InTouch QuickScripts Wonderware Training 33. Click the HopperLevel + 10 button. The level should increase by 10, and the red pointer and text display should change. 34. Click the HopperLevel = 0 button. The button should reset the hopper level to 0. 35. Return to Development mode. 261. Lab 5 – Using InTouch QuickScripts 5-49 InTouch® HMI 9.5 Fundamentals of Application Development Course Create Condition Scripts To drive and animate the filling of the Hopper, condition scripts are necessary to change the value of Hopper_Level, and to control when this script will operate. The first condition script increments the HopperLevel tag by 1 every tenth of a second (100 msec) that the Conveyor_on tag is TRUE. 36. Expand the Scripts list by clicking the + sign in front of Scripts. 37. Right-click on Scripts / Condition and select New. 262. 5-50 Module 5 – InTouch QuickScripts Wonderware Training The Condition Scripts editor appears. 38. Name the new Condition Conveyor_on. 39. Configure the Condition Script as follows: 40. Click Validate. 41. Click OK to save your Condition Script. 42. Click OK to exit the Animation Links Selection dialog box. 263. Lab 5 – Using InTouch QuickScripts 5-51 InTouch® HMI 9.5 Fundamentals of Application Development Course 43. Switch to Runtime and click the Conveyer_On Toggle button to test the script. When the Conveyor_On Toggle button is pushed, the conveyor image should animate and the fill level should change. Use the HopperLevel = 0; button to reset the conveyor fill level. The conveyor needs to be turned on automatically when the HopperLevel value is less than the HopperSetpoint, then stop when the HopperLevel value is equal to or greater than the HopperSetpoint. An On True and On False set of condition scripts for the Condition: HopperLevel < HopperSetpoint controls the On/Off state of the conveyor. 264. 5-52 Module 5 – InTouch QuickScripts Wonderware Training 44. Create new Condition Scripts with On True and On False condition types as shown in the following figures. Click Validate after each. 265. Lab 5 – Using InTouch QuickScripts 5-53 InTouch® HMI 9.5 Fundamentals of Application Development Course Now, when the Conveyor is running, the HopperLevel increases, but will exceed the level of 100. 45. Create or modify a condition script to keep the HopperLevel tag from increasing beyond 100. Note that there are several possible solutions. After completing the script, your instructor will provide you with the optimal answer. Hint: Modify an existing script rather than creating a new condition script. 46. Switch to Runtime and test the script. The conveyor should stop when the HopperLevel reaches 100. Exceeds 100 266. 5-54 Module 5 – InTouch QuickScripts Wonderware Training Create the GATE CONTROL Window Script The Hopper window includes a button marked GATE CONTROL. When the button is clicked, it toggles the Gate tag True / False, but nothing else happens at this point. The gate graphic at the bottom of the hopper has a horizontal location link assigned to the memory integer tag, GateCount. When GateCount is equal to 0 (zero), the gate appears to be closed. When GateCount is equal to 30, the gate appears to be open. We need to create a script that increments GateCount up to 30 when Gate is TRUE, and decrements GateCount to 0 (zero) when Gate is FALSE. We can only view the hopper when the Hopper window is open, so we need to enter a While Showing window script. 47. Expand the Windows icon in the Application Explorer. 48. Right-click Hopper and select Window Scripts. 267. Lab 5 – Using InTouch QuickScripts 5-55 InTouch® HMI 9.5 Fundamentals of Application Development Course 49. Enter the script shown in the following figure. 50. Validate the script. 268. 5-56 Module 5 – InTouch QuickScripts Wonderware Training 51. Continue editing the script shown in the following figure for a second condition type. 52. Click Validate, then OK to close the Window Script editor. 53. Switch to Runtime and test the scripts. When the window is opened, all levels and values should be set to 0. 54. Click the Gate Control button. The gate graphic should appear to slide open and closed. The HopperLevel does not decrease when the gate is open. 55. Switch to Development mode. 269. Lab 5 – Using InTouch QuickScripts 5-57 InTouch® HMI 9.5 Fundamentals of Application Development Course 56. Write a script to make the HopperLevel value decrease to 0 and stay there when the gate is opened. There are several possible solutions. After completing the script, your instructor will provide you with the optimal answer. Hint: Do not base the scripting on the GateCount tag. The following figure provides a hint for the optimal solution. 57. Switch to Runtime and test the script. The conveyor should stop when the HopperLevel reaches 100. When the gate is opened, the level should decrement. When the gate is left open, HopperLevel decrements to 0 and the gate should close automatically. Closing the gate before the HopperLevel reaches 0 should stop the level value from decrementing. 270. 5-58 Module 5 – InTouch QuickScripts Wonderware Training Use QuickScript Functions InTouch has the ability to work with other programs, and to see if they are running or not. The following script uses the InfoAppActive QuickScript function in a script to see if the Calculator program is running. If it isn’t, the StartApp function will start it. If it is, the ActivateApp function will bring it to the foreground. 58. Select the Calculator button in the Hopper window and create a Touch Action Script as shown in the next figure: 59. Validate the script and switch to Runtime. 271. Lab 5 – Using InTouch QuickScripts 5-59 InTouch® HMI 9.5 Fundamentals of Application Development Course 60. Click the Calculator button. If the Windows Calculator is not running, it appears on screen. If it is running but not in the foreground, it appears in the foreground. 61. Close the Calculator and switch to Development mode. Write a Custom Report Script We would like to see a report of the HopperLevel status when the REPORT button is clicked. This report needs to contain: The Date and Time the button was clicked The status of the conveyor and gate The current HopperLevel and HopperSetpoint 272. 5-60 Module 5 – InTouch QuickScripts Wonderware Training 62. Enter or verify the following ACTION script for the button labeled REPORT. DIM ConveyorStatus AS MESSAGE; IF Conveyor_on == 1 THEN ConveyorStatus = "Conveyor Running"; ELSE ConveyorStatus = "Conveyor Stopped"; ENDIF; DIM GateStatus AS MESSAGE; IF Gate == 1 THEN GateStatus = "Gate is Open"; ELSE GateStatus = "Gate is Closed"; ENDIF; DIM ReportHeader AS MESSAGE; ReportHeader = "HopperLevel report for " + $DateString + ", " + $TimeString; DIM ReportLine1 AS MESSAGE; ReportLine1 = Text(HopperLevel, "HopperLevel is currently #"); DIM ReportLine2 AS MESSAGE; ReportLine2 = Text(HopperSetpoint, "HopperSetpoint is currently #"); FileWriteMessage( "C:HopperReport.txt", -1, ReportHeader, 1); FileWriteMessage( "C:HopperReport.txt", -1, ConveyorStatus, 1); FileWriteMessage( "C:HopperReport.txt", -1, GateStatus, 1); FileWriteMessage( "C:HopperReport.txt", -1, ReportLine1, 1); FileWriteMessage( "C:HopperReport.txt", -1, ReportLine2, 1); FileWriteMessage( "C:HopperReport.txt", -1, " ", 1); 63. Switch to Runtime and click the Report button. 64. Open the HopperReport file from the specified location using Notepad. 65. Close the file and switch to Development mode. 273. Module 6 Alarms Section 1 – Alarms and Events 6-3 Section 2 – The Distributed Alarm Object 6-23 Lab 6 – Creating Alarms and Events 6-39 274. 6-2 Module 6 – Alarms Wonderware Training Module Objectives Introduce the different alarm and event types Discuss the acknowledgment of alarms and how alarms can be inhibited Add Alarm functionality to the application 275. Section 1 – Alarms and Events 6-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Alarms and Events This section explains and defines the different types alarms and events and how to add alarm functionality to applications. Introduction InTouch has two types of notifications to inform operators of process activity: Alarms and Events. Alarms represent warnings of process conditions that could cause problems, and require an operator response. A typical alarm is triggered when a process value exceeds a user-defined limit, such as an analog value exceeding a hi-limit threshold. This triggers an unacknowledged alarm state that can be used to notify the operator of a problem. Once the operator acknowledges the alarm, the system returns to an acknowledged state. InTouch can be configured to require an alarm to be acknowledged even if the condition causing the alarm has passed. This ensures that an operator is aware of events that caused a temporary alarm state but have returned to normal. Events represent normal system status messages, and do not require an operator response. A typical event is triggered when a certain system condition takes place, such as an operator logging into InTouch. If configured to do so, InTouch can log an event to the alarm database and print it out to a printer. Any tag can be configured to do event monitoring while you are defining it in the Tagname Dictionary. When you define a tag to do event monitoring, an event message is logged to the alarm system each time the tag value changes. The event message logs how the value changed, whether the operator, I/O, scripts or the system initiated the change. Alarm Concepts There are a number of terms and concepts that apply to alarms generally, regardless of the particular system in which they are used, or how they are implemented. Alarms: In general, an Alarm is a specific type of a condition – in particular, an alarm is an abnormal condition. The intention of an alarm is to signal that something has gone wrong, or that a particular stage of processing has been reached. For example, an alarm might indicate that a boiler has exceeded a safe temperature limit. Priority: A level of priority is associated with an alarm to indicate how severe the situation or condition is. In the case of a boiler temperature limit, it might be very severe, requiring immediate attention to save life and property. By contrast, in other (less dire) situations the severity might be minimal. The severity of an alarm usually depends upon the circumstances – the factory application, the nature of the equipment, safety, availability of backup systems, potential costs of damage or downtime and so on. Section Objectives Explain and define Alarms and Events Identify the different alarm types and events and add alarm functionality to applications 276. 6-4 Module 6 – Alarms Wonderware Training Sub-states: An alarm condition may also have sub-conditions, in which case it is called a multi- state alarm. For example, an analog alarm typically has several limits, with High and Low bounding the normal operating range, and HiHi and LoLo marking the extreme departures from normal. The boiler temperature level mentioned above could be in the alarmed condition for any one of these sub-states. It could also transition between any two sub-states while continuing to remain in the overall alarmed condition. Events: An event is defined as a detectable occurrence, which may or may not be associated with an alarm. A transition into or out of an alarmed state constitutes one kind of event. An event might also mark an operator action, a change to the system configuration or some kind of system error. It is important to make a distinction between an alarm condition and an event. A condition may persist for minutes, hours, days or weeks. An event is momentary; it takes place and is immediately over. An alarm is a condition; an alarm notification is an event. Acknowledgment: One major purpose of an alarm is to alert someone about the condition. The person or system should then acknowledge the alarm, indicating that is has been seen. Acknowledgment is separate from the issue of taking corrective action, which might not happen right away. It is also separate from the issue of whether the alarm condition returns to normal – which it might do on its own, even without any external intervention. Acknowledgment merely indicates that someone has noticed the occurrence of the alarm. A high or medium priority alarm usually requires acknowledgment, while a very low priority alarm might not. Although the condition that generated the alarm may go away (for example, a temperature rises too high and then becomes lower again), the alarm itself is not considered "handled" until it is acknowledged. Groups: Alarms may be organized into groups to facilitate tracking and management. These groups might represent different areas of a factory, pieces of equipment, operator responsibility or a specific functionality. Groups may also be organized into a hierarchy of parent groups and sub- groups. Areas: Factories are generally organized into areas, representing physical location, operator responsibility, phases of a process, types of equipment and so on. Like groups, areas can be hierarchical – divided into main areas and sub-areas. However, areas should be mentioned separately from groups, because some factories make a distinction between the two. Note: The Distributed Alarm System provides no explicit support for Areas. However, alarm Groups may be used to divide alarms into collections that correspond to Areas. 277. Section 1 – Alarms and Events 6-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Alarm Types InTouch classifies alarms into several general categories based on their characteristics. These categories are known as Class and Type. The Distributed Alarm System categorizes all alarms into five general Conditions: Discrete, Deviation, Rate-of-Change, SPC and Value. The table below summarizes the alarm condition for both systems. Each alarm can be associated with an InTouch tag. Depending upon a tag type, you can define one or more of the alarm classes or types for it. Alarm conditions are defined within the Tagname Dictionary. Event Types InTouch also classifies events into general categories based on their characteristics. These categories are known as Event Types. The table below summarizes the classification of events. The first six events listed are configured automatically when event logging is enabled. The remaining three must be defined by users for each tagname in the Tagname Dictionary. Alarm Condition Distributed Class Distributed Type Discrete DSC DSC Deviation – Major DEV MAJDEV Deviation – Minor DEV MINDEV Rate-of-Change ROC ROC SPC SPC SPC Value – LoLo VALUE LOLO Value – Low VALUE LO Value – High VALUE HI Value – HiHi VALUE HIHI Event Condition ACK Alarm was acknowledged. ALM Alarm has occurred. EVT An alarm event occurred. RTN Tagname returned from an alarm state to a normal state. SYS A system event occurred. USER $Operator changed. I/O The tagname value was poked from a DDE client. LGC A QuickScript modified the tagname value. OPR The operator modified the tag value using the Value Input. 278. 6-6 Module 6 – Alarms Wonderware Training Tagname Alarm Configuration In Touch supports alarm definition and configuration for each tag that is defined in the Tagname Dictionary. By default, all tags have their alarms disabled. The basic concept is that any tag can be configured as alarmable, specifying the type of alarm and user-selected limits. For such a tag, when the tag value changes, the alarm logic is invoked. This alarm logic is an InTouch subroutine that checks the type of alarm, compares the new value to the indicated limits, and determines whether the tag is in an alarmed condition. Any transitions of state are then reported to the Distributed Alarm System. There are two basic alarm types (or classes) defined in InTouch. These are subdivided into several additional alarm sub-types. Discrete: A discrete alarm corresponds to a discrete tag. You can configure whether the alarmed state corresponds to the TRUE state or the FALSE state of the discrete tag, and the associated priority of the alarm. The configuration dialog for a discrete tag is as follows. Select Details & Alarms to display Alarm configuration 279. Section 1 – Alarms and Events 6-7 InTouch® HMI 9.5 Fundamentals of Application Development Course The configuration dialog for an analog tag is as follows. Analog: An analog alarm corresponds to either an integer or real (floating point) tag. Within the analog type there are several alarm classes. Value: The current value is compared to one or more limits. If the value exceeds the limit, the alarmed state is declared. You can individually configure values and priorities for the "LoLo" limit, "Lo" limit, "Hi" limit and "HiHi'" limit and indicate whether or not each limit is to be used. The Value Deadband establishes how much the value must change before it is taken out of alarm. Deviation: The current value is compared to a target value, and then the absolute value of the difference is compared to one or more limits, expressed as a percent of the range of the tagname value – that is, the total difference between its configured maximum and minimum allowable values. You can individually configure values and priorities for the "Minor Deviation" limit and the "Major Deviation" limit, and indicate whether or not each limit is to be used. Values may also be configured for a "Deviation Deadband," also expressed as a percent of the tag's range. This controls the percentage the tag value that must drop before it is taken out of alarm. Rate-of-Change: The current value and the previous value are used in this computation, along with the current time and the time of the previous update. If the absolute value of the rate of change exceeds the limit, the alarmed state is declared. You can configure the value and priority for the ROC limit, and whether or not the limit is to be used. The limit is expressed as a percent of the range of the tag value, which can be per-second, per- minute, or per-hour. 280. 6-8 Module 6 – Alarms Wonderware Training Alarm Priorities Each alarm configured in InTouch has a priority value associated with it. This value represents the severity of the alarm and can range from 1 to 999 with 1 being the most severe. By creating alarm ranges using these priorities and assigning alarms to each, you can easily filter out critical alarms from non-critical ones. You can also create animation links, acknowledgment scripts, and filtered viewing and printing all based on the priority range. For example, if a process plant has determined that they need four levels of severity, they could establish ranges as shown below. As the plant engineers create InTouch tags and alarm conditions, each alarm will be assigned to one of these severity levels by choosing a priority number within that range. When the ranges are configured, the plant operators may now easily display and print only certain severity levels. Alarm Groups Each InTouch alarm is assigned to a logical Alarm Group. Each Alarm Group is user-definable, must have a unique name, and can be arranged into a hierarchy up to 32 levels deep. The groups provide a way of categorizing alarms based on an organization, plant layout, or any other metric. Alarm Groups are useful for filtering alarm displays, Alarm Printers, and acknowledgment scripts. Every tag is associated with an Alarm Group. If you do not associate an Alarm Group name to a tag, InTouch automatically associates it with the root group, $System by default. Any Alarm Group may have both tags and other Alarm Group names associated with it. Alarm Groups are organized into a hierarchical tree structure with the root group, $System, at the top of the tree. All defined Alarm Groups automatically become descendants of the root group. This tree may have up to 32 levels. Each Alarm Group may have a maximum of 32 subgroups. Each subgroup may have a maximum of 32 subgroups, and so on, until the maximum of 32 levels is reached. Alarm Severity Priority Range Critical 1 – 249 Major 250 – 499 Minor 500 – 749 Informational 750 – 999 281. Section 1 – Alarms and Events 6-9 InTouch® HMI 9.5 Fundamentals of Application Development Course This illustration displays only Alarm Groups, not the tagnames within each group. This tree concept is analogous to the Windows Explorer directory structure, where a directory may contain other sub-directories which are analogous to groups, and file names which are analogous to tagnames. Alarm Group names are limited to 31 characters and must begin with an alpha character A-Z or a- z. At the same time, the Group name cannot have any spaces in the string. For example, a valid name is "AlarmGroup#1-23" whereas a sample of an invalid name is "Alarm Group # 1 - 23". The Distributed Alarm System also uses these groups as the basis for its Alarm Group Lists. Note: While Alarm Groups do not count as tags with InTouch licensing, they do count as tags in the database. Therefore, the total number of Alarm Groups plus actual tagnames cannot exceed 61,402. Also, groups cannot be created if WindowViewer is running. Warning: Large numbers of alarm groups (hundreds or thousands) can cause performance problems. For more information, refer to the Alarm Deployment Guide. Creating an Alarm Group a. Click Special / Alarm Groups on the WindowMaker main menu. The Alarm Groups dialog box appears: The Modify and Delete buttons are not available until an Alarm Group is defined. The $System Alarm Group cannot be modified or deleted. Note: While defining tagnames in the Tagname Dictionary, you can create Alarm Groups and associate them with any tags. 282. 6-10 Module 6 – Alarms Wonderware Training b. Click Add. The Add Alarm Group dialog box appears: c. In the Group Name box, enter the name for the new Alarm Group. Since this is the first Alarm Group you have created, it is automatically assigned to the $System Parent Group. After you have created an Alarm Group, it can be used as a Parent Group. d. Click OK. The Alarm Groups dialog box reappears: e. Select the first Alarm Group you created, then click Add to create a second group. The Alarm Group that was selected is now the Parent Group of the new alarm group. f. In the Comment box, enter any comment for the new Alarm Group. g. Click OK. 283. Section 1 – Alarms and Events 6-11 InTouch® HMI 9.5 Fundamentals of Application Development Course The Alarm Groups dialog box reappears displaying your Alarm Group hierarchy: h. Click Close. Modifying an Alarm Group a. Select Special / Alarm Groups. The Alarm Group dialog box appears: Note: You can also modify Alarm Groups while defining tags in the Tagname Dictionary. b. Select the Alarm Group to modify in the list and then click Modify. The Modify Alarm Group dialog box appears: c. Click Parent Group to change the parent group for the Alarm Group. 284. 6-12 Module 6 – Alarms Wonderware Training The Alarm Groups dialog box appears: d. Select $System as the new parent group. Click Close. e. The Modify Alarm Group dialog box appears, displaying the new parent group: f. Make any changes (if any) to the Comment. g. Click OK. The new Alarm Group hierarchy is displayed: h. Click Close. 285. Section 1 – Alarms and Events 6-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Deleting an Alarm Group a. Select Special / Alarm Groups. The Alarm Group dialog box appears. b. Select the Alarm Group in the list to delete. c. Click Delete. d. Click Yes to confirm the intended deletion. Note: You can also delete Alarm Groups while defining tags in the Tagname Dictionary. Alarm Groups can be deleted regardless of any tagnames in use in the group to be deleted. Any tags in the deleted group will migrate to the parent Alarm Group. 286. 6-14 Module 6 – Alarms Wonderware Training Alarm Acknowledgment Models When an item goes from a Normal state to an Alarmed state, a new instance of its alarm is generated. If the alarm is a multi-state alarm, any change to a new sub-state while still remaining alarmed is treated as a transition of the same alarm instance. The lifetime of an alarm instance stops when the alarm returns to Normal – a subsequent transition to the alarmed state generates a new alarm instance. The InTouch Distributed Alarm system tracks each instance of an alarm – when it first enters the alarmed state, when it makes a sub-state transition, when it returns to Normal, whether it is waiting for an Acknowledgment, and when it is Acknowledged. 287. Section 1 – Alarms and Events 6-15 InTouch® HMI 9.5 Fundamentals of Application Development Course Alarms as conditions: Acknowledgment is for the instance of the alarm. An alarm instance begins waiting for an ACK when it first enters the alarmed state. If it is ACKed and subsequently transitions to a new alarmed sub-state (for example from “Hi” to HiHi”), it begins waiting for another ACK. when the ACK is received, it is accepted and applies to all transitions of the alarm that have occurred so far. The alarm is considered ACKed when the most recent instance has been ACKed. Alarms as events: Acknowledgment is for the instance of the alarm, and must be for the most recent transition to an alarmed state or sub-state. An alarm instance begins waiting for an ACK when it first enters the alarmed state. If it is ACKed and subsequently transitions to a new alarmed sub-state, it begins waiting for another ACK. Each subsequent transition is assigned a sequence number, and the ACK must have attached to it the sequence number of the transition to which it is responding. The ACK is accepted only if it is for the most recent transition. A rejected ACK may be logged for diagnostic purposes, but is not otherwise tracked in the system. If it is accepted, it applies to all transactions of the alarm that have occurred so far. The alarm is considered ACKed when the most recent instance has been ACKed. The event-oriented model ensures that if an alarm is changing between different states, the ACK corresponds to up-to-date information. In systems with small latency times, this may look just like condition-oriented alarms – but in other environments, such as the Internet, the features of this model may become important. Expanded Summary Alarms: Acknowledgment is for each transition of the alarm. The initial entry to the alarmed state must be ACKed, and the return to normal must also be separately ACKed. Any transition to a new alarm sub-state is treated as a new occurrence that must be ACKed, and whose RTN must also be ACKed. Sub-state transitions are treated as belonging to a "RTN group," starting with the first entry into an alarmed state when the item was previously normal. If the item returns to normal and subsequently enters the alarmed state again, a new RTN group is created. Each transition must be acknowledged individually and explicitly; and the alarm is considered acknowledged only when the item has returned to normal and all transitions in all pending RTN groups have been acknowledged. Note: Here the term summary means "awaiting acknowledgment." This alarm model may also be known as ring-back alarms. To summarize, for condition-oriented alarms, an acknowledgment counts against all entries into the alarmed state up to the time of the acknowledgment. For event-oriented alarms (as in OPC) an acknowledgment is accepted only if it refers to the most recent activation event. For Expanded Summary alarms, all events – to active, inactive, and different sub-states – must be acknowledged before the overall alarm is considered acknowledged. 288. 6-16 Module 6 – Alarms Wonderware Training Expanded Summary Alarms When an alarm occurs it generates a record in the alarm display object showing that an alarm condition has occurred with the date and time stamp of the alarm. This record does not leave the display until an operator has acknowledged the alarm and a return-to-normal state (RTN) has occurred. If the return-to-normal state occurs before the alarm is acknowledged, then two records are displayed in the alarm object. For example, if a boiler's temperature exceeds the hi-limit state, thus triggering an alarm, but returns to the normal temperature range before an operator acknowledges the alarm state, a record will be generated showing the alarm state and an additional record will be generated showing that the alarm state was not acknowledged. An acknowledgment is only for a particular transition, whether to an alarmed state, to a sub-state, or a return to normal. Each transition from the normal state marks the beginning of a new RTN group. All transitions in an RTN group must be acknowledged individually before the overall RTN group is considered acknowledged. Using Expanded Summary Alarms When you define a tagname and select Expanded Summary as its ACK Model it requires an operator to acknowledge that an alarm occurred even if the state triggering the alarm has returned-to-normal. Acknowledging an alarm state will change the color of the alarm entry but does not change the displayed time stamp. Alarms will only clear from the display when they are acknowledged and the alarm has returned to a normal state. Note: When you define a tag with the Expanded Summary ACK model, the RTN Implies Ack option in the Alarm Properties dialog box does not apply to the tag. Alarm Visibility Controls It may sometimes be necessary or desirable for you to turn some alarms off without actually removing the alarm configurations for an item. InTouch supports three basic types of alarm visibility control: disablement, inhibition, and suppression. These are described in terms of a three-stage alarm model. Alarm stimulus: The value or status of an alarmable item is tracked. Alarm state: The alarmable item is compared against limits and conditions, to determine if it is in an alarmed state. State transitions are tracked and reported. Alarm annunciation: Reports and updates of the alarm state are displayed and/or logged via one or more alarm clients. 289. Section 1 – Alarms and Events 6-17 InTouch® HMI 9.5 Fundamentals of Application Development Course With the model shown in the previous figure in mind, the following visibility controls are handled at the Alarm Provider. Alarm Disablement: An alarm can be disabled by setting a flag that marks it as disabled. No other change to the alarm configuration is involved. While an alarm is disabled, any checking may or may not- continue regarding conditions that would put the item into an alarmed state. But while the disablement is in effect those conditions cannot put the item into the alarmed state. Essentially, the item is in a forced normal state. Disablement breaks the connection between the alarm stimulus and the alarm state. Since the alarm cannot go into the alarmed state, while an alarm is disabled, no entries are made to the alarm history for that alarm. Alarm Inhibition: An alarm can be inhibited by identifying a tag that marks it as inhibited. This tag is called an inhibitor tag. No other change to the alarm configuration is involved. While the inhibitor tag is FALSE (or zero), the alarm is handled normally; but while the inhibitor tag is TRUE (or non-zero), the item cannot alarm. In essence, it is treated the same as if the alarm were disabled. The alarm is then actively inhibited. Alarm inhibition is a two-stage process. 1. Assignment of the inhibitor tag. 2. A change of the state of the inhibitor tag from FALSE to TRUE or vice-versa. As with disablement, inhibition breaks the connection between the alarm stimulus and the alarm state. Alarm Suppression: With the alarm model in mind, we have the ability to break the connection between the alarm state and the alarm annunciation. The alarm still occurs and is stored/logged, but is not visible in the Alarm Display. This visibility control is known as Alarm Suppression. Alarm Suppression is discussed in detail on page 6-29 of this manual. 290. 6-18 Module 6 – Alarms Wonderware Training To Configure Alarm Inhibition a. Open the Tagname Dictionary (Special / Tagname Dictionary). b. Select an existing tag. c. Click OK. d. Select the Details & Alarms option. 291. Section 1 – Alarms and Events 6-19 InTouch® HMI 9.5 Fundamentals of Application Development Course e. Click the Ellipsis button in the Alarm Inhibitor column of one of the Alarm Value rows (LoLo, Low, High, HiHi). The alarm inhibition can be based upon any non-Message tag. In this example, a Memory Discrete tag-type is used. When the tag value becomes true, it will trigger the inhibition. f. Select the tag, and click OK. The Tagname Dictionary appears with the new inhibition tag filled in: g. Click Save, then click Close. Alarm Inhibitor for LoLo 292. 6-20 Module 6 – Alarms Wonderware Training Disabling Alarms a. The Alarms view of the Tagname Dictionary may be used to access a tag’s .alarm enabled dot field. This dot field can disable alarming for an individual tag, or for an alarm group. Note: Disabling the alarms for an Alarm Group disables ALL alarms in that group. Note: Additional dot fields are available for alarm configuration. For a complete list of dot fields refer to the InTouch Reference Guide. Configuring the Alarm System You can configure various parameters for the alarm system such as whether to enable events, whether alarms require an acknowledgment when they return to normal, and so on. The configuration dialog box behaves like any standard Windows property sheet in that no settings are recorded until you click OK. If you click Cancel, all input is ignored and the dialog box closes. Alarm/Event General Properties a. Select Special / Configure / Alarms from the main WindowViewer menu. The Alarm Properties dialog box appears: Configuration Options: Alarm Buffer Size: The number of in-memory alarm events you want WindowViewer to maintain. This number represents the maximum number of alarms that the node can store for summary or historical queries. Note: Only in-memory alarm events can be displayed in alarm display objects. If alarms are not being used, this value may be set to 1 to conserve memory. If you set this value too high, it can slow down the performance of your system. For the Distributed Alarm System, the default value of 500 is recommended. RTN implies ACK: Automatically acknowledges alarmed tags that return to the "normal" state (RTN). Do not select this option if you want the operator to acknowledge an alarm after it returns to normal. (RTN Implies ACK does not apply to tags with Expanded Summary ACK model.) 293. Section 1 – Alarms and Events 6-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Events Enabled: Turn on event logging of all data changes that are initiated by the operator, I/O, QuickScripts, or the system. (Only tagnames with Log Events selected will be affected.) Alarm Enable Retentive: State of the .AlarmEnabled variable to be retained when WindowViewer is closed and restarted. Retain ACK Comment as Alarm Comment: Custom comments are to override the alarm comments. Otherwise, alarm comments from the Tagname Dictionary will be used. 294. 6-22 Module 6 – Alarms Wonderware Training – Intentionally left blank – 295. Section 2 – The Distributed Alarm Object 6-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – The Distributed Alarm Object The Distributed Alarm object displays both locally and remotely generated alarms. This display objects features include: built in scroll bars, resizeable display columns, multiple selection of alarms, update status bar, query status bar, context sensitive right-click menu, and alarm display colors based on alarm priority. Introduction InTouch allows you to modify the appearance of the alarm display (including the information that is displayed), the colors used for various alarm conditions, and the Alarm Group and alarm priority levels displayed. Section Objective Introduce and Configure the Distributed Alarm control 296. 6-24 Module 6 – Alarms Wonderware Training Creating a Distributed Alarm Display a. Click the Wizard tool in the Wizard/ActiveX Toolbar icon . b. The Wizard Selection dialog box appears. c. Select Alarm Displays. d. Select the Dist. Alarm Display Control. e. Click OK. The Wizard Selection dialog box closes and your window reappears with the cursor in the "paste" mode. f. Click anywhere in an active window to paste the Alarm Display control. You are now ready to configure the display. 297. Section 2 – The Distributed Alarm Object 6-25 InTouch® HMI 9.5 Fundamentals of Application Development Course Alarm Viewer Features Scroll Bars The distributed alarm display has built-in horizontal and vertical scroll bars that allow you to move through listed alarms. You can configure the display of these scroll bars. Sizable Display Columns The distributed alarm display uses a grid to hold the alarm messages. This grid allows for dynamic sizing of the column widths simply by selecting a column and dragging it to set the column width. This functionality is available only during Runtime. You can configure whether or not the grid can be used to size the columns Grid column changes are not saved; therefore, if you make grid column changes and close the window containing the alarm display, the grid columns will again be at their default width upon re- opening that window. Double-click the vertical grid line to autosize the column. Multiple Selection: The grid supports selecting a single or multiple alarms in a list box. The selected alarms can be acknowledged by using the almAckSelect() QuickScript function described later in this chapter. When you configure the distributed alarm display, you can also define the selection behavior to allow either toggle selection (item by item), or multiple selection (holding down CTRL or SHIFT in conjunction with a mouse click to select multiple alarms). You can turn off Runtime selection. Alarm Message Colors: Configure up to eight different colors for each displayed alarm message, based on the priority of the alarm and whether it is acknowledged or not. 298. 6-26 Module 6 – Alarms Wonderware Training Update Status Bar: The distributed alarm display includes a status bar that contains three indicators: Status message, Current Alarm Query, and Progress Bar. These indicators provide an overview of the current state of the display query and provide details about the suppression available in the Distributed Alarm Object. The right pane of the status bar is red when freeze is in effect and the left pane of the status bar is red when suppression is in effect. The word suppression appears in the left pane when suppression is in effect. You can turn off the display of the status bar in Runtime. Note: If new alarms are received while the display is frozen, the words “New Alarm (s)” appear in the status bar. Feature Description Status Message The status message at the left end of the status bar provides a more detailed description of the current query status. Progress Bar The update progress bar at the right end of the status bar provides a visual indication of the current query progress. Alarm Query The Alarm Query provides a visual indication of the current alarm query. Status Message State/Indicator Progress Bar None No Query None Update Incomplete Query Incomplete Blue/Green Update Successful Query Complete Solid Blue Suppression Query name Solid Blue Freeze Query name Red New Alarm Query name Red/Blue (depends on freeze status). 299. Section 2 – The Distributed Alarm Object 6-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Right-Click Menu: The Distributed Alarm Display object supports right-click menus for quick access to the commands that you can apply to the display object and/or one or more selected alarms, Alarm Groups, Tags and Priorities contained in the Runtime display. By default, the right-click menu is disabled. It can be enabled by setting the appropriate value in the Property sheets. Also, script functions can be called to do anything you can do with the right- click menu. a. To enable the Runtime right-click functionality, while in Development right-click the Distributed Alarm Display and select Properties. 300. 6-28 Module 6 – Alarms Wonderware Training The Alarm Configuration dialog box appears. b. Select the General tab. c. Select the Show Context Sensitive Menu option. 301. Section 2 – The Distributed Alarm Object 6-29 InTouch® HMI 9.5 Fundamentals of Application Development Course With the Runtime right-click functionality now enabled, several additional levels of functionality can be utilized. Ack Selected: When the operator right-clicks the display and then points to Ack Selected during Runtime, the operator can quickly acknowledge the selected alarm. Ack Others: When the operator right-clicks the display and then points to Ack Others, a sub-menu appears that contains acknowledgment commands. During Runtime, the operator can quickly acknowledge all alarms in the display, or only visible alarms, selected groups, selected tagnames and selected priorities by using right-click functionality. Suppress Selected: When the operator right-clicks the display and then points to Suppress Selected during Runtime, the operator can quickly Suppress the selected alarm. Suppress Others: When the operator right-clicks the display and then points to Suppress Others, a sub-menu appears that contains suppression commands. During Runtime, the operator can quickly suppress all alarms in the display, or only visible alarms, selected groups, selected tagnames and selected priorities by using this functionality. Query Favorites: When you right-click the display and then point to Query Favorites, the Alarm Query dialog box appears. Stats: Brings up the alarm statistics dialog box. Suppression: Brings up the Alarm Suppression dialog box. Freeze: Freezes the current display. 302. 6-30 Module 6 – Alarms Wonderware Training Alarm Viewer Control Display Guidelines The Alarm Viewer control uses the same mechanism as the Window Control wizards. This mechanism requires that the following guidelines be observed when using objects such as the Distributed Alarm Display. Use the following guidelines: Each display must have an identifier so that any associated QuickScript functions know which display to modify. This identifier, entered as Display Name in the Alarm Configuration dialog box, must be unique for each display. Displays should not overlap other InTouch objects such as window controls or graphic objects. You can easily verify this by clicking on the distributed alarm display in WindowMaker, and checking the display's "handles." The handles should not touch other graphic objects on the screen. Displays should be used sparingly. Placing numerous displays on one screen can result in reduced system performance. When possible, limit the number of displays on your screen and call further screens containing additional displays. Note: Additional alarm displays are available as ActiveX Alarm Objects. Alarm Display Configuration Options The Alarm Configuration dialog box has three tab fields that contain the options for General, Message, and Color configuration. Note: The configuration dialog box behaves like any standard Windows dialog box in that no settings are recorded until you click OK. The options are verified for proper entries, however, when you change from one property sheet (tab) to another, if an entry verification fails, the property sheet containing the failed entry is brought back into focus, and a message box appears indicating the error. If you click Cancel, all input is ignored and the dialog box closes. a. Double-click the distributed alarm display. 303. Section 2 – The Distributed Alarm Object 6-31 InTouch® HMI 9.5 Fundamentals of Application Development Course The Alarm Configuration dialog box appears with the General tag selected: Configuration Options Display Name: Enter the name for the alarm display. This name must be unique for each alarm display used. Note: The name you type here will be used throughout the system for referring to this object for execution of tasks such as alarm acknowledgment and queries. New Alarms Appear At: Where you want new alarms to open within the control. Top of List: Displays the most recent alarm at the top of the list. Bottom of List: Displays most recent alarm at the bottom of the list. 304. 6-32 Module 6 – Alarms Wonderware Training Property Settings Default Query Properties Note: The Default Query Properties are active if you select the Perform Query on Startup option or, if the almDefQuery QuickScript function is executed. Note: To perform multiple queries, separate each query with a space. Multiple Alarm Providers are configured as part of the InTouch Advanced Application Development course. Property Description Show Titles Displays alarm message title bar Allow Runtime Grid Changes Allows the user to change column settings in Runtime Perform Query on Startup Automatically begins updating the display using default query properties, if selected. If not selected, you need to perform an almDefQuery or almQuery before the display will update. Use Default Ack Comment If checked and a string is entered, when a user ACKs an alarm without entering a comment, the associated message string will be used as a default comment Show Message Displays the message entered in the checkbox when selected. This is the message which is displayed inside the DAO when there are no alarms to be displayed. Show Status Bar Displays status bar Allow Runtime Alarm Selection Allows user to select alarms at Runtime Show Context Sensitive Menu Enables the activation of the right-click popup menu and use of default Ack command Auto-Scroll to New Alarms If the user scrolls the list from the beginning, this automatically jumps to the new alarm Use Extended Alarm Selection Allows multiple alarms to be selected by holding down Ctrl or Shift in conjunction with a mouse Show Vert Scrollbar Displays the vertical scrollbar on the alarm display object Show Horz Scrollbar Displays the horizontal scrollbar on the alarm display object Property Description From Priority Default minimum alarm priority. To Priority Default maximum alarm priority. For more information on alarm priorities, see the "Alarm Priorities" section of this chapter. Alarm State Default alarm state to query (All, UnAck, Ack). Query Type Sets display type as either Summary or Historical. Alarm Query Sets the initial Alarm query. This field accepts text only; it does not accept tags. The valid syntax for these lists include: NodeInTouch!Group Full path to Alarm Group InTouch!Group Full path to local Alarm Group InTouch!Group!Tag Full path to local Alarm Group and Tag GroupList Entry from Distributed Name Manager 305. Section 2 – The Distributed Alarm Object 6-33 InTouch® HMI 9.5 Fundamentals of Application Development Course Distributed Alarm Message Format The information displayed in a distributed alarm display object is configurable. a. Select the Message Tab. Note: If you right-click a text box in any alarm configuration dialog box, a menu will open displaying the commands that you can apply to the selected text. The preview area (at the bottom of the dialog box) displays an example of the alarm message as currently configured. This example will show the message using the font selected, but not color. Configuration Options Date Format: The available formats include the following. Time Format: The values in this field are used as a template to specify the format of the time. For example, to specify the time as 10:24:30 AM, use HH:MM:SS AP. Selection Display Selection Display DD MMM 28 Feb MM/DD 02/28 DD MMM YYYY 28 Feb 2002 MM/DD/YY 02/28/02 DD/MM 28/02 MMM DD Feb 28 DD/MM/YY 28/02/02 MMM DD YYYY Feb 28 2002 YY/MM/DD 02/02/28 YYYY/MM/DD 2002/02/28 306. 6-34 Module 6 – Alarms Wonderware Training The template characters include the following: Displayed Time: Type of display based upon the alarm status. The available formats include the following: Sort Order: area: Order in which you want the alarms to be sorted in the alarm object (LCT and OAT). Select Display Font: Change the font, style and size used in the alarm display. AP Selects the AM/PM format. For example, three o'clock in the afternoon is displayed as 3:00 PM. A time without this designation defaults to 24 hour military time format. For example, three o'clock in the afternoon is displayed as 15:00. HH Displays the hour the alarm/event occurred. MM Displays the minute the alarm/event occurred. SS Displays the second the alarm/event occurred. SSS Displays the millisecond the alarm/event occurred. LCT Last Changed Time – that is, the date/time stamp of the most recent change of status for the instance of the alarm: onset of the alarm, change of sub-state, return to normal, or acknowledgment. LCT But OAT on ACK Last Changed Time, but Original Alarm Time on ACK – that is, LCT will be used while the alarm is UNACKed, then OAT will be used after the alarm has been ACKed. OAT Original Alarm Time – that is, the date/time stamp of the onset of the alarm. 307. Section 2 – The Distributed Alarm Object 6-35 InTouch® HMI 9.5 Fundamentals of Application Development Course Column Management: Customize the column order and respective column widths. Displays the Column Details dialog box. Check the Column Names for the one you wish to display. Use the Up and Down arrows to change the order in which they are displayed. Click the Edit button to display the dialog box where the name and size of the highlighted column can be customized. Date: Display the date. Time: Display the time. State (UnAck,Ack): Display the state of the alarm. Class (VALUE.DEV. ROC..): Display the category of the alarm. Type (HIHI,LO,MAJDEV,…): Display the alarm type. Priority: Display the alarm priority. Name: Display the alarm/tagname. Name: Display the Alarm Group name. Provider: Display the name of the alarm provider. Value: Display the value of the tagname when the alarm occurred. Note: The value should be large enough to provide the desired level of precision (32 characters maximum). Limit: Display the alarm limit value of the tagname. Note: The size of this field should be large enough to provide the desired level of precision (32 characters maximum). Operator: Display the logged-on operator's ID associated with the alarm condition. Comment: Display the tagname's comments. These comments were entered in the Alarm Comment box when the tagname's alarm was defined in the database. 308. 6-36 Module 6 – Alarms Wonderware Training Distributed Alarm Display Color Properties a. Select the Color tab. General area: Each color box opens the InTouch Palette. Select the color that you want to use in the palette for each of the following options: Alarm Priority: Enter the breakpoint values for the alarm display. UnAck Alarm and Ack Alarm: Each color box opens the InTouch palette. Select the color in the palette that you want to use for each breakpoint. Option Description Window Sets display background color. Grid Sets display grid color. Selection Back Sets highlighted text background color. Selection Text Sets highlighted text color. Title Bar Back Sets title bar background color (visible only if Show Titles option is on). Title Bar Text Sets title bar text color (visible only if Show Titles option is on). Alarm Return Sets color of returned alarms (alarms that have returned to normal without being acknowledged). Event Sets color of Event alarms. 309. Section 2 – The Distributed Alarm Object 6-37 InTouch® HMI 9.5 Fundamentals of Application Development Course Acknowledging Alarms You can acknowledge different alarms by using the Ack function in an action or key QuickScript, or by using the context sensitive right-click menu at the Distributed Alarm Object. The Ack function monitors and/or controls the alarm acknowledgement status of all types of local alarms. Create a 3-D button or any other object to which an action or Key QuickScript be linked. Then, enter any of the following statements for the QuickScript Action Script. Alarm Acknowledgment QuickScript Functions The Distributed Alarm System is capable of acknowledging any alarms that it can query (summary display only). To provide this capability, the Distributed Alarm System includes alarm acknowledgment QuickScript functions. These functions supplement the .Ack dot field that the InTouch alarm system uses to acknowledge local alarms, and Alarm Groups. Individual ALM QuickScript functions are listed in Appendix G, “Script Functions” of this manual. Attaching Comments to an Alarm Ack Function Each alarm acknowledgment function must have a comment attached to it. The operator acknowledging the alarm can use this comment to add information about the alarm. InTouch can store these alarms in the alarm database and print them. The Distributed Alarm System uses the Alarm Comment box of the tag's alarm definition in the database to pass these comments to the logging and printing subsystems. Choose whether to allow the alarm system to use the tag’s Alarm Comment box for ACK comments. If you use the tag’s Alarm Comment box to hold ACK comments, any comments in that field will be overwritten during Runtime (This does not affect the Tagname Data Dictionary). a. Click Special / Configure / Alarms. Statement Description Ack $System; Acknowledges all local alarms in the system. Ack Group Name; Acknowledges all local alarms in a specific Alarm Group. Ack Tagname; Acknowledges a specific tagname's alarms. $System.Ack=1; Acknowledges all local alarms in the system. Group Name.Ack=1; Acknowledges all local alarms in a specific Alarm Group. Tagname.Ack=1; Acknowledges a specific tagname's alarms. Tagname.AckDev=1; Acknowledges a specific tagname's deviation alarm. Tagname.AckROC=1; Acknowledges a specific tagname's rate-of-change alarm. Tagname.AckValue=1; Acknowledges a specific tagname's value alarm. 310. 6-38 Module 6 – Alarms Wonderware Training The Alarm Properties dialog box appears: b. Select the Retain ACK Comment as Alarm Comment if you want to use various almAck() functions for custom comments. Otherwise, alarm comments from the Tagname Dictionary will be used. c. Click OK. Tip: If you right-click a text box in any alarm configuration dialog box, a menu will open displaying the commands that you can apply to the selected text. 311. Lab 6 – Creating Alarms and Events 6-39 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 6 – Creating Alarms and Events Introduction In this lab, you will create and configure designated alarm windows in order to enable acknowledgement of alarms and establishment of events. Objectives Upon completion of this lab, you should be able to: Import the Alarms Window Configure the Alarms Window Convert Alarms Window Tags Configure Alarms for Tags Define the Acknowledge Button Create the Inhibit Tag Create an Inhibitor Switch Configure Alarm Dot Fields Configure Alarm Annunciation Create Events 312. 6-40 Module 6 – Alarms Wonderware Training Lab 6a – Alarm Acknowledgement Import the Alarms Window 1. Close WindowViewer. 2. Close any open windows in WindowMaker. 3. Select File / Import from the main WindowMaker menu, and wwimport (used in earlier labs). 4. Select the Alarms window. 5. Click OK. 6. Click Import. 313. Lab 6 – Creating Alarms and Events 6-41 InTouch® HMI 9.5 Fundamentals of Application Development Course The Alarms window now appears in the Application Explorer: Configure the Alarms Window 7. Open the Alarms window. 8. Click the Wizard tool in the Wizard/ActiveX Toolbar icon . 314. 6-42 Module 6 – Alarms Wonderware Training 9. The Wizard Selection dialog box appears: 10. Select Alarm Displays. 11. Select the Dist. Alarm Display Control. 12. Click OK. The Wizard Selection dialog box closes and your window reappears with the cursor in the "paste" mode . 315. Lab 6 – Creating Alarms and Events 6-43 InTouch® HMI 9.5 Fundamentals of Application Development Course 13. Place and size the Alarm Display control in the window. 14. Press the F2 key. 15. Select Special / Substitute Tags. 16. Click Convert. 316. 6-44 Module 6 – Alarms Wonderware Training The Convert dialog box appears: 17. Click Local. 18. Click OK. Configure Alarms For Tags 19. Select the IntTag from the Tagname Dictionary. 20. Select the Details & Alarms option. 21. Configure the alarm as shown in the following figure and click Save. 317. Lab 6 – Creating Alarms and Events 6-45 InTouch® HMI 9.5 Fundamentals of Application Development Course 22. Select the RealTag from the Tagname Dictionary. 23. Configure the Alarm as shown in the following figure. 24. Click Save, then Close. 25. Switch to Runtime. 26. Test the Alarm Display by moving the RealTag slider up, and the IntTag slider down. The Alarm display should update with each movement of the sliders. 27. Switch to Development mode. 318. 6-46 Module 6 – Alarms Wonderware Training Define the Acknowledge Button 28. Double-click the Acknowledge button and select Touch Pushbuttons - Action. 29. Clear any previous scripts. 30. Configure the Action Script editor with the script shown in the previous figure. 31. Validate the script. The script acknowledges the Alarm Object with the Acknowledge button by assigning the almAckSelect function to the Distributed Alarm Object. Note: The value for the AlarmObject argument for all of the almAck functions is derived from the name property of the Alarm Object configuration. Modify the script to match your alarm object display name. 32. Click OK, then OK again. 33. Switch to Runtime and initiate an alarm for RealTag and IntTag. 34. Select one of the alarms. 319. Lab 6 – Creating Alarms and Events 6-47 InTouch® HMI 9.5 Fundamentals of Application Development Course 35. Click the Acknowledge button. The color of the alarm will change indicating it has been acknowledged. 320. 6-48 Module 6 – Alarms Wonderware Training Lab 6b – Alarm Inhibition Create the Inhibit Tag An inhibition tag is used to disable a specific property of an alarm. 36. Open Tagname Dictionary and click New. 37. Create an InhibitTag as a Memory Discrete. 38. Click Save. 39. Click Select. 40. Select RealTag in the Tagname Dictionary. 41. Click OK. 42. Select the Details & Alarms option. 321. Lab 6 – Creating Alarms and Events 6-49 InTouch® HMI 9.5 Fundamentals of Application Development Course 43. Click the Ellipsis button for HiHi Alarm Inhibitor. 44. Highlight InhibitTag within the Tagname Dictionary, then click OK. 45. Click Save, then Close. 322. 6-50 Module 6 – Alarms Wonderware Training Create an Inhibitor Switch 46. Select the Wizard Hat toolbar icon . 47. Select Switches. 48. Select the Knob Switch. 49. Double-click Knob Switch in the Wizard Selection dialog box, and place it in your application. 50. Double-click the Knob Switch in your application. The Discrete Switch Wizard dialog box displays 51. Double-click within the Tagname field and select InhibitTag from the Tagname Dictionary. 52. Click OK, then OK again. 323. Lab 6 – Creating Alarms and Events 6-51 InTouch® HMI 9.5 Fundamentals of Application Development Course 53. Switch to Runtime. 54. Click the Knob Switch to turn it On. 55. Move the RealTag Slider up to the top. The alarm display shows only the HI Alarm. The HiHi alarm has now been inhibited so that only the Hi alarm state is displayed. 324. 6-52 Module 6 – Alarms Wonderware Training 56. Repeat the previous step with the switch turned to the Off position. The HiHi alarm is now displayed. 57. Switch to Development mode. 325. Lab 6 – Creating Alarms and Events 6-53 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 6c – Alarm Dot Fields Configure Alarm Dot Fields 58. Double-click the # symbol for the $System.Alarm field. 59. Assign a Value Display - Discrete animation link. The Output Discrete Expression dialog box appears. 60. Double-click within the Expression text field. (Clear any previous Expression, if any.) The Select Tag dialog box appears. 61. Scroll down in the Tagname list to select the $System Tagname. 62. Open the Dot Field drop-down list. 326. 6-54 Module 6 – Alarms Wonderware Training The dialog box containing all dotfields is displayed. 63. Select Alarm. The Select Tag dialog box should now appear like the following figure. 64. Click OK. The dotfield, .Alarm, is now associated with $System. 65. Set the On Message to Yes and the Off Message to No. 66. Click the top OK button. 67. Double-click the # symbol adjacent to $System.Ack in the InTouch Alarms window. 68. Select the Touch Links/User Inputs - Discrete animation link. 327. Lab 6 – Creating Alarms and Events 6-55 InTouch® HMI 9.5 Fundamentals of Application Development Course 69. Clear any previous tagnames and settings. 70. Double-click in the Tagname field. The Select Tag dialog box appears: 71. Select the $System tag. 72. Open the Dot Field drop down list and select Ack. 73. Click OK. 328. 6-56 Module 6 – Alarms Wonderware Training 74. Complete the Animation Link object configuration to match the following figure: 75. Click the top OK to save and close the animation link selection. 76. Use the previous steps to configure the RealTag.HiLimit text display object with a Touch Link/User Input – Analog link. 77. Use the previous steps to configure the RealTag.HiStatus text display object with a Value Display-Discrete link. 78. Click OK. 79. Switch to Runtime - observe changes to the dotfields. 329. Lab 6 – Creating Alarms and Events 6-57 InTouch® HMI 9.5 Fundamentals of Application Development Course 80. Modify RealTag.HiLimit with a value of your choice. 81. Switch to Development mode. 330. 6-58 Module 6 – Alarms Wonderware Training Lab 6d – Alarm Annunciation Configure Alarm Annunciation 82. Right-click Windows and select New from the sub menu. 83. Configure the window with the properties shown in the following figure. 84. Click OK. 85. Use the following figure as a guide to add the following text and button objects. 331. Lab 6 – Creating Alarms and Events 6-59 InTouch® HMI 9.5 Fundamentals of Application Development Course 86. Define the following Blink link for the Attention text: 87. Create a new condition script, where On True condition has the window open when a tag goes into alarm. 88. Validate the script and click OK. 332. 6-60 Module 6 – Alarms Wonderware Training 89. Enter the following Touch Pushbutton - Action script for the Acknowledge Alarms button. The Touch Pushbutton Action script for the Acknowledge Alarms button script will acknowledge ALL alarms, set the $NewAlarm tag to 0 and then hide the Alarm Acknowledge window. 90. Validate the script and click OK. 91. Click OK to close the Animation Links window. 92. Save and close the Alarm Acknowledge window. Ensure the Alarms window is still open. 93. Switch to Runtime. 333. Lab 6 – Creating Alarms and Events 6-61 InTouch® HMI 9.5 Fundamentals of Application Development Course 94. Move the sliders. The Alarm Acknowledge window should now open when the tags go into alarm. The Attention text box should blink. 95. Click the Acknowledge Alarms button. The window should close and the current alarms should be changed to ACK status. 96. Return to Development. 334. 6-62 Module 6 – Alarms Wonderware Training Event Monitoring Create Events 97. Double-click the Alarm object. 98. Change the Query Type to Historical in the Default Query Properties area. 99. Click OK. The Alarm object rows are populated with the alarms in Runtime. 335. Lab 6 – Creating Alarms and Events 6-63 InTouch® HMI 9.5 Fundamentals of Application Development Course 100.Double-click on the DiscTag1 button to review the Touch Pushbuttons - Action script. 101.Click OK, then OK again. 102.Open the Tagname Dictionary. 103.Ensure the Log Events option for DiscTag1 is checked and the Priority is 998. 336. 6-64 Module 6 – Alarms Wonderware Training 104.Switch to Runtime and click on the DiscTag1 Toggle button to display events. These alarms will appear at the bottom of the Alarm Object display. 337. Module 7 Real-time and Historical Trending Section 1 – Real-time Trends 7-3 Lab 7 – Configuring Real-time Trends 7-7 Section 2 – Historical Trends 7-11 Lab 8 – Configuring Historical Trends 7-27 338. 7-2 Module 7 – Real-time and Historical Trending Wonderware Training Module Objectives View user data in real-time Retrieve data from historical archives 339. Section 1 – Real-time Trends 7-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Real-time Trends InTouch provides two types of trend display objects: Real-time and Historical. Both trend objects can be configured to display graphical representations of multiple tags over time. Introduction Real-time trends allow you to chart up to four pens (data values). Historical trends allow you to chart up to eight. Both types of trends are created using special tools in WindowMaker. An optional 16-pen trend wizard is available. InTouch also provides you with complete trend configuration control. For example, you can specify the time span, value range, grid resolution, location of time stamps, location of value stamps, number of pens, and color attributes. InTouch also supports a distributed history system that allows you to retrieve historical data from any InTouch historical log file, even those across a network. Creating a Real-time Trend A trend object is like any other object drawn in WindowMaker. It can be moved by grabbing it with the mouse or resized by grabbing one of the object handles. a. Select the Real-time Trend tool in the Drawing Toolbar. b. Click and drag in the window to place the object. In Runtime, data is written in the trend from right-to-left. There is no limit to the number of trends that can be placed on a window. Section Objective View user data in real-time using Real-time Trends 340. 7-4 Module 7 – Real-time and Historical Trending Wonderware Training Configuration Options The first time a real-time trend object is pasted into a window, the system default configuration settings are used. Once a real-time trend has been configured, the next trend created will, by default, have the same settings. a. Double-click the trend object. The Real Time Trend Configuration dialog box appears: Note: All entries made in the Real Time Trend Configuration dialog box are independent of the size of the trend and cannot be modified in Runtime. Time Span: Enter the length of time to be displayed horizontally (x-axis) on the trend. Then select the Sec, Min, or Hr option. Sample-Interval: Enter the frequency at which the trend expression will be evaluated and the chart updated. Then select the Msec, Sec, Min, or Hr option. Color: Click the Chart Color and select a background color. Border Color: Select a trend border color. Repeat this process for all color selections. Time Divisions area - Number of Major Div: Enter the number of major time divisions for the trend. Then select a color for the division lines. The number of major time divisions must be an even multiple of the number of Minor Div/Major Div. Time Divisions area - Minor Div/Major Div: Enter the number of minor time divisions to be visible within each major time division. Then select the color for the division lines. Time Divisions area-Top Labels: Display time labels at the top of the trend. Time Divisions area-Bottom Labels: Display time labels at the bottom of the trend. Trends can have both top and bottom labels or no labels at all. 341. Section 1 – Real-time Trends 7-5 InTouch® HMI 9.5 Fundamentals of Application Development Course When using time labels, enter the number of time labels per major time division line in the Major Div/Time Label box of the Time Divisions group. Time Divisions area- Colors: Select a color for the major time division lines. Value Divisions area: The settings in this area are configured the same way as the settings in the Time Divisions area, except the minor and major value divisions set the vertical value (y-axis) range for the trend. This range uses Engineering Units and is the same for all trended tags. To display decimal points for the minor and major value divisions at Runtime, they must be formatted in this area of the Real Time Trend Configuration dialog box. For example, 0.00 to 100.00. Min Value: Must be configured for the Minimum value of a trended tag. Max Value: Must be configured for the Maximum value of a trended tag. Expression: Enter the tag or expression each Pen will trend. Up to four pens can be visible in a trend. The pens can be used to display any local tagname or an expression that contains one or more local tagnames. (Message type tags cannot be logged or trended.) The ability to trend expressions is useful in creating custom displays to show tagnames with widely different ranges. Color: Select the color for each pen to plot each tag in the trend. Width: Width in pixels of each trace. Selecting a pen width greater than 1 significantly reduces performance in trend updating and printing of the trend. Select Display Font Button: Displays the Font dialog box. Select the font, style and size to use when printing the trend. Only update when in memory: Update your trend only when it is displayed in the active window. If this option is not selected, the trend will be updated constantly, even if it is not in an open window. This may result in slightly slower system performance. Optimizing Real-time Trend Performance Set the pen width to 1. Make sure no other objects are placed on top of the Real-time trend. Lower the number of samples being taken. For example, if the Time Span is set to 30 minutes and the Sample Interval is set to 2 seconds, the number of samples taken during the 30 minutes will be calculated as: 30* 60/2 = 900 If the Time Span is set to 30 minutes and the Sample Interval is set to 5 seconds, the number of samples taken during the 30 minutes will be calculated as: 30* 60/5 = 360 342. 7-6 Module 7 – Real-time and Historical Trending Wonderware Training – Intentionally left blank – 343. Lab 7 – Configuring Real-time Trends 7-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 7 – Configuring Real-time Trends Introduction In this lab, you will create and configure pens to display user data using Real-Time Trends. Objectives Upon completion of this lab, you should be able to: Import and Convert the Real Time Trend Window Configure a Real Time Trend 344. 7-8 Module 7 – Real-time and Historical Trending Wonderware Training Import and Convert the Real Time Trend Window This task begins with importing a window and performing a tag conversion. Detailed steps for these operations are contained in previous labs. 1. Close all open WindowMaker windows, shut down WindowViewer, and import the Real Time Trend window from the wwimport directory. 2. Open the Real Time Trend window. 3. Press F2 to select all objects on the window. 4. Substitute and convert the tags to Local. 5. Select the Real-Time Trend tool in the Drawing toolbar. 6. Add the Real-Time Trend object to the gray pane of the Real Time Trend window. 345. Lab 7 – Configuring Real-time Trends 7-9 InTouch® HMI 9.5 Fundamentals of Application Development Course 7. Resize the Real-Time Trend object to occupy most of the pane. The Real Time Trend window should now look similar to the following figure. Configure a Real Time Trend 8. Double-click on the trend to display the Real Time Trend Configuration dialog box. 9. Set the Time/Time Span to 30 Sec. 10. Set the Sample/Interval to 1 Sec. 11. Set the Value Divisions/Max value to 1000. 12. Double-click in the Expression field for Pen 1 and select RealTag. 13. Double-click in the Expression field for Pen 2 and select IntTag. 14. For Pens 3 and 4 enter the following: Pen 3: $Second*10 Pen 4: DiscTag1*250 15. Set each Pen Width value to 2. 346. 7-10 Module 7 – Real-time and Historical Trending Wonderware Training The Real Time Trend Configuration dialog box should now look like the following figure: 16. Click OK and switch to Runtime. 17. Move the sliders up and down and click on the DiscTag1 button to get values into the trend. You will see the trace lines reflect slider movements. (You may need to acknowledge alarms). 18. Return to Development. 347. Section 2 – Historical Trends 7-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Historical Trends This section will introduce and explain InTouch historical trends, and explains the historical trend configuration options. Introduction Historical trends provide snapshots of data from a time and date in the past. They are not dynamic. Unlike real-time trends, historical trends are only updated when they are instructed to do so, either through the execution of a QuickScript or an action by the operator (e.g., clicking a button). Up to eight tags (pens) can be trended at one time with no limit to the number of trends displayed. You have complete flexibility in designing the interface to your trend. Scooters can be created that the operator slides over the trend to access a variety of data based on the scooter's current location. For example, when the operator positions the scooter over an area on the trend that has visible data, the time and values at that location for all data points being trended is returned. You can also create buttons to zoom in and out between the scooters or to data, such as the maximum to minimum value. Average and standard deviation can be displayed for the complete chart or for the area between the scooters. Historical trends can also be scrolled by any amount of time. Custom scales can be created and linked to the .MinEU and .MaxEU tagname .fields to display the minimum and maximum Engineering Units. The distributed history system extends the retrieval capabilities of historical trends to include remote log databases. This system allows information from multiple historical log databases to be displayed in a single trend. Note: You must select the Log Data option for each tag in the Tagname Dictionary in order for it to be trended. In addition to its trending capabilities, InTouch includes the HistData Utility, designed to work with InTouch historical log files. The HistData utility converts encrypted historical log files (.LGH) to comma separated variable files (.CSV) for use in spreadsheet or text editing environments such as Microsoft Excel. Logging Tagnames to the Historical Log File In WindowViewer, the values of logged tags are written to the historical log file each time they change more than the specified Log Deadband setting, and by default, once an hour regardless of change. For a tag's value to be written to the historical log file, it must be configured to be logged in the Tagname Dictionary. For integer and real (floating point) tag types, you can set the Log Deadband in their respective details dialog boxes. The Log Deadband controls how many Engineering Units a tag's value must change before it is logged to disk. Section Objectives Introduce and explain InTouch Historical trends Explain Historical trend configuration options 348. 7-12 Module 7 – Real-time and Historical Trending Wonderware Training Logging a Tag To log tags, Historical logging must be enabled. If a tag is changed from logged to not logged, the data already logged for the tag will not be accessible. However, if logging for a tag is re-enabled, the data is available but will display a gap in a trend trace. Any changes made in WindowMaker to logging while WindowViewer is running are ignored until WindowViewer is restarted. a. Click Special / Tagname Dictionary. The Tagname Dictionary dialog box appears. b. Open the desired tag’s definition and select the Log Data option. c. Click Close. Note: The Min/Max Engineering Units are very important for displaying historical trend data. The historical trend displays from 0-100% of EU scale. Configuring Historical Logging In order for tags configured with the Log Data option to be written to the historical log file, the global logging function must be enabled. a. Click Special / Configure / Historical Logging. The Historical Logging Properties dialog box appears: b. Select the Enable Historical Logging option to enable global tag logging. 349. Section 2 – Historical Trends 7-13 InTouch® HMI 9.5 Fundamentals of Application Development Course c. In the Keep Log Files for box, enter the number of days (prior to today) of log files to keep saved to disk. Note: InTouch will create and save two historical log files per day (24 hours). Therefore, disk space must be considered when this value is set. If your hard disk does not have enough free space to save a historical log file, logging will stop. You must free some disk space and then restart logging. Historical logging can be started and stopped in Runtime by linking the $HistoricalLogging internal tag to a button or QuickScript or by using the Restart Historical Logging Command in WindowViewer. For example, if you enter 10 and today is the 12th day of the month, the log files for the 2nd through the 12th (10 days plus today) will be saved to disk. The file for the 1st will automatically be deleted. If you enter a zero, the log files will be kept indefinitely. Store Log Files in Application Directory: Saves the historical log file in an application directory. Store Log Files in specific Directory: Saves files to another directory. Enter the complete path to the directory you want to use. This entry must be either a DOS or UNC path such as C:histlog. By default, historical log files are named as follows: YYMMDD00.LGH and YYMMDD00.IDX where: YY equals the year the file was created MM equals the month the file was created (01-12) DD equals the day the file was created (01-31) 00 represents hours; always displays zeros (regardless of when the log files were created). For example, if the files were created on December 28, 2005, they would be named as follows: 05122800.LGH and 05122800.IDX Note: This version of InTouch supports the log files with extensions of .LGH and .IDX. Earlier versions of InTouch used the extension .LOG for log files. Name of Logging Node: Enter the network node name for the node that will be logging to the history log file. Default % of page to print on: Enter the percentage ratio for the page size to trend. Example: If you use 50 for the percentage, when you print a historical trend, it will fill half of the page (vertically and horizontally). A printout this size will take roughly one quarter of the time to prepare as a full page printout. Max consecutive time to spend printing: Enter the number of milliseconds (processor time slice) the historical trend print module will spend consecutively printing. Time to wait between printing: Enter the number of milliseconds the historical trend print module will wait between printouts. Always use colors when printing: When using a color printer or plotter. Select Printer Font: Accesses the Windows Font dialog box. 350. 7-14 Module 7 – Real-time and Historical Trending Wonderware Training Using Historical Trend Wizards The InTouch trend Wizard selector provides a quick and easy way to create a historical trend. Trend Wizards allow you to configure a full-featured historical trend with features such as scooters and zooming with just a few mouse clicks. A trend object is like any other object drawn in WindowMaker. It can be moved by grabbing it with the mouse or it can be resized by grabbing one of the object handles. You can place multiple trends in a window. Note: Configuration of the Hist Trend w/Scooters and Scale Wizard is similar to the object on the Draw Objects toolbar. a. Click the Wizard toolbar icon . The Wizard Selection dialog box appears: b. Select Trends. Note: The 16-Pen Trend and 16-Pen Trend Scooter wizards will not appear if not installed during the original InTouch installation. 351. Section 2 – Historical Trends 7-15 InTouch® HMI 9.5 Fundamentals of Application Development Course c. Place the Hist Trend with Scooters and Scale wizard in your InTouch window. d. Double-click on the trend wizard The Historical Trend Chart Wizard dialog box appears: Suggest: The wizard will automatically enter the configuration settings. The settings configured for a historical trend wizard are the same as those configured when the historical trend object is drawn using WindowMaker's trend tool in the Drawing Toolbar. e. Click Suggest. 352. 7-16 Module 7 – Real-time and Historical Trending Wonderware Training The trend wizard creates and fills in two tags: Values…: This option allows customization of the vertical axis divisions, format, and range. f. Click the Values… button in the Historical Trend Chart Wizard. The Value Format (Vertical Axis) dialog box appears: g. Click OK to save your changes. Times…: This option allows customization of the horizontal axis divisions, time span, and time format. h. Click the Times… button in the Historical Trend Chart Wizard. The Time Format (Horizontal Axis) dialog box appears: i. Click OK to save your changes. 353. Section 2 – Historical Trends 7-17 InTouch® HMI 9.5 Fundamentals of Application Development Course Pens…: This option allows the user to select which values and colors each pen will plot. j. Click the Pens… button in the Historical Trend Chart Wizard. The Trend Pens dialog box appears: k. Double-click on the tags to trend field. A Select Tag dialog box appears, showing only the tags that have Log Data enabled in the Tagname Dictionary: l. Configure the first pen to plot the value of the IntTag tagname. m. Configure the second pen to plot the value of the RealTag tagname. 354. 7-18 Module 7 – Real-time and Historical Trending Wonderware Training Allow Runtime Changes: Selection of this option sets the historical trend to be touch- sensitive in WindowViewer and the operator will be able to change features such as the pen assignments or the start date and time. n. Ensure that Allow Runtime Changes is checked in the Historical Trend Chart Wizard, and click OK. o. Switch to Runtime. p. Click the trend object in WindowViewer. The Historical Trend Setup dialog box appears: q. Chart Start: Enter the starting date and time for the chart. r. Display Mode: Select one of three modes as described in the following examples. Min/Max Historical Trend: This mode displays the trends or changes in the percentage of Engineering Units scale as a vertical line over the time span, with emphasis on time flow and rate-of-change and not on the amount of change. Average/Scatter Historical Trend: This mode displays the average value of the point during the time intervals. Average/Bar Chart Historical Trend: This mode displays the average value of the point during the time intervals in bar form. Note: The display mode of the trend affects performance. Foremost, is the length of the lines being drawn to generate the trend: the longer the lines, the longer it takes to generate. Line width is also a performance factor. Wider lines take significantly longer to draw. Min/Max or Average/Scatter trends are generally much faster to generate than Average/Bar Chart. s. Chart Length: Enter the horizontal (x-axis) length of time to be displayed on the trend and then select the time increment for the length. If you enter a 1 and select Hrs, the trend will be 1 hour long. 355. Section 2 – Historical Trends 7-19 InTouch® HMI 9.5 Fundamentals of Application Development Course t. Chart Range: Enter the percentage of Engineering Units scale that the trend is to zoom in/out (vertical y-axis) range to be displayed on the trend. The units for the range are a percentage of Engineering Units scale. These values should be from 0 to 100. u. Pen#: Click within the blank field to select the tag. The Tag Browser appears in the filtered selection mode: Only the tags that are defined with the Log Data option selected will be displayed for the selected tag source. Double-click the tagname that the selected pen will plot on the trend or select the tagname and click OK. The Historical Trend Setup dialog box reappears displaying the selected tagname next to the Pen# button you originally clicked. You can open the Filter drop-down list to view the filters that can be used to populate the Tag Browser. The first entry of this list is , which means that no filter is being used. Only the tags that are defined with the Log Data option selected will be displayed for the selected tag source. 356. 7-20 Module 7 – Real-time and Historical Trending Wonderware Training Additional Historical Trend Wizards Add zoom and movement functions or pen controls to your historical trend with a Trend Zoom / Pan Panel or Trend Pen Legend wizard. For these components to work together, the same Hist Trend tagname must be used by all wizards. Trend Zoom / Pan Panel: Place and configure the Trend Zoom / Pan Panel using the same steps outlined in the Hist Trend with Scooters and Scale section. a. Place a Trend Zoom / Pan Panel wizard in your InTouch window and configure it using the Suggest button. Note: The above diagram depicts the Zoom Bar and Scroll Bar button functionality when the Historical Trend wizard is not configured to update automatically. Use the scooters at the bottom of the Hist Trend with Scooters and Scale wizard to pinpoint a specific area. Then click the Zoom In button to zoom into that specified area. 357. Section 2 – Historical Trends 7-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Trend Pen Legend: Displays tagname and values at Scooters for one pen. By default, the value of the pen at the left-most point on the Historical Trend is displayed on the left, while the value of the pen at the right-most point is displayed on the right side of the Trend Pen Legend. However, you can use the scooters at the bottom of the Historical Trend wizard to display a pen’s value at a specific time. b. Place two Trend Pen Legends in your InTouch window. Configure the first for the IntTag Pen Number (and Trend Pen color), and the second for the RealTag Pen Number (and color). 358. 7-22 Module 7 – Real-time and Historical Trending Wonderware Training HistData Wizard: Saves Historical data to a CSV file. c. Place a HistData wizard in your InTouch window, and configure using the Suggest button. 359. Section 2 – Historical Trends 7-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Historical Trend Dot Fields For any given historical trend tag there are many .fields that only apply to historical trending tags. Historical QuickScript Functions There are several internal functions that can be used to specify the tag to be trended by each pen, display the value at a scooter location, scroll the trend by a percentage, and so on. These functions are described in Appendix G of this manual. .Field Description .ChartLength Read/write integer tagname .field used to control the length of time displayed in a Historical trend graph. .ChartLength displays the length of the chart in seconds. .ChartStart Read/write integer tagname .field used to control the starting time and/or to scroll the corresponding historical trend. .ChartStart displays the number of elapsed seconds since 12:00 a.m., 1/1/70. .DisplayMode Read/write analog tagname .field used to determine the method to be used in displaying values on the trend. .MaxRange, .MinRange Read/write real tagname .fields used to represent the percentage of the tagname's Engineering Unit range that should be displayed for each tagname being trended. The limits for .MaxRange and .MinRange are from 0 to 100 and .MinRange should always be less than .MaxRange. If a value less than 0 or greater than 100 is assigned to either of these fields, the value will be clamped at 0 or 100. If .MinRange is greater than or equal to .MaxRange, the trend will not display any data. .Pen1 - .Pen8 Read/write TagID type tagname .fields used to control the tagname being historically trended by each pen. A TagID type tagname can only be equated to another TagID tagname. It cannot be mixed with any other tagname type unless the .TagID extension is added to the other tagname. .TagID cannot be used for remote history provider tagnames. .ScooterLockLeft Read/write discrete field. When the value of this field is TRUE, the RIGHT scooter cannot move to the left of the left scooter's position. (0=FALSE, 1=TRUE). .ScooterLockRight Read/write discrete field. When the value of this field is TRUE, the LEFT scooter cannot move to the right of the right scooter's position. (0=FALSE, 1=TRUE). .ScooterPosLeft Read/write real field which represents the position of the left scooter (range 0.0 to 1.0). .ScooterPosRight Read/write real field which represents the position of the right scooter (range 0.0 to 1.0). .TagID Read/write TagID tagname .field used in conjunction with the Historical Trend .Pen1 - .Pen8. TagID tagnames monitor and/or control the tagname being trended by a pen. .UpdateCount Read-only integer .field that is incremented when a retrieval is complete for the trend. .UpdateInProgress Read-only discrete .field that shows historical data retrieval status (0=no retrieval in progress, 1=retrieval in progress). .UpdateTrend Read/write discrete tagname .field that can be set to 1 to cause a Historical trend to update using all current values. 360. 7-24 Module 7 – Real-time and Historical Trending Wonderware Training HistData Utility The HistData utility program provides access to the historical data files created by InTouch. It is used to move selected historical data into a requesting program such as Microsoft Excel. HistData provides you with the ability to immediately view historical data or create a file for later access. Access to the historical data may be accomplished via macro functions in a requesting program or from within InTouch. The HistData program should be started and then reduced to an icon prior to starting any program that will be using it. Note: The HistData utility cannot be used with remote tagname references, for example, DBS:TAG (AccessName:Item). HistData Database The HistData program contains its own I/O. The items are used to specify start period, duration and sampling interval, and so on., for the historical data to be accessed. The following lists the items defined in the HistData program. .Field Description Description DATADIR Message Pathname of the directory containing the historical data files (e.g., C:InTouchApp). DBDIR Message Pathname of the directory containing the InTouch Tagname Dictionary (e.g., C:InTouchApp). STARTDATE Message Data sample start date in the format MM/DD/YY. STARTTIME Message Data sample start time in the format HH:MM:SS using the 24- hour clock DURATION Message The length of time for which data is to be returned. DURATION can be expressed in weeks, days, hours, minutes and seconds. The following are the valid characters: w (week), d (day), h (hour), m (minute), s (second). Fractional values are also permitted (e.g., .5s for 500 milliseconds). To request a single sample, set DURATION to 0 (zero). INTERVAL Message The length of time between samples. INTERVAL can be expressed in weeks, days, hours, minutes and seconds (e.g., 1w represents 1 week). Fractional values are also allowed (e.g., .25d represents 6 hours). (The valid characters are the same as those for DURATION.) Note: The maximum length of time allowed for DURATION and INTERVAL is 6 weeks. This applies to all request types, days, seconds, and so on. For example, if using days, 42 is the maximum (7 days x 6 weeks = 42). FILENAME Message Complete pathname of file to write the requested data (e.g., C:INTOUCHHDFILE.CSV). WRITEFILE Integer When set to 1, HistData will write the requested data to the file specified by the FILENAME item name. When the file update is complete, WRITEFILE is automatically reset to 0 (zero). ERROR Message A string containing a description of the last error. It will be "None" when STATUS is 1 and will contain an error message string when STATUS is 0 (zero). 361. Section 2 – Historical Trends 7-25 InTouch® HMI 9.5 Fundamentals of Application Development Course Note: For legacy systems, ensure complete accuracy of time configuration by referring to InTouch Tech Note #144, How the Time Zone & Daylight Savings Time Affect InTouch Historical Logging, included in Appendix E, “InTouch-Related Tech Notes.” TAGS1, TAGS2,... Message The TAGS string can be 131characters in WindowViewer and 255 characters in Excel. The string can be appended for longer requests by adding tagname items named "Tags1," "Tags2", and so on. If a tagname needs additional tagname text appended to it, a plus (+) is entered at the end of the string. For example: TAGS="$Date,ProdLevel,ProdTemp,+" TAGS1=“ReactLevel,Temp,GasLevel,+” TAGS2="MotorStatus" Note: Duplicate tagnames are not allowed and the maximum length of each tag’s string is 512 bytes. PRINTTAGNAMES Discrete This item defaults to 1 and causes HistData to print the tagnames on the first line of the output file above the associated column of values. If the tagnames are not to be printed, this item's value must be changed to 0 (zero). DATA Message This item is used to hold the requested data in the HistData program in comma separated variable format. It is used by other applications to ADVISE or REQUEST data via DDE. STATUS Discrete Displays the status of the last operation. 1 indicates success and 0 (zero) indicates that an error occurred. Historical Trending and Daylight Savings The InTouch history system automatically accounts for time zones. For information on Daylight Savings considerations please refer to the InTouch Support area of the Wonderware website. SENDDATA Integer When set to 1, HistData will update the DATA item with the requested data. When the update is complete, SENDDATA is automatically reset to 0 (zero). Note: If you receive an error message saying you have requested too much data when using SENDDATA, shorten the DURATION or reduce the number of tagnames you are requesting.Duplicate tagnames are not allowed and the maximum length of each tag’s string is 512 bytes. .Field Description Description 362. 7-26 Module 7 – Real-time and Historical Trending Wonderware Training – Intentionally left blank – 363. Lab 8 – Configuring Historical Trends 7-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 8 – Configuring Historical Trends Introduction In this lab, you will create and configure a Historical Trend to retrieve information about two existing tags, RealTag and IntTag. Objective By the conclusion of this lab, you should have a thorough understanding of creation and configuration of InTouch Historical Trends. To do this, the following tasks must be completed successfully: Create a Historical Trend Window Configure the Trends Wizard Define the Trend Zoom/Pan panel Define the Trend Pen Legend Define the HistData Wizard Define the sliders 364. 7-28 Module 7 – Real-time and Historical Trending Wonderware Training Create a Historical Trend Window 1. Create a new window with the attributes shown in the following figure. 2. Click OK. 3. Press the Ctrl+T keys to open the Tagname Dictionary. 4. Confirm the Log Data option is enabled for IntTag. 5. Click Save. 6. Use the >> button to scroll down to RealTag. 7. Confirm the Log Data option is enabled for RealTag. 8. Click Save, then Close. Note: Historical Logging cannot be performed on a Message Tag. 9. Click Special / Configure / Historical Logging. 365. Lab 8 – Configuring Historical Trends 7-29 InTouch® HMI 9.5 Fundamentals of Application Development Course The Historical Logging Properties window appears: 10. Click the Enable Historical Logging check box. 11. Click OK. 12. Shutdown WindowViewer if it is running. DO NOT RESTART WINDOWVIEWER! 13. Create a window similar to the one below utilizing the Hist Trend w/Scooter and Scales, Trend Zoom/Pan Panel, Trend Pen Legend and HistData wizards. Also include two Sliders. Hint: Copy and paste the sliders from the RealTime Trend Window created earlier. Sliders Hist Trend with Scooter and Scales Trend Zoom / Pan Panel Trend Pen Legends HistData Wizard 366. 7-30 Module 7 – Real-time and Historical Trending Wonderware Training Configure the Trends Wizard 14. Double-click on the trend. The Historical Trend Chart Wizard dialog box appears: 15. Click Suggest to enter tagnames. Suggested names appear automatically. Keep in mind that all of the Trends wizards used in your window must now be associated with the HistTrend tag. 16. Click the Pens button. The Trend Pens dialog box appears. 17. Double-click in the Pen 1 field. 367. Lab 8 – Configuring Historical Trends 7-31 InTouch® HMI 9.5 Fundamentals of Application Development Course The Select Tag window appears: 18. Select the IntTag, then click OK. 19. Repeat the previous 2 steps for the Pen 2 field, and select the RealTag. 20. Click OK. 21. Click OK again to exit the Historical Trend Chart Wizard dialog box. Define the Trend Zoom/Pan Panel 22. Double-click the Trend Zoom/Pan Panel. The Trend Panel Wizard dialog box appears. 23. Click the Suggest button to enter the correct tagnames. Be sure that the HistTrend tagname is used. 24. Click OK. 368. 7-32 Module 7 – Real-time and Historical Trending Wonderware Training Define the Trend Pen Legend 25. Double-click the first Trend Pen Legend object. This object will display the IntTag tag. The Trend Legend Wizard appears as following. 26. Click Suggest to enter the correct tagnames. Again, be sure that the HistTrend tagname is used. 27. In the Color group, use green for the Trend Pen. 28. Verify that 1 is entered in the Pen Number box. 29. Leave all other entries as their defaults. 30. Click OK. 31. Double-click the second Trend Pen Legend (for the RealTag tag). 32. Click Suggest. 33. Enter a Trend Pen Color of Red and a Pen Number of 2. 34. Click OK. 369. Lab 8 – Configuring Historical Trends 7-33 InTouch® HMI 9.5 Fundamentals of Application Development Course Define the HistData Wizard 35. Double-click the HistData wizard and then click Suggest to enter the HistTrend tag. 36. Enter 50 for the number of records to write per CSV file. 37. Click OK. 370. 7-34 Module 7 – Real-time and Historical Trending Wonderware Training Define the Sliders If you did not copy the two sliders from the Real Time Trend window, configure them using the steps outlined next. 38. Double-click the upper slider. This slider will be used for the tag IntTag. 39. Configure the Slider Wizard dialog box with the following attributes. TagnameIntTag Slide Face / Label IntTag Fill color Green Slide Range / Maximum 1000 Decimal Places 0 Leave the other default settings. 40. Click OK. 41. Repeat this process for the second slider using: TagnameRealTag Slide Face / Label RealTag Fill color Red Slide Range / Maximum 1000 Decimal Places 0 42. Switch to Runtime. 371. Lab 8 – Configuring Historical Trends 7-35 InTouch® HMI 9.5 Fundamentals of Application Development Course A message box will appear asking if you want to start the HistData program: 43. Click Yes. 44. Move the sliders up and down to change the values and write them to the Historical Log file. 45. Click the Update to Current Time button to update the trend with the most current data. 46. Move the scooters and click the Zoom buttons to zoom in and out. 47. Click the “Save to File” button to perform the HistData extraction. The information extracted may be viewed in spreadsheet format in the .csv file indicated by “Filename” on the HistData Panel Wizard. Update to Current Time 372. 7-36 Module 7 – Real-time and Historical Trending Wonderware Training – Intentionally left blank – 373. Module 8 I/O Communication Section 1 – I/O Communication Protocols 8-3 Section 2 – Wonderware I/O Servers 8-13 Lab 9 – Configuring I/O Communication 8-19 Section 3 – Troubleshooting I/O 8-25 374. 8-2 Module 8 – I/O Communication Wonderware Training Module Objectives Explain I/O communication protocols Establish communication with I/O aware programs and be able to configure and troubleshoot I/O Servers 375. Section 1 – I/O Communication Protocols 8-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – I/O Communication Protocols This section explains I/O communication protocols and demonstrates how to configure an InTouch access name. Dynamic Data Exchange (DDE) Dynamic Data Exchange (DDE) is a communication protocol developed by Microsoft to allow applications in the Windows environment to send/receive data and instructions to/from each other. It implements a client-server relationship between two concurrently running applications. The server application provides the data and accepts requests from any other application interested in its data. Requesting applications are called clients. Some applications such as InTouch and Microsoft Excel can simultaneously be both a client and a server. Note: NetDDE, an older protocol used for communication over the network to Wonderware and non-Wonderware sources, is supported on Windows XP and Windows 2000, but not on Windows 2003 Server. Communication with Wonderware sources is recommended using SuiteLink. Section Objectives Explain I/O Communication Protocols Explain and configure an InTouch Access Name 376. 8-4 Module 8 – I/O Communication Wonderware Training Wonderware SuiteLink Wonderware SuiteLink uses a TCP/IP-based protocol. SuiteLink is designed specifically to meet industrial needs, such as data integrity, high-throughput, and easier diagnostics. This protocol standard is supported for Windows 2000, Windows 2003 Server, and Windows XP. SuiteLink is Not a Replacement for DDE. Wonderware recommends that DDE be used for internal client communication, and SuiteLink for communication over the network. Each connection between a client and a server depends on your network situation. SuiteLink provides the following benefits: Consistent high data volumes can be maintained between applications, regardless of whether the applications are on a single node or distributed over a large node count. Value Time Quality (VTQ) places a time stamp and quality indicator on all data values delivered to VTQ-aware clients. Extensive diagnostics of the data throughput, server loading, computer resource consumption, and network transport are made accessible through the Microsoft Windows NT® operating system performance monitor. This feature is critical for the scheme and maintenance of distributed industrial networks. The network transport protocol is TCP/IP using Microsoft’s standard Winsock interface. To use the SuiteLink Communication Protocol, the following conditions must be satisfied. You must have Microsoft TCP/IP configured and working properly. You must use computer names (Node Names) of no more than 15 characters. For more information on installing and configuring Microsoft TCP/IP, see your Microsoft Windows operating system's documentation. Wonderware SuiteLink must be running as a service. If for some reason SuiteLink has been stopped, you will need to start it again. (SuiteLink is automatically installed as a Common Component when you install InTouch. It is configured to startup automatically as a Windows Service). 377. Section 1 – I/O Communication Protocols 8-5 InTouch® HMI 9.5 Fundamentals of Application Development Course InTouch I/O Addressing InTouch identifies an element of data in an I/O Server program by using a three-part naming convention that includes the application name, topic name and item name. To obtain data from another application, the client program (InTouch) opens a channel to the server program by specifying these three items. In order for InTouch to acquire a data value from another application, it must also know the name of the application providing the data value, the name of the topic within the application that contains the data value, and the name of the specific item within the topic. In addition, InTouch needs to know the data's type: discrete, integer, real (floating point), or message (string). This information determines the I/O type for the tagname when it is defined in the InTouch database. When WindowViewer is running, it will automatically perform all of the actions required to acquire and maintain the value of this item. For example, in the case of Excel, the application name is "Excel," the topic name is the name of the specific spreadsheet that contains the data and the item name is the identification of the cell on the spreadsheet to/from which the data is to be read/written. When another Windows application requests a data value from InTouch, it also must know the three I/O address items. The following describes the I/O address convention for InTouch. VIEW (application name) identifies the InTouch Runtime program that contains the data element. TAGNAME (topic name) is the word always used when reading/writing to a tagname in the InTouch database. ActualTagname (item name) is the actual tagname defined for the item in the InTouch Tagname Dictionary. For example, to access a data value in InTouch from Excel (running on the same node), a DDE Remote Reference formula would be entered in the cell into which the data value is to be written: =VIEW|TAGNAME!'ActualTagname' 378. 8-6 Module 8 – I/O Communication Wonderware Training InTouch Access Names When you create I/O-type tags or remote tagname references, they must be associated with an Access Name. Access Names contain the information that is used to communicate with other I/O data sources including the node name, application name and topic name. Create an Access Name Note: All I/O Server setup which follows is specific to the Wonderware facility training environment. Your instructor will provide the proper configuration information. Note: The Access Name configured in the following steps is used in the subsequent lab. a. Expand Configure in the Application Explorer. b. Right-click Access Names and select Open. Note: Access Names can also be created while you are defining an I/O-type tag in the Tagname dictionary. The Access Names dialog box appears: c. Click Add. 379. Section 1 – I/O Communication Protocols 8-7 InTouch® HMI 9.5 Fundamentals of Application Development Course The Add Access Name dialog box appears: d. Access Name: Enter the new Access Name (For simplicity, use the same name that you will use for the topic name.). InTouch uses Access Names to reference real-time I/O data. Each Access Name equates to an I/O address, which can contain a Node, Application, and Topic. In a distributed application, I/O references can be set up as global addresses to a network I/O Server or local addresses to a local I/O Server. e. Node Name: Used when the data is from a remote I/O Server over the network. f. Application Name: Enter the actual program name for the I/O Server program from which the data value will be acquired. If the value is coming from a Wonderware Modbus I/O Server, MODBUS is used. Do not enter the .exe extension portion of the program name. g. Topic Name: Enter the topic name to access. The Topic Name is an application-specific sub- group of data elements. In the case of data coming from a Wonderware I/O Server program, the topic name must be the exact same name defined in the I/O server. h. Which Protocol to use: Select DDE (internal) or SuiteLink (network). i. When to advise server: Advise all items: Select if the server program is to poll for all data whether or not it is in visible windows, alarmed, logged, trended or used in a script. Selecting this option will impact performance and is not recommended. Advise only active items: Select if the server program is to poll only points in visible windows and points that are alarmed, logged, trended or used in any script. A Touch Pushbuttons action script will not be polled unless it opens in a visible window. The following figure shows an example of a completed access name (if the I/O server is on the local node, the Node Name: can be left blank as shown in the following figure). 380. 8-8 Module 8 – I/O Communication Wonderware Training j. Click OK to accept the new Access Name. k. Click Close to close the dialog box. Modifying or Deleting an Access Name a. In the InTouch Application Explorer, right-click Access Names and select Open. The Access Names dialog box appears: b. Select the access name to modify. c. Click Modify. The Modify Access Name dialog box appears. d. Make any changes and click OK. e. Repeat this procedure if you need to modify other Access Names. 381. Section 1 – I/O Communication Protocols 8-9 InTouch® HMI 9.5 Fundamentals of Application Development Course To delete an Access Name, select it in the list and then click Delete. A message box will open asking you to confirm the deletion. Click Yes. f. Click Close or repeat this procedure to delete other defined Access Names. Note: Access Names used by tags cannot be deleted. Defining an I/O Type Tagname All I/O type tags receive their values from other Windows application programs such as Excel and I/O Servers. This value is referred to as the "raw" value. When you define a tag in the Tagname Dictionary, you must enter values for the Min- and Max Raw. These values are used by the database as clamps on the actual raw value received from the I/O device. For example, if you set the Min Raw value to 50 and the actual value received from a I/O Server is 0, database will force the Raw value to 50. InTouch does not display raw values. Instead, it displays engineering units (EU). When you define an I/O type tag in the Tagname Dictionary, you must specify values for the Min- and Max EU. These values are used to scale the raw value to the displayed value. If you do not want to do scaling or your I/O device does the scaling for you, set the Min/Max EU values equal to the Min/ Max Raw values. For example, assume that a flow transmitter wired to a PLC register generates a value of zero at no flow and a value of 9999 at 100% flow. The following values would be entered: Min EU = 0 Max EU = 100 Min Raw = 0Max Raw = 9999 A raw value of 5000 would be displayed as 50. Assume that a flow transmitter wired to a PLC register generates a value of 6400 at no flow and a value of 32000 at 300 GPM. Min EU = 0 Max EU = 300 Min Raw = 6400Max Raw = 32000 In this case, a raw value of 12800 would be displayed as 150. A raw value of 6400 would be displayed as 0 and a Raw value of 0 would be displayed as 0 (all values outside the boundaries set by the Min Raw and Max Raw values are clamped). The above scaling works in reverse when the I/O tag data is written from the InTouch Tagname Dictionary to other Windows applications. 382. 8-10 Module 8 – I/O Communication Wonderware Training a. Press Ctrl+T. The Tagname Dictionary dialog box appears: b. Click Details. c. Click New to add a new tagname. d. In the Tagname field, enter a name for the new tagname. e. Click Type. The Tag Types dialog box appears: f. Select I/O Integer for this tag. g. Click OK. The respective details dialog box will be visible in the Tagname Dictionary. (If the details portion of the dialog box does not open, click Details at the top of the screen.) h. Specify all the required details for defining the item. i. Click Access Name. 383. Section 1 – I/O Communication Protocols 8-11 InTouch® HMI 9.5 Fundamentals of Application Development Course The Access Names dialog box appears: j. Double-click the Access Name to use or select it and click Close. In the previous figure, the PLC1 access name is selected for this tag. The selected Access Name (now associated with this tag definition) appears adjacent to the Access Name button in the details portion of the Tagname Dictionary (shown next). k. In the Item Box, enter the item name or number for the data value in the IOServer application, PLC, or associated application. If the Item name is to be the same as the tagname, check the Use Tagname as Item Name box to automatically fill in the Item name. Note: Understand that the “tagname” is the name used within InTouch to refer to a data value (tag). The Item is the name used by a remote Windows application to refer to the same value. These names do not have to be the same, but it is recommended to use the same names. l. Click Close. Note: The Type field can be changed after adding the Item, until it is assigned to an Animation link or used in a script. 384. 8-12 Module 8 – I/O Communication Wonderware Training – Intentionally left blank – 385. Section 2 – Wonderware I/O Servers 8-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Wonderware I/O Servers This section will describe the configuration of a Wonderware I/O Server (Modbus). Introduction Wonderware I/O Servers are Microsoft Windows application programs that enable other DDE- aware Windows applications (such as InTouch or Excel) access to data in the real world (such as PLCs or RTUs). Wonderware servers are primarily intended for use with Wonderware's InTouch program; however, they can be used by any Microsoft Windows program capable of acting as a DDE client. In this section, we will examine the start-up, configuration and use of a Wonderware I/O Server. Because Wonderware's I/O servers are Windows applications, they will all have the same basic appearance and capabilities. Keep in mind that depending on server required, additional hardware (network, and so on) may be necessary and the configuration screens may require additional information. The following information references the Modbus I/O Server as a point-to-point server using the RS-232 serial port to PLCs provided at the Wonderware facility training environment. Your instructor may have you configure the following screens differently. Note: All I/O Server setup which follows is specific to the Wonderware facility training environment. Your instructor will provide the proper configuration information. It accesses one Koyo DirectLogic O5 PLC via its programming port. Configuring I/O Servers Once the I/O Server has been installed, some configuration is required. Configuring the server automatically creates a configuration file named MODBUSDV.CFG. This file stores the configuration information about communication ports and all of the topic definitions (described in detail later). The configuration file is automatically saved to the directory in which the I/O Server is installed unless a different directory is specified via the Configure / I/O Server Settings command. a. Select Start / Programs / WonderwareFactorySuite / IOServers / Modicon MODBUS. The MODBUS dialog box appears: b. Click Configure / Com Port Settings. Section Objective Configure a Wonderware I/O Server (Modbus) 386. 8-14 Module 8 – I/O Communication Wonderware Training The Communication Port Settings dialog box appears. This dialog is used to configure the communication port that will be used to communicate with the PLC equipment. Com Port: Select the communication port that is connected to the PLC equipment. Reply Timeout: Enter the amount of time (in seconds) that all PLCs connected via this serial communications port will be given to reply to commands from the I/O Server. Note: This timeout is sustained only when the PLC fails to respond. When the PLC is responding normally, there is no penalty. The default value of 3 second should be sufficient for most configurations. Protocol area: Select the protocol configured for the equipment attached to this communication port. RTU is recommended. Baud Rate area: Select the baud rate (serial bit rate) setting that matches the equipment connected to this communication port. Data Bits area: Select the option for the number of data bits that corresponds to the configuration of the equipment on this communication port. If ASCII is selected for the protocol, use 7. If RTU is selected, use 8. Stop Bits area: Select the appropriate number of stop bits for the communication port. If the baud rate is greater than 300, the stop bits should be set to 1. Parity area: Select the setting that corresponds to the configuration of the equipment on this communication port. Note: All devices on a single communication port must be configured with the same Protocol, Parity, Stop Bits, Data Bits and Baud Rate. 387. Section 2 – Wonderware I/O Servers 8-15 InTouch® HMI 9.5 Fundamentals of Application Development Course For this training class, the following settings must be configured as shown. c. Save your changes in the suggested directory and click Done to exit. Note: Click Save to save the current settings entered for the selected communication port. The Communication Port Settings dialog box remains displayed and another communication port can be configured. 388. 8-16 Module 8 – I/O Communication Wonderware Training Creating Topic Definitions The Configure / Topic Definition command is used to create, modify, or delete topic definitions. One or more topic definitions must exist for each PLC that the I/O Server will communicate with. Each topic definition must contain a unique name for the PLC associated with it. This unique name is then used as the topic name portion of the DDE Address for all DDE conversations to that PLC. a. Click Configure / Topic Definition. The Topic Definition dialog box appears: Note: Once topics have been defined, their names will be listed in the Topics pane of this dialog box. b. Click New to add a new topic definition. The MODBUS Topic Definition dialog box appears: c. Topic Name: Enter a unique name (up to 32-characters long) for the PLC in the field. Note: When communicating with InTouch, this exact name is used as the topic name in the Access Name definition. d. ComPort: Select the communications port to be associated with this topic. 389. Section 2 – Wonderware I/O Servers 8-17 InTouch® HMI 9.5 Fundamentals of Application Development Course e. Slave ID: Enter the Slave ID of the PLC in the box. f. Slave Device Type: Drop-down list contains slave device types other than the default. g. String Variable Style: The PLC will use this style to store ASCII strings in its registers. h. Register Type: Select BINARY or BCD, based on hardware used. i. Block I/O Sizes: Coil Read: Enter the maximum number of consecutive coils to be read at one time. In this example, the valid coil read values can be between 8 and 2000 and must be an even multiple of 8. j. Coil Write: Enter the maximum number of consecutive coils that can be written to at one time. In this example, the valid coil write values can be between 8 and 800 and must be an even multiple of 8. k. Register Read: Enter the maximum number of consecutive registers to be read at one time. In this example, the valid register read values can be between 1 and 125. l. Register Write: Enter the maximum number of consecutive registers that can be written to at one time. In this example, the valid register write values can be between 1 and 100. m. Update Interval: Enter the frequency (in milliseconds) that the I/O Server will read (poll) the items/points associated with this topic. Different items/points can be polled at different rates by defining multiple topic names for the same PLC and setting different update rates for each topic. n. Click OK to accept the entries and close the dialog box. The Topic Definition dialog box will open with the new topic listed: o. Click the Done button to close this dialog box and return to the server's program window. p. Click Modify to change an existing topic definition. q. Click Delete to delete an existing topic definition. Note: The previous information is provided for example only. Configuration steps for this class are provided in the following lab. 390. 8-18 Module 8 – I/O Communication Wonderware Training – Intentionally left blank – 391. Lab 9 – Configuring I/O Communication 8-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 9 – Configuring I/O Communication Introduction In this lab, you will configure a Modbus server and establish communication with I/O-aware programs by creating and animating new tags. Assumptions This lab was developed using a Koyo PLC as the data source. If a PLC containing simulation logic is not available, a similar lab using the SIMULATION program is provided in Appendix F, “I/O Simulation.” The SIMULATION program is included with InTouch. Configuring the Modbus I/O Server is included as an instructor-led task starting on page 8-13. If the I/O Server has not yet been configured, please do so at this time. Note: All I/O Server setup which follows is specific to the Wonderware facility training environment. Your instructor will provide the proper configuration information. Objectives Upon completion of this lab, you should be able to: Start and Configure the Modbus Server Define the MODBUS Topic Create a New Access Name Create a New Factory Floor Window 392. 8-20 Module 8 – I/O Communication Wonderware Training Start and Configure the Modbus Server 1. If not already started, start the Modbus server by clicking Start / Programs / Wonderware FactorySuite / IO Servers / Modicon MODBUS. 2. When the server is running, click Configure/Com Port Settings. Ensure the following settings are configured. 3. Click Done. 393. Lab 9 – Configuring I/O Communication 8-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Define the MODBUS Topic 4. Click Configure / Topic Definition. 5. Click New. The Modbus Topic Definition window appears: 6. Enter PLC1 in the Topic Name field. 7. Ensure COM1 is selected in the Com Port field. 8. Select BCD as the Register Type. Enter 100 for the Update Interval. 9. Click OK. The Topic appears in the Topic definition dialog Topics pane: 10. Click Done. 11. Minimize the Modbus server. 12. Maximize WindowMaker. 394. 8-22 Module 8 – I/O Communication Wonderware Training Create a New Access Name 13. Select Configure / Access Names from the WindowMaker Application Explorer. 14. Double-click Access Names. 15. Click Add. The Add Access Name dialog box displays. 16. Enter the information shown in the following figure. 17. Click OK to accept the new Access Name. Your new Access Name is now displayed in the Access Names pane. 18. Click Close. 395. Lab 9 – Configuring I/O Communication 8-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Create a New Factory Floor Window In this lab, we will create a new window called Main, where materials will be received from the hopper into a mixing drum. There will be two valves attached to the mixing drum allowing two more materials to be added. The mixture will then be agitated and drained. For a complete description, please see page page 8-24. 19. Create a new window called Main. Important: All tags except the Start tag should be configured as ‘read-only’. 20. Create the following tags. Since we will be communicating with the PLC, the tags will need to be assigned to the Access Name, PLC1 with the Items listed below. 21. Add text for each of the tags in the Main window. 22. Link each text object to the appropriate tag as follows. Tagname Tag Type Access Name Item Start I/O Discrete PLC1 2049 Gate_Valve I/O Discrete PLC1 2050 Valve_A I/O Discrete PLC1 2051 Valve_B I/O Discrete PLC1 2052 Agitator I/O Discrete PLC1 2053 Drain_Valve I/O Discrete PLC1 2054 Tank_Level I/O Integer PLC1 40001 (Min/Max EU 0-1000) (Min/Max Raw 0-1000) Tagname Animation Link Start Touch Pushbutton – Discrete Value - Toggle, Discrete Text Color - Green/Red Gate_Valve Discrete Text Color – Green/Red Valve_A Discrete Text Color – Green/Red Valve_B Discrete Text Color – Green/Red Agitator Discrete Text Color – Green/Red Drain_Valve Discrete Text Color – Green/Red Tank_Level Value Display - Analog 396. 8-24 Module 8 – I/O Communication Wonderware Training 23. Switch to Runtime to test the links. The Start text field should toggle between Green and Red when clicked. The Gate_Valve text field should change from Green to Red when the tag value changes. The Valve_A and Valve_B text fields should change from Green to Red when the tag value changes. The Agitator text field should change from Green to Red when the tag value changes. The Drain_Valve text field should change from Green to Red when the tag value changes. The Tank_Level text field should change when the tag value changes. Now, you are on your own. Try to be as creative as you can. For example; use as many animation links as possible, implement trending, try using wizards, bitmaps, and so on. The materials you use in this process visualization are completely up to you. Important Note: Process Description: When ‘Start’ is set to True, the ‘Gate_Valve’ will open and the ‘Tank_Level’ will start to increase until it reaches 300, at which point Gate_Valve will close. ‘Valve_A’ will then open and the ‘Agitator’ will turn on to mix the product. When the ‘Tank_Level’ reaches 600, ‘Valve_A’ will close and ‘Valve_B’ will open. When the ‘Tank_Level’ reaches 1000, ‘Valve_B’ will close, the ‘Agitator’ will turn off, and the ‘Drain_Valve’ will open, causing the ‘Tank_Level’ to decrease to 0 (zero). This process will repeat as long as the ‘Start’ point remains True. If ‘Start’ is set to ‘False’, the process will stop when the ‘Tank_Level’ value reaches 0 (zero). 397. Section 3 – Troubleshooting I/O 8-25 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 3 – Troubleshooting I/O This section explains how to troubleshoot I/O communication between the I/O Server and InTouch, and between the I/O Server and the PLC. Note: All I/O Server setup which follows is specific to the Wonderware facility training environment. Your instructor will provide the proper configuration information. The following figure illustrates where the failures can occur: Communication Between InTouch and the I/O Server Error situations can occur when attempting to establish an I/O conversation between InTouch and an internal I/O Server. When WindowViewer requires the status of a I/O item, it opens a channel with the I/O Server and requests it to advise WindowViewer when the DDE item changes. The I/O Server automatically handles all of the messages to and from the PLC. The client application simply tells the I/O Server what register, coil number or I/O point to read or write. The I/ O Server then automatically updates the client upon any change of that data value. It is highly recommended that you always start the I/O Server before starting WindowViewer. If WindowViewer attempts to establish a channel with an I/O Server that is not running, the Initializing I/O message box will open for each un-initialized I/O conversation. When this dialog box appears, note the information on the second line. This information indicates that at least one tag in WindowMaker is linked to an Access Name that defines MODBUS as the application name and PLC1 as the topic name. Section Objective Explain troubleshooting InTouch I/O 398. 8-26 Module 8 – I/O Communication Wonderware Training In this case, when the WindowViewer program was started, it immediately looked for an I/O Server application named MODBUS containing a topic defined as PLC1. It could not find this application and/or topic and is notifying you that communications cannot be established. The following describes the three situations that will cause the previous dialog box to open. The I/O Server is not running. The I/O Server application (MODBUS in this case) is not running. You can verify this by opening the Windows Task List (CTRL+ALT) and checking the list of currently running applications for the MODBUS server. The server's program name is misspelled in the Access Name definition. The server is running, but its name is misspelled in one or more Access Name definitions. The name entered in the Access Name definition must be the I/O Server's actual program name (less the .EXE extension) as seen in the Windows Explorer. The topic is not defined in the server or it is misspelled. Assume that the server's name is spelled correctly and is running. WindowViewer is now looking for a topic defined in the server as PLC1. To check the topic name, close WindowViewer. The server cannot be configured if WindowViewer is running. Open the I/O Server's program window and click Configure / Topic Definition. If there is a topic defined as PLC1 listed in the dialog box, ensure that it is spelled exactly the same (including spaces, and so on) as it is in the Access Name definition field. Note: Be sure there are no blank spaces after the topic name in both the server and in the Access Name definition in WindowMaker. When you have confirmed all of the above situations, restart WindowViewer and switch to the server's program window. Data should now appear in the window. This data indicates that WindowViewer and the server are communicating. The data also indicates read and write messages that the server is attempting to send to the PLC. These are not error messages: only status messages are written to this window. If no data appears in the server's window, check the Error Log in FactorySuite for error messages. The most common error message is: Error for DDE: MODBUS|PLC1! ("item") Advise failed This error message indicates that the item used on one or more tagnames is unrecognized by the server. InTouch tagnames use specific naming conventions when accessing data from a server. 399. Section 3 – Troubleshooting I/O 8-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Monitoring Communication Status Between InTouch and the I/O Server WindowViewer supports a built-in topic name called IOStatus that can be used to monitor the status of specific I/O conversations. When monitoring an I/O conversation using IOStatus, you must define at least one I/O-type tag for the Access Name being monitored. Assume that WindowViewer (View) is communicating with the Wonderware Modbus I/O Server to a PLC that has been defined in the I/O Server with PLC1 for its topic name. Note: Every Topic in Wonderware I/O Servers includes a Status bit. a. Click Special / Tagname Dictionary to open the Tagname Dictionary dialog box. b. Create an I/O Discrete type tag. c. Click Access Name to assign the tag to an Access Name definition that defines IOStatus for its topic name. The Access Name Definition dialog box appears. Notice that an Access Name definition called PLC1 (the topic we need to monitor) currently exists. To be sure that this is the correct Access Name (with Topic Name of PLC1), you will need to access the Modify Access Name window. d. Select PLC1 and click Modify. Finding the Access Name containing the right topic name in this example is easy because we kept the tagname and the Topic Name the same. 400. 8-28 Module 8 – I/O Communication Wonderware Training e. Click Cancel to close the dialog box and return to the initial Access Name Definition dialog box. The Access Name dialog box appears. f. Click Add. The Add Access Name dialog box appears: g. In the Access field, enter IOStatus. h. Since you are going to monitor the status in WindowViewer, in the Application Name field, enter View. 401. Section 3 – Troubleshooting I/O 8-29 InTouch® HMI 9.5 Fundamentals of Application Development Course i. In the Topic Name field, enter the InTouch internal topic, IOStatus. j. Select Advise only active items. k. Click OK to close the dialog box. The initial Access Name Definition dialog box reappears displaying the new Access Name, IOStatus: l. Click Close. m. In the Item box, enter the actual Access Name to monitor, in this case, PLC1. n. When configuring a monitor text link, point the links to their respective I/O Tags and configure Text Color- and/or Value Display- DISCRETE animation links to the tags. Testing for the ServerStatus link can be done by shutting down the I/O Server (in this example, MODBUS). o. Restart the I/O by restarting the MODBUS server, then select Special/Reinitialize I/O in the WindowViewer main menu. 402. 8-30 Module 8 – I/O Communication Wonderware Training Monitoring Communication Status Between the I/O Server and the I/O Device For each topic name being used, there is a built-in discrete item, Status, which can be used to monitor the state of communications with the I/O Servers program. Status is set to 0 when communication with the device fails (cable disconnected, PLC is powered down, and so on) and is set to 1 when communication is successful. Note: When monitoring the status of a topic using the Status item, at least one I/O point must be active. From InTouch, read the status of server communication by defining a tagname and associating it with the topic configured for the device. Status must be used as the item name. For example, if WindowViewer is communicating with a PLC using the Wonderware Modbus I/O Server, the Access Name definition would be as follows. To monitor the status of all communication to the topic, PLC1, create the following tagname definition. Testing for the PLC1 topic (previous example) can be done by disconnecting the PLC. 403. Section 3 – Troubleshooting I/O 8-31 InTouch® HMI 9.5 Fundamentals of Application Development Course Monitoring I/O communication status from Excel From Excel read the status of PLC communication by entering the following formula in a cell: =MODBUS|PLC1!'STATUS' Using IOStatus Topic Name in Excel Excel can also be used to perform this same type of monitoring by entering the same information in a formula in a spreadsheet cell. For example, to monitor the same topic as above, the following would be entered: =view|IOStatus!'PLC1' 404. 8-32 Module 8 – I/O Communication Wonderware Training – Intentionally left blank – 405. Module 9 Advanced Tag Functionality Section 1 – Advanced I/O Functions 9-3 Section 2 – Indirect Tags 9-7 Lab 10 – Creating and Using Indirect Tags 9-9 Section 3 – InTouch SuperTags 9-15 Lab 11 – Defining SuperTags 9-27 Section 4 – DBDump and DBLoad 9-37 Section 5 – Optimizing the Tagname Dictionary 9-43 Lab 12 – Deleting Tags 9-55 406. 9-2 Module 9 – Advanced Tag Functionality Wonderware Training Module Objectives Identify advanced I/O functions Modify I/O parameters of tags and access names at Runtime Change tag assignment at Runtime Use advanced tag creation tools Delete tags from Tagname Dictionary 407. Section 1 – Advanced I/O Functions 9-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Advanced I/O Functions This section explains InTouch advanced I/O functionality including the IOSetAccessName and IOSetItem functions, and Dynamic Reference Addressing. IOSetAccessName Function The QuickScript function IOSetAccessName modifies the node name, application name or topic name portions of an Access Name during Runtime. This enables the implementation of hot-backup strategies for InTouch. Syntax IOSetAccessName("AccessName", "NodeName", "AppName", "TopicName"); The Access Name, Node Name, Application Name, and Topic Name values may be specified as literal strings or they may be string values provided by other InTouch tags or functions. If an empty string ("") is specified for an argument, that argument retains its current value. For example, the Access Name MyAccess1 can be changed to point to the EXCEL application and the Book1 topic, without affecting the current Node Name, by using the following script function. IOSetAccessName("MyAccess1", "", "EXCEL", "Book1"); If an empty string is specified for a Topic, the Access Name’s current Application value is updated and its Topic value is retained. For example, the following changes the Application Name for access name MyAccess2 to "EXCEL" without affecting its current Topic value. IOSetAccessName("MyAccess2", "", "EXCEL", ""); Likewise, if an empty string is specified only for an Application Name, the tag’s current Topic value is updated and its Application value is retained. For example, the following changes the Topic for tagname MyAccess3 to "Book2" without affecting its current Application Name value. IOSetAccessName("MyAccess3", "", "", "Book2"); For example, the following changes the Topic for tagname MyAccess3 to "PLC2" without affecting its current Node Name or Application Name value. IOSetAccessName("MyAccess3", "", "", "PLC2"); This example would be used when PLC redundancy is a requirement. Section Objectives Identify advanced I/O functions Explain Dynamic Reference Addressing Arguments Description AccessName The existing Access Name to assign the new AppName and Topic Name values to. Actual string or message tag. NodeName The new Node Name to assign. Actual string or message tag. AppName The new Application Name to assign. Actual string or message tag. TopicName The new Topic Name to assign. Actual string or message tag. 408. 9-4 Module 9 – Advanced Tag Functionality Wonderware Training Note: When IOSetAccessName is processed, there is a time delay as the existing conversation is terminated and the new conversation is initiated. During this time, any attempted POKEs or writes to the new topic will be lost. Using the IOSetItem Function The IOSetItem function is used to set an I/O type tag’s .Reference field. Syntax IOSetItem(“Tagname”, “AccessName”, “Item”); For example, the .Reference field of tagname MyTag1 can be changed to point to the Excel access name and the R1C1 item by using the following script function. IOSetItem("MyTag1", "excel", "R1C1"); or by: Number = 1; TagNameString = "MyTag" + Text(Number, "#"); IOSetItem(TagNameString, "excel", "R1C1"); If an empty string (" ") is specified for both the Access Name and Item values, the tag is deactivated. For example, the tag MyTag2 is deactivated by the following. IOSetItem("MyTag2", "", ""); If an empty string is specified only for an Item, then the tag’s current Item value is retained and its AccessName value is updated. For example, the following changes the Access Name for tagname MyTag3 to Excel2 without affecting its current Item value. IOSetItem("MyTag3", "excel2", ""); Note: If a space appears between double-quotes, the argument is set to blank, or deactivate. No space between double-quotes, means “do not change this argument.” Likewise, if an empty string is specified only for an AccessName, then the tag’s current Item value is retained and its AccessName value is updated. For example, the following changes the Item for tagname MyTag3 to R1C2 without affecting its current Access Name value: IOSetItem("MyTag3”, "", "R1C2"); Parameters Description Tagname Any InTouch IO tagname enclosed in quotes. AccessName The Access Name to change the tag to. Item The Item to change the tag to. The Tagname, AccessName, and Item values may be specified as literal strings, or they may be string values provided by other InTouch tags or functions. 409. Section 1 – Advanced I/O Functions 9-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Dynamic Reference Addressing (DRA) Dynamic Reference Addressing allows you to address multiple data sources with a single tagname. By assigning a valid reference to the .Reference field of an I/O-type tag, the address of the data source for the tag can be dynamically changed. Each I/O-type tag includes a reference associated with the address of its data source. The valid syntax for the .Reference field is as follows. Note: Dynamic references are used to view data points whose values are only needed temporarily, such as in diagnostic applications. This makes it an ideal troubleshooting tool. Since the data source of a tagname can be changed, dynamic references should not be used for any data that needs to be permanently stored or continuously monitored for alarm conditions. Syntax Description Tagname.Reference="accessname.item” Changes Access Name and item. Tagname.Reference="[.]item” Same Access Name, different item. Tagname.Reference="accessname” Changes Access Name. Tagname.Reference= “ “ Deactivates the tagname. If the Access Name or Item is not specified, the current value for that field is assumed. .ReferenceComplete 1 = Valid I/O for tag.0 = Either Access Name or Item is invalid for tag. 410. 9-6 Module 9 – Advanced Tag Functionality Wonderware Training – Intentionally left blank – 411. Section 2 – Indirect Tags 9-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – Indirect Tags This section explains the concept and practice of indirect tags, including discussion of the advantages and disadvantages. Indirect Tags Indirect-type tags allow you to create one window and reassign the tags in that window to multiple sources. For example, you could create a Data Change QuickScript that would modify the source for all tags in a window, based on a value that has changed. When you equate an indirect tag to another source tag, both the indirect and the source tags become exact duplicates of each other in every aspect including .fields, scripts, and so on. If the value of the source tag changes, the indirect tag reflects the change. If the indirect tag's value changes, the source tag changes accordingly. You can define indirect tag values in the database as retentive and reset them to take on their last tag’s assignment on startup. Indirect tags are assigned by using the .Name field. For example, if you created an indirect analog tag called Setpoint and used the expression below in a QuickScript, Setpoint1 would become the source for the value of Setpoint, and vice versa: Setpoint.Name = "Setpoint1"; Setpoint.Name = Setpoint1.Name; You can also concatenate tagnames for use in indirect tags. For example, if you created a Data Change QuickScript that executes each time the value of the tagname "Number" changes, the indirect tagname, "Setpoint," would change accordingly: Number=1; Setpoint.Name = "Setpoint" + Text(Number, "#" ); When this QuickScript executes, the value of the analog tag Number is converted to text and added to the analog tag Setpoint, making Setpoint.Name equal to Setpoint1. Indirect analog-type tags are used for both integer (whole numbers) and real (floating point) tags. Indirect tags can be mapped to any other tag providing they are the same type. Advantages of Indirect Tag Addressing Saves on window development Scalable Supports alarm and history trends Supports .fields (attributes of a tag) Supports Remote Tagname Referencing Works With Dynamic Reference Addressing Section Objectives Explain the concept and practice of Indirect Tags Discuss the Advantages and Disadvantages to using Indirect Tags 412. 9-8 Module 9 – Advanced Tag Functionality Wonderware Training Disadvantages of Indirect Tag Addressing Increases tag count Requires planning (e.g., tagnames, scripting) Special steps must be taken to be sure that tags assigned to the indirect tags are not deleted Note: If the Indirect assignment does not exist or the tag has not been created, the last assignment is retained. 413. Lab 10 – Creating and Using Indirect Tags 9-9 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 10 – Creating and Using Indirect Tags Introduction The following lab demonstrates creating and using Indirect Tags. They are created in order to reassign tags to multiple sources using QuickScripts. Objectives Upon completion of this lab, you should be able to: Create and use Indirect Tags 414. 9-10 Module 9 – Advanced Tag Functionality Wonderware Training Create Indirect Tags 1. Open the Scratch window in WindowMaker. 2. Insert two sliders, a button and a text display object as shown. 3. Create two new tags called Tag_A and Tag_B, with a Min Value of 0 and a Max Value of 100. Each is a Memory Integer-type. 4. Attach Tag_A to a slider as shown. 5. Attach Tag_B to the second slider. 6. Change each slider Label to reflect the tagnames. 415. Lab 10 – Creating and Using Indirect Tags 9-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Configure the Button Object 7. Attach the following Touch Pushbutton Action - On Key Down script to the button. 8. Click Validate. You will be prompted to define the Indirect_Toggle tag reference. 9. Click OK. 416. 9-12 Module 9 – Advanced Tag Functionality Wonderware Training 10. Define the Indirect_Toggle tag as Memory Discrete. 11. Click Close. You are prompted to define Indirect. 12. Click OK. 13. Define Indirect as an Indirect Analog type. 14. Click Save, then Close. 15. Click OK to exit the script editor. 16. Click OK to exit the Animation Links Selection dialog box. 17. Change the button text to read Indirect_Toggle. 417. Lab 10 – Creating and Using Indirect Tags 9-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Configure the Text Object 18. Double-click the text object. 19. Assign a User Input – Analog link. 20. Enter the values shown in the following figure. 21. Click OK to exit Animation Links. 22. Switch to Runtime. 23. Move the Tag_A slider up. 24. Move the Tag_B slider to a different location. 25. Click the Indirect_Toggle button. The value changes to reflect the opposite slider setting. Moving the slider changes the value display for the toggled slider. 418. 9-14 Module 9 – Advanced Tag Functionality Wonderware Training – Intentionally left blank – 419. Section 3 – InTouch SuperTags 9-15 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 3 – InTouch SuperTags This section will define SuperTags using the SuperTag template structure. Introduction SuperTags are a development tool that provides a way to organize and quickly replicate tags. InTouch provides a template structure enabling definition of composite tagname types known as SuperTags. SuperTag templates can contain up to 64 member tagnames and 2 nesting levels. A SuperTag parent can contain up to 64 embedded child members and each child member can contain up to 64 sub-member tagnames for a total of 4096 member tagnames. (When one SuperTag template parent is embedded into another it becomes a child member). All SuperTag template child tags behave exactly like normal tags. They support trending, alarming and all tagname .fields. For convenience, InTouch provides a TemplateMaker that can be used to create your SuperTags. The TemplateMaker allows you to create, edit and delete SuperTag templates and member tagnames. InTouch saves all SuperTag templates in the file SUPERTAG.DAT within your InTouch installation directory (not the application directory). This allows the templates to be used in any application. InTouch also provides the ability to create SuperTags in several alternative ways. For example, SuperTags can be created directly from the Tagname Dictionary, in animation link tagname or expression input boxes, in InTouch QuickScripts, or in an external file that can be loaded into your application using the InTouch DBLoad utility. When you create a SuperTag parent template, its name is automatically added to the tagname Tag Types dialog box in the Tagname Dictionary and is immediately available for selection when a new tagname is created. WindowMaker does not need to be restarted to define tagnames using a newly created SuperTag type. Section Objective Define SuperTags using the SuperTag template structure 420. 9-16 Module 9 – Advanced Tag Functionality Wonderware Training SuperTag Syntax Since InTouch tagnames are limited to 32 characters, each SuperTag ParentInstanceChildMemberSub-member is restricted to a maximum of 32 characters. A SuperTag reference can only be a maximum of two templates (ParentInstanceChildMember) and one member deep as illustrated in the following figure. Each member in a SuperTag template is accessible in the standard format currently used to access the .fields of normal InTouch tagname types. The SuperTag reference syntax is supported throughout InTouch where normal tagnames can be used. For example, a valid SuperTag reference would be: ColdRoom4EvapUnit1FanMotor2.MaxEU Remote tag references also support SuperTags. For example: PLC1:"TurkeyEvapUnit2PrsRegVlv.EngUnits" SuperTag Template Structure To realistically illustrate the SuperTag concept in a factory environment, assume that we have four identical refrigerated storage rooms in which we store beef, pork, chicken and turkey. Each of these cold rooms has a room temperature sensor and two evaporator units. Each evaporator unit has seven data values that we need to monitor or control in Runtime. An InTouch HMI window might look like the following figure: 421. Section 3 – InTouch SuperTags 9-17 InTouch® HMI 9.5 Fundamentals of Application Development Course Without the use of SuperTag templates, we would need to manually define each individual tagname for each data value in each cold room multiplied by the total number of cold rooms. In other words, we would have to organize and define dozens of tagnames in the Tagname Dictionary. By using SuperTags we can save hours of development time and minimize the chance of making errors. Using the Cold Room scenario described above, we create one SuperTag parent template called EvapUnit. This EvapUnit will later become a child member of the ColdRoom parent template. This is a detail-up design concept. EvapUnit will be defined with seven sub-member tagnames. SuperTag Parent Template a. Click Special / TemplateMaker. The TemplateMaker dialog box appears. b. Select New Template. Member Tag Type Description FanMotor1 Discrete Motor Starter for Fan 1 FanMotor2 Discrete Motor Starter for Fan 2 DefrostVlv Discrete Defrost Gas Valve State LiquidVlv Discrete Liquid Refrigerant Valve State CoilTemp Real Temperature of the refrigerant PrsRegVlv Integer Pressure Regulator Valve (0-100%) EvapStatus Message Evaporator Unit Status String 422. 9-18 Module 9 – Advanced Tag Functionality Wonderware Training The New Template dialog box appears: c. Enter a unique name for the new template in the Name: field. The name must have a maximum of 10 characters, with alpha character leads. No special characters are supported. As you add new parent templates, their names immediately open as a tagname type in the Tagname Dictionary (Tag Types dialog box) and are immediately available for selection. You do not need to restart WindowMaker to define new tagnames and assign them to the SuperTag type. d. Description: Enter any information to describe the template (Optional). e. Click OK. The TemplateMaker dialog box reappears displaying the new template name in its window: Notice that once a template is created, the Add Member and Delete buttons become active. The day, date and time the template was created and/or last modified and the template's description are now displayed when the template name is selected. 423. Section 3 – InTouch SuperTags 9-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Note: The TemplateMaker window displays all currently defined SuperTag parent templates and their child members in a hierarchical list. To expand a template's view, click the left mouse button beside the template name. All member tags defined for the parent template name will be displayed. To collapse a view, click the left mouse button beside the template name again. Creating SuperTag Member Tagnames a. Select the SuperTag template (in this example, EvapUnit). b. Click Add Member. The New Member Tag dialog box appears.: c. Name: Enter a name for the member tag. d. Type: Enter or select the type for the tag member. A type can be Discrete, Integer, Real, Message, or another SuperTag template. Note: The type you specify here is only a placeholder for the SuperTag template. By default, all member tags are set to Memory types when defined in the TemplateMaker. However, when you define a template instance in the Tagname Dictionary, you will need to specify whether they are Memory- or I/O type tags. e. Comment: Enter any information to describe the member tagname. f. OK: Repeat this procedure to add additional member tags to the SuperTag template. The new member tags are added beneath the SuperTag parent template in the TemplateMaker window. 424. 9-20 Module 9 – Advanced Tag Functionality Wonderware Training g. Create another parent template called ColdRoom. ColdRoom will have one member tagname, RoomTemp, and two EvapUnit child member templates, EvapUnit1 and EvapUnit2. The two child member templates will use the parent, EvapUnit, SuperTag template for their type. h. Select InTouch Templates and then click New Template. The New Template dialog box appears: i. Enter a unique name for the new parent template in the Name text field (maximum of 10 characters.) j. Enter any information to describe the template in the Description text field. k. Click OK. The TemplateMaker dialog box reappears displaying the new template name in its window. l. Click OK. The parent template is added to the list of InTouch Templates in the TemplateMaker window. 425. Section 3 – InTouch SuperTags 9-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Now, create three members for our ColdRoom parent template, two EvapUnit child members and one member tagname, RoomTemp. m. Select the SuperTag parent template (in this case, ColdRoom) and then click Add Member. The New Member Tag dialog box appears. n. Enter a name for the member tagname in the Name text field. o. Enter the tagname type for the member in the Type text field. p. Enter any information to describe the member tagname in the Comment text field. q. Click OK. Next we will create our two child member templates, EvapUnit1 and EvapUnit2. They both use the EvapUnit template type. r. Select the SuperTag parent template (in this case, ColdRoom) and click Add Member. The New Member Tag dialog box appears. s. Enter a name for the member tagname in the Name text field. t. Enter the tag type for the member in the Type text field. In this case, we are using the special template type, EvapUnit. u. Enter any information to describe the member tagname in the Comment text field. v. Click OK. 426. 9-22 Module 9 – Advanced Tag Functionality Wonderware Training w. Repeat the previous steps to add EvapUnit2. x. Click OK. When the ColdRoom parent template is completed, the TemplateMaker window will display the following template structure hierarchy: Now that we have completed the ColdRoom SuperTag template, we can immediately create tag instances that use the template for their tag type. Editing SuperTag Templates and Member Tagnames SuperTag templates or member tagnames can be modified at any time. When an existing SuperTag template or its members are modified, all existing instances of that template are not affected. (Instances are tags defined in the Tagname Dictionary that use a SuperTag for their type.) In other words, modifications made to a SuperTag are not retroactive. However, all new instances defined using the modified SuperTag will use the new composition. a. In the TemplateMaker window, double-click the SuperTag template name (or member name). The Edit Template (or Edit Member Tag) dialog box appears displaying the SuperTag template's (or member's) definition. b. Make your edits and click OK. Deleting a SuperTag Template or Member a. In the TemplateMaker window, select the SuperTag template name (or member name) to delete and then click Delete. A message box appears asking you to confirm the deletion. b. Click Yes to delete the selected name. Note: If you press the ESC key to close the TemplateMaker instead of OK, the template will not be deleted. When a template is deleted, all of its associated member tagnames are also deleted. If an existing SuperTag template is modified, all existing instances of that SuperTag are not affected. Examples are tagnames defined in the Tagname Dictionary that use a SuperTag for their type. In other words, modifications that you make to a SuperTag are not retroactive. However, all new instances defined using the modified SuperTag will use the new composition. 427. Section 3 – InTouch SuperTags 9-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Similarly, if a member tagname is added to a SuperTag instance through an alternative method, its template is not updated. Defining SuperTag Template Instances An important concept in TemplateMaker is distinguishing a SuperTag template from a template instance. The most important difference is that the parent template name is replaced by the instance tagname. The child template name and the sub-member tags do not change. For example, think of a literal template used for drafting, such as a stencil. A stencil is used to produce drawings. The drawings themselves, in this metaphor, are template instances that are patterned after the template or stencil used to create them. In our ColdRoom template scenario, after we have created our template, we can create SuperTag instances of Beef, Pork, Chicken and Turkey. To do so, we will simply create four tagnames that use ColdRoom for their types. Thus, with our one time effort, we will quickly create 60 tagnames in the Tagname Dictionary. This is a huge time saver. After we have created the ColdRoom SuperTag template and the instances, we can refer to any of its members by using valid SuperTag references in animation link expressions or QuickScripts. For example: BeefRoomTemp ChickenRoomTemp.RawValue ChickenEvapUnit1FanMotor1.OnMsg PorkEvapUnit2EvapStatus TurkeyEvapUnit2PrsRegVlv.EngUnits Alternative Methods for Creating SuperTags In addition to the TemplateMaker, InTouch supports the creation of SuperTags through animation link expressions, InTouch QuickScripts, and external .CSV (Comma Separated Variable) files that are uploaded into the Tagname Dictionary through the DBLoad utility. A member or sub-member can be added to an existing SuperTag through the Tagname Dictionary, the easiest method to use. When a SuperTag is created through an animation expression or InTouch QuickScript you must use the valid SuperTag format. For example: 428. 9-24 Module 9 – Advanced Tag Functionality Wonderware Training Using the Tagname Dictionary to Create SuperTags The Tagname Dictionary is the easiest alternative method to create a SuperTag instance or member tagnames. a. Click Special / Tagname Dictionary. The Tagname Dictionary dialog box appears. b. Click New. c. Enter the exact name of your SuperTag instance followed by the backslash () delimiter and the name of the new member tagname. In this example the name is TurkeyRoomTemp2. Note: When adding a new member tagname to an existing SuperTag instance, the spelling of the instance name must match exactly. Otherwise, a brand new SuperTag instance and member will be added. d. Click Type and select the type for the SuperTag member. (Selection of the remaining options is not required in this context.) In this case, I/O Real. e. Click Save or Close to add the member. f. To view the member tagname in the Turkey SuperTag without exiting the Tagname Dictionary, select the Members option at the top of the dialog box. 429. Section 3 – InTouch SuperTags 9-25 InTouch® HMI 9.5 Fundamentals of Application Development Course The Members details area appears: g. Click Close to close the Tagname Dictionary. h. If you click New when a SuperTag is displayed in the Tagname Dictionary, the following dialog box appears: i. Click Yes to create another SuperTag instance that is an exact duplicate of the displayed SuperTag instance. 430. 9-26 Module 9 – Advanced Tag Functionality Wonderware Training The Enter Name dialog box appears: j. Enter a new SuperTag instance name. k. Click OK. Advantages of SuperTags All SuperTag sub-member tagnames behave exactly like normal tagnames Supports alarms and history trends Supports .fields Development tool Template file can be copied Disadvantages of SuperTags One SUPERTAG.DAT file No individual SuperTag member deletion Inability to delete one tag at a time Slight increase in tag count 431. Lab 11 – Defining SuperTags 9-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 11 – Defining SuperTags Introduction This lab demonstrates how to define SuperTags using the InTouch TemplateMaker. Objectives Upon completion of this lab, you should be able to: Create new Template Create new Members 432. 9-28 Module 9 – Advanced Tag Functionality Wonderware Training SuperTag Parent Template 1. Double-click TemplateMaker in the Application Explorer window. The TemplateMaker window displays. 2. Click the New Template button. 3. Enter Tank in the New Template / Name: field, and click OK. 4. Click the Add Member button in the TemplateMaker window. 433. Lab 11 – Defining SuperTags 9-29 InTouch® HMI 9.5 Fundamentals of Application Development Course The New Member Tag dialog box displays: 5. Enter a Name of Contents, with a Type of Message and click OK. 6. Continue adding the following Members to the Tank Template: The completed Tank Template and Members display as follows: Template Name Type Tank Level Real Tank Temp Real Tank Pressure Real 434. 9-30 Module 9 – Advanced Tag Functionality Wonderware Training 7. Add an additional Template named Pump, with the following Members: The new Pump Template and Members display as shown in the following figure: 8. Click the Tank Template. 9. Click Add Member. Template Name Type Pump RPM Real Pump Pressure Real Pump Status Discrete Pump Temp Real Pump Vibration Real Pump Test Real 435. Lab 11 – Defining SuperTags 9-31 InTouch® HMI 9.5 Fundamentals of Application Development Course 10. Enter Name: Pump1, Type: Pump, as shown: 11. Click OK. Pump1 shows as a Member of the Tank Template: 436. 9-32 Module 9 – Advanced Tag Functionality Wonderware Training 12. Select the Test Member Tag in the Pump Template. 13. Click the Delete button. 14. Click Yes when prompted to confirm the deletion. The Test Member Tag in the Pump1 member also is deleted. 15. Click OK to close the TemplateMaker. 437. Lab 11 – Defining SuperTags 9-33 InTouch® HMI 9.5 Fundamentals of Application Development Course Define Template Member Tags in the Tagname Dictionary 16. Open the Tagname Dictionary. 17. Click New. 18. Enter a new tagname of Pump1. 19. Click the Type button. The new SuperTag Templates appear as Tag Types. 20. Select Pump, and click OK. 21. Click the Member List: drop-down arrow. The new SuperTags you created for Pump1 display: 22. Click Close to close the Tagname Dictionary. Edit Templates 23. Open the TemplateMaker. 24. Expand the Pump Template. 25. Select the Temp Pump Member and click the Delete button. 26. Confirm the deletion by clicking Yes. 438. 9-34 Module 9 – Advanced Tag Functionality Wonderware Training Temp is no longer a Member of the Pump Template. Click OK to close the TemplateMaker. 27. Open the Tagname Dictionary. 28. Click the New button. 29. Click Yes to Replicate Pump1. 30. Click OK to accept the name Pump2. 31. Click the Member List: drop-down menu. Pump2Temp: Memory Real is listed because the new tagname was based on Pump1. 32. Click New. 33. Click No to decline to Replicate Pump2. 34. Enter Pump3 in the Tagname field. 35. Click Type: Pump. 36. Click the Member List: drop-down menu. 439. Lab 11 – Defining SuperTags 9-35 InTouch® HMI 9.5 Fundamentals of Application Development Course Pump3 does not contain the Temp tagname because it was based on the Pump Template you edited. 37. Click Close to close the Tagname Dictionary. 440. 9-36 Module 9 – Advanced Tag Functionality Wonderware Training – Intentionally left blank – 441. Section 4 – DBDump and DBLoad 9-37 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 4 – DBDump and DBLoad This section will explain the use of the DBDump and DBLoad Utilities. Introduction There are two Tagname Dictionary utility programs: DBDump and DBLoad. DBDump: Exports an InTouch application Tagname Dictionary as a text file that can be viewed or edited in another program (such as Microsoft Excel). DBLoad: Imports a properly formatted Tagname Dictionary file (created in another program such as Excel or a DBDump file from another InTouch application) into an existing InTouch application. These two utilities allow the Tagname Dictionary to be copied, modified or developed in separate portions and then merged into one application. The DBLoad utility can also be used as an alternative to the InTouch TemplateMaker to create SuperTag instances. Note: Both the DBDump and DBLoad utilities are launched from the InTouch Application Manager (INTOUCH.EXE). Also, you must convert an application created in an earlier version of InTouch before its Tagname Dictionary can be extracted. DBDump Utility The following steps show how to extract an existing InTouch application’s tagname dictionary. a. Close WindowMaker and WindowViewer if they are running. b. Start the InTouch Application Manager. c. Click the DBDump toolbar icon . Section Objective Explain the use of the DBDump and DBLoad Utilities 442. 9-38 Module 9 – Advanced Tag Functionality Wonderware Training The CSV File to Dump To: dialog box appears: Name of CSV Dump file: Enter a name for the file that ends with the .CSV (Comma Separated Variable) extension. If the name already exists, a message box will open. Group output by types: Group the extracted tagnames by tag-type instead of alphabetically by tagname (default). The database information from the selected application directory will be downloaded to the specified filename. When the .CSV file is opened in Microsoft Excel, it sees the comma as a delimiter and automatically separates the data records into columns. 443. Section 4 – DBDump and DBLoad 9-39 InTouch® HMI 9.5 Fundamentals of Application Development Course When the .CSV file is opened in Notepad, each data record is separated by a comma. Using DBLoad, it is possible to: Change logging properties. Make mass changes to the Tagname dictionary. Modify existing tag properties. If the tag is renamed, DBLoad will create a new tag rather than delete the original tag instance. It is not possible to delete a tag using DBLoad; however, new tags can be created. Database Input File Format The first line of a database input file should specify the operating :mode for the file when it is loaded/merged into an application via DBLoad. All data records must begin with the valid keyword for the tagname’s :type, followed by the valid keyword for each data record (separated by commas): :mode=test :IOMsg,Group,Comment,Logged,EventLogged,Event Logging Priority, . . . There is a valid keyword for each tagname type and data record. Database Input File Operating Modes The following lists the valid operating mode keywords and the actions which occur in each mode when a duplicate tagname is encountered during the load. :MODE=ASK – Change the tagname of the input or the existing entry to your specified tagname and then insert the new definition into the Tagname Dictionary. :MODE=REPLACE – Delete the existing entry and replace it with the new entry. :MODE=UPDATE – Overwrite the existing definition with only the fields that are explicitly defined in the input file; i.e., include DELTA changes only. :MODE=TEST – In this mode, DBLoad will act as if it were in the replace mode, but will not modify the database. Test mode scans the file before loading it, then reports errors and gives the location/line number. It is recommended to use this mode to locate possible Tagname Dictionary format errors. After the errors are resolved, change the mode to Update or Replace and load the DB. Note: For more information on operating modes, refer to the InTouch User Guide. 444. 9-40 Module 9 – Advanced Tag Functionality Wonderware Training DBLoad Utility Using DBLoad, you can import tags from other applications, then import other windows. File size can become large when loading large numbers of tags, but not excessively. Note: Use the exported file as a backup and perform a DBLoad in case of system failure. The following steps show how to load/merge a database input file into an existing InTouch application’s database. a. Close WindowMaker and WindowViewer if they are running. b. Start InTouch Application Manager. c. Click the DBLoad toolbar icon . A message box appears asking if you have backed up your application. Click Yes. The CSV File to Load From: dialog box appears: Name of CSV Load file: Enter the path to the .CSV file to load or locate the file using the Directories and Drive list boxes. Once the file is properly selected its name will appear in the field. d. Click OK. The database information contained in the selected file will begin uploading to the selected application's Tagname Dictionary. Creating a Database Input File The DBDump and DBLoad database utilities are the tools used to perform batch type operations on a Tagname Dictionary. Database input files can be created in any program that supports the comma separated variable file format (.CSV). The database input file must be saved as a .CSV format. Once an input file is created, the DBLoad program is used to load/merge the data contained in the file into an existing InTouch application's database. You can create a database input file template by creating a new InTouch application and then running the DBDump program to dump its database to create a correctly formatted .CSV file. This makes entering your modifications easier than creating the input file from scratch. 445. Section 4 – DBDump and DBLoad 9-41 InTouch® HMI 9.5 Fundamentals of Application Development Course Creating SuperTag Instances In addition to the TemplateMaker, animation links, InTouch QuickScripts and the Tagname Dictionary, InTouch also supports the creation of SuperTags using the DBLoad Utility. Note: When DBLoad is used to create SuperTag instances, these instances are not reflected in the SuperTag template definition in the TemplateMaker. When you create a SuperTag with DBLoad, you must use the valid SuperTag format and the SuperTag instance data records must begin with the valid keyword for the tagname's :type. For example: When a .CSV file containing SuperTag instances is uploaded, they are automatically added to the Tagname Dictionary and are immediately available for use in animation links and InTouch QuickScripts. 446. 9-42 Module 9 – Advanced Tag Functionality Wonderware Training – Intentionally left blank – 447. Section 5 – Optimizing the Tagname Dictionary 9-43 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 5 – Optimizing the Tagname Dictionary There are several ways to edit existing links and tags. This section includes substituting, converting, and deleting tagnames as well as utilizing the InTouch Cross Reference Utility. Deleting Tags Deleting tags is made deliberately difficult in InTouch. When WindowViewer is running, deleting a tag is not allowed. When a tag is referenced by any script or animation link, it cannot be deleted. Use the Cross Reference tool to determine tag usage. In other words, to delete an unused tag from the Tagname Dictionary, you must complete the following tasks: Shut down WindowViewer. Eliminate tag use with the Cross Reference utility. Update Use Counts under Special/Update Use Counts. Confirm the deletion. The Delete button will not be available if WindowViewer is running or if InTouch considers the tagname as being used in the application. InTouch Cross Reference Utility The InTouch Cross Reference utility allows you to determine your tagname and SuperTag usage in animation links, wizards, InTouch QuickScripts, QuickFunctions, ActiveX controls, scripts and the following InTouch add-on programs: SPC Pro, SQL Access Manager and Recipe Manager. For all objects such as wizards, ActiveX controls and animation links, it displays the window name and the coordinates of all objects linked to the tagname. It also allows you to view any QuickScript or QuickFunction in which a tag reference is found. The InTouch Cross Reference tool can remain running in WindowMaker while other tasks are performed. Section Objectives Explain tag/link substitution, conversion, and deletion Import and Export windows Utilize the InTouch Cross Reference Utility 448. 9-44 Module 9 – Advanced Tag Functionality Wonderware Training Utilizing the InTouch Cross Reference Utility a. Click Special / Cross Reference. The InTouch Cross Reference Search Criteria dialog box appears: Search Criteria area: Enables you to limit the scope of your search. The scope can be determined by selecting only the options required. Search for all occurrences: Search for all uses of the tagname or SuperTag in animation links, InTouch QuickScripts and all add-on programs such as SPC, SQL Access Manager, Recipe Manager, and so on. Search for specific occurrences: Search for only the tagname or SuperTag in the specified options. For example, to search for the usage in window scripts, select Usage in window scripts Filter: Enter a unique name to identify the filter that you wish to define or open the Filter drop-down list to select a previously defined filter from the list. When you define filters, the name you enter is added to the Filter list. Search: Begins the cross reference search based on the specified view criteria. 449. Section 5 – Optimizing the Tagname Dictionary 9-45 InTouch® HMI 9.5 Fundamentals of Application Development Course Cross Reference Search Results When you perform a cross reference search, the InTouch Cross Reference Utility dialog box appears listing all instances of usage found for the Filter that you specified. If no filter is used, all tagnames defined in the current application's Tagname Dictionary are displayed. For example: 450. 9-46 Module 9 – Advanced Tag Functionality Wonderware Training Cross Reference Utility Interface Icons The following table briefly describes the various icons that appear in the InTouch Cross Reference Utility. Icon Description Tagname or SuperTag is assigned to an InTouch object or used to store a value in an InTouch QuickScript, wizard or add-on program. Click to expand the level's view. Click to collapse an expanded level's view. Displayed tagname or SuperTag is defined in the application's Tagname Dictionary, but it is not assigned to an object. Displayed tagname or SuperTag is used in either an animation link or InTouch QuickScript. Click to expand the view. Displayed tagname or SuperTag is assigned to an animation link. Displayed tagname or SuperTag is used in an Application script. Displayed for all Application On Startup, While Running, and On Shutdown scripts; Window On Show, While Showing, and On Hide scripts, and Key On Key Down, While Down, and On Key Up scripts. Double-click the icon to view it. Displayed tagname or SuperTag is used in a Window script. Displayed tagname or SuperTag is used in a Data Change script. Displayed tagname or SuperTag is used in a Condition script. For example, $Hour==12 On True. Double-click any script icon to view it. Displayed tagname or SuperTag is used in a Key script. For example, F2 On Key Down. Double-click any listed script icon to view it. Displayed tagname or SuperTag is used in a QuickFunction. Displayed tagname or SuperTag is used in an ActiveX Event script. When cross referencing by Window, this icon precedes the window name in which the displayed tagname or SuperTag is used. Displayed tagname or SuperTag is used in a SPC Pro application. Displayed tagname or SuperTag is used in a SQL application. Displayed tagname or SuperTag is used in a Recipe Manager application. Displayed tag is used as an alarm inhibitor. Double-click or click to view the names of all tags for which it is an inhibitor. Displayed tagname is used in InTouch window (name). Displayed tagname is used in an Historical Trend. 451. Section 5 – Optimizing the Tagname Dictionary 9-47 InTouch® HMI 9.5 Fundamentals of Application Development Course Changing the Cross Reference Search Criteria If desired, after the initial cross reference search has been performed, you can narrow the search by modifying your original search options. a. In the InTouch Cross Reference Utility dialog box, (displayed after you have performed your initial search), click Options. The InTouch Cross Reference View Options dialog box appears: b. To change the Search Criteria selection, click Cancel. The InTouch Cross Reference Utility dialog box reappears. c. Click Search and select the new Search Criteria option. d. In the list at the bottom of the dialog box, select (if the tree view is to be populated by) Tag Name or By Window. By Tagname: Cross referencing by tagname alphabetically lists all tagnames found for the specified search criteria (default view). Based on your specified search criteria, this view allows you to view the usage of all tagnames found in windows, animation links, scripts and add-on applications. e. To expand the view, either double-click a displayed tagname and then double-click Animation Link Use, or click the Expand View button. 452. 9-48 Module 9 – Advanced Tag Functionality Wonderware Training When the view is expanded, the window name and the location (coordinates) of the object(s) linked to the tagname are displayed: f. Double-click a tagname and then double-click any of its associated scripts to open it in the Script usage for dialog box. g. Click Close. h. Click Contract View in the InTouch Cross Reference Utility window to return the dialog box to its default mode. The drop-down list field at the top of the dialog box displays all scripts associated with the selected tag. 453. Section 5 – Optimizing the Tagname Dictionary 9-49 InTouch® HMI 9.5 Fundamentals of Application Development Course i. Open the list and select another script. For Application, Window, Key and Condition scripts, the list contains the names of all scripts that use this tagname. For Data Change scripts, only the tagname is listed. For QuickFunctions, the list will contain the names of all QuickFunctions (read-only view). By Window Name: Cross referencing by window name sorts the display by window name and then by the tagnames used in the window. Note: This view only displays the tagnames used in the window. It does not include usage in animation links, scripts, and so on. j. Click the Options button in the InTouch Cross Reference Utility window (Special/Cross Reference/Search/Options). k. Choose the By Window option to display Windows alphabetically. Expand or contract the view as desired. l. Click Close to exit the InTouch Cross Reference Utility. 454. 9-50 Module 9 – Advanced Tag Functionality Wonderware Training Saving Cross Reference Files Cross reference files can be saved and viewed later in any text editor program that supports the comma separated variable (.CSV) file format. The information stored in a cross reference file corresponds to the information currently displayed in the InTouch Cross Reference Utility dialog box. a. In the InTouch Cross Reference Utility dialog box, click Save As. The Save As dialog box appears. b. In the File name box, enter the name to save the cross reference file under. The file can only be saved as a .CSV file. c. Click Save. 455. Section 5 – Optimizing the Tagname Dictionary 9-51 InTouch® HMI 9.5 Fundamentals of Application Development Course Printing Cross Reference Files A cross reference .CSV file can be opened in any text editor program that supports the .CSV file format and then printed as a report. For example, in Notepad, the file would display as follows. a. Click File / Print to print the file. 456. 9-52 Module 9 – Advanced Tag Functionality Wonderware Training Updating Use Counts and Deleting Multiple Unused Tagnames InTouch maintains a use count for each item in the database. This count is not updated automatically for certain operations, such as deleting a window, changing tagnames in links or scripts, and so on. In these cases, InTouch continues to consider the tagname as being used in the application and will not allow it to be deleted. Therefore, you may need to update your use count in order to delete one tagname, or multiple tagnames. Updating Use Counts Since InTouch maintains a use count for each item in the database, you may need to update the use counts to set all unused tagnames to zero before InTouch will allow you to delete them. a. Close all windows. b. Click Special/Update Use Counts. A message informing you that updating use counts may take a while appears: c. Click Yes to update the use counts. When the system has completed updating, the following dialog box appears: d. Click OK. Deleting Multiple Unused Tagnames After you have updated the use count, InTouch will allow you to delete all unused tags. You can either delete them one by one in the Tagname Dictionary or several at once by using the Delete Unused Tags command. a. Click Special / Delete Unused Tags. The Choose Names to Delete dialog box appears: b. Select the tagnames by holding the Control Key and clicking each tag, then click Delete. c. Click All to delete all displayed tagnames. 457. Section 5 – Optimizing the Tagname Dictionary 9-53 InTouch® HMI 9.5 Fundamentals of Application Development Course Displaying the Tag Usage Count The number of local tags defined in the Tagname Dictionary can be displayed in the WindowMaker menu bar. The tag count does not include internal system tags or remote tagname references. System Tags (37) do not count toward licensed tags. a. Click Special / Configure / WindowMaker. The WindowMaker Properties dialog box appears: b. Select Show Tag Count. and click OK. The following message appears. c. Click OK to close/restart WindowMaker. The total number of local tagnames defined in the Tagname Dictionary is displayed: Caution: The entire Tagname Dictionary must be read in order to update the displayed tagname count. When this option is enabled, performance may decrease when changes are being made to the Tagname Dictionary. If your Tagname Dictionary is large, do not select this option. 458. 9-54 Module 9 – Advanced Tag Functionality Wonderware Training – Intentionally left blank – 459. Lab 12 – Deleting Tags 9-55 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 12 – Deleting Tags Introduction This lab demonstrates deletion of unused or erroneous tags. Objectives Upon completion of this lab, you should be able to: Update Use Count Delete tags 460. 9-56 Module 9 – Advanced Tag Functionality Wonderware Training Update Use Count 1. Close any open WindowMaker windows. 2. Select Special / Update Use Counts. WindowMaker prompts you to confirm the Update operation: 3. Click Yes. 4. Click OK. 461. Lab 12 – Deleting Tags 9-57 InTouch® HMI 9.5 Fundamentals of Application Development Course Delete Tags 5. Select Special / Delete Unused Tags from the WindowMaker menu. The Choose Names to Delete…dialog box appears. The list of unused tags on your system may be different. 6. Select one or more tags for deletion. 7. Click Delete. The system prompts to confirm the delete operation. 8. Click OK. 9. Click OK. 462. 9-58 Module 9 – Advanced Tag Functionality Wonderware Training – Intentionally left blank – 463. Module 10 Security Section 1 – Security Models 10-3 Lab 13 – Establishing Security 10-15 Section 2 – BulletProofing the Application 10-27 464. 10-2 Module 10 – Security Wonderware Training Module Objectives Define basic Security Models Explain the InTouch Security Model Implement InTouch Security 465. Section 1 – Security Models 10-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Security Models This module provides an overview of three security models available to the InTouch developer. The focus is on the InTouch-based Security model. Introduction This module provides an overview of three security models available to the InTouch developer (the None option is self-explanatory). The focus is on the InTouch-based Security model. All InTouch security methods are configurable with application granularity, meaning that you can operate two applications with different security settings on the same computer. All three security methods are compatible with Network Application Development (NAD) distribution of applications. InTouch-based security works with NAD as it did in pervious versions of InTouch. For more information on NAD, see Network Application Development in the InTouch Users Guide. The InTouch developer can select between three security models: ArchestrA Security: ArchestrA-based security for Industrial Application Server (IAS) is centralized regardless of whether NAD is used or not. IAS Security-related activities are configured externally in the Integrated Development Environment (IDE). For more information on the IDE, see the Wonderware ArchestrA Integrated Development Environment (IDE) Guide. After selecting ArchestrA authentication and authorization, the Change Password, LogOn, Configure Users and LogOff options on the Special...Security menu are unavailable. The details for features available with the Industrial Application Server are covered in a separate course. InTouch Security: By applying security to your application, you can control specific functions that an operator is allowed to perform by linking those functions to internal tags. Audit trails can be created that tie the operator to all alarms/events that occur during the time he/she is logged on to the system. Security is based on the concept of the operator logging on to the application, typing his/her name and password. You must configure a user name, password, and access level for each operator. There is no association between Microsoft operating system security and InTouch security. Section Objectives Define security models Explain InTouch security 466. 10-4 Module 10 – Security Wonderware Training Operating System Security: If the authentication mode is operating system-based, user names will be the Windows Domain Name/User name pairs. User names can be chosen from the list of users associated with a Windows Network Domain/Workgroup. Each user name has an assigned access level that determines the user's authorization for a given activity. Since the operating system manages the passwords internally, InTouch will not store passwords. Operating system-based security uses the InTouch script function AddPermission to maintain a list of users and their corresponding access levels. This list, created after the execution of the AddPermission() call, is written to disk. The file containing the authentication details of users will not be copied to the NAD client machines. The operating system security scheme allows InTouch to meet security requirements in regulated industries. These specifications are established by the Food and Drug Administration (FDA) in CFR 21 Part 11. InTouch Security Securing an InTouch application means different things to different people: Application Developers may want to secure the operating system, audit operators' actions, or secure the InTouch application itself. To accommodate the different needs, the InTouch security scheme includes various options for a variety of applications. In some cases the top security concern is to limit the operator's access to other Windows applications or the operating system on the local node. Script functions are available to lock the use of keys like or . There are ways to configure WindowViewer (View) to always run it maximized or to hide its menu so that operators can't close it. In other instances security can include auditing the operator's actions (keeping track of what was done and when it was done). InTouch events and inactivity system tags can track these actions. In other cases security would mean restricting features of the application based on privileges set forth for the current user (like a User ID) or the group the user belongs to (like Roles). This functionality is accomplished by setting a visibility or disable link to the object with limited access (for example, a push button to open another window). InTouch retains the traditional InTouch security based on a binary file containing a list of users of the application with passwords and access levels. InTouch includes additional security script functions and system tags. 467. Section 1 – Security Models 10-5 InTouch® HMI 9.5 Fundamentals of Application Development Course InTouch Application Security Implementing security in an InTouch Application means that users must be created, and those users must be given a way to login to the application window. When a new application is created, the user name is set to None with an access level of 0 (which allows no access to security commands) by default. This level prevents access to the Configure Users command in both WindowMaker and WindowViewer. Therefore, you must configure a user name for the System Administrator with an access level equal to or greater than 9000 in order to access the security user list later. Once an operator logs on to the application, access to any protected function will be granted upon verification of the operator's password and access level against the value specified for the internal security tagname linked to the function. For example, you can control access to a window, the visibility of an object, and so on by specifying that the logged on operator's "Access Level" must be greater than 2000. Note: The operator can log on to the application by executing the Special / Security / Log on command in WindowViewer (if the Special menu is displayed) or by creating a custom log on window with touch-sensitive input objects linked to internal security tags. The commands used to establish security on an application are located under the Special / Security command in both WindowMaker and WindowViewer. The security commands are used to log on and off the application, change passwords and configure the list of valid user names, passwords and access levels. Security Features in InTouch Three major aspects of security must be considered when using InTouch: Securing the Operating System Auditing Securing the Application 468. 10-6 Module 10 – Security Wonderware Training Securing the Operating System Many InTouch applications require an operator to constantly monitor processes running 24/7. In these cases it is often desirable to have InTouch as the only Windows application that operators have access to. The operating system task bar, system files, and other Windows applications (like Solitaire) are inaccessible if View is configured properly. Operating system security is configured from the WindowViewer Properties - Windows Configuration tab (Special / Configure / WindowViewer). InTouch includes the script function EnableDisableKeys() that enables/disables the ALT, TAB, or WIN keys in Runtime. Disabling these keys prohibits users from switching between windows applications or accessing the task bar. This function, combined with WindowViewer settings to Always Maximize and hide Menu bar and Windows control options, will effectively secure the operating system. Another common practice to hide/show the menu bar in View is to create a popup style window with its X,Y coordinates set to 0,-38 with a height of 38 pixels and a width equal to the display resolution (e.g. 1024). This example uses the Microsoft Windows Server 2003 Operating System, with a screen resolution of 1024 x 768. Values will differ depending on the Operating System and resolution used. Values will be -48 and +48 if XP look and feel is applied. 469. Section 1 – Security Models 10-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Auditing Keeping track of what the operators do doesn't make an InTouch application more secure but it is an important aspect of security in InTouch. When users and groups (or roles) are created to be used in an InTouch application, audit trails can tie operators to all alarms/events that occur during the time that they are logged onto the system. Alarms and events are very similar in nature, since both require that a condition has occurred and should be logged. The difference between the two is that events, unlike alarms, do not require an acknowledgment. The ActiveX Alarm Object contains links to OS/ArchestrA security tags. The Distributed Alarm Object does not. Securing the Application InTouch provides a number of System tags and script functions that enable InTouch developers to configure security for the individual application. Note: Applying security to your application is optional. The default security setting for InTouch applications is None. However, by applying security to your application, you can control specific functions that an operator is allowed to perform by linking those functions to internal tagnames. Once a user is validated and logged on to the InTouch application, the $Operator and $AccessLevel system tags contain information about the user and their access level. To log on to an InTouch application, users can click on Special / Security / Logon, call a script function to display a logon dialog box (standard), or log on via a custom logon window. AlarmViewerCtrl1 ActiveX Control Distributed Alarm Object 470. 10-8 Module 10 – Security Wonderware Training Note: See the InTouch Reference Guide for a complete documentation on System Tags and script functions $AccessLevel is the tag used to secure InTouch applications. It is the main system tag to modify what a user ($Operator) can and cannot do during Runtime. For example, to disable a pushbutton just set a "disable" or "visibility" type link to it with an expression like $AccessLevel < 9000. InTouch Authentication Schemes When users are authenticated against a binary file (password.bin) that contains information about users, passwords, and access levels, this is known as InTouch authentication. In addition to that mode, InTouch programmers can use operating system authentication, ArchestrA authentication, or no authentication at all. The commands used to establish security in an application are accessible by selecting Special / Security on the main WindowMaker menu. The security commands are used to log on and off the application, change passwords and to configure the list of valid user names, passwords and access levels. You can also link a User Input - Discrete button to the $ConfigureUsers tag to allow an authorized operator with an access level of equal to or greater than 9000 to display the Configure Users dialog box. The dialog box is used to edit the security user name list. When the operator clicks the button, the value of the $ConfigureUsers tagname is set to 1 and the Configure Users dialog box appears. When the operator closes the dialog box, the system resets the value to 0 (This is a system discrete tag intended for write-operation only). If the Special menu will not be displayed in WindowViewer, you can create a custom logon window (see below) that the operator uses to log on to the application. You can also link a User Input - Discrete button to the $ChangePassword tagname to show the Change Password dialog box and allow the operator to change his/her password. When the operator clicks the button, the value of the $ChangePassword tagname is set to 1 and the Change Password dialog box appears. When the operator closes the dialog box, the system resets the value to 0 (This is a system discrete tagname intended for write operation only.) The None and Administrator names are reserved. Only the password of the Administrator may be changed. Once you have configured user names for your application, you should change the Administrator name's password since it will more than likely become known to most users of the system. The Administrator default access level (9999) is the highest and allows access to everything including the Configure Users menu command. 471. Section 1 – Security Models 10-9 InTouch® HMI 9.5 Fundamentals of Application Development Course Creating a Custom Security LogOn Window $OperatorDomainEntered, $OperatorEntered, and $PasswordEntered are the three tags to be used in case a custom logon dialog box is required. Create a popup-type window and set user touch links (user input string) to these tags. If the provided credentials are validated, $Operator, $AccessLevel, $OperatorName, $OperatorDomain will update accordingly. Note: The $OperatorDomainEntered tag is for OS Security only. If the Special menu is not displayed in WindowViewer, a custom log on window can be created for the operator to log on to the application. Link the $OperatorEntered, $PasswordEntered and $OperatorDomainEntered system tagnames to user input objects or use them in a QuickScript to set the User Name, Password, and Domain Name. These are internal message type tagnames that are intended for write operation only. For example: Set the User Name string into ->$OperatorEntered Set the User Password string into ->$PasswordEntered The $OperatorDomainEntered is required only if the security mode is operating system-based. Also, if the security mode is operating system-based and the $OperatorDomainEntered value is null, it is treated as pointing to local machine. After an operator logs on to the application, access to any protected function will be granted upon verification of the operator's password and access level against the value specified for the internal security tag will be linked to the function. Security-Related System Tags Three internal security tags are used in buttons, in animation link expressions or QuickScripts, and so on. They are $Operator, $AccessLevel, and $OperatorName. These tags control whether or not the logged-on operator is allowed to perform specific functions. The following table lists all security-related system tags. For example, to make an object become visible based on the logged on user's access level, the following statement could be used in a Visibility animation link expression: $AccessLevel >= 2000 Tagname Type Valid Values Access $AccessLevel System Integer 0-9999 Read Only $ChangePassword System Discrete 1 or 0 Read Write $ConfigureUsers System Discrete 1 or 0 Read Write $InactivityTimeout System Discrete 1 or 0 Read Write $InactivityWarning System Discrete 1 or 0 Read Write $Operator System Message 16-characters max Read Only $OperatorName System Message 131-characters max Read Only $OperatorDomain System Message 16-characters max Read Only $OperatorDomainEntered System Message 16-characters max Write Only $OperatorEntered System Message 16-characters max Write Only $PasswordEntered System Message 16-characters max Write Only $VerifiedUserName System Message 16-characters max Read Only 472. 10-10 Module 10 – Security Wonderware Training Or, a QuickScript can be bounded by an IF statement: IF $Operator == "DayShift" THEN Show "Control Panel Window"; {and other lines that only execute for the DayShift Operator} ENDIF; You can also control an object's touch functionality based on the value of an internal security tagname by using the Disable animation link. For example: If no one is logged on and the above expression is used, the object or button is secured from tampering. Configuring Security Levels a. Select Special / Security / Select Security Type / InTouch. b. The first time you use security, you must logon as Name: Administrator and Password: wonderware. Use Special / Security / Logon. c. Select Special / Security / Configure Users. The Configure Users dialog box appears: User Name: Assign a name to the operator. Password: Enter a password (up to 32 characters). Access Level: Enter a value (lowest = 0 to highest = 9999). d. Click Add to add the user name to the security list. To modify an existing user name, select the name. 473. Section 1 – Security Models 10-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Enter your changes and then click Update to accept the changes. To delete a user name, select it in the list and then click Delete. Changing a LogOn Password a. Click Special / Security / Change Password. The Change Password dialog box appears (asterisks appear when users and passwords are configured). Old Password: Enter the old password. New Password: Enter the new password (up to 32 characters). Verify Password: text field, enter the new password again. b. Click OK. All information entered displays on the screen as asterisks. Logging on to an Application There are four topics pertinent to logging into InTouch’s security system. Special / Security / Log On QuickScript Function Post Logon Dialog (detailed in Appendix G, “Script Functions.”) QuickScript Function Attempt Invisible Logon (detailed in Appendix G, “Script Functions.”) SystemTags ($OperatorEntered, $PasswordEntered) To Log On using the Special / Security / Log On method a. Click Special / Security / Log On. The Log On dialog box appears: Name: Enter your user name. Password: Enter your password. b. Click OK. If the information is entered incorrectly or is invalid, a message box will appear indicating that log on failed. If log on is successful, the $AccessLevel tag will be set to its predefined value as configured in the security user list. 474. 10-12 Module 10 – Security Wonderware Training Logging Off an Application There are four topics pertinent to logging out of InTouch’s security system. Special / Security / Log Off Log Off Automatic Log Off based on inactivity QuickScript Function LogOff (detailed in Appendix G of this manual) SystemTags ($OperatorEntered = “None”) To Log Off using the Special/Security/Log Off method a. Click Special / Security / Log Off. When this command is executed, the User Name is reset to None with an Access Level of 0. You can configure the application to automatically log off the operator after a specified amount of time has elapsed with no activity by the operator. 475. Section 1 – Security Models 10-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Automatic Log Off (Timeout Settings) The warning and timeout settings can be used to configure your application to automatically log the operator off if there has been no activity for a specified period of time. a. Click Special / Configure / WindowViewer. b. Warning: Enter the number of seconds that can elapse with no operator activity (mouse clicks or keystrokes) before the system discrete tag $InactivityWarning is set to 1 (True). $InactivityWarning can be used in a Condition QuickScript to display a window warning the operator that he/she is about to be logged off the system. If the operator clicks the mouse, presses a key or performs an action using any other pointing device before the specified timeout elapses, $InactivityWarning and the timer are reset and the operator is not logged off. c. Timeout: Enter the number of seconds that can elapse with no operator activity (mouse clicks or keystrokes) before the system discrete tag $InactivityTimeout is set to 1 (True). When $InactivityTimeout is true, the system equates the logged on operator name to the reserved name "None" and sets the security tagname $AccessLevel to 0. 476. 10-14 Module 10 – Security Wonderware Training You can use $InactivityTimeout in a Condition QuickScript to show a window telling the operator that he/she has been logged off the application. The Timeout feature can be used independently of the Warning feature. However, the Timeout value must be greater than the Warning value for proper use of both system tags. For example: Warning becomes true after 30 seconds of inactivity and Timeout becomes true after an additional 15 seconds (for a total of 45 seconds) of inactivity. 477. Lab 13 – Establishing Security 10-15 InTouch® HMI 9.5 Fundamentals of Application Development Course Lab 13 – Establishing Security Introduction In this lab, you will learn to establish security in the application by creating specific user accounts and applying security scripting to them. Objectives Upon completion of this lab, you should be able to: Create New User Accounts Create Logon Method Create Security Scripts Configure Window Navigation Test Security 478. 10-16 Module 10 – Security Wonderware Training Create New User Accounts To implement security to our application, you first need to set the security type for the application. 1. If not done in the previous section, select Special / Security / Select Security Type from the main WindowMaker menu and select InTouch. Log on as Administrator with password wonderware. Next, create three new user accounts. 2. Click the Special / Security / Configure Users command to display the Configure Users dialog box. 3. Enter the following users and account information. 4. Click Add after each entry and then OK. The following figure shows the completed Configure Users dialog box: 5. Click OK. Create Logon Method 6. Import the Menu and Security windows from the wwimport directory used for previous imports (File / Import). 7. Open the Security window. User Name Password Access Level WW WW 9999 Operator HMI 8000 Day Shift 4000 479. Lab 13 – Establishing Security 10-17 InTouch® HMI 9.5 Fundamentals of Application Development Course The window contains the following graphical elements: 8. Attach a Touch Link - Touch Pushbuttons - Action script to the button labeled Logon. The script function PostLogonDialog( ) prompts the user to log into the application and returns a result as an DISCRETE value. As you do not need to store the returned value for this exercise, you will use a local tag LogonResult for this value. 9. Enter the script shown in the following graphic: 10. Validate the script and click OK. 11. Click OK to exit the Animation Links Selection dialog box. 480. 10-18 Module 10 – Security Wonderware Training Configure the Operator Display Object 12. Assign a Value Display – String to the $Operator display object. 13. Enter $Operator in the Expression field. 14. Click OK. Configure the # Display Object 15. Assign a Value Display - Analog link to the value display object. 16. Enter $AccessLevel in the Expression: field. 17. Click OK. Configure the Click to Continue button 18. Assign a Miscellaneous - Visibility link to the button labeled Approved - Click to Continue. This button will only be visible when a successful log in to the system has been completed. 19. Enter an Expression: based on $AccessLevel. 20. Click the lower OK button. 21. Configure a Touch Link - Touch Pushbutton - Show Window animation link to show the windows Menu and Links. 481. Lab 13 – Establishing Security 10-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Configure the Cancel Button The Cancel button will be used to cancel the log on process, but will only be visible when no one is logged into the system, or ultimately, when this window is first opened. 22. Configure a Miscellaneous - Visibility link for the Cancel button. 23. Enter the expression shown in the following figure. 24. Click the lower OK button. 25. Configure the following Touch Link - Touch Pushbuttons - Action script to cause the window to close. 26. Validate and click OK, then OK again to exit the Animation Links Selection dialog box. 482. 10-20 Module 10 – Security Wonderware Training Create Home Window 27. Create a new window called Home and assign it the following properties: Note: The previous example uses the Windows 2003 Operating System with XP Themes turned on and with a screen resolution of 1024 x 768. Values will differ depending on the Operating System and resolution used. Try Y Location at -38 for Windows NT look-and-feel. 28. Place a bitmap object on the window and stretch it to cover the entire window. 29. Right click on the bitmap object and select Import Image. 30. Select the wwb1.jpg file from the c:wwimport directory. 31. Click Open to import the image into the bitmap object. 32. Resize the image to fill the entire Home window, if necessary. 483. Lab 13 – Establishing Security 10-21 InTouch® HMI 9.5 Fundamentals of Application Development Course The Home window should now appear similar to the following figure: 33. Draw a rectangle object over the front door of the building image. 34. Double-click the rectangle object. 484. 10-22 Module 10 – Security Wonderware Training 35. Attach the following Touch Pushbuttons - Show Window to the rectangle object: 36. Send the rectangle to the back. 37. Save and close the Home window. Configure Window Navigation 38. Open the Menu window. 39. Convert the contents of the Menu window (F2, Special / Substitute Tags / Convert / Local). Hint: Ensure the Menu window is active prior to clicking F2 by clicking once in a blank area of the window, for example in the black area of the Disk Space Free text. Next you need to link the buttons on the Menu, Historical Trend and Real-Time Trend windows to their respective windows and configure scripting. 485. Lab 13 – Establishing Security 10-23 InTouch® HMI 9.5 Fundamentals of Application Development Course 40. Configure the Animation Links according to the following table. 41. Save the Menu window. 42. Change the Menu window’s Y Location to -48 in the Window Properties dialog box. This will place the Menu window over the WindowViewer program menu bars. Note: The previous example uses the Windows 2003 Operating System with XP Themes turned on and with a screen resolution of 1024 x 768. Values will differ depending on the Operating System and resolution used. Try Y Location at -38 for Windows NT look-and-feel. 43. Open the Historical Trend window. 44. Create a Real-Time Trend button (if necessary) and link it to the Real-Time Trend window using the Touch Pushbutton - Show Window link. A suggested button position is shown in the following figure. 45. Save and close the window. 46. Open the Real-Time Trend window and add a button labeled Historical Trend. 47. Configure a Show Window link to the Historical Trend window. 48. Save and close the Real-Time Trend window. Button Link Type Window Expression Script Home Touch Pushbuttons - Action (On Left Click/KeyDown) DIM LogOffResult as DISCRETE; LogOffResult=LogOff(); Show "Home"; Links Touch Pushbuttons - Show Window Links Alarms Miscellaneous / Disable $AccessLevel < 5000 Disabled State = On Touch Pushbuttons - Show Window Alarms Trends Touch Pushbuttons - Show Window Historical Trend Visibility $AccessLevel < 5000 Visible State = Off Hopper Touch Pushbutton - Show Window Hopper Main Touch Pushbutton - Show Window Main 486. 10-24 Module 10 – Security Wonderware Training 49. Select Special / Configure / WindowViewer. 50. Select the Home Windows tab and check Home. 51. Click OK. 52. Close WindowMaker. 53. Start WindowViewer. The Home window should appear. 54. Begin by clicking on the door of the graphic image. 487. Lab 13 – Establishing Security 10-25 InTouch® HMI 9.5 Fundamentals of Application Development Course The Logon screen appears. 55. Click Logon. 56. Login as User: ww, password ww. After logging in, the main screen should present your login name and access level. 57. Click the Approved - Click to continue button. The Links window should appear for all logins. 58. Login as each user you created. • The ww user name login should have access to all windows. • The Operator has access to the same windows. • The Day login has access to only the Links, Hopper, and Main windows. The Alarms link/button is disabled and the Trend link is invisible. User Name Password Access Level WW WW 9999 Operator HMI 8000 Day Shift 4000 488. 10-26 Module 10 – Security Wonderware Training – Intentionally left blank – 489. Section 2 – BulletProofing the Application 10-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 2 – BulletProofing the Application This section covers customization of the Runtime and development environments to bulletproof the application. It also explains how to automatically start an application. Customizing the Runtime Environment Like WindowMaker, WindowViewer includes many options to customize your Runtime environment. For example, you can set the blinking speed for blinking objects, the system inactivity timeout and warning values, and the windows that are automatically opened when WindowViewer is started from its icon or its menu command. WindowViewer Properties – General a. Click Special / Configure / WindowViewer. Section Objective Explain applying customized security options to an application 490. 10-28 Module 10 – Security Wonderware Training WindowViewer Startup area Start up as icon to start WindowViewer as an icon instead of a window.Select this option only when you are using WindowViewer to gather data for other I/O-interconnected applications. Transfer to WindowMaker area Close WindowViewer: Automatically closes WindowViewer when WindowMaker is started. If memory is not an issue, and you are using the fast switch to move between WindowViewer and WindowMaker, this option should not be selected. The fast switch option is selected in the WindowMaker Properties - General dialog box. When this option is selected, the Close on Transfer to WindowViewer option located on the WindowMaker Properties/General property sheet is automatically selected also. Close all open windows: Automatically closes all open windows when transferring from WindowViewer to WindowMaker. Selecting this option will free up memory on your system. WindowViewer Memory area Always load windows from disk: If a low memory situation exists, this option causes your application windows to be loaded from disk and not saved in RAM memory when they are closed. Minimum Memory to Keep Free: Enter the number of K bytes of memory to keep free for other Windows applications. Optimize performance for memory: Significantly increase the drawing update speed. Significantly increases the update rate for text fields. If your system is low on memory do not enable this option. Inactivity area Warning: Enter the number of seconds that can elapse with no operator activity (mouse clicks or keystrokes) before the system discrete tag $InactivityWarning is set to 1 (True). Timeout Enter the number of seconds that can elapse with no operator activity (mouse clicks, keystrokes, and so on) before the system discrete tag $InactivityTimeout is set to 1 (True). Time/Timer Control area Tick Interval: Enter the speed interval that InTouch will use to check its internal timers. This setting controls how fast Application While Running, Window While Showing, Condition While On True/On False, Key and Touch Pushbutton Action While Down QuickScripts will be executed. Scripts cannot execute faster than every 10 milliseconds on the Windows XP, Windows NT® or Windows 2000 operating systems. Update Time for Time Variables: Enter the frequency (in milliseconds) WindowViewer will update the time-based system tagnames $Msec, $Second, $Minute, and so on. It is recommended that you use the default setting of 1000 milliseconds. However, a 0 (zero) can be entered to prevent updating of all time variables. 491. Section 2 – BulletProofing the Application 10-29 InTouch® HMI 9.5 Fundamentals of Application Development Course Miscellaneous area Beep when objects touched: For all touch-sensitive objects to beep when selected in WindowViewer. Update all trends "fast" to update trend objects faster. Select this option only when you are absolutely certain that no objects are overlapping your Runtime trend objects. Otherwise, the trend will not be drawn properly. Debug Scripts: Writes a message to the Wonderware Logger program each time a QuickScript is executed. If you select the Debug menu option in the WindowViewer Properties/Window Configuration property sheet, you will be able to turn this command on and off in Runtime from WindowViewer's Special menu. Use old SendKeys only if you are using an international application that was developed using InTouch Version 3.26 or earlier (This is a legacy option and is not used for FactorySuite). Blink Frequency area: Slow, Medium, Fast: Enter the speeds (in milliseconds) to use for blink animation links. I/O area Retry Initiates: Enter the number of seconds to elapse before the InTouch retries connecting to an I/O server. This box has no effect when InTouch can successfully connect to the I/O Server the first time. Start local servers: Display a dialog box when WindowViewer is started and the server you are trying to communicate with is not running. Note: After you modify any of these parameters, WindowViewer must be restarted to apply your changes. Hotlinks area Show Halo around Hotlink: Displays a square halo in Runtime when you move the cursor over an object. Halo follows object shape: Displays a halo around the edges of an object in Runtime when you move the cursor over an object. Show halo around Active X control: Displays a square halo in Runtime when you move the cursor over an Active X control. Keyboard area InTouch Keyboard: Displays the InTouch standard on-screen alpha keyboard or numeric keypad when an animation link is set for Keypad = Yes. Resizeable Keyboard: Displays a resizeable on-screen alpha keyboard or numeric keypad when an animation link is set for Keypad = Yes. Click Options to select font properties. Select X and Y Location, Width, and Height parameters for initial size and placement in Runtime. The keyboard or keypad is resizeable during Runtime. Windows Keyboard: Displays the Windows international keyboard with numeric keypad when an animation link is set for Keypad = Yes. 492. 10-30 Module 10 – Security Wonderware Training WindowViewer Properties - Window Configuration Bulletproofing refers to the ability to turn off undesired Menu Bar entries, certain keystrokes and other settings to insure that users do not change the application’s environment, close the application or escape from the application to other programs. Enabling the desired options prevents users from performing potentially dangerous actions. a. Click Special / Configure / WindowViewer. b. Select the Window Configuration tab. 493. Section 2 – BulletProofing the Application 10-31 InTouch® HMI 9.5 Fundamentals of Application Development Course Menus area Menu Bar: Prevents the menu bar from appearing. WindowMaker: Prevents the operator from being able to switch to the WindowMaker program (Selecting this option does not affect the fast switch to WindowMaker). Logic: Prevents the operator from starting and stopping all QuickScript execution during Runtime. You can use the system tagname $LogicRunning to allow the operator to start and stop all QuickScripts. Note: If the Allow CTRL-Break to stop scripts option is selected, the operator will be able to stop all QuickScripts from executing, regardless of whether or not the Logic menu is displayed. Debug: Only to debug your application. Window: controls to be available in Runtime. Note: You must clear the Control Menu option (also called the System menu) in order to hide the close (X button) in the upper right hand corner of the application. Title Bar Text: Enter the title to appear in your application's title bar in Runtime. For example: ABC Company, Paint APP1 Note: You cannot change the title bar if you are using a "Promotional License." Show Application Directory in Title Bar: Include the path to the application's directory in the title bar. For example: ABC Company, Paint APP1 - C:DEMOAPP1 Hide Title Bar: Hide the application's title bar in Runtime. Impossible to Close: Prevent the operator from closing WindowViewer. Note: You must clear the Control Menu option (also called the System menu) in order to hide the close (X) box in the upper right hand corner of the application.) Allow CTRL-Break to stop scripts: Allow the operator to press the CTRL + BREAK key sequence and stop the execution of all QuickScripts when necessary during Runtime. Note: Asynchronous QuickFunctions that are currently executing cannot be stopped. However, new asynchronous QuickFunctions can be prevented from executing. Disable ALT key to disable the ALT key and prevent the operator from executing menu commands by using the ALT + accelerator key. For example, ALT + FX to exit the application. Note: Clear the Control Menu option (also called the System menu) to hide the close (X) box. Hide Cursor to prevent the cursor from being displayed during Runtime (if a touch-screen will be used). Disable CTRL-ESC key to prevent the operator from accessing the Windows Start menu to close and/or switch applications. Disable WIN key to prevent the operator from accessing the Windows Start menu to close and/or switch applications. Always Maximize to keep the WindowViewer program maximized at all times. 494. 10-32 Module 10 – Security Wonderware Training Selecting WindowViewer's Home Windows Home Windows are windows designated in your application to open when WindowViewer first starts. a. Click Special / Configure / WindowViewer. b. Select the Home Windows tab. Select the window(s) to automatically open when WindowViewer is started. Note: The home windows selections have no effect when you use the fast switch to start WindowViewer. Home windows are automatically opened when you start WindowViewer directly from either its icon or its menu command. c. Click OK. 495. Section 2 – BulletProofing the Application 10-33 InTouch® HMI 9.5 Fundamentals of Application Development Course Customizing the Development Environment WindowMaker includes many configuration options. For example, you can customize your application's title bar text to include the company name, set the pixel spacing for the grid, and so on. Setting WindowMaker Properties a. Click Special / Configure / WindowMaker. Title Bar Text: Enter the title that you want to appear in your application's title bar in Runtime. Show Application Directory: Include the path to the application's directory in the title bar. Spacing: Enter the number of pixels that you want spaced between the snap to grid's coordinates. Show Grid: Display a grid in your windows when you turn on WindowMaker's Snap to grid functionality. Click the Snap to Grid tool on the View toolbar or click on the Arrange / Snap to Grid command to turn the snap to grid functionality on and off. Close on Transfer to WindowViewer: Automatically close WindowMaker when WindowViewer starts. If memory is not an issue and you are moving often between WindowViewer and WindowMaker, this option should not be selected. Note: When you select this option, the Close WindowViewer option located on the WindowViewer Properties General Properties sheet is automatically selected too. Pick Through Hollow Objects: Select objects that are behind hollow objects. 496. 10-34 Module 10 – Security Wonderware Training Enable Fast Switch: Display the fast switch (between WindowMaker and WindowViewer) command in your menu bar for both programs. If this option is selected in WindowMaker, the fast switch is the word Runtime displayed in the upper right hand of your screen. In WindowViewer, it is the word Development. To quickly switch between the two programs, click the fast switch. Note: When you use the fast switch, WindowMaker automatically saves all changes made to all open windows before WindowViewer is started. Line Selection Precision: Enter the number of pixels that your cursor can be away from a line and still be able to select it. In most cases, the default setting of 4 should be sufficient. Levels of Undo: Enter the number of undo/redo levels to save (up to 25 levels). Enter zero (0) to turn the undo/redo functionality off. One level represents one action. The undo and redo stacks are empty when a new window is created or an existing window is opened. Both stacks are emptied when the window is saved. Note: After these settings are modified, WindowMaker must be restarted to apply changes. Configure Fonts area: Text: Select default font type and size for text objects. Button: Select default font type and size for bottom objects. 497. Module 11 Application Backup Section 1 – Application Backup 11-3 498. 11-2 Module 11 – Application Backup Wonderware Training Module Objective Explain saving an application and optimizing it for distribution/deployment 499. Section 1 – Application Backup 11-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Section 1 – Application Backup This section will explain how to save an application and optimize it for distribution/deployment. Introduction Before proceeding with any changes to the contents of the application directory, it is highly recommended that the application file(s) be backed up to the hard drive whenever possible. When backing up an InTouch application, WindowViewer must ALWAYS be shut down. It is also recommended that WindowMaker be shut down. Backing up files creates a record of your development and ensures recovery of work in case of some unexpected event. A backup operation should take place before major changes are made to an application, or before an application is distributed/deployed on another node. InTouch File Content When an application window is created, multiple files are created to hold the information needed by both WindowMaker and WindowViewer to display the window as defined. This means that each window will have more than one file used to define it. When a window is created in WindowMaker, a file called WIN****.WIN is created to hold pertinent window data. When changes are made to the window in WindowMaker, the new version is saved as a .win file and the old file extension is changed to .WBK. When you switch to Runtime, WindowViewer compiles its own version of the .WIN file for its use. This file has the .WVW extension. Finally, if your window contains one or more real-time trend files, a file with a .TRN extension is generated along with the .win file. Previously, if a user had to move an application to another computer, the entire application directory was moved as a whole. However, the size of the transport medium can be limited and the application might not fit. In today’s environment, disk space is inexpensive and is generally not a consideration. Backing up an application directory can be as easy as copy/pasting the entire contents of an application into another directory. InTouch Backup – Application Publisher The InTouch Application Publisher creates a self-extracting file that contains all relevant files and setup procedures that you need to install the application onto another InTouch node. The Application Publisher compresses the Application to reduce download time over the Internet. You can copy these compressed applications to floppy disks, zip disks, and so on, for installation on other nodes. Section Objective Identify backup methods for InTouch applications 500. 11-4 Module 11 – Application Backup Wonderware Training Note: The Application Publisher's finished file size is significantly less than the source file. For example, a full development and Runtime application may fit on a standard floppy disk. If the finished file is Runtime only, a large application may fit on a single floppy disk. Once you publish an application, you can use several methods to load the published application file onto another InTouch node. Copy to a floppy disk Copy the file over your company intranet Copy the file over the Internet Run the self-extracting file as a program on the destination node Publishing an InTouch Application a. Close any open instance of WindowViewer, and close all WindowMaker windows. b. In WindowMaker, expand the Applications directory within the Application Explorer. c. Select Application Publisher. 501. Section 1 – Application Backup 11-5 InTouch® HMI 9.5 Fundamentals of Application Development Course The InTouch Application Publisher -- Step 1 of 4 dialog box appears: d. Click Next. The InTouch Application Publisher -- Step 2 of 4 dialog box appears: e. Enter Author Name: Enter the name of the person(s) (up to 256 characters) to contact regarding the application. f. Enter a short description…: Enter a description for the application (up to 256 characters). Enter package name…: Enter a name for the package (up to 32 characters). 7. Click Next. 502. 11-6 Module 11 – Application Backup Wonderware Training Note: The information entered in the previous step, while required, is only used when publishing to an IIS Client like FS WebServer or SuiteVoyager® 1.0. The information is stored in a file called packagename.inf and is not a necessary component when copying the self- extracting executable. Publishing to any (IIS) virtual directory is supported by Application Publisher. The InTouch Application Publisher -- Step 3 of 4 dialog box appears: h. Enter the InTouch application source…: Enter the correct path to the InTouch application source. The default is the WindowMaker application directory. i. Runtime only: Prevents inclusion of development WindowMaker files in the published file. This option is not recommended if any edits to this application in WindowMaker are desired. 10. Click Next. 503. Section 1 – Application Backup 11-7 InTouch® HMI 9.5 Fundamentals of Application Development Course The InTouch Application Publisher -- Step 4 of 4 dialog box appears: k. Verify that the executable name in the first box is correct (by default, this will be the same as the Package Name you specified). l. In the second field, enter the path to the directory where you want to save the published file, or click Browse to locate a different directory. Note: The default setting to the Documents and Settings/AdministratorName/Local directory is acceptable. m. Do NOT publish to a floppy location (A:). Copy the published files to the floppy after the publishing operation is successful. n. Click Finish. Other Backup Scenarios In cases where disk space is at a premium, certain redundant or backup files may be deleted to reduce the application to a more manageable size. WindowViewer must be shutdown before backing up. 504. 11-8 Module 11 – Application Backup Wonderware Training InTouch Data Files When an application directory is created in InTouch, a set of data files is created to be used by WindowMaker and WindowViewer. Each application created must be in a separate directory. Unless specifically instructed by Wonderware personnel, do not, under any circumstances, edit these files. File Description ALARM.CFG This binary file contains information for alarm logging and printing. ALMGRP.INI Text file containing the Alarm Group Lists specified in the Name Manager/Distributed Alarms configuration. APP.VER This binary file contains the application version. APPEDIT.LOK Read-only file created by WindowMaker to prevent multiple nodes from editing an application. APPCHNGD.FMS File updated from WindowMaker when a Special/Notify Clients is performed. APPLIST.INI Text file containing information about the custom and transparent colors used by the WindowMaker Palette. APPSTG.STG Binary file containing information about the custom and transparent colors used by the WindowMaker palette. APPLOGIC.LGC This binary file containing the Application script (On Start, While Showing, On Shutdown). COLORCH.INI Text file containing the 32 colors used by the color selection boxes in WindowMaker. DB.INI This file contains the defaults for each dialog box in the Tagname Dictionary. DDE*.AVL, DDE*.BIN, DDE.CFG These files contain information for DDE Access names and nodes. DHISTCFG.INI This file is used by the distributed history system. DS######.CFG This file contains SPC dataset configuration information. DS######.DAT This binary file contains data collected using SPC. DS.INF This binary file contains Dataset information. GROUP.DEF This file contains information for tagname alarm groups. HISTLOG.CFG This file contains the configuration information used by this Historical logger. HISTPRV.INI Text file containing the distributed history provider information specified by the Name Manager/Distributed History configuration. INTOUCH.INI This file contains the configuration information used by InTouch for the application. INTRACK.INI Text file containing information about the InTrack configuration. INTRACK.ITL Binary file containing the InTrack taglist information. ITOCX.CFG Binary file containing cross-reference information about ActiveX controls used in the application. LINKDEFS.INI This file contains the defaults for each link dialog box in WindowMaker. OCX.INI Text file containing the Globally Unique Identifier (GUID), and a description of each ActiveX control registered in InTouch from Install Wizards/Active X. PASSWORD.BIN This binary file contains the User Names, Passwords and Access Levels used in the security section of the application. 505. Section 1 – Application Backup 11-9 InTouch® HMI 9.5 Fundamentals of Application Development Course RETENTIV.X, RETENTIV.A, RETENTIV.D, RETENTIV.H, RETENTIV.S, RETENTIV.T These binary files contain retentive values for this application. SECCONFIG.XML This file contains the security model definition for this application. SERIAL.TRN This file contains the serial numbers for all the real time trends in the application. SPC.CFG Binary file containing information about the SPC configuration. SPC.INI Text file containing information about the SPC Dataset and SPCPro data source name configuration. SPCPASSWORD Binary file containing the user/password configuration for event-based and automatic data collection to the SPCPro database. SUPERTAG.DAT Binary file containing the template definitions used by WindowMaker when creating SuperTags from the Tagname Dictionary. SQL.DEF Text file containing the bindlist and templates defined from the SQL Access Manager. TAGBRW.DAT Binary file containing the last configuration used by the Tag Browser. TAGNAME.AVL, TAGNAME.NDX, TAGNAME.X These files contain specific information about items in the Tagname Dictionary. TBOX.INI This file contains the initial settings for the toolbox. It is updated each time WindowMaker is closed and will restart with the same settings for the application. *.TRN This file represents trend information for a window. If a window has no trend information, there will be no corresponding .TRN file. VERS_RES.INF This file contains the InTouch version number and the screen resolution of the application. VIEW.INI This file contains the default window selections used by WindowViewer. *.WIN This WindowMaker file contains a detailed description of each window. File names are in the following format: win#####.win. WIZ.INI Text file containing information about the Wizards registered in InTouch from Install Wizards/ActiveX. WM.INI This file contains the default window selections used by WindowMaker on startup. *.WVW When a window is first loaded by WindowViewer it is “compiled” and save into a .WVW file. This substantially improves the window loading time in WindowViewer. WWREPORT.INI Text file containing the tagname of the tag to increment when using the InTrack report function. WW_WDWS.NDX This file contains a cross-reference of the application window names. *.AEH This is a text file created by the WWLOGGER.EXE program and contains the error log for all Wonderware products. *.ALG This is the ALARM file. It is a text file created by the InTouch alarm program and contains a listing of all logged alarms. *.LGH This binary file contains logged data from InTouch. *.IDX This is the index file for the *.LGH file. *.CSC This binary file contains a condition script. *.KSC This binary file contains a Key script. *.CSV Text file in Comma Separated Variable format. *.TXT Text file. File Description 506. 11-10 Module 11 – Application Backup Wonderware Training Certain InTouch files may be deleted to conserve disk space. Typically, any files whose extensions end in BK (e.g., .cbk) may be deleted by specifying a delete of *.?BK in one of the file manipulation utilities (e.g., Winfile or Explorer). Because WindowViewer always compiles a fresh .wvw file for each new version of the .win files, all of the .wvw files can be deleted and new .wvw files will be compiled from the existing .win files when WindowViewer is launched. Depending on how the application was configured, historical log files and alarm log files can be stored in the application directory. If the log files are unnecessary, all files ending with .LGH and .IDX (historical log files) can be removed. Most of the files remaining are essential to an application and should be left alone. If further size reduction is desired, a compression utility can be used (e.g., PKZip or WinZip) or a backup utility can be used to condense and store the application. When using one of the zip programs, it is recommended to convert the zipped file into a self-extracting zip file by running zip2exe or the equivalent. This will insure that the recipient of the application has the correct unzip version. *.BMP, *.JPG. *.PCX, *.TGA Graphics/image files containing a bitmap object of the bitmap has a String Value Display link. *.PAL Windows Palette file created by exporting a palette from the WindowMaker color palette or by a 3rd party utility. *.WAV Microsoft sound file. *.NEH Text file created by the Wonderware NT Conversion Logger when a 16- bit InTouch application is converted to 32-bit. Contains a log of the conversion process, including any errors that are encountered. *.DCH This binary file contains a Data Change script. *.NMD A binary file containing a Quick Function script. *.OES A binary file containing an ActiveX event script. *.?BK All files ending with .?BK are backup files. InTouch creates backup files of all edited files. All backup files can be deleted when the application is complete. This will free up disk space and make the application directory smaller for making backups or transporting an application. File Description 507. Appendix A FactorySuite 2000 Licensing 508. A-2 Appendix A – FactorySuite 2000 Licensing Wonderware Training Overview This Appendix explains: Changes to FactorySuite 2000 Licensing License Definition/Description/Function Installation steps Component requirements Bundling Hardware Key issues Demo Licenses Upgrading to FactorySuite 2000 Using previous versions Installation problems Year 2000 Compliance Other Compliance remarks For further information on licensing considerations, please refer to the FactorySuite System Administrators Guide, the Wonderware TechNote #113, Overview of the FactorySuite License System contained on the Wonderware KBCD, or on the Wonderware Web site at www.wonderware.com/support. Questions can also be submitted via fax, or directly to Wonderware’s Technical Support team via the Tech Support Web site. Introduction Wonderware® FactorySuite® 2000 consists of integrated software components that are delivered on multiple-product CD-ROMs in a single CD-ROM case. The Wonderware License Agreement grants the right to use and display the software on a single computer at a single address location. Additionally, Wonderware provides several types of enforcement mechanisms to license and enable specific software programs. This is accomplished by means of a new licensing management system that replaces the FactorySuite 1000 License Utility. FactorySuite 2000 Licensing FactorySuite 2000 has one license file, WWSuite.lic, which is located under the Licenses folder on the license file disk. All information for the licensed FactorySuite components is contained in this file. The FactorySuite 2000 WWSuite.lic license file is located under the Common sub-directory under the FactorySuite installation directory (usually Program FilesFactorySuiteCommon Licenses). The FactorySuite 2000 License Utility that comes with FactorySuite 2000 can read installed license files and install new license files. Each license file contains the customer’s name, company name and location, and the customer’s licensed options. This information can be viewed by using the License Viewer program. The license file consists of two levels of information: Component and Feature. The Component information states which FactorySuite 2000 components are licensed; the Feature information actually enables the components that are part of the Component information. 509. Appendix A – FactorySuite 2000 Licensing A-3 InTouch® HMI 9.5 Fundamentals of Application Development Course License File Types Software A License Enabler Kit includes a floppy disk containing the License File. The floppy disk label lists information about the customer and the licensed options. The License Enabler Kit contains a license file for the purchased products only. You may contact your local Wonderware distributor at anytime to obtain a demonstration license for any desired FactorySuite 2000 component. (For a review of which components are licensed, see the sections titled Component Requirements and Demo Licenses below). To activate the license file, simply install the licensed FactorySuite component(s) software, then install the license file from the License floppy disk. Software/Hardware Key This option is the same as the Software License File option, except that the license file is locked to a specific hardware key. If you have this type of license option, your License Enabler Kit will include the license file disk and a hardware key (sometimes referred to as a dongle). Note that the part number listed on the label of the license file disk should include a “D” (for Dongle) (example, 01-627D) or an “E”, which is an upgrade to an Existing hardware key. Your hardware key has a unique serial number that matches the license file’s authentication algorithm. Both the license file and the hardware key must be installed on the same computer in order to enable the licensed FactorySuite component(s). The license file’s Host ID determines which hardware key must be installed on the computer. For example, the following line in the license file specifies the Host ID: HOSTID=Wonderware_HWKeyID=xxxxxxxx where xxxxxxxx is the hexadecimal representation of the hardware key serial number yyyyyyyy. To activate the license file, install the licensed FactorySuite component(s) software and the license file. Then plug in the hardware key into the computer’s parallel port before starting up the FactorySuite component. Paper License Agreement The paper License Agreement will be included with your License Enabler Kit if you purchased ScoutVT™, IndustrialSQL™ Client Access License (CAL), Crystal Reports or the FactorySuite Toolkit. To run any of these licensed products, simply install the product from the appropriate CD- ROM and read the instructions in the paper license agreement. 510. A-4 Appendix A – FactorySuite 2000 Licensing Wonderware Training Component Requirements The FactorySuite components that require license files are: InTouch I/O Servers (Release 4.5 and later for 16-bit; Release 5.5 and later for 32-bit) InControl InTrack InBatch IndustrialSQL Server Factory Focus FactorySuite Web Server The customer is expected to follow a written licensed file that ships with the FactorySuite. The following individual InTouch add-ons do not require license files: SQL Access SPC Program Recipe Manager NetDDE Windows NT Extensions Note: As of version 7.0, SPC Pro with no license only performs the old features of SPC, i.e., v.5.6b and 6.0b. To obtain use of the new SPC Pro features, a license for SPC Pro is required. Information on the Disk The license file contains the customer’s name, location, and license options. This information can be reviewed by using the License Viewer program. Installation Run the Setup program from the license file disk and select the license file components to install on the PC. If a FactorySuite component has not yet been installed on the PC, a default directory will be created for the selected license file. To change the destination directory for the license file, select the license file and browse the PC. Upon validation of the licensing information, the license manager activates the appropriate FactorySuite 2000 component and options. Installation Problems In case of problems installing or using a license file, call your local Wonderware distributor. Year 2000 Compliance The Wonderware License Management Utility is fully Year 2000 compliant. 511. Appendix A – FactorySuite 2000 Licensing A-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Other Compliance To verify if you are in compliance for your FactorySuite license, run the License Utility program and view the license information that is displayed. Note that you can view the license file that is either on the local computer or on any remote computer across the network. The License Utility can either browse specific remote computers or search the entire network for a license file. However, searching the entire network can take some time and we recommend that, when possible, you use the browse feature and search one or more specific remote computers for the license file. For details on this, please refer to the FactorySuite System Administrators Guide. Backup copies of the license file disk are permitted as long as the purpose is to create backup copy for emergencies. Your Wonderware license agreement states that you are allowed to make and maintain one copy of the software solely for backup or archival purposes. Making and maintaining copies of written materials supplied by Wonderware is permitted solely for your own use. Note: For a detailed presentation of installation steps and compatibility issues, see Wonderware Tech Note #113, Overview of the FactorySuite 2000 License System. For more information on our Comprehensive Support program, you may contact your local Wonderware distributor, your local Certified Support Provider, or Wonderware Technical Support. 512. A-6 Appendix A – FactorySuite 2000 Licensing Wonderware Training – Intentionally left blank – 513. Appendix B Wonderware Product Support 514. B-2 Appendix B – Wonderware Product Support Wonderware Training Overview This appendix explains how to access product support and support information on the Wonderware Technical Support Website including the ArchestrA® Deployment Guide. Note: The Web pages shown on the following pages are subject to change without prior notice. The Wonderware Technical Support Website is located at: http://www.wonderware.com/support/mmi/. When you first enter the Technical Support site, you will have limited access. To gain access to the different areas and services, you must first register by selecting the Register link on the main page and filling out the requested information. After you submit the information, an e-mail will be sent to you with your assigned Wonderware userid and password. After you register, click Login and enter your userid and password to access the support areas. 515. Appendix B – Wonderware Product Support B-3 InTouch® HMI 9.5 Fundamentals of Application Development Course On the Support page, you will find a variety of information including the Expert Knowledge Base, Documentation, FAQs, Tech Alerts, Tech Articles, Tech Notes, and Tech Support Forums. Access to the different areas and services on the site depends on your level of support based on one of the following types of support programs: Basic Support Comprehensive Support Enterprise Support For information on each of these support programs as well as information on how to contact Technical Support, support policies and procedures, and much more, see the Technical Support 516. B-4 Appendix B – Wonderware Product Support Wonderware Training Policies, Terms & Conditions guide. This guide is available for download in HTML Help file format on the Technical Support Website. To download the file, click the Technical Support Policies, Terms & Conditions link in the Quick Links section shown below: ArchestrA® Deployment Guide The FactorySuite A2™ Deployment Guide provides recommendations and "best practice" information to help define, design and implement integration projects within the Wonderware® FactorySuite A2 System environment. Recommendations included in this guide are based on experience gained from multiple projects using the ArchestrA™ infrastructure for FactorySuite A2. Recommendations contained in the Deployment Guide document should not preclude discovering other methods and procedures that work effectively. Assumptions The Deployment Guide is intended for: Engineers and other technical personnel who will be developing and implementing FactorySuite A2 System solutions. Sales personnel or Sales Engineers who need to define system topologies in order to submit FactorySuite A2 System project proposals. It is assumed that you are familiar with the working environment of the Microsoft Windows 2000 Server, Windows Server 2003, and Windows XP Professional operating systems, as well as with a scripting, programming, or macro language. Also, an understanding of concepts such as variables, statements, functions, and methods will help you to achieve best results. It is assumed that you are familiar with the individual components that constitute the FactorySuite A2 environment. For additional information about a component, see the associated user documentation. 517. Appendix B – Wonderware Product Support B-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Access The Deployment Guide is located on Team.Wonderware. 1. On Team.Wonderware select Product Info / Find Products By Name / Industrial Application Server. 2. Select Deployment Guide. 518. B-6 Appendix B – Wonderware Product Support Wonderware Training 3. Select FactorySuite A2 Deployment Guide - Industrial Application Server 2.1 included. 4. Select the file. 519. Appendix C InTouch Glossary of Terms 520. C-2 Appendix C – InTouch Glossary of Terms Wonderware Training Access Name Information used to communicate with other I/O data sources including the node name, application name and topic name. ActiveX Control/Container ActiveX controls, originally known as OLE controls or OCXs, are standalone software components that perform specific functions in a standard way. ActiveX controls must be placed in an ActiveX container. InTouch is an ActiveX container. Alarm A warning signal that is displayed or activated when a critical deviation from normal conditions occur. Alarm Logger The Alarm Logger provides the user with a centralized log of alarm information across multiple nodes in a separate, standalone utility. The Alarm Logger also provides access to distributed alarms. Alarm Priorities Each alarm configured in InTouch has a priority value associated with it. This value represents the severity of the alarm and can range from 1 to 999, with 1 being the most severe. Analog Referring to the representation of numerical quantities by the measurement of continuous physical variables. Animation Giving ‘life’ to an object by using movement or color. Animation Links Animating an object by linking it to specific dialog boxes or scripts which carry out specific commands. Application A program or group of programs used for a particular kind of work, such as InTouch. Application Explorer WindowMaker’s hierarchical graphical view of the current application. Application Manager InTouch program which organizes the applications you create and establishes which application is the default application. Application Publisher InTouch program which creates a self-extracting file that contains all relevant files and setup procedures needed to install the application onto another InTouch node. Application Scripts Scripts linked to the entire application. Argument A variable to which either a logical or a numerical value may be assigned. Up to 16 arguments can be specified for an InTouch QuickFunction. Binary Pertaining to the number system with a radix of 2, or to a characteristic or property involving a choice or condition in which there are exactly two possibilities. Binary Code A coding system in which the encoding of any data is done through the use of bits, 0 or 1. 521. Appendix C – InTouch Glossary of Terms C-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Bit A binary digit; a digit (1 or 0). The smallest unit of information recognized by a computer and its associated equipment. Bitmap A graphical memory image. Bitmaps can be manipulated in InTouch by utilizing Microsoft Paint. Button Large rounded-rectangular or small round buttons appearing in dialog boxes. Click with the cursor arrow to select the button’s option or command. Cell A cell is a collection of two or more objects, symbols, or other cells that are joined together to form a single unit. Cells maintain a fixed spatial relationship between their individual graphic elements. Each component of a cell can have its own links. Cells are used to create virtual devices such as a slide controller. Check Box A small square box which appears in a dialog box that can be turned on or off. Check boxes are generally associated with multiple options which can be set. Clipboard A storage area for holding data (text, bitmap, graphic object, and so on) which is being copied or moved to another application or window. Command A word or phrase, usually found in a menu that carries out an action. Command Button A round-cornered rectangle with a label on it that describes an action, such as OK, Cancel or Close. When chosen, the command button carries out the action. Command Key Any keyboard key used to perform separate functions. Command Line The string of arguments that follow any MS-DOS command, including the command to initiate an application program. The arguments in the command line are passed to the MS-DOS function or the program at startup time. Condition Script Scripts linked to a discrete tagname or expression that equates to true or false. Comma Separated Variable CSV is the format used by the Clipboard for transfer of columns of text and numerical data between applications. A CSV data item is text that has each variable separated by commas. Microsoft Excel supports this format. Cross Reference Utility A utility for determining usage of tagnames in various functions. Database A collection of logically related records or files. A database consolidates many records into a common pool of data records which serves as a single central file. Data Change Script Scripts linked to a tagname and/or tagname.field only. This script is executed once when the value of the tagname or field changes by a value greater than the deadband defined in the Tagname Dictionary. 522. C-4 Appendix C – InTouch Glossary of Terms Wonderware Training DBDump/DBLoad Two utilities that allow a database to be copied or modified and then merged into one application. Default An option, command, or device that is automatically selected or chosen by the system. For example, one of the command buttons in a dialog box is already selected when the dialog box is opened. This indicates that it is the default value and will be chosen automatically if the key is pressed. Default values are overridden by selecting another appropriate option, command, or device. Device Driver A program that controls how the computer interacts with devices such as a printer, monitor, or mouse. A device driver enables the use of devices with the computer. Dialog Box A window that appears when Windows needs further information before it can carry out a command. For example, if the Save command on a File menu is selected, a dialog box will appear asking for a name for the file to be saved under. Discrete Value A variable which only has two states: '1' (True, On) or '0' (False, Off). Distributed Applications Distributed applications, are much more complex, often with several layers of networks. Dynamic Data Exchange DDE is the passage of data between applications, accomplished without user involvement or monitoring. In the Windows environment, DDE is achieved through a set of message types, recommended procedures (protocols) for processing these message types, and some newly defined data types. By following the protocols, applications that were written independently of each other can pass data between themselves without involvement on the part of the user. For example, InTouch and Excel. Events Events are associated with ActiveX controls and occur through the ActiveX container. You can execute ActiveX control events in Runtime (WindowViewer) by designating a particular action and associating it to the event by creating ActiveX Event Scripts. Expression A general term for numerals, numerals with signs of operation, variables and combinations of these: 6, 3+6, n+10 are all expressions. Extension The period and three letters at the end of a filename. An extension identifies what kind of information a file contains. For example, an extension may be .EXE, .BAT indicating that a file contains an application. FactorySuite Wonderware's software package which is comprised of an integrated component-based HMI system able to run a factory. Graphic User Interface (GUI) The graphical representation of a software program seen on the computer monitor and used to enter, monitor, and manipulate data. GUI uses standard Microsoft features i.e., floating and docking toolbars, right-mouse click functions and menus, and so on. Historical Trend Graphical representations of data over a certain period of time. They are not dynamic and are only updated when they are instructed to do so, either through the execution of a script or an action by the operator, i.e., clicking a button. 523. Appendix C – InTouch Glossary of Terms C-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Human Machine Interface (HMI) Formerly Man Machine Interface (MMI). Tool that allows a person to control equipment remotely. Integer Any member of the set consisting of the positive and negative whole numbers and zero. Examples: -59, -3, 0. Key Scripts Scripts linked to a specific key or a combination of keys on the keyboard. List Box A box within a dialog box listing all available choices for a command. For example, a list of filenames on a disk. Usually an item is selected from the list box and then OK is chosen. If there are more choices than can fit in the list box, it will have vertical scroll bars. Selecting the down arrow next to the first item in the list will display the rest of the list box. Macro A single, symbolic programming-language statement that when translated results in a series of machine-language statements. Master-Slave Architecture Developed to overcome some of the drawbacks of the client-based and server-based architectures. While it still allows View nodes to be set up in a client or server type architecture, it does not require that they all have the same data sources. Menu Menus are group listings of available Windows and application commands. Menu titles appear in the menu bar at the top of the window. A command is chosen by displaying the menu and then choosing the desired command. Menu Bar The horizontal bar that lists the names of an application's menus. The menu bar appears below the title bar of a window. Each Window's application has a menu bar that is distinct for that application, although some menus (and commands) are common to many of these applications. Message Box A special dialog box through which an application displays error messages or other important information. Message boxes alert the user when an error occurs or when the application needs information to complete an action or command. Method Methods are associated with ActiveX controls. They are similar to script function calls that you can call from the ActiveX container. For example, Browser.Navigate ("URLPageName"), Engine.start(). Mode A method or condition of operation. Multitasking The ability of a computer to perform two or more functions (tasks) simultaneously. NAD Network Application Development or NAD is an architecture that combines the best of the client- based and server-based architectures. NAD provides automatic notification of application changes and automatic distribution of the updated applications to View nodes. NAD can even be used to automatically distribute master/slave applications Object A set of data. Objects come in several formats; bitmap images, text, Real-time and Historical trend graphs, and so on. 524. C-6 Appendix C – InTouch Glossary of Terms Wonderware Training Option Button A small round button appearing in a dialog box. An option button is selected to set the option, but within a group of related option buttons, only one can be selected. An option button has a black dot when it is selected and is blank when it is not selected. Path The hierarchy of files through which control passes to find a particular file. Designates one or more disk drives and/or directory paths to be searched sequentially for a program or batch file if the file cannot be found in the current or specified drive and directory. The drives and/or directory paths are searched in the order they appear in the Path. Pixel A picture cell. The visual display screen is divided into rows and columns of tiny dots, squares or cells, each of which is a pixel. The smallest unit on the display screen grid that can be stored or displayed. A computed picture is typically composed of a rectangular array of pixels. The resolution of a picture is expressed by the number of pixels in the display. For example, a picture with 800 x 600 pixels is much sharper than a picture with 640 x 480 pixels. Programmable Logic Controller (PLC) Computer used to control plant equipment and generate data to serve internal needs. Used in process control applications. Process Control The use of the computer to control industrial processes such as oil refining and steel production. Processing The application that currently has control of the processor. An application is given control of the processor upon receipt of a message. It retains control of the processor until the message is processed. Properties Properties are associated with ActiveX controls and can be associated with InTouch tagnames. The properties that you can configure for a particular ActiveX control are determined by the ActiveX control designer. Some properties are one-directional, meaning either the property sets the tagname's value, or the tagname's value sets the property. While other properties are bi-directional, meaning the value can be set from either the tagname or the property. Protocol Set of rules or conventions governing the exchange of information between computer systems or applications. QuickFunction QuickFunctions are scripts that you can write and call from other scripts or expressions. You can use up to 16 arguments per QuickFunction. They are stored in the application in which they are created. QuickFunctions can be defined as asynchronous that, when executed, run in the background of the main WindowViewer (Runtime) process. QuickScript Script created in InTouch. InTouch QuickScript capabilities allow you to execute commands and logical operations based on specified criteria being met. For example, a key being pressed, a window being opened, a value changing, and so on. Real-Time Trend Graphical representations of multiple tagname values displayed overtime Register A high-speed device used in a central processing unit for temporary storage of small amounts of data or intermittent results during processing. 525. Appendix C – InTouch Glossary of Terms C-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Remote Tagname A tagname that resides in a remote tag source but is referenced in a local InTouch application. Client applications can be designed without using any tagnames in the local Tagname Dictionary by using remote tagname references. Runtime The time during which data is fetched by the control unit and actual processing is performed in the arithmetic-logic unit. Also, the time during which a program is executing. Script Editors Dialog boxes which allow scripts to be created, edited, or manipulated. Security Security on an application is an optional feature. If implemented, it provides the ability to control whether or not specific operators are allowed to perform specific functions within an application. Security for specific functions is accomplished by linking them to internal security tagnames. Service Special kind of program that is "privileged" and operates at a very low level within the system. Services run automatically in the background, and they do not require a user to log on. Because the Windows NT operating system is a secure operating system, normal programs are not allowed to access hardware directly, such as a hard disk, or other system objects, such as the Event Lot. Service programs can access the hardware and system objects for other normal programs. For example, the Wonderware Logger, WindowViewer can both be run as NT services. SmartSymbol SmartSymbols integrate object-oriented technology with InTouch graphics to transform them into reusable templates. Changes made to the SmartSymbols can automatically propagate throughout an application, as well as across multiple networked PC nodes. SmartSymbols allow the creation of templates from graphics that can connect to ArchestrA® Objects, local InTouch tags, and InTouch tags through remote references. These symbol templates are saved in the SmartSymbol Library and can be instantiated by selecting them and dropping them onto an InTouch window. Standalone Computer A single, self-contained computer system, as opposed to a computer that is connected to and dependent upon a remote computer system. A standalone computer will operate by itself, requiring no other equipment. Standalone Applications Stand-alone applications are those that use just one Operator Interface (OI) for each monitored system. Stand-alone applications are generally easier to configure, with minimal to no networking, and require only simple maintenance. String A connected sequence of characters or bits treated as a single data item. SuperTag InTouch supports a template structure that allows you to define composite tagname types called SuperTags. SuperTag templates can contain up to 64 member tagnames and 2 nesting levels. See TemplateMaker. Symbol A symbol is a combination of simple objects (lines, filled shapes, and text) which is treated as a single object. Any attribute change applied to a symbol, whether it is a change in a static attribute in WindowMaker, or a change in a dynamic attribute in WindowViewer, will affect all the component objects of a symbol. Syntax The rules governing the structure of a language and its expressions. 526. C-8 Appendix C – InTouch Glossary of Terms Wonderware Training Task A task is an executing application. Task is a synonym for "process". Tag Browser Primary tool for viewing and selecting local and remote tagnames and tagname dot fields (.field) from FactorySuite applications, or any other tag source that supports the InTouch Tagname Dictionary interface. It allows selection of existing tagnames, adding new tagnames and viewing basic Tagname Dictionary information. It also allows access to the dialog boxes that perform tagname editing, replication, and to select tagnames (remote references) in remote tag sources. Tagname The name assigned to a variable defined in the Tagname Dictionary (InTouch database). TemplateMaker InTouch utility that allows you to create SuperTag templates. See SuperTag. Text Box A box where information needed to carry out a command is typed. A text box usually appears in a dialog box. Title Bar The bar across the top of each window that contains the name of the application and the document or file being used by that application. (In InTouch an option exists to eliminate the Title bar.) Title bars are also used to move a window on the screen by grabbing it while dragging the mouse. Touch Pushbutton Action Script Script similar to Key Scripts, except they are associated with an object linked to a Touch Link – Action Pushbutton. Window A rectangular area on the screen in which an application is viewed and worked. Multiple windows can be open on the screen at one time which can be sized and moved independently. Windows Application An application that is designed especially for the Microsoft Windows operating environment and that uses all Windows features such as menus, scroll bars, and icons. Wonderware Logger Application which records all problems or errors to a disk file and to the screen for your viewing and analysis. WindowMaker Development environment for InTouch where object-oriented graphics are used to create animated windows. Window Script Script linked to a specific window. WindowViewer Runtime environment used to display the graphic windows created in WindowMaker. Wizards Pre-drawn individual components for the object, some with set value and animations ranges. 527. Appendix D ActiveX Controls 528. D-2 Appendix D – ActiveX Controls Wonderware Training Introduction ActiveX controls, originally known as OLE controls or OCXs, are standalone software components that perform specific functions in a standard way. ActiveX controls define standard interfaces for reusable components. ActiveX controls are not separate applications. Instead, they are servers that are placed into a control container. To use ActiveX controls, they must be placed in an ActiveX container. InTouch is an ActiveX container. Microsoft VisualBasic and internet browsers are also ActiveX containers. ActiveX controls behave exactly like InTouch Wizards, except they bring compelling new functionality to InTouch applications. ActiveX controls can be created using Visual Basic, Microsoft VC++ or other 3rd party development tools. ActiveX controls can also be bought from third-parties for specific functionality. These controls are packaged in the OCX form. Wonderware's FactorySuite InTrack component also provides several ActiveX controls. Additionally, the IndustrialSQL Server Historian ActiveTrend allows you to run the IndustrialSQL Trend program (or a functional subset) from within InTouch. ActiveEvent allows you to notify the IndustrialSQL Event sub-system when an event has occurred in another application. There are three main components of ActiveX controls: properties, methods and events. Properties are very similar to variables that can be modified, e.g., Calendar.day, Control.height, and so on. Methods are similar to script functions that can be called from the container. For example, Browser.Navigate("http://www.wonderware.com"), Engine.start(). Events occur through the ActiveX container. For example, Control.click (shift), FileViewer.DoubleClick (name), and so on. InTouch allows access to ActiveX control properties, methods and events. These properties can be associated with InTouch tagnames or can be accessed through InTouch QuickScripting. Note: In order for an ActiveX Event script to function properly, the ActiveX control for which the script was created must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts or any other InTouch QuickScripts containing script functions associated with that ActiveX control, will not execute properly. One or more ActiveX controls can be used in your InTouch application. InTouch allows you to easily select and paste an ActiveX control into any application window and add them to the Wizards / ActiveX Toolbar. ActiveX Event scripts can also be imported from one application to another. 529. Appendix D – ActiveX Controls D-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Using ActiveX Controls in InTouch 1. Install the ActiveX control(s) that you want to use. 2. Select and paste the ActiveX control into a WindowMaker window. 3. Configure the ActiveX control's properties and assign them to tagnames. 4. Associate ActiveX events to ActiveX Event scripts. 5. Call ActiveX methods and set ActiveX control properties in ActiveX Event scripts or other InTouch QuickScripts. The following WindowMaker edits can be made to an ActiveX control: An ActiveX control's size can be changed if sizing is supported by the control. ActiveX controls can be duplicated, cut, copied, pasted and deleted. All aligning commands (left, right, top, bottom, centerpoint) can be applied to an ActiveX control. ActiveX controls can be added to the Wizards / ActiveX Toolbar. ActiveX controls can be included with other objects when creating a cell. The WindowMaker menu commands and their equivalent toolbar tools can be used to directly modify many ActiveX properties. For example, Reduce Font, Line Color, Fill Color, and so on. InTouch does not support the following types of ActiveX controls: Windowless Controls Simple Frame Site (Group Box) Containers Data Controls Dispatch Objects Arrays, Blobs, Objects, Variant Types Naming ActiveX Controls 1. Paste the ActiveX control into your WindowMaker window. 2. Double-click the control to open the Properties dialog box. 530. D-4 Appendix D – ActiveX Controls Wonderware Training Each ActiveX control's Properties dialog box is unique to the control. The number of tabs displayed is based on the properties of that particular control. In some cases, you may need to configure Colors and Fonts. Others may not require this configuration. However, for all ActiveX controls, InTouch adds three tabs: Control Name, Properties and Events. 3. Click the Control Name tab and enter a unique name for the ActiveX control in the ControlName box. Note: You must define a unique name for each ActiveX control used in your InTouch application. The Control Name is used in script functions to identify the control. For example: #Calendar2.day = Tag1; #Calendar2.year = 1997; If you use the default Control Name, e.g., Calendar2 and you subsequently duplicate the ActiveX control, InTouch will automatically increment the Control Name. In this case, the duplicate ActiveX control's name would be Calendar3. 531. Appendix D – ActiveX Controls D-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Installing/Removing ActiveX Controls 1. Click Special / Configure / Wizard/ActiveX Installation to open the Wizard/ActiveX Installation dialog box. 2. Click the ActiveX Control Installation tab. 3. In the Installed ActiveX controls list, select the control(s) to remove from your application and then click Remove. An interactive message box appears asking you to confirm the deletion. 532. D-6 Appendix D – ActiveX Controls Wonderware Training Note: To select a group of controls, click your first selection, hold down the SHIFT key and select your last selection. To select multiple controls that are not consecutively listed, click the first control and then hold down the CTRL key as you click another. 4. Click Yes to remove the control(s). The removed control(s) is moved to the Available ActiveX controls list. Note: When you remove a control, it is not deleted. However, it is no longer loaded into memory. Therefore, it will not function properly. 5. To install ActiveX controls, select them in the Available ActiveX controls list and then click Install. Note: The Install button is active only when controls are displayed in Available ActiveX controls list. 6. Click Close. Placing ActiveX Controls in a Window 1. Click the Wizard dialog tool in the Wizards/ActiveX toolbar. The Wizard Selection dialog box appears: 2. In the list of wizards, click the ActiveX Controls category. All installed ActiveX controls will be displayed. 3. Select the ActiveX control that you want to use and then click OK (or double-click the control). The dialog box closes and your window reappears. Add an ActiveX Control to the WindowMaker Wizard/ActiveX toolbar 533. Appendix D – ActiveX Controls D-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Note: To add an ActiveX control to the Wizards/ActiveX Toolbar, click Add to toolbar. When a control is added to the Wizards/ActiveX Toolbar, it can be selected and pasted into your open window at any time. The number of ActiveX controls that can be added to the toolbar is limited to system resources 4. The cursor will change to the corner symbol when you return to the window. Click the location in the window to paste the ActiveX control. 5. Double-click the control to configure its properties. Removing ActiveX Controls from the Toolbar 1. Click the Wizard dialog tool in the Wizards/ActiveX Toolbar. The Wizard Selection dialog box appears: 2. Click Remove from toolbar. Remove an ActiveX Control from the WindowMaker Wizard/ActiveX toolbar 534. D-8 Appendix D – ActiveX Controls Wonderware Training The Remove Wizard from Toolbar dialog box appears: 3. Select the ActiveX control(s) that you wish to remove from the toolbar. 4. Click OK. Configuring ActiveX Control Properties The properties that can be configured for a particular ActiveX control are determined by the ActiveX control designer. Each ActiveX control's Properties property sheet displays three columns: Property, Range and Associated Tag. The Property and Range columns are read-only. The Associated Tag column is used to associate InTouch tagnames with the respective property in the Property column. Note: When certain items in the Range column are clicked, an arrow appears. This arrow can be clicked to view the list of possible values for the item. The items in the list are for viewing purposes only and cannot be changed. 1. Click the Properties tab in the Calendar Properties dialog box. 2. Click in the middle of each cell in the Associated Tag column and enter a tagname for the respective property. If a tagname is entered that has not been defined in the Tagname Dictionary, you will be prompted to define it now. 535. Appendix D – ActiveX Controls D-9 InTouch® HMI 9.5 Fundamentals of Application Development Course If you double-click a blank cell, or click the button, the Tag Browser will appear displaying the tagnames for the selected tag source. Double-click the desired tagname or select it and click OK. The tagname is automatically inserted into the cell. 3. When the tagname is specified, double-click in the cell to the left of the tagname. Select the association direction for the tagname to its respective property. Continuously double-clicking will cycle you through the various association direction choices. There are actually two fields in each cell in the Associated Tag column. The association direction selection and the tagname entry. The ActiveX control determines the association direction and the property type determines the tagname type that must be used. You can select one directional or bi-directional association. However, if the association direction you select is not valid for the property or tagname, the control will automatically change it accordingly. For example, if you select when the tagname's value changes, its associated property is changed accordingly. A certain subset of the symbols below will appear based on the potential relationship between the property and the tagname. For example, if you associate a property to a writeable tagname, you will see a different set of associations than if you associate the same property to a read-only tagname. Select the appropriate association symbol as follows: The tagname sets the value of the associated property. The property is read-only and the tagname cannot change the property's value. The property sets the value of the associated tagname. The tagname is read-only and the property cannot change the tagname's value. The value can be set from either the tagname or the property. (Tagname takes precedence.) The tagname and the property are both read-only. The tagname can change the property's value, but the property cannot change the tagname's value. The property cannot change the tagname's value because the property is non-bindable or the tagname is read-only. The property can change the tagname's value, but the tagname cannot change the property's value. The tagname cannot change the property's value because the property is read-only. 4. Click OK. Note: Properties can be accessed or changed through ActiveX Event scripts and/or other InTouch QuickScripts. All ActiveX script functions are qualified by the # (pound) sign. The valid syntax to access ActiveX properties is: #ControlName.PropertyName Examples: #Calendar2.Day = 29; Tag1 = #Calendar2.year; 536. D-10 Appendix D – ActiveX Controls Wonderware Training Using ActiveX Control Methods ActiveX control methods are similar to ActiveX control properties. Methods are activated in Runtime (WindowViewer). ActiveX control methods are accessed through ActiveX Event scripts and/or other InTouch QuickScripts. Note: In order for an ActiveX Event script to function properly the ActiveX control for which the script was created must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts (or any other InTouch QuickScripts containing script functions associated with that ActiveX control) will not execute properly. 1. In the ActiveX control's Properties dialog box, click the Events tab. 2. Double-click a blank cell in the Script column. 537. Appendix D – ActiveX Controls D-11 InTouch® HMI 9.5 Fundamentals of Application Development Course The ActiveX Event Scripts editor appears: 3. Click on Insert / ActiveX. 538. D-12 Appendix D – ActiveX Controls Wonderware Training The ActiveX Control Browser appears: 4. In the Control Name list, select the ActiveX control whose methods or properties you want to access. The names of all ActiveX controls currently being used in your application will be listed. Note: If you select This Control instead of the actual Control Name, the methods and properties displayed will be those for the ActiveX control currently selected in your application. By selecting This Control instead of the actual Control Name, you can create generic ActiveX Event script functions. You can then copy and paste these functions into any other ActiveX Event script or any other InTouch QuickScript without having to change the Control Name in the new script. For example: #ThisControl.Navigate ("http:www.wonderware.com"); #ThisControl.Navigate(URL); { where URL is a tagname} This Control is accessible only through ActiveX Event scripts. It is not accessible through any other type of InTouch QuickScript. 5. In the Method / Property list, select the method or property that you want to use in your script. Properties are the items in the list that include parentheses. For example, Display(). 6. Click Done. The selected control name and method or property are automatically inserted into your script. ActiveX control's methods and properties are also accessed through the Insert menu in all other InTouch QuickScripts types. 539. Appendix D – ActiveX Controls D-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Using ActiveX Control Event Parameters ActiveX control events can be executed in Runtime (WindowViewer) by designing a particular action and associating it to the event. For example, if your ActiveX control has an error event handler, you could create an ActiveX Event script that displays a window with an error message when an error occurs. ActiveX Event scripts are provided to support event actions. You can associate a named event script to each event. Note: In order for an ActiveX Event script to function properly the ActiveX control for which the script was created must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts (or any other InTouch QuickScripts containing script functions associated with that ActiveX control) will not execute properly. 1. Double-click the ActiveX control for which you want to create an ActiveX Event script to open the ActiveX control's Properties dialog box. 2. Click the Events tab. 3. In the Event column, select the event to which you want to associate an ActiveX Event Script. 4. In the respective cell in the Script column, enter a unique name for the ActiveX Event Script that you want to create and then double-click the name or click OK. The following message box appears: 5. Click OK. The ActiveX Event script editor appears displaying the name you entered in the Name input box (see following example). If you double-click a blank Script cell when the ActiveX Event script editor appears, you must then enter a name for the ActiveX Event script. 6. Click the button if the ActiveX Event script that you want to use already exists. 540. D-14 Appendix D – ActiveX Controls Wonderware Training The Choose ActiveX Script dialog box appears listing all existing ActiveX Event scripts in your application: 7. Click Insert/ActiveX. The ActiveX Control Browser appears: 541. Appendix D – ActiveX Controls D-15 InTouch® HMI 9.5 Fundamentals of Application Development Course 8. In the Control Name list, select This Event to access the parameters for the selected event. In this case, the selected event is Error. Note: This Event is accessible only through ActiveX Event scripts. It is not accessible through any other type of InTouch QuickScript. You must select This Event to access the event parameters for an ActiveX control. Events may or may not pass parameters in Runtime. Event parameters can be accessed by using the ThisEvent keyword. For example: MyActiveXErrorNumber = #ThisEvent.ErrorNumber; Where: # indicates that this is an ActiveX script function, ThisEvent relates to the event selected in the ActiveX control's Event property sheet, and ErrorNumber is the parameter passed by the selected event. 9. In the Method / Property list, select the event to use in your ActiveX Event script. 10. Click Done. The selected control name, e.g., This Event, and selected event parameter are both automatically inserted into your script at the cursor location. For example: 11. Click OK to save your ActiveX Event script and close the script editor. The ActiveX control's Properties dialog box reappears. 12. Click OK to close the Properties dialog box or continue to create ActiveX Events scripts. 542. D-16 Appendix D – ActiveX Controls Wonderware Training ActiveX Event Scripts Most ActiveX controls have events associated with them. For example, click, double-click, mouse down and key press are typical events used in many ActiveX controls. InTouch ActiveX Event scripts are provided to support event actions. One ActiveX Event script can be associated with each event. ActiveX control events are executed in Runtime (WindowViewer). Accessing the ActiveX Event Script Editor 1. Click the Events tab in the ActiveX control's Properties dialog box to activate the Events property sheet. 2. Double-click a blank cell in the Script column or enter a name for the ActiveX Event script and click OK. 3. If an ActiveX Event script for the name you enter does not currently exist, a message box will appear asking you if you want to create it now. Click OK. 543. Appendix D – ActiveX Controls D-17 InTouch® HMI 9.5 Fundamentals of Application Development Course The ActiveX Event Scripts editor appears: 4. In the Name box, enter the name to identify the ActiveX Event script. 5. ActiveX control methods are similar to ActiveX control properties. To access the ActiveX control methods, click on the Insert / ActiveX command. 544. D-18 Appendix D – ActiveX Controls Wonderware Training The ActiveX Control Browser appears: The ActiveX Control Browser will display the names of all ActiveX controls being used in your application. When you select a control's name, its respective methods will be displayed. Select the method to insert into your script and then click Done. Reusing ActiveX Event Scripts ActiveX Event scripts can only be reused for the same event for the same kind of ActiveX control. For example, the mouse down event may be a stock event on hundreds of ActiveX controls. However, an ActiveX Event script written for mouse down on ActiveX ControlA cannot be reused for mouse down on ActiveX ControlB unless the two controls are the same type. 1. Double-click the ActiveX control for which you want to reuse an existing ActiveX Event script. The selected ActiveX control's Properties dialog box will appear. 2. Click the Events tab. 545. Appendix D – ActiveX Controls D-19 InTouch® HMI 9.5 Fundamentals of Application Development Course The MyActiveX Control2 Properties window displays: 3. In the Script column for the respective event, click the button. The Choose ActiveX Script dialog box appears: Note: This dialog box will only display the ActiveX Event scripts that were written for the same type of ActiveX control and the same selected event.For example, let's assume that you are creating an ActiveX Event script for a second ActiveX Calendar control's "Click" event. You have already created two other ActiveX Event scripts named Click1 and Click2 in your application. Click1 was created for a different ActiveX Calendar control's "Click" event and Click2 was created for an ActiveX InSQLTrend control's "Click" event. When you click the button and the Choose ActiveX Script dialog box appears, it will only display the Click1 script since it was created for the same type of ActiveX control and the same event. 4. Select the ActiveX Event script that you want to use and click OK. 546. D-20 Appendix D – ActiveX Controls Wonderware Training The name of the selected script is automatically inserted into the Script cell where you previously clicked the button. For example: 5. Click OK to close the Properties dialog box or continue to create ActiveX Events scripts. Importing ActiveX Event Scripts Importing ActiveX Event scripts from another InTouch application to your current application can save considerable amounts of development time. When you move ActiveX Event scripts from one InTouch application to another, you must use the File / Import command. Note: When you import ActiveX Event scripts from one application to another, all ActiveX Events scripts are imported. Additionally, in order for an imported ActiveX Event script to function properly in the new application, the same ActiveX control and the same event for which the script was originally created must also be used in the new application, and it must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts or any other InTouch QuickScripts containing script functions associated with that ActiveX control will not execute properly. 547. Appendix E InTouch-Related Tech Notes 548. E-2 Appendix E – InTouch-Related Tech Notes Wonderware Training For the latest Tech Notes and Tech Alerts, go to the www.wonderware.com/support/mmi web page. The following Tech Notes apply to InTouch 9.0. Tech Note 144 How the Time Zone & Daylight Savings Time Affect InTouch 7.0 Historical Logging All Tech Notes and KBCD documents and software are provided "as is" without warranty of any kind. This Tech Note shows how Wonderware® InTouch® accounts for differences in the time zone and Daylight Savings Time (DST). In addition, you will learn how to adjust your computer for DST while maintaining data integrity. The InTouch 7.0 Historical Logging creates a new Historical Log file each day at midnight based on the computer clock. In addition, the Historical Logging uses Greenwich Mean Time (GMT) as a reference for recording and retrieving data. Greenwich Mean Time is also known as Universal Coordinated Time (UCT). The Historical engine checks the values of the tags that have log data checked for changes greater than the Log Deadband and then records those values to the log file. Each record contains the updated value of the tag as well as the time and date the value was updated. Historical Logging To describe historical logging, let's assume we have a tag, called tag1, which changes its value at 10:00:00 am (computer time) and uses the following examples. If we are logging west of GMT, the time stamp for the logged value is calculated as follows: Logged_TimeStamp = Computer_Time+(Offset–DST) Where Logged_TimeStamp is the time stamp of the record written to the Historical Log file. Example #1 The Time Zone is set for Pacific Standard Time (GMT-8) and DST is enabled. Logged_TimeStamp = 10:00:00+(8–1) = 17:00:00 Example #2 The Time Zone is set for Pacific Standard Time (GMT-8) and DST is not enabled. Logged_TimeStamp = 10:00:00+(8-0) = 18:00:00 If we have the same tag and values, but are logging east of GMT, then the time stamp for the logged value is calculated as follows: Logged_TimeStamp = Computer_Time+(-Offset+DST) Example #3 The Time Zone is set for Amsterdam, Berlin, Bern, Rome (GMT+1) and DST is enabled. Logged_TimeStamp = 10:00:00+(–1+1) = 10:00:00 549. Appendix E – InTouch-Related Tech Notes E-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Example #4 The Time Zone is set for Monrovia, Casablanca (GMT0) and DST is not enabled because Casablanca does not observe DST. Logged_TimeStamp = 10:00:00+(-0+0) = 10:00:00 In this example, the time stamp in the Historical Log file is the same as the computer time. Note that GMT0-Monrovia, Casablanca is the ideal time zone setting. Historical Retrieval The retrieval engine also accounts for differences in the time zone and DST settings on the computer on which the retrieval occurs. In most cases, if the logging and retrieval were performed on the same computer or on computers with identical time zone settings, then the retrieved records will be correct. Note: If the time zone settings are different between the Logging computer and the Retrieval computer, then the record logged at 10:00:00 on the Logging computer may show at a different time on the Retrieval computer. In older versions of InTouch ( InTouch 5.6, InTouch 6.0, InTouch 7.0 SP2 Patch03 and InTouch 7.1 Patch02), if the DST is checked, for certain Time Zones the data will be retrieved with a 2-hour offset. The solution to this problem is to set the time zone to one that does not observe DST, such as GMT0-Monrovia, Casablanca. Starting with InTouch 7.0 SP2 Patch04 and InTouch 7.1 Patch03 any GMT setting can be used. Make sure that there is no TZ variable in the autoexec.bat and no TZ environment variable in Control Panel/System/ Environment. Keep in mind that DST can affect the data retrieval, even when the logging and retrieval are performed on the same computer or on computers with identical time zone settings. Choosing a time zone that observes DST or enabling DST causes the retrieved data to be two hours off and, at the beginning of the day, the Historical Trend chart will show two hours of flat line or no data. This behavior is present when the Time Zone setting is of the type GMT+x (east of GMT) and DST is enabled. For example, if the time zone on your computer is set to Amsterdam, Berlin, Bern, Rome (GMT+1) and DST is enabled, then the retrieved data will show a flat line at the beginning of the day and the current data will be two hours in the future. The solution is to set the time zone to one that does not observe DST, such as GMT0-Monrovia, Casablanca. This causes the time stamp in the Historical Log file to be the same as the computer clock. In addition, DST is not enabled because GMT0-Monrovia, Casablanca does not observe DST. 550. E-4 Appendix E – InTouch-Related Tech Notes Wonderware Training Tech Note 21 Understanding How Scripts Operate in InTouch This describes how the script engine operates within the Wonderware® InTouch® environment. This is intended for all Wonderware employees and distributors, OEMs, VARs, MIS/MES professionals, system integrators, application engineers, system developers, and system administrators of InTouch applications. You should have an advanced programming competency level in order to apply some of the features shown in this issue. The testing for this article was completed using InTouch Release 5.6 under Microsoft Windows 95; however the results should be accurate for InTouch releases 5.0b through 5.6. Disclaimer The information contained here is correct based on the scripting examples and demonstration application that were used in this article. However, your results and experiences in using the InTouch script engine may vary due to circumstances outside the realm of the examples that are shown here. Installing the Associated InTouch Test Applications This article references two InTouch test applications that demonstrates the various points made in this article. These applications will run under InTouch Release 5.6 or later. Download the Testscr1.zip file for the InTouch Test Script application #1. Download the Testscr2.zip file for the InTouch Test Script application #2. Note: The above test scripts are available on Wonderware.com via the Wonderware Customer Support Program. Overview The InTouch script engine encompasses and operates a number of script types in a seamless manner. Programmers may occasionally encounter problems with complex scripts, especially when they execute one type of script from another. This Tech Note will help you think out your scripts and understand how the script engine works so that when you write your scripts, you will do so with minimal errors. Writing Scripts The easiest way to write an InTouch script—especially if it is complex—is to first flowchart what you want to accomplish. However, keep in mind that your flowchart cannot have any loops in it. 551. Appendix E – InTouch-Related Tech Notes E-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Initial Script Operation After you flowchart your application, the next step is to decide which scripts will control each process in your flow chart. If there are no timed or scanned scripts (that is, While True, While Showing, and so on), when WindowViewer starts up, the script engine will execute the scripts in the order shown in Table 1. Table 1. InTouch Script Engine Order of Execution Figures 1 and 2 below comprise a simplified flowchart of how the script engine operates that is accurate for all scripting questions that you may have. However, note that the interrupt vector paths are not shown and they may occur at any point in any script. Keep in mind that when a timer completes (each timer is checked for completion just after the Tick Interval is reset), the flowchart will branch back to the script subroutine instance which called the interrupt and complete or halt on another timer, then return. 1. Application On-Startup Scripts 10. Open Window(s) While Showing Scripts 2. Data Change Scripts 11. Data Change Scripts 3. Condition Scripts 12. Condition Scripts 4. Home Window(s) On-Show Scripts 13. Windows On-Close Scripts 5. Data Change Scripts 14. Data Change Scripts 6. Condition Scripts 15. Condition Scripts 7. Application While-Running Scripts 16. Application On-Shutdown Scripts 8. Data Change Scripts 17. Data Change Scripts 9. Condition Scripts 18. Condition Scripts 552. E-6 Appendix E – InTouch-Related Tech Notes Wonderware Training Figure 1. Scripting Flowchart – Main Program Body (Note: AppTick is the Application Tick Interval) 553. Appendix E – InTouch-Related Tech Notes E-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Figure 2. Scripting Flowchart – Script Subroutine The unscanned Application On Startup script is run first. Data Change or Condition scripts may not execute from an Application On Startup script. 554. E-8 Appendix E – InTouch-Related Tech Notes Wonderware Training Warning If you try to execute a Data Change or Condition script from an Application On Startup script, then the data that you are changing may not yet be available globally. This is because the InTouch Runtime variable database is initializing while the Application On Startup script is executing. Technical Support’s tests show that in some cases, a Data Change or Condition script may actually run, however, this may not be true every time Window Viewer is restarted. If a window is called from an Application On Startup script, then the window’s processes (including any Window Action scripts that are called) will not start until the Application On Startup script completes. However, these requests will be queued and run once the Application On Startup script and the home window’s On Show script complete. The home window’s Window Action On Show scripts run after WindowViewer successfully starts up. If these scripts change any data, then any unscanned Data Change scripts are executed first, and the unscanned Condition scripts are executed next. All scanned scripts are handled in this same manner. The difference between the unscanned and scanned scripts is that the scanned scripts are put into a storage area during the scan time, and the remaining unscanned scripts within the scanned script shell or thread will not run until the script scan time completes. (Note that this type of script design allows “nesting” of scripts operating within other scripts.) Once the scan time expires, this causes an interrupt vector in the current script. The interrupt branches to the timed out scanned script which runs either to completion or until another scanned script executes. Timed out scripts do not run when the script timer completes. Remember that many processes are running at any given moment, and some of these processes cannot be interrupted. Examples of processes that cannot be interrupted are disk writes, DDE updates, ODBC, and preconditioned processes in InTouch (that is, FOR-NEXT loops, other scripts with senior precedence, and so on). When the scan time expires, a flag that prevents the script from running while the timer is counting is cleared, allowing the timed script to begin. A script with a scan time of 100 milliseconds would probably run once every 100 milliseconds if there was no I/O Server running or historical logging or retrieval, and if the application had only one simple window with no other scripts running. However, this is unrealistic for “real world” applications! On Shutdown Application scripts run when WindowViewer is shutting down. If you try to execute a Data Change script and/or a Condition script from an On Shutdown script, then the Data Change and Condition scripts may not be called or complete. Like the On Startup scripts, the Data Change and Condition script subroutines in the script engine may not be available during shutdown. If you are trying to achieve some internal process or condition before WindowViewer exits, your best chance of achieving that process or condition is to execute the Data Change or Condition script before the On Shutdown script. When the On Shutdown script is running, processes within WindowViewer are being shut down. Under certain circumstances, “long” processes will not finish if WindowViewer shuts down before the task completes that were executed from the On Shutdown script. Tick Interval and Script Timing The Tick Interval is configured in WindowMaker under the menus Special/Configure/View Generic/Tick Interval. This setting is the master application tick for all running scripts. If you have a Tick Interval of 1000 milliseconds and your timed scripts running within the script engine are set for 100 milliseconds, then they will not run at least until the Tick Interval has been reset. The result is that each timed script will not run for at least 1000 milliseconds even if they are set for a smaller value. Note that these times are not cumulative. That is, if you use a timed script, the timer will run asynchronously with the Tick Interval timer. 555. Appendix E – InTouch-Related Tech Notes E-9 InTouch® HMI 9.5 Fundamentals of Application Development Course What happens if the Tick Interval is set for a smaller value than your timed script? For example, if the Tick Interval is set to 100 milliseconds and a Condition script set to 450 milliseconds, then when will the Condition script run? Assuming no “long” processes are running that take more than a few milliseconds, once the Condition script begins and the timer is running, the Tick Interval will reset five times before the Condition script times out. This means the script will run at about 500 milliseconds, not 450 milliseconds. Within the InTouch application, the “outside” loop of the script engine (as shown in Figure 1) has the lowest priority. This is so other Windows processes can continue to run. These Windows processes will try to run at 55 milliseconds under Windows 95 or Windows for Workgroups, or 10 milliseconds under Windows NT; this is the OpSysTick. DDE processes are serviced at this rate, then are redefined at the scan time set in the I/O Server, if one is running. The “operating system” screen updates are handled at this rate, as well as the keyboard and mouse “operating system” scans. Invoked Immediate Scripts * (* “Immediate” is a programming term that is used to describe the current or immediate program process thread.) An Invoked Immediate script is a script that is called from any process that is currently in focus. This does not necessarily depend on the Tick Interval or the main script engine thread. Two examples of an Invoked Immediate script are: 1) calling a Data Change script that is triggered by a DDE update (that is, a I/O Server updates a value in the InTouch Runtime database); and 2) running a Pushbutton or Key script. These Data Change, Pushbutton, and Key scripts run immediately until they complete. Note that all other processes are halted until these scripts complete or until they start a timer (which allows for an interrupt vector) so that InTouch can branch to other processes. An interesting effect is how Immediate windows are opened. If, for instance, a Pushbutton script calls a popup or overlay window whose Window Action script then calls another popup or overlay window, then in what order are the scripts executed? The Pushbutton script will run the script subroutine shown in Figure 2 which will run a Show() window function that is a line in the Pushbutton script. Show() then calls the popup or overlay window which starts its On Show Window Action script. This script will attempt to call a second popup or overlay window; however this will not occur until the first On Show Window Action script completes. A script cannot call itself, even if it is in a different window. The purpose is to prevent infinite loops. However, future versions of InTouch may not behave in this manner. Test Application Two versions of an InTouch test application was created to demonstrate how the script engine works. Note: Both test applications are available on the Wonderware BBS (phone 949-727-0726). This application does the following: Successive scripts were defined, starting with the outermost script shell and progressing inward, including paths for the interrupt vectors. Each successive script updates a new tag with a counter. Once each tag is updated, the counter will increment. This defines a specific operation path for the script engine. 556. E-10 Appendix E – InTouch-Related Tech Notes Wonderware Training Different script types are tried in various orders to show how the script engine operates and to predict what the script engine will do so that a flowchart of the script sequence is created. The following lists the scripts that were written for our InTouch test application. Window Scripts for "Test Scripts": Script on Show: g = startupvar; startupvar = startupvar + 1; i = startupvar; startupvar = startupvar + 1; k = startupvar; startupvar = startupvar + 1; l = startupvar; Application Script: On Application Startup: testvar = 1; startupvar = 1; A = startupvar; startupvar = startupvar + 1; While application running, every 100msec: IF testvar THEN startupvar = startupvar + 1; b = startupvar; startupvar = startupvar + 1; d = startupvar; startupvar = startupvar + 1; f = startupvar; startupvar = startupvar + 1; testvar = 0; ENDIF; Condition Script: Condition: b > 0 Comment: On True: startupvar = startupvar + 1; c = startupvar; Condition Script: Condition: g > 0 On True: startupvar = startupvar + 1; o = startupvar; Data change script: On Changes to b: startupvar = startupvar + 1; e = startupvar; Data change script: On Changes to g: startupvar = startupvar + 1; j = startupvar; 557. Appendix E – InTouch-Related Tech Notes E-11 InTouch® HMI 9.5 Fundamentals of Application Development Course Data change script: On Changes to j: startupvar = startupvar + 1; m = startupvar; Comment: On True: startupvar = startupvar + 1; h = startupvar; Condition Script: Condition: j > 0 Comment: On True: startupvar = startupvar + 1; n = startupvar; Condition Script: Condition: p > 0 Comment: On True: startupvar = startupvar + 1; q = startupvar; Condition Script: Condition: A > 0 Comment: On True: startupvar = startupvar + 1; s = startupvar; Condition Script: Condition: r > 0 Comment: On True: startupvar = startupvar + 1; End1 = startupvar; Condition Script: Condition: n > 0 Comment: Data change script: On Changes to m: startupvar = startupvar + 1; p = startupvar; Data change script: On Changes to o: startupvar = startupvar + 1; r = startupvar; 558. E-12 Appendix E – InTouch-Related Tech Notes Wonderware Training Data change script: On Changes to s: startupvar = startupvar + 1; t = startupvar; Data change script: On Changes to q: startupvar = startupvar + 1; End2 = startupvar; The application window shown in Figure 4 was developed based on the scripts shown on the previous page. The values displayed on the window are from ‘startupvar’ which was initialized in the On Startup Application script and is incremented each time a new tag is updated with the new value. These are the script thread values which show the path that the script engine “travels” through all the scripts. The letters preceding the thread values are the actual tagnames which you can reference in the listed scripts. Notice that the scripts demonstrate the script engine’s order of execution that is shown in Table 1. Figure 4. InTouch “Test Scripts” Application Window By changing the Condition script which initiates tag ‘o’ to a scanned While True Condition script with a scan time of 1100 milliseconds, an interrupt vector will be generated from a script “holding area” when the timer expires. The result is that the Data Change and Condition scripts in its branch will not start as shown in Figure 5. 559. Appendix E – InTouch-Related Tech Notes E-13 InTouch® HMI 9.5 Fundamentals of Application Development Course Figure 5. Test Application Window with the Modified Condition Script For our test application, the scan time was set to 1100 milliseconds. This value was chosen because it illustrates the Condition script timer expiring and the halted processes resuming. Notice where the interrupt vector appears in the timed script. If this same application were to run on a different computer, the processes running on each computer might be different enough to cause the interrupt vector to appear in another location. Also, the Tick Interval will not affect where the interrupt vector will appear. (The test application was run using a 100 milliseconds Tick Interval and a 100 milliseconds system tag update time.) If the Tick Interval was changed to 20000 milliseconds as shown in the TESTSCR2 application in Figure 6, then the scripts will run exactly the same, except that the next iteration of the application loop (which is controlled by the Tick Interval) will run only after the Tick Interval is reset. This occurs after the “n o” Condition script has run. This shows an interrupt vector “node” or a place where the script engine was interrupted to handle other processes based on some decision that probably deals with an external process time or ‘wait’ period. Although this particular interrupt location cannot be easily predicted, it does provide an insight on when DDE and other processes might be updated. 560. E-14 Appendix E – InTouch-Related Tech Notes Wonderware Training A common question is “When are DDE tags updated?” Based on our test application, in most instances, DDE tags will not be updated until the Tick Interval is reset. But why is this? In order for DDE tags to be updated, or be active, one of the following ten conditions must occur: 1. A DDE topic is set to Advise All Items. 2. A tagname is displayed in an open application window. 3. A tagname is used in a Window script or Action script and the application window that is associated with either script is opened. 4. A tagname is actively being used by a real-time trend. 5. A tagname is used for alarm purposes. 6. A tagname is event logged and Event Logging is enabled. 7. A tagname is being logged in an Historical Log file and Historical Logging is enabled. 8. A tagname is used in a Key, Condition, Data Change, or Application script. 9. A tagname is an Auto Collection tagname in the SPC Program. 10. A tagname is currently accessed by a client application (such as Microsoft Excel) using DDE. Except for item 1, the tagname in each of the nine remaining items has some link to a script or an application window (which has a link to a script). Since we know when the DDE tag is updated, we can assume that the tag under these conditions will be updated at approximately the Tick Interval. Item 1 is based on the I/O Server, so the update time is equal to the I/O Server’s scan time (which is set in the I/O Server or topic—it has nothing to do with the script engine). When a DDE item is written by a user input, such as pressing the key, it will cause an interrupt vector. The interrupt vector makes a request to the server to write the value to the DDE device at the DDE server’s tick time. Updates from the DDE device will not appear immediately if it is routed through the script engine. As an example, create the following items in a new application: A DDE User Input tag which is a hot link to an Microsoft Excel spreadsheet; A separate value display using the DDE tag as the expression; A display for a tag value being updated from a DDE tag through an immediate Data Change script (this runs as an instance of the variable database being changed by DDE); A display for a tag value being updated from a DDE tag through an immediate, unscanned Condition script (this runs as an instance of the variable database being changed by DDE). Then, show the Excel spreadsheet on the monitor screen underneath the InTouch windows. By setting the Tick Interval to 20000 milliseconds, the application shows that as the User Input tag value is changed, the Excel spreadsheet, the DDE tag value, and the rewritten tags are all immediately updated at the conclusion of the interrupt vector and displayed to the screen, regardless of what the Tick Interval value. (This could be a Pushbutton Action script instead of a user input.) Choosing the appropriate scan time/Tick Interval for these scripts may require tuning in that you may need to try several values until a satisfactory value can be found. The reason for this is that there are many other processes running within InTouch that need to be serviced, in addition to the script engine. Some of these processes are DDE accesses, screen updates, and checking for messages for the WW Logger. 561. Appendix E – InTouch-Related Tech Notes E-15 InTouch® HMI 9.5 Fundamentals of Application Development Course Each of these services require some system overhead time, and depending on how complex your application is, the appropriate scan time/Tick Interval will vary for each application. Note that while within the script engine, some external processes may not be updated. Be very careful when you make assumptions about external processes such as updating DDE tagnames. The simplest thing to do is to make your scripting as streamlined as possible and to avoid unnecessary coding or loops which can consume system overhead time. Conclusion There are many factors which affect the InTouch script engine. If you are not careful when designing the scripts for an application, your application may result in an undesired behavior. To avoid problems with complex scripts, you should graphically display what you want to accomplish in your scripts. This can be done by flowcharting your application before you start to write your scripts. Also, optimizing your application may require proper nesting of scripts and adjusting the scan times. Scripting Supplement A: Some Scripting Related Questions and Answers Q How are scripts scheduled for execution in an InTouch application? A All scripts are event driven. Events may be a data change , a condition, a timer, and so on. The order that scripts are executed is different for each application. Thus, there is no guaranteed order of execution. Scripts execute in the order that their associated triggering events have occurred. This means that two events cannot happen at the same time under Windows; every event has a unique time stamp. Currently, the order of execution for scripts is based on event time stamps and nothing else. If a tag is defined as retentive and is modified in a script, then the file I/O is performed when its value is changed. Normally, there are no peeks while the script is executing. Any script that brings up a dialog or selection box will peek to allow the processing of the Windows messages (that is, DDE input is processed, keystrokes are processed, time initiated scripts are processed, and so on). This means that other scripts may be initiated while the dialog or selection box is displayed. In this case, the dialog or selection box does not regain control until the scripts that were initiated are completed. A Data Change script may act like a subroutine within a script. If the value of a tag, which is linked to a Data Change script, changes while another script is executing, the script that is currently running will pause. The Data Change script will then execute and complete, then the other script will then resume executing. Similarly, if a line in a Data Change script changes the value of a tag that is tied to second Data Change script, the first Data Change script will pause, the second Data Change script will execute, then the first Data Change script will resume executing. Data Change scripts run only when a tag value is updated. If the tag value comes from DDE, then the Data Change script executes once the DDE value is received. If the tag value is changed by another script, then the Data Change script will immediately run and complete before InTouch will execute the next line in the script. Note that this could cause an infinite loop. To prevent this from happening, do not allow a script to execute if it is still active. Here are two examples of how to prevent an infinite loop in a script: Data Change script on Tag1 which modifies Tag2. Data Change script on Tag2. Script1 modifies Tag1.Script1 calls Script2 which calls Script3 which attempts to call Script2. In this case, the last attempt to call Script2 will not execute. Q What is the sequence and timing for executing commands within a script? A Each command in a script is executed in the order that it is found in the script file. Each command is completed before it moves to the next command, except for functions that require a DONE Tag such as FileMove(), FileCopy() or PrintWindow(). 562. E-16 Appendix E – InTouch-Related Tech Notes Wonderware Training The following lists the order of precedence, in descending order, for evaluation of script operators. Operators that are listed in the same line have equal precedence. Q What are the effects of blank and comment characters in a script? A Blank and comment characters are ignored. When the left brace ({) is encountered, the script engine continues ignore the characters until a right brace (}) is encountered. This may be used in any InTouch script or expression box. Its effect on the timing of the script is negligible. Wonderware Technical Support recommends that you document your scripts and expressions with comment characters. Q How do scripts interact? What is predictable and what is not? A If one script is currently running and a second script is triggered, then the first script is halted and the second script executes to completion. Any tagnames that are changed by the second script will be seen by the first script. If a tag value is changed, then the message is changed immediately, but it will not be processed by the receiving program (that is, a I/O Server) until at least at the end of the script. When the DDE server gets the processor, it will do the write on its next message for that particular topic. Q How can I use a script as a subroutine? A Data Change scripts can be used as subroutines for other scripts. That is, if the Data Change script is started from another script, InTouch will branch out and run the Data Change script as a subroutine. For example, say you have a Data Change script based on a tag called Trigger and the script uses “value = value + 10;”. Then, you can create a Pushbutton or a Condition script with these lines: trigger = not trigger; trigger = not trigger; trigger = not trigger; trigger = not trigger; When this script runs once, the Data Change script on Trigger runs each time “trigger = not trigger” was interpreted while it was still processing the first script. This technique allows you to set up subroutines that can be triggered from inside of other scripts. This can be extremely powerful! ( ) Highest Precedence - , NOT, ~ ** * , /, MOD +, - SHL, SHR , = ==, & ^ | = AND OR Lowest Precedence 563. Appendix E – InTouch-Related Tech Notes E-17 InTouch® HMI 9.5 Fundamentals of Application Development Course However, a change in a tag value should not be used to call a previously triggered script (that is, if Script1 calls Script2 which calls Script3 which attempts to call Script1, the final call will not be executed). That is, tagnames that are modified in a Condition script or a Data Change script should not be used as the tagname for a Data Change script or in the expression of a Condition script. Example: A Data Change script that executes based on the value of tag “A”, contains the line “B=B+1.” Tagname “B” should You can also “nest” your scripts (that is, have a script call another script which calls another script, and so on). But, the maximum number of nested levels for script execution depends on the size of the window stack which is represented by the Stack parameter value in your SYSTEM.INI file. (During installation, InTouch ensures that the Stack parameter is set to a value that is adequate for most scripting situations.) Q Can I modify the value of a tag that is linked to a Data Change script which is within the body of the same script? What about modifying tag values that are linked to a Condition script? A If the tagname is linked to a Data Change script (that is, it is listed in the Tagname field), and the tag’s value is changed within the body of that same script, then it will modify the value once. For example, if the tagname MYTAG is linked to a Data Change script that contains the line “MYTAG = MYTAG + 1”, then the script will increase the value of MYTAG by one and exit. The Data Change script will not execute again. This feature prevents infinite loops. If the MYTAG value is redefined several times in the Data Change script, then each redefinition will take place, but the Data Change script will not execute again. Warning Do not write any scripting which relies on this behavior. Future versions of InTouch may not operate following this logic and it will expose your application to upgrading difficulties and/or incompatibilities. If you modify the value of a tag that is linked to a Condition script, then within the body of that same script, the results may not be what you expect. The following is an example of what happens when you do this. Here is an example Condition Script: Condition: ( X == 25 ) ON TRUE body: PrintWindow("Main Window"); Blob = TAN(MyAngle); X=0; AppActivate("NotePad"); Show("Blaster Control"); TagLevel = NewValue * SIN( Blob ); ON FALSE body: SendKeys("Main Window Printed"); Blob = 0; 564. E-18 Appendix E – InTouch-Related Tech Notes Wonderware Training You would think that execution would proceed as follows: PrintWindow("Main Window"); Blob = TAN(MyAngle); X=0; AppActivate("NotePad"); Show("Blaster Control"); TagLevel = NewValue * SIN( Blob ); SendKeys("Main Window Printed"); Blob = 0; That would make sense; the ON-TRUE script executes first, then the ON-FALSE. But what really happens is this: PrintWindow("Main Window"); Blob = TAN(MyAngle); X=0; [ Pause the ON-TRUE ] [ Launch ON-FALSE ] SendKeys("Main Window Printed"); Blob = 0; [ Resume ON-TRUE ] AppActivate("NotePad"); Show("Blaster Control"); TagLevel = NewValue * SIN( Blob ); Now the value of Blob has been reset to zero (at the wrong time), and more importantly, the SendKeys has failed to make it to Notepad, since it was not active yet. Q If a tag is defined as retentive and its value changes in a script, then is the file I/O performed immediately after the value changes? A No, not until the script has finished executing. Q Is it true that if a tag value changes within a script, then any Data Change scripts will immediately execute? What about Condition scripts set to On True or On False—will these types of Condition scripts immediately execute that are affected by the new tag value? A Yes for both questions. Be aware that this feature may change in a future InTouch version. In general, you should not rely on the Data Change scripts or the Condition scripts executing immediately after the tag value changes. Instead, you should design your system to avoid this type of condition from happening. This way, your application will not be adversely affected when you upgrade to a future version of InTouch. Q Does a script need to run to completion before it can give up the CPU? At what point in the script can I do a PeekMessage to give other applications a chance to run? Also, if a script triggers or executes other scripts, when does the CPU get released? A The script engine will capture the CPU during script execution. At no time during the execution of a script will the CPU be released. PeekMessage( ), which is an Windows API call, is not performed while the script executes. Q Is there an upper limit to the nesting level for executing scripts? How many scripts can be chained together to execute in a series through a Data Change script? A Wonderware Technical Support is not aware of an upper limit on how many scripts you can nest or how many scripts you can chain together. Be aware that the practice of purposely chaining scripts together is not a good idea because there may be incompatibility issues with future versions of InTouch. 565. Appendix E – InTouch-Related Tech Notes E-19 InTouch® HMI 9.5 Fundamentals of Application Development Course Q If a tag value changes, then is the new value immediately sent to the I/O Server? If not, when? When does the I/O Server perform the write? Is a I/O Server inactive while the script executes? A No, the new tag value is not immediately sent to the I/O Server. Instead, the value is sent after the script completes. And, yes, the I/O Server is temporarily inactive while a script executes. Q When are the system tags for date and time updated? (that is, $Month, $Day, $Year, $Time and so on) I thought they were updated based on the value of the Update Time Variables setting under /Special/Configure/View Generic. I wrote a script to change the time and date, and $Time changed, but $Date did not update until WindowViewer was restarted. A If you change the system time or date on your computer, then be sure to send a WM_TIMECHANGE message to all Windows applications that are currently running, including your InTouch applications. Windows applications rarely “poll” for the current time. Q I want to print a file from my InTouch application. How can I do this? A You can use the FileCopy()function, as in this example: status = FileCopy("c:autoexec.bat","lpt2", Monitor.Name); This prints the AUTOEXEC.BAT file on printer LPT2 and uses the Integer tag Monitor as the DoneTag. (Note: You can also use the FilePrint() function that is part of the Technical Support script function library which is available on the Knowledge Base CD.) Q How do I create a timer in InTouch? A Use a Condition script that references a Memory Discrete tag named Flag. Then, create an On True Condition script that references a tag named Counter that is set to zero (that is, initialize the counter). Set the time, While True Every xxx msec, to the desired frequency. The While True Condition script should increment the Counter tag every time the script runs. When Counter is greater than a preset value, set a Memory Discrete tag called Trigger to one (1). Here is an example Condition Script: Counter = Counter + 1; IF Counter >= 5 THEN Trigger = 1; ENDIF; Q How do I toggle a Discrete tag from a script? A Try the following: Discrete = 1 - Discrete; or Discrete = NOT( Discrete ); Q I am using the On Shutdown Application script to kill the applications ‘App1’ and ‘App2’ when my InTouch application exits (by choosing Exit from the File menu). Here is my On Shutdown Application script: ActivateApp "App1"; SendKeys( "%(f)" ); SendKeys( "x" ); ActivateApp "App2"; SendKeys( "%({F4})" ); 566. E-20 Appendix E – InTouch-Related Tech Notes Wonderware Training However, when I exit my application, ‘App1’ and ‘App2’ are still running. I copied this script into a Pushbutton Action script and the two applications were killed. Why does my On Shutdown Application script not work? A Because WindowViewer captures the CPU during shutdown, you cannot run a script which would cause another application to get access to the CPU. Thus, the ActivateApp( ) function will not work in an On Shutdown Application script. Q Then, why is there no KillApp( ) script function? A There is a script function called WWControl( ). WWControl( ) can be used to terminate an application. If you use it in your Application Action script, then it will kill your applications during shutdown. For example, insert this line into an On Shutdown Application script: WWControl( "Notepad - (Untitled)", "CLOSE"); Run Notepad without loading any files and then start up the application under WindowViewer. Exit WindowViewer and the Notepad application should disappear. Scripting Supplement B: Indepth Review of Complex Script Functions The InTouch script editor supports two “styles” of scripts: Simple and Complex. Simple scripts allow you to do assignments, comparisons, simple math functions, and so on. Complex scripts allow you to perform logical IF-THEN-ELSE type statements and to process loops using the FOR- NEXT script structure. In addition, InTouch also supports the use of built-in complex script functions, such as StartApp(). Functions with the argument ApplicationName will start the Windows application identified in the ApplicationName argument. These type of functions may be used in both simple and complex scripts. Note that each IF statement requires an ENDIF statement. Also be aware that an ELSE statement is not required if your script does not need it. The first NEXT closes the inner FOR loop and the last NEXT closes the outer FOR loop. Likewise, in nested IF statements, the ENDIF statements automatically apply to the nearest prior IF statement. The following is an example of an IF-THEN-ELSE script: IF React_temp > 200 THEN React_temp_sp = 150 PRValve = 1 PlaySound (“c:fire.wav”,1); ELSE PRValve =0; PlaySound (“c:All_Ok.wav”, 1); ENDIF; In this example, the script checks if React_temp is greater than 200. If so, then Reactor_temp_sp is assigned the value of 150, PRValve is turned on and the FIRE.WAV file is played. If React_temp is equal to or less than 200, then the PRValve is turned off and the ALL_OK.WAV file is played. Note the use of the PlaySound(path_text,number) in this script. Here is an example of a FOR-NEXT loop script. This loop performs a simple iterative mathematical calculation. When executed, Product equals the value of NumberToRaise raised to the power of 10 (that is, Product=NumberToRaise10). 567. Appendix E – InTouch-Related Tech Notes E-21 InTouch® HMI 9.5 Fundamentals of Application Development Course Product = 1; NumberToRaise = 4; FOR Index = 1 TO 10 Product = Product * NumberToRaise; NEXT; Once the above script has completed processing, the value of the Product will be 1,048,576. Here are some more examples of various complex scripts: IF-THEN statement with no ELSE clause: IF a 0 THEN a = a + 100; ENDIF; IF-THEN-ELSE statement with one ELSE clause: IF temp > 500 THEN Disc = 1; Real = 43.7; ELSE Disc = 0; Real = 93.4; ENDIF; IF-THEN-ELSE statement with one ELSE IF clause and no ELSE clause: IF temp > 500 THEN Disc = Disc * 10; ELSE IF temp > 250 THEN x = y / z; a = abc + def; ENDIF; ENDIF; IF-THEN-ELSE statement with one ELSE IF clause and one ELSE clause: IF temp > 500 THEN Disc = Disc - 10; ELSE IF temp < 250 THEN Disc = Disc + 10; ELSE Disc = Disc + 50; Real = 100; ENDIF; ENDIF; IF-THEN-ELSE statement with multiple ELSE IF clauses and one ELSE clause: IF temp > 100 THEN temphihi = 1 Disc = 50; ELSE IF temp > 80 THEN temphi = 1; ELSE IF temp < 30 THEN templo = 1; ELSE IF temp < 10 THEN 568. E-22 Appendix E – InTouch-Related Tech Notes Wonderware Training templolo = 1; ELSE tempok = l; ENDIF; ENDIF; ENDIF; ENDIF; IF-THEN-ELSE statement that tests for Condition 1 or Condition 2: IF (pump1 < 50.0) OR (pump2 < 50.0) THEN alarm-1 = 1; ELSE alarm-1 = 0; ENDIF IF-THEN-ELSE statement that tests for Condition 1 and Condition 2: IF (pump1 < 50.0) AND (pump2 < 50.0) THEN alarm-2 = 1; ELSE alarm-2 = 0; ENDIF; IF-THEN-ELSE statement that tests for equivalency: IF a > 50 THEN IF b == 100 THEN c = 0; ENDIF; ENDIF; Control structures can be placed inside other control structures (such as an IF-THEN block within a FOR-NEXT loop). A control structure inside another control structure is known as nesting. Example: FOR TagX = 1 TO 5 FOR TagY = 1 TO 10 ...statements... IF (condition) THEN [EXIT FOR;] ENDIF; ...statements... NEXT; NEXT; Where: The first NEXT closes the inner FOR loop and the last NEXT closes the outer FOR loop. Likewise, in nested IF statements, the ENDIF statements automatically apply to the nearest prior IF statement. 569. Appendix E – InTouch-Related Tech Notes E-23 InTouch® HMI 9.5 Fundamentals of Application Development Course Tech Note 257 Understanding QuickFunctions All Tech Notes and KBCD documents and software are provided "as is" without warranty of any kind. See the Terms of Use for more information. Topic: t001033 Created: November 5, 2001 This Technote covers the use of QuickFunctions in InTouch applications and how they operate. This also describes the proper scripting architecture in how QuickFunctions should and should not be used. QuickFunctions are a very helpful tool in application development but can also create problems if used improperly within an application. We will discuss proper scripting techniques and provide some background information on QuickFunction threading and how this relates to existing scripts in InTouch. Note: This document assumes you are familiar with the Windows Operating System, InTouch, and InTouch scripting. This document pertains to the proper use of Scripts and QuickFunctions. Details on QuickFunctions can be found in the InTouch Users Guide and Technote 205 entitled “Using QuickFunctions in InTouch 7.x”. QuickFunction Threading and InTouch Scripts In order to understand the do’s and don’ts of using QuickFunctions with scripts in InTouch, we must first understand the basics of Windows Threading and then take a look at how QuickFunctions and Scripts interact together. In the Windows Operating system, a thread is basically a path of execution through a program. It is also the smallest unit of execution that Win32 schedules. A thread consists of a stack, the state of the CPU registers, and an entry in the execution list of the system scheduler. Each thread shares all of the process’s resources. A process consists of one or more threads and the code, data, and other resources of a program in memory. When running an InTouch application all scripts executed by the scripting engine run in one Synchronous thread along with WindowViewer. The script types include application, data change, condition, and window scripts. Each scripting type has a specific priority and order in which they are executed. This can be seen in a flow chart form as described in Technote 21, “Understanding How Scripts Operate in InTouch”. Another type of script in InTouch is called a QuickFunction. QuickFunctions are scripts that you can write and call from other scripts or expressions. Calling QuickFunctions from other scripts or expressions allows us to create a script one time and then reuse it. QuickFunctions run in a Synchronous fashion in the main scripting thread as they are called from various scripts. QuickFunctions are the only scripts that can also be configured to run in an Asynchronous mode. This allows a QuickFunction to run in a separate thread outside of the existing Synchronous scripting thread. This functionality allows WindowViewer to separate time- consuming operations such as SQL Database calls, from the main program flow. This allows all other scripts to remain active while the Asynchronous operation is running. 570. E-24 Appendix E – InTouch-Related Tech Notes Wonderware Training Note: There is no limit to how many Asynchronous functions that can be run, however to ensure reliable performance, it is highly recommended that not more than three be executed simultaneously. Each Asynchronous thread requires a lot of resources thus degrading system performance. Inside QuickFunctions When a QuickFunction is called the CallExecute() function is invoked. CallExecute() is the only function, which takes a parsed quick function (either Synchronous or Asynchronous) expression as a parameter and tries to execute it. This function will also verify the QuickFunction type. No two threads can execute this code concurrently. If the QuickFunction called is Asynchronous, CallExecute() takes the Asynchronous QuickFunction expression as a parameter, determines it is an Asynchronous QuickFunction, launches a separate thread to execute it and exits. If the QuickFunction called is Synchronous, CallExecute() takes the Synchronous QuickFunction expression as a parameter, determines it is Synchronous, executes it as part of the same thread that called it and does not exit until the Synchronous QuickFunction is finished. Examples: An Asynchronous QuickFunction is called from an application, Data Change Script, Condition Script or Action Button a. The Application script, Data Change Script (DCS), Condition Script (CSC) or Action script is started (main thread) b. The call to the Asynchronous QuickFunction is reached c. CallExecute() determines the QuickFunction is Asynchronous and a new thread is created d. After the creation of the thread, the main script will be waiting for the thread to be initialized e. After the initialization of the thread, the control is transferred back to the main script without executing the Asynchronous script The Asynchronous script thread starts executing when the operating system provides a time slice. The Asynchronous script thread has a lower priority and the operating system determines a thread's eligibility to run (using a set of priority queues). When it is time for a context switch, the operating system examines the set of ready threads and selects the head of the highest priority queue to run. Can you run more than one instance of any Asynchronous QuickFunction? Let’s assume you have an Asynchronous QuickFunction called ‘QF’ that can be called from 2 Data Change Scripts called DCS1 and DCS2 and both Data Change Scripts get triggered at the same time.No, it is not possible to run more than one instance of any Asynchronous QuickFunction concurrently. DCS1 Logmessage("DCS1 started"); Call QF(); Logmessage("DCS1 ended"); 571. Appendix E – InTouch-Related Tech Notes E-25 InTouch® HMI 9.5 Fundamentals of Application Development Course DCS2 Logmessage("DCS2 started"); Call QF(); Logmessage("DCS2 ended"); QF Logmessage("QF started"); Logmessage("QF ended"); Behavior 1) DCS1 started 2) DCS1 ended 3) DCS2 started 4) QF started 5) QF ended As you can notice, the Asynchronous QuickFunction was executed only once and the DCS2 never finished. Possible Workaround DCS2 Logmessage("DCS2 started"); If NOT IsAnyAsyncFunctionBusy(1); Call QF2(); Logmessage("DCS2 ended"); Behavior 1) DCS1 started 2) DCS1 ended 3) DCS2 started 4) QF started 5) QF ended 6) DCS2 ended 7) QF started 8) QF ended As you notice, the QF was executed twice and the DCS2 ran to its end. This behavior is true only if the Async QuickFunction finished executing in 1 second. If QF takes longer than 1 second to execute, it will not be called again from the second Data Change Script. Calling a QuickFunction while another Synchronous QuickFunction called from an Asynchronous QuickFunction is running Let’s assume we have an Asynchronous QuickFunction called QF_Async that calls a Synchronous QuickFunction called QF_Sync. The Synchronous QuickFunction is expected to last ‘X’ seconds. If the application attempts to call a third QuickFunction (Asynchronous or Synchronous) while QF_Sync is still executing, View’s updates will stop. The updates will resume as soon as QF_Sync finishes. 572. E-26 Appendix E – InTouch-Related Tech Notes Wonderware Training Explanation 1) CallExecute() takes the QF_Async expression as parameter and checks its type. Being an Asynchronous QuickFunction, it will launch a separate thread to execute it and then CallExecute() exits. 2) QF_Async calls QF_Sync. CallExecute() is called again from this second thread. It determines that QF_Sync is a Sync QuickFunction, starts executing it and doesn’t exit before QF_Sync finishes. 3) A third QuickFunction is called from a CSC, DCS or an Application script. Now the main thread can't call the function CallExecute() as it is already busy as part of the secondary thread execution. So the main thread has to wait until CallExecute () is free from the secondary thread execution. During this time, View will stop updating. Note: This can create an issue for “Hot Backup” fail over logic that may be relying on counter or Heartbeat scripts which will not be running in this situation, thus resulting in a false communication loss. How Does the IsAnyAsyncFunctionBusy(timeout) Work? You can use the IsAnyAsyncFunctionBusy() function to find out if any Asynchronous QuickFunctions are running. This function can be used to make a QuickScript, which will allow you to call an Asynchronous QuickFunction, and waits for all other Asynchronous QuickFunctions to complete processing. This allows the QuickScript to re-synchronize itself. Syntax DiscreteTag = IsAnyAsyncFunctionBusy(timeout); DiscreteTag Is a discrete type tagname to which a value is returned as follows: If the function times out, waiting for all executing QuickFunctions to complete, a value of 1 (true) is returned to DiscreteTag. If there are no asynchronous QuickFunctions running, a value of 0 (false) will be returned immediately, or the QuickFunction will wait for the timeout to elapse. It will also return a value of 0 if after timing out, there are no asynchronous QuickFunctions running. timeout Is an integer value representing the number of seconds to wait to determine if any asynchronous QuickFunctions are running. During the 'timeout' period IsAnyAsyncFunctionBusy() will continuously check to see if any asynchronous QuickFunctions are running. Note: The value of the 'Timeout' parameter should be carefully selected. If there are any Asynchronous QuickFunctions running when the IsAnyAsyncFunctionsBusy(timeout) function is invoked, WindowViewer will stop updating until all Asynchronous QuickFunctions finish or until the 'timeout' elapsed. 573. Appendix E – InTouch-Related Tech Notes E-27 InTouch® HMI 9.5 Fundamentals of Application Development Course Examples: CSC1 Logmessage("CSC1 started"); Call QF(); Logmessage("CSC1 ended"); CSC2 Logmessage("CSC2 started"); IF NOT IsAnyAsyncFunctionBusy(10) THEN Call QF2(); ENDIF; QF1 Logmessage("QF1 started"); For index=1 to 999999 Mytag=Mytag+1; Next; Logmessage("QF1 ended"); As you notice, QF1 is running a ForNextLoop that will timeout in 5seconds. QF1 will take 5 seconds to execute. Note: When using “for next loops”, the time out delay can be adjusted by adding the line “looptimeout=seconds” in the Intouch.ini file. Seconds is the time you wish to end the for next loop so that it does not run indefinitely. In this test example we have “looptimeout=5” in the Intouch.ini file. QF2 Logmessage("QF2 started"); Logmessage("QF2 ended"); Behavior 1) 17:01:27.734 CSC1 started 2) 17:01:27.734 CSC1 ended 3) 17:01:27.734 CSC2 started 4) 17:01:27.734 QF1 started 5) 17:01:32.734 QF1 ended 6) 17:01:32.734 CSC2 ended 7) 17:01:32.734 QF2 started 8) 17:01:32.734 QF2 ended Please note that the second condition script (CSC2) didn’t start the QF2 Asynchronous QuickFunction until QF1 finished (5 second delay). The IsAnyAsyncFunctionBusy (10) constantly checks if there are any Asynchronous QuickFunction running. In our case, QF1 was running. As soon as QF1 finished, QF2 was called. If QF1 would have taken more than 10 seconds (timeout) to execute, QF2 would have never been executed because the IsAnyAsyncFunctionBusy(10) has a 10 second timeout. 574. E-28 Appendix E – InTouch-Related Tech Notes Wonderware Training Setting Delays Between Two Asynchronous QuickFunctions Let's assume you have two Asynchronous QuickFunctions: QF1 and QF2 that can be triggered at the same time from two different Condition Scripts (CSC1 andCSC2). Ideally you would like to have only one Asynchronous QuickFunction running at any given time. You could implement the logic described in the above example: IF NOT IsAnyAsyncFunctionBusy(10) THEN Call QF2(); If the above logic is implemented, you run the risk of never triggering QF2 (if QF1 takes more than 10 seconds to execute). You are willing to wait 3 seconds to make sure no Asynchronous QuickFunctions are running before triggering QF2, but after the 3 seconds, you need to trigger QF2 (even if QF1 didn't finish). Solution CSC1 Logmessage("CSC1 started"); Call QF1(); Logmessage("CSC1 ended"); CSC2: LogMessage("CSC2 started" ); IsAnyAsyncFunctionBusy (3); CALL QF2(); ENDIF; Implementing the above logic, QF2 will be triggered as soon as no other Asynchronous QuickFunctions are running or after 3 seconds (whichever is shorter). Recommendations 1. Run no more than three Asynchronous QuickFunctions simultaneously. (Running only one Asynchronous QuickFunction at a time is strongly recommended.) 2. Do not attempt to run more than one instance of any Asynchronous QuickFunction concurrently. 3. Avoid calling Synchronous QuickFunctions from within an Asynchronous QuickFunction especially when you do not know how long the Synchronous function will take. 4. Control the spawning of Asynchronous QuickFunctions by using discrete tags (Flags) to determine when an Asynchronous QuickFunction ends and when to start another Asynchronous QuickFunction. The IsAnyAsyncFunctionBusy() can be used as well to determine if any other Asynchronous scripts are running. 575. Appendix F I/O Simulation 576. F-2 Appendix F – I/O Simulation Wonderware Training Introduction In this lab, you will configure the SIMULATE I/O server and establish communication with InTouch by creating and animating new tags. This lab is intended to be used during Module 8, “I/O Communication” and should replace Lab 9, “Configuring I/O Communication” in the event that a PLC is not available for InTouch. This lab was developed using the SIMULATE I/O server application that is packaged with InTouch. Objectives By the conclusion of this lab, you should have an InTouch window that uses I/O data from the Simulation application. To do this, the following tasks must be completed successfully: Start and Configure the SIMULATE I/O Server Create a New Access Name Create a Factory Floor Application Start and Configure the SIMULATE I/O Server 1. Start the Simulate I/O server by selecting Start / Run from the Windows task bar. 2. Enter Simulate and press the Enter key. The Simulate server starts. 3. Click Configure / Topic Definition. The Topic Definition dialog appears. 4. Click New. 577. Appendix F – I/O Simulation F-3 InTouch® HMI 9.5 Fundamentals of Application Development Course The SIMULATE Topic Definition dialog box appears. 5. Configure the SIMULATE Topic Definition dialog box to match the following figure: 6. Click OK. The Save Configuration dialog appears. 7. Click OK to accept the default directory. The topic appears in the Topic Definition Topics pane. 8. Click Done. 578. F-4 Appendix F – I/O Simulation Wonderware Training Create a New Access Name 1. Select Configure / Access Names from the WindowMaker Application Explorer. 2. Right-click Access Names and select New. 3. Click Add. The Add Access Name dialog box appears. 4. Configure the Add Access Name dialog box as shown and click OK to accept the new Access Name. The new name appears: 5. Click Close. 579. Appendix F – I/O Simulation F-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Create a Factory Floor Application In this task, we will create a new window called Main, where materials will be received from the hopper into a mixing drum. There will be two valves attached to the mixing drum allowing two more materials to be added. The mixture will then be agitated and drained. 1. Create a new window called Main. 2. Create the following tags. Since we will be communicating with the PLC, the tags will need to be assigned to the Access Name, PLC1 with the Items listed below. Important Note: All tags except the Start tag should be configured as ‘read-only’. Tagname Tag Type Access Name Item Start I/O Discrete PLC1 Start Valve_A I/O Discrete PLC1 V1 Valve_B I/O Discrete PLC1 V2 Agitator I/O Discrete PLC1 A1 Drain_Valve I/O Discrete PLC1 V3 Tank_Level I/O Integer PLC1 L1 (Min/Max EU 0-1000) (Min/Max Raw 0-1000) 580. F-6 Appendix F – I/O Simulation Wonderware Training 3. Add text for each of the tags in the Main window. 4. Link each text object to the appropriate tag as follows. Text Object Animation Link Property / Setting Start Touch Pushbutton - Discrete Value Action: Toggle Discrete Text Color 1,True,On: Red / 0,False,Off: Green Valve_A Discrete Text Color 1,True,On: Red / 0,False,Off: Green Valve_B Discrete Text Color 1,True,On: Red / 0,False,Off: Green Agitator Discrete Text Color 1,True,On: Red / 0,False,Off: Green Drain_Valve Discrete Text Color 1,True,On: Red / 0,False,Off: Green Tank_Level Value Display - Analog 581. Appendix F – I/O Simulation F-7 InTouch® HMI 9.5 Fundamentals of Application Development Course 5. Switch to Runtime to test the links. The Start text field should toggle between Green and Red when clicked. The Gate_Valve text field should change from Green to Red when the tag value changes. The Valve_A and Valve_B text fields should change from Green to Red when the tag value changes. The Agitator text field should change from Green to Red when the tag value changes. The Drain_Valve text field should change from Green to Red when the tag value changes. The Tank_Level text field should change when the tag value changes. Now, you are on your own. Try to be as creative as you can. For example; use as many animation links as possible, implement trending, try using wizards, bitmaps, etc. The materials you use in this process visualization are completely up to you. Important Note: Process Description When Start is set to True, Agitator is set to True, Valve_A is set to True, and Tank_Level starts to increase until it reaches 800. At Tank_Level = 800, Valve_A is set to False and Valve_B is set to True. At Tank_Level = 1000, Valve_B is set to False, Agitator is set to False, Drain_Valve is set to True, and the Tank_Level will decrease until it reaches 0 (zero). While Start is True and when Tank_Level = 0, the entire process repeats. When Start is set to False, all points are set to False / 0 (zero). 582. F-8 Appendix F – I/O Simulation Wonderware Training – Intentionally left blank – 583. Appendix G Script Functions 584. G-2 Appendix G – Script Functions Wonderware Training Overview This Appendix explains InTouch Script Functions, and is arranged to mirror the Function groupings found within InTouch. String Functions Math Functions System Functions Add-ons Misc Functions 585. Appendix G – Script Functions G-3 InTouch® HMI 9.5 Fundamentals of Application Development Course String Functions String functions are used on string variables. Function Description DText Changes a message tagname based on the value of a discrete tagname. StringASCII Returns the ASCII value of the first character in a specified message tagname. StringChar Returns the character corresponding to a specified ASCII code. StringCompare Compares two text strings (case sensitive). StringCompareNoCase Compares two text strings (case insensitive) StringFromIntg Converts an integer value into its string representation in another base. StringFromReal Converts a real value into its string representation, either as a floating-point number or in exponential notation. StringFromTime Converts a time value (in seconds since Jan-01-1970) into a particular string representation. The time value should be UTC equivalent (number of seconds since Jan-01-1970 GMT). The value returned reflects the local time. StringFromTimeLocal Converts a time value (in seconds since Jan-01-1970) into a particular string representation. The value returned reflects Localtime. StringInString Returns the position in Text where Search For first occurs. StringLeft Returns the number of characters specified by Chars starting with the leftmost character of text. StringLen Returns the length of text to integer result. StringLower Converts all the uppercase characters in text to lower case and places the resulting string in MessageResult. StringMid Extracts from text the specific numbers of characters specified by Chars, starting at the position StartChar. This function is slightly different from its counterparts, StringLeft() function and StringRight() function, in that it allows the user to specify both the start and end of the string to be extracted from the message tag. StringReplace Replaces or changes specific parts of a provided string. Using this function can take a string tagname and replace characters, words or phrases. StringRight Returns the number of character specified by Chars starting at the rightmost character of text. StringSpace Generates a string of spaces within a message tagname or an expression. StringTest Tests the first character of text to determine whether it is of a certain type. StringToIntg Converts the numeric value of a message tagname to an integer value to which mathematical calculations can be applied. StringToReal Converts the numeric value of a message tagname to a real (floating point) value to which mathematical calculations can be applied. StringTrim Removes unwanted spaces from text. StringUpper Converts all the lowercase character in text to uppercase. Text Causes a message type tagname to display the value of an analog (integer or real) tagname based on the specified Format_Text. WWStringFromTime Extracts 1 of 5 time formats from a given time/date formatted field: 1: 08/22/2003 2: 12:51:26 AM 3: Fri Aug 22 00:52:03 2003 4: Fri 5: Friday 586. G-4 Appendix G – Script Functions Wonderware Training Math Functions The following table briefly describes each math script function. For more details and syntax examples, please refer to the InTouch application Help files. Function Description Abs Returns the absolute value (unsigned equivalent) of a specified number. ArcCos Given a number between -1 and 1 (inclusive), returns an angle between 0 and 180 degrees whose cosine is equal to that number. ArcSin Given a number between -1 and 1 (inclusive), returns an angle between -90 and 90 degrees whose sine is equal to that number. ArcTan Given a number, returns an angle between -90 and 90 degrees whose tangent is equal to that number. Cos Returns the cosine of an angle given in degrees. Exp Returns the result of e raised to a power. Int Returns the next integer less than or equal to a specified number. Log Returns the natural log of a number. LogN Returns the values of the logarithm of x to base n. Pi Returns the value of Pi. Round Rounds a real number to a specified precision. Sgn Determines the sign of a value (whether it is positive, zero, or negative). Sin Returns the sine of an angle given in degrees. Sqrt Causes InTouch to automatically calculate the square root of the value, which follows the statement. Tan Returns the tangent of an angle given in degrees. Trunc Truncates a real (floating point) number by eliminating the portion to the right of the decimal point. 587. Appendix G – Script Functions G-5 InTouch® HMI 9.5 Fundamentals of Application Development Course System Functions The following table briefly describes each system script function. For more details and syntax examples, please refer to the InTouch application Help files. Function Description ActivateApp Activates another currently running Windows application. FileCopy Copies a SourceFile to a DestFile, similar to the DOS Copy command or the Copy function in Windows File. FileDelete Deletes unnecessary or unwanted files. FileMove Similar to FileCopy() except that it moves the file from one location to another. FileReadFields Reads a Comma Separated Variable (CSV) record from a specified file. FileReadMessage Reads specified number of bytes (or a whole line) from a specified file. FileWriteFields Writes a Comma Separated Variable (CSV) record to a specified file. FileWriteMessage Writes a specified number of bytes (or a whole line) to a specified file. InfoAppActive Tests whether an application is active. InfoAppTitle Returns the Application Title or Windows Task list name of a specified program which is currently running. InfoDisk Returns information about a specific local (or network) disk drive. InfoDosEnv This function is used to retrieve the setting of a particular DOS environment variable. InfoFile Returns information about a specific file or subdirectory. InfoInTouchAppDir Returns the current InTouch application directory. InfoResources Returns various system resource values. StartApp Automatically starts another Windows application. 588. G-6 Appendix G – Script Functions Wonderware Training Add-ons Add-on functions are outside the scope of the InTouch Basic course. They are included here for completeness. For more information about Add-ons functions, please refer to the InTouch help files. Function Description RecipeDelete Deletes a Recipe Name from the specified recipe template file. RecipeGetMessage Writes an error code to an Analog tagname and the corresponding error code message to a Message tagname. RecipeLoad Loads a specific recipe to a specific unit of tagnames. RecipeSave Saves a newly created recipe or to save changes made to an existing recipe to the specified recipe template file. RecipeSelectNextRecipe Selects the next Recipe Name currently defined in the recipe template file. RecipeSelectPreviousRecipe Selects the previous Recipe Name currently defined in the recipe template file. RecipeSelectRecipe Selects a specific Recipe Name currently defined in the recipe template file. RecipeSelectUnit Selects the unit of tagnames to which the current recipe values will be loaded. SPCConnect Used in conjunction with automatic data collection datasets. Before an Automatic data collection dataset will start collecting data, this function must be used to indicate to SPC which user the node is. SPCDatasetDig This function is used to display the SPCPro Dataset Configuration dialog box in WindowViewer. New Datasets can be added and deleted. There are no parameters or any return value. SPCDiconnect This function is used to disconnect an Agent from a SPC Pro database. When this function is used, all datasets that were assigned to the Agent that was disconnected will stop collecting. SPCDisplayData This function is designed to allow convenient scrolling of the chart to any date and time. You can use a tagname to monitor the status of the SPC data search. Status will contain a 0 if SPC found data and 1 if it could not find data for the specified time period. SPCLocateScooter This function is designed to allow convenient scrolling of the Scooter to any valid sample number. The Scooter tagname defined in the dataset will be updated with the X-Bar sample value. Setting SampleNumber to 0 hides/disables the Scooter. SPCMoveScooter This function is designed to allow convenient scrolling of the Scooter to any valid sample number. The Scooter tagname defined in the dataset will be updated with the X-Bar sample value. SPCSaveSample Saves a manually input sample. This function is used in conjunction with the SPCSetMeasurement function. SPCSelectDataset Opens a dialog box from which the user may select a direct dataset. SPCSelectProduct Opens a dialog box from which the user may select a product in a given dataset. SPCSetControlLimits Allows convenient manual or event driven input of the control limit values for a Control Chart. SPCSetMeasurement Allows convenient manual or event driven inputs of analog measurement values by processing the QuickScript. SPCSetProductCollected Changes the product being collected in a specified Dataset. SPCSetProductDisplayed Changes the product being displayed in a specified Dataset. 589. Appendix G – Script Functions G-7 InTouch® HMI 9.5 Fundamentals of Application Development Course SPCSetRangeLimits Allows convenient manual or event driven input of the Control Limits for a Range Chart. SPCSetSpecLimits Allows convenient manual or event driven input of the specification limit values for a Control Chart. SQLAppendStatement Continues a SQL statement using the contents of string. Errors are returned in the function return. SQLClearParam Clears the value of the specified parameter. SQLSetParam must be called again before calling the SQLExecute() function. SQLClearStatement Releases the resources associated with the statement specified by SQLHandle. SQLClearTable Deletes all records in a database table, but keeps the table. SQLCommit The SQLCommit() command defines the end of a group of transaction commands. The group of commands performed between the SQLTransact() command and the SQLCommit() command is called a transaction set. A transaction set is handled like a single transaction. After the SQLTransact() command is issued, all subsequent operations will not be committed to the database until the SQLCommit() command is issued. SQLConnect Connects InTouch to the database specified in the ConnectString. SQLCreateTable Creates a table in the database using the parameters in the named Table Template. Table Templates (defined in the SQL.DEF file) determine the structure of a database table. SQLDelete Deletes a record or multiple records. SQLDisconnect Disconnects the user from the database. SQLDropTable Destroys a table. SQLEnd This is used after a SQLSelect() function to free resources that were being used to store the Results Table. SQLErrorMsg Retrieves the text error message associated with a specific ResultCode. ErrorMsg is the InTouch Memory Message tagname (maximum 131 characters) associated with ResultCode. SQLExecute Executes the SQL statement. If the statement is a select statement, the BindList parameter designates the name of the BindList to use for binding the database columns with tagnames. If the BindList is NULL, no tagnames relationships are formed. For example, the SQL statement could be Create View, Insert, and so on. Errors are returned in the function return. If the statement has been "prepared," the statement handle returned from the prepare should be passed. If the statement has not been prepared, the statement handle should be zero (0). SQLFirst Selects the first record of the Results Table created by the last SQLSelect() function. A SQLSelect() function must be processed before using this command. SQLGetRecord Retrieves the record specified by RecordNumber from the current selection buffer. SQLInsert Inserts a new record into the referenced table using the values of the tagnames in the supplied BindList. The BindList parameter defines which InTouch tagnames are used and which database columns they are associated. SQLInsertEnd Releases the statement. SQLInsertExecute Execute the already prepared statement. Function Description 590. G-8 Appendix G – Script Functions Wonderware Training SQLInsertPrepare Creates and prepares an Insert statement for execution. The Insert statement is not processed. The SQLHandle parameter is an Integer tagname that will contain a value after the statement is processed. SQLLast Selects the last record of the Results Table created by the last SQLSelect() function. A SQLSelect() function must be processed before using this command. SQLLoadStatement Reads the statement contained in FileName. At this point the statement is similar to one created by SQLSetStatement() function, and can be appended to via SQLAppendStatement() function, or executed by SQLExecute() function. There can be only one statement per file. However, SQLAppendStatement() function can be used to append something to the statement if SQLPrepareStatement() function or SQLExecute() function has not been called. SQLManageDSN Runs the Microsoft ODBC Manager setup program. This can be used to add, delete and modify all data source names. SQLNext Selects the next record of the Results Table created by the last SQLSelect() function. A SQLSelect() function must be processed before using this command. SQLNumRows Indicates how many rows met the criteria specified in the last SQLSelect() function. For example, if a WhereExpression is used to select all rows with a column name AGE, where AGE is equal to 45, the number of rows returned could be 40 or 4000. This may determine which function is processed next. SQLPrepareStatement A SQLPrepareStatement() prepares an existing SQL statement for use by the SQLSetParam() function. A statement can be created by using either a SQLSetStatement(), or SQLLoadStatement(). The statement handle is returned. SQLPrev Selects the previous record of the Results Table created by the last SQLSelect() function. SQLRollback The SQLRollback() command reverses, or "rolls back," the most recently committed transaction set. A transaction set is a group of commands issued between the SQLTransact() command and the SQLCommit() command or the SQLRollback() command. A transaction set is handled like a single transaction. After the SQLTransact() command is issued, all subsequent operations are not committed to the database until the SQLCommit() command is issued. SQLSelect Instructs the database to retrieve information from a table. When a SQLSelect() function is processed, a temporary Results Table is created in memory, containing records that can be browsed using SQLFirst(), SQLLast(), SQLNext() and SQLPrev() functions. Note Always use the SQLEnd() function after a SQLSelect() to free resources that were being used to store the Results Table. SQLSetParamClear Sets the value of the specified parameter to the specified string. SQLSetParamChar() function may be call multiple times before executing, resulting in the parameter value being set to the concatenation of all values sent. Lengths of 0 (zero) are ignored. SQLSetParamDate Sets the value of the specified date parameter to the specified string. SQLSetParamDateTime Sets the value of the specified date-time parameter to the specified string. SQLSetParamDecimal Sets the value of the specified decimal parameter to the specified string. Precision is the number of digits in the value and Scale is the number of digits to the right of the decimal point. Function Description 591. Appendix G – Script Functions G-9 InTouch® HMI 9.5 Fundamentals of Application Development Course SQLSetParamFloat Sets the value of the specified parameter to the specified ParameterValue. SQLSetParamInt Sets the value of the specified parameter to the specified ParameterValue. SQLSetParamLong Sets the value of the specified parameter to the specified ParameterValue. SQLSetParamNull Sets the value of the specified parameter to the NULL. SQLSetParamTime Sets the value of the specified time parameter to the specified string. SQLSetStatement Starts a SQL statement buffer using the contents of SQLStatement, on the established connection, ConnectionID. There can be one SQL Statement buffer per ConnectionID. Errors are returned in the function return. SQLTransact The SQLTransact() command defines the beginning of a group of transaction commands. The group of commands performed between the SQLTransact() command and the SQLCommit() command is called a transaction set. A transaction set is handled like a single transaction. After the SQLTransact() command is issued, all subsequent operations will not be committed to the database until the SQLCommit() command is issued. SQLUpdate Modifies a record to update the record with the current tagname values. SQLUpdateCurrent Takes the currently selected record and updates it with any new InTouch values. The following example will update the currently selected record. Function Description 592. G-10 Appendix G – Script Functions Wonderware Training Misc Functions Miscellaneous functions are used to perform a variety of actions, including hiding a window, monitoring and controlling historical trends, printing windows, and so on. The specific syntax of these functions is addressed in the InTouch Reference Guide. Function Description Ack Script function to acknowledge local alarms. AddPermission Sets the Access Level to a particular group or user in the specified domain. Attempts to reach the account Account located on domain Domain. almAckAll Acknowledges all the alarms in the current alarm query. Since the alarm display has only a limited display area, the almAckAll function may acknowledge alarms that are not visible in the display. almAckDisplay Acknowledges only those alarms that are currently visible in the alarm display. almAckGroup Acknowledge all alarms that have a given Group name from the same provider. almAckPriority Acknowledges all alarms within a specified priority range having same provider name and group name. almAckRecent Acknowledges only the most recent alarm that has occurred in the current alarm query. almAckSelect The distributed alarm display allows alarms to be selected by clicking on them with the mouse at Runtime. The almAckSelect function can be used to acknowledge those alarms. almAckSelectedGroup Acknowledges all alarms that have the same group name from the same provider as one or more of the selected alarms. almAckSelectedPriority Acknowledges all alarms that have the same priority from the same provider and group name as one or more of the selected alarms. almAckSelectedTag Acknowledges all alarms that have the same Tagname from the same provider and group name and having the same priority as one or more of the selected alarms. almAckTag Acknowledge all alarms that have the same Tagname, Provider name and Group name within the given Priority range. almDefQuery Performs a query to update an alarm display object using the default properties. almMoveWindow Scrolls the alarm display object window. almQuery Performs a query to update an alarm display object. almSelectAll Toggles the selection of all the alarms in an alarm display object. almSelectGroup Toggles the selection of all alarms that are contained by a named Distributed Alarm Display instance as a result of the display’s last query and where the resultant alarm contains the same alarm group name. almSelectionCount Returns the integer value containing the number of alarms selected by the operator in the Distributed Alarm Object. almSelectItem Toggles the selection of the item that is highlighted in an alarm display object. almSelectPriority Toggles all alarms that are contained by the named Distributed Alarm Display instance as a result of the display’s last query and where the resultant alarms are the specified priority range. almSelectTag Toggles all alarms that are contained by the named Distributed Alarm Display instance as a result of the display’s last query and given tagname. 593. Appendix G – Script Functions G-11 InTouch® HMI 9.5 Fundamentals of Application Development Course almSetQueryByName Start a new alarm query for the named instance of the Distributed Alarm Display Control using the query parameters associated with a user defined (favorite) query name. almShowStats Displays the alarm display object statistics screen. almSuppressAll Suppress the display of all current and future instances of the alarms in the current query including those not currently displayed in the alarm summary display object. almSuppressDisplay Suppress the display of current and future occurrences of those alarms visible in the alarm summary display object. almSuppressGroup Suppress the display of current and future occurrences of the alarms that belong to a given Group name. almSuppressPriority Suppress the display of current and future occurrences of any alarm of the specified priority range, having the same Provider name and Group name. almSuppressRetain Retain alarm suppression for all following queries. almSuppressSelected Suppress the display of future occurrences of the alarms selected in the alarm summary display object. almSuppressSelectedGroup Suppress the display of current and future occurrences of the alarms that belong to the same groups of one or more selected alarms having the same Provider name within the named Distributed Alarm Display Control. almSuppressSelectedPriority Suppress the display of current and future occurrences of the alarms that belong to the same priority of one or more selected alarms having the same Provider name and Group tag within the named Distributed Alarm Display Control. almSuppressSelectedTag Suppress the display of current and future occurrences of any alarm that belongs to the same Tagname name of one or more selected alarms having the same Provider name, Group name and Priority range. almSuppressTag Suppress the display of current and future occurrences of any alarm emitted by a given tagname name, having the same Provider, Group name and Priority range. almUnselectAll Unselects all the selected alarms in a named Distributed Alarm Display instance. almUnSuppressAll Clear all suppressed alarms. APUFindAlarmGroupInstance Find the first instance of the Alarm Print Utility using the specified Alarm Group String. This can be used to initially obtain the desired instance of an Alarm Print Utility. The initial alarm group String is read from the ALC file. The String string match is NOT case sensitive. APUFindFileInstance Find the first instance of the Alarm Print Utility using the specified ALC configuration file. This can be used to initially obtain the desired instance of an Alarm Print Utility. The file path that an instance of the ALC uses can be controlled manually by the user or else it can be specified on the command line when the program is started. The file path string match is NOT case sensitive. APUFindPrinterInstance Find the first instance of the Alarm Print Utility using the specified printer name or port. This can be used to initially obtain the desired instance of an Alarm Print Utility. The printer name is stored and read from the ALC file. The printer name string match is NOT case sensitive. APUGetAlarmGroupText Gets the Alarm Query Alarm Group Text. The initial alarm group text is read from the ALC file. Function Description 594. G-12 Appendix G – Script Functions Wonderware Training APUGetConfigurationFilePath Get the full file path of the ALC configuration file being utilized. The file path that an instance of the ALC uses can be controlled manually by the user or else it can be specified on the command line when the program is started. APUGetInstanceCount Returns the number of running instances of the Alarm Print Utility up to and including the sixteenth instance. Any instances beyond the first sixteen running simultaneously will not be dynamically controlled nor can their status be obtained. APUGetPrinterJobCount Gets the most recent Windows printer status job count for the printer used by this instance. The results will not be current unless a query is running. The results will not be current unless an alarm has been printed – the job count is typically updated when the printer is initially opened, and then each time an alarm line is printed. You can use this to determine if the Windows spooler is filling up with alarm line printer jobs. If this number becomes increasingly large over a period of time, it could indicate that the alarm line printer is physically offline or out of paper or has some other error not otherwise reported. This value is only valid for printers assigned to a Windows printer and does not have much meaning for printers associated with a parallel or serial port. APUGetPrinterName Gets the Windows printer name or port name for the printer used by this instance. Returns ‘NONE’ if no printer is configured. The printer name is stored and read from the ALC file. APUGetPrinterStatus Gets the most recent Windows printer status for the printer used by this instance. The results will not be current unless a query is running. The results will not be current unless an alarm has been printed – the status is typically updated when the printer is initially opened, and then each time an alarm line is printed. The selector can be one of the following: · 0 = AlarmPrinterError · 1 = AlarmPrinterNoPaper · 2 = AlarmPrinterOffline · 3 = AlarmPrinterOverFlow NOTE: This status information is being queried to the printer based on Microsoft/Windows driver standards. Not all Printer Manufacturers will follow these standards, and therefore, not all printers will return status information. APUGetQueryAlarmState Gets the Alarm State for the Query (0 = All, 1 = Ack, 2 = UnAck). The initial alarm state is read from the ALC file. APUGetQueryFromPriority Gets the From Priority for the Query. The initial priority is read from the ALC file. APUGetQueryProcessingState Gets the Alarm Query Processing State (0 = Stop, 1 = Start). APUGetQueryToPriority Gets the To Priority for the Query. The initial priority is read from the ALC file. APUIsInstanceUsed Success implies that the instance is in use. APUSetAlarmGroupText Sets the Alarm Query Alarm Group text. A query can not be running for this function to succeed. (See functions below for Start, Stop, and Query Processing State) The initial alarm group text is read from the ALC file. APUSetQueryAlarmState Sets the Alarm State for the Query (0 = All, 1 = Ack, 2 = UnAck). A query can not be running for this function to succeed. (See functions below for Start, Stop, and Query Processing State) APUSetQueryFromPriority Sets the From Priority for the Query. A query can not be running for this function to succeed. (See functions below for Start, Stop, and Query Processing State) Function Description 595. Appendix G – Script Functions G-13 InTouch® HMI 9.5 Fundamentals of Application Development Course APUSetQueryToPriority Sets the To Priority for the Query. The ‘To’ priority must be set equal to or greater than the ‘From’ priority or the function will not succeed. A query can not be running for this function to succeed. (See functions below for Start, Stop, and Query Processing State) APUSetTimeoutValues Specify timeout intervals in seconds. This can control how many errors related to memory access or errors resulting from failing to obtain valid responses are observed while program is running. The default memory access timeout is 2 seconds. The default short response wait time is 10 seconds, and the default long response wait time is 20 seconds. APUStartInstance Start an instance of the Alarm Printer in a minimized state with the specified configuration file. Returns instance started to Instance or an error code to ErrorCode. The Alarm Printer program will not automatically begin processing the alarm database. Use the APUStartQuery() command to cause the instance to begin processing the alarm database. APUStartQuery Sets the date and time limits for records to be processed and then starts the query. It is an error to try to start a query if a query is already running. Setting data to all 0 causes all alarms to be printed. Any individual 0 implying a “don’t care state” defaults to the lowest reasonable value. January 01, 1900 at Midnight is the earliest time, used as the default. The time and dates specified are in local time. A value of –1 for the year will set the data to the current time that the command is processed. APUStopInstance Stops specified instance of the Alarm Printer. Any further addition of records to be printed will stop, any currently executing query against the alarm database for printing will be terminated, and the instance of the program will exit. APUStopQuery Request the specified instance to stop running its query. The application will remain running, but it will not process any alarm database queries. A call to APUStartQuery()can cause the instance to begin alarm database queries. APUTranslateErrorCode Convert an error code returned by one of the APU functions into an English string briefly describing the error code. Can fail if unknown error code is passed in for translation. AttemptInvisibleLogon Attempts to logon to InTouch using the supplied credentials. ChangePassword Displays the Change Password dialog box allowing the logged on operator to change his/her password. ChangeWindowColor The script function changes the color of the InTouch Window using red, green and blue values ranging from 0 to 255. DialogStringEntry Displays an alphanumeric keyboard on the screen, allowing the operator to change the current string value of a Message tagname in the Tagname Dictionary. DialogValueEntry Displays the numeric keypad on the screen, allowing the user to change the current value of a Discrete, Integer or Real tagname in the Tagname Dictionary. EnableDisableKeys Enables/Disables key filters for the Alt,Escape and Windows keys. FilePrint FilePrint is used to tell InTouch to print a specified file. FileSelect Presents the user with a standard Windows File Open dialog box and returns the file entered specified. Function Description 596. G-14 Appendix G – Script Functions Wonderware Training GetAccountStatus Used to determine when a user’s password will expire. Return value will display the number of days (positive value) until the user’s password expires. GetAccountStatus also displays the following account status values: Account password expired = -1 Account password will never expire = -2 Account locked out = -3 Account disabled = -4 Account info failed = -5 Users can write a script to pop up a window displaying either the number of days until the user’s passcode expires, or the proper message/warning which corresponds to the return value of the function. GetNodeName Returns the NetDDE node name to a string variable. GetPropertyD Retrieves the specified property’s discrete value during Runtime. GetPropertyI Retrieves the specified property’s integer value during Runtime. GetPropertyM Retrieves the specified property’s message value during Runtime. Hide Hides various windows from within a QuickScript. A Hide() function must precede the name of each window to be hidden. HideSelf Hides the currently active Window. HTGetLastError Determines if there was an error during the last retrieval of a specified pen. HTGetPenName Returns the tagname of the tag currently used for the specified pen # of the specified trend. HTGetTimeAtScooter Returns the time in seconds since 00:00:00 hours GMT, January 1, 1970 for the sample at the scooter location specified by ScootNum and ScootLoc. UpdateCount, ScootNum, and ScootLoc cause the expression to be evaluated when any of these parameters change. This ensures that the expression is evaluated after new retrievals or after a scooter moves. HTGetTimeStringAtScooter Returns the string containing the time/date for the sample at the scooter location specified by ScootNum and ScootLoc. UpdateCount, ScootNum, and ScootLoc cause the expression to be evaluated when any of these parameters change. This ensures that values are updated after new retrievals or after a scooter moves. The format of the string determines the contents of the return value. HTGetValue Returns a value of the requested type for the entire trend's specified pen. The UpdateCount parameter will cause the expression to be evaluated after a retrieval is complete. HTGetValueAtScooter Returns a value of the requested type for the sample at the specified scooter position, trend and pen #. The UpdateCount parameter will cause the expression to be evaluated after a retrieval is complete. HTGetValueAtZone Returns a value of the requested type for the data contained between the right and left scooter positions for a trend's specified pen. The UpdateCount parameter will cause the expression to be evaluated after a retrieval is complete. HTScrollLeft Sets the start time of the trend to a value older than the current start time by a percentage of the trend's width. The effect is to scroll the date/time of chart to the left by a given percentage. HTScrollRight Sets the start time of the trend to a value newer than the current start time by a percentage of the trend's width. The effect is to scroll the date/time of chart to the right by a given percentage. Function Description 597. Appendix G – Script Functions G-15 InTouch® HMI 9.5 Fundamentals of Application Development Course HTSelectTag Displays the Select Tag dialog box and the operator can select a different tagname for specified pen. (The dialog box only lists the tagnames that have been defined for historical logging (Log Data option selected) in the Tagname Dictionary. HTSetPenName Assigns a different tagname to a trend's pen. HTUpdateToCurrentTime Causes the data to be retrieved and displayed with an end time equal to the current time. The start time will be equal to EndTime minus the Width of the chart. HTZoomIn Calculates a new chart width and start time. If the trend's .ScooterPosLeft is 0.0 and the .ScooterPosRight is 1.0, then the new chart width equals the old chart width divided by two. The new start time will be calculated based on the value of LockString. HTZoomOut Calculates a new chart width and start time. The new chart width is the old chart width multiplied by two. The new start time will be calculated based on the value of LockString. InfoAppStatus Returns either a True or False value which tells the current status of the specified application. InfoAppTitleExpand Returns the application title or Microsoft Windows Task List name of a window whose title is partially or fully specified. InfoWinEnv Retrieves the value of a particular attribute for the current Windows session. InTouchVersion Enables users to get InTouch version information through scripts. InvisibleVerifyCredentials Checks to verify the credentials of the given user without logging the user on to InTouch. IOGetApplication Returns the application name defined for a specific Access Name to the specified tagname. IOGetNode Returns the node information (address) defined for a specific Access Name to the specified tagname. IOGetTopic Returns the topic name defined for a specific Access Name to the specified tagname. IOReinitialize Closes all existing I/O conversations and restarts the entire process of setting up I/O conversations. All I/O points are affected when this function executes. IOSetAccessName Modifies the application or topic name portions of an Access Name during Runtime which allows implementing of hot-backup strategies for InTouch. IOSetItem Changes the access name and/or item in an I/O type tagname .Reference field. IOStartUnitConversations When WindowViewer is started, it automatically processes an initiate request to start all I/O conversations. If an I/O server program does not respond to WindowViewer's initiate request, you can force WindowViewer to try again to establish the I/O conversation by executing this function in a QuickScript. IsAnyAsynchFunctionBusy Used to find out if any asynchronous QuickFunctions are running. This function can be used to make the QuickScript that calls an asynchronous QuickFunction wait for all other asynchronous QuickFunctions to complete processing. This allows the QuickScript to re-synchronize itself. IsAssignedRole Used to find out if current logged on user has the indicated role. LogMessage Writes a user-defined message to the Wonderware Logger. Logoff Logs the user off of InTouch. Function Description 598. G-16 Appendix G – Script Functions Wonderware Training LogonCurrentUser This script function is designed for InTouch to run in security OS mode. When the script function is called, whoever is logged onto the computer will be logged in to InTouch. MessageBox This function displays a standard Windows message box with a specific text message. MoveWindow MoveWindow positions a window that is being used on top of InTouch. OpenWindowsList Displays a dialog box with a list of currently open windows. PlaySound Plays a wave form sound specified by a .wav filename. PostLogonDialog Displays the InTouch Logon dialog and returns TRUE. PrintHT Can be used in a button for printing the Historical Trend chart associated with the specified Hist Trend type tagname. The Historical Trend must be visible on the screen when using this function. PrintScreen Prints the specified screen. PrintWindow Prints the specified window. ptGetTrendType ptLoadTrendCfg ptPanCurrentPen ptPanTime ptPauseTrend ptSaveTrendCfg ptSetCurrentPen ptSetPen ptSetPenEx ptSetTimeAxis ptSetTimeAxisToCurrent ptSetTrend ptSetTrendType ptZoomCurrentPen ptZoomTime These script functions are loaded when the 16pen trend is installed and only apply to the 16pen trend. QueryGroupMembership Valid for OS security mode only and applies to the currently logged on user. If a user is currently logged on and if he part of the group lpszGroup which is located on the domain lpszDomain then a TRUE is returned and in all other cases a FALSE is returned. ReloadWindowViewer Allows the user control over reloading WindowViewer. RestartWindowViewer Allows the user control over shutting down and restarting WindowViewer. SendKeys Sends keys to an application. To the receiving application, the keys appear to have been entered from the keyboard. This capability may be used to enter data into the application or to give commands to the application. Most keyboard keys can be used in a SendKeys statement. Each key is represented by one or more characters such as A for the letter A or {ENTER} for the Enter key. SetPropertyD Specifies the property's discrete value that is to be written during Runtime. SetPropertyI Specifies the property's integer value that is to be written during Runtime. SetPropertyM Specifies the property's message value that is to be written during Runtime. Function Description 599. Appendix G – Script Functions G-17 InTouch® HMI 9.5 Fundamentals of Application Development Course SetWindowPrinter Can be used to have WindowViewer print to something other than the Default printer. Show Displays a specified window. (Window name must be enclosed in quotation marks.) ShowAt Specifies the horizontal and vertical pixel location of a window when it is shown. ShowHome Displays the "home" window(s). Home windows are those you selected to open automatically when WindowViewer is started. (The home windows are selected in the WindowViewer Properties - Home Windows property sheet.) ShowTopLeftAt Specifies the horizontal and vertical pixel location of the top left corner of a window when it is shown. TseGetClientId Returns a string version of the client ID (the TCP/IP address of the client) if the View application is running on a Terminal server client. Otherwise it returns an empty string. TseQueryRunningOnClient Returns a non-zero integer value if the View application is running on a Terminal server client. Otherwise it returns a value of zero (0). TseQueryRunningOnConsole Returns a non-zero integer value if the View application is running on a Terminal server console. Otherwise it returns a value of zero (0). UTCDateTime Allows user to obtain the UTC time (Coordinated Universal Time), the current time zone and offset from GMT, and the daylight savings time status. wcAddItem Adds the supplied string to the List box or Combo box. If the List box or Combo box was not created as sorted, the string is added to the end of the list. Otherwise the string is inserted into the list and the list is sorted. wcClear Removes all items from the List box or Combo box. wcDeleteItem Deletes the item associated with the item index argument in both List and Combo boxes. wcDeleteSelection Deletes the currently selected item from the list. wcErrorMessage Returns a message string describing the error. wcFindItem Determines the corresponding index of the first item in the List box or Combo box that matches the supplied Message string. wcGetItem Returns the value property of the item string associated with the corresponding ItemIndex in the List box or Combo box. wcGetItemData Determines the integer value associated with the list item identified by the parameter ItemIndex. wcInsertItem Inserts the Message string into the list. ItemIndex is the corresponding index number of the position in the List box that will receive the string. Unlike wcAddItem(), wcInsertItem() will not sort a list, even if it was created as a sorted List box or Combo box. wcLoadList Replaces the contents of the List box or Combo box with the items contained in the FileName. wcLoadText Replaces the contents of the Text box with the contents of the FileName. wcSaveList Replaces the contents of the FileName with the items listed in the List box or Combo box object. wcSaveText Saves the text contained in the Text box to FileName. If the file doesn't exist, it will be created. If it does exist, it must be read/write. wcSetItemData Assigns an integer value of the item (Number) to the item in the list specified by ItemIndex. This function allows the assignment of a number to a string. Function Description 600. G-18 Appendix G – Script Functions Wonderware Training WindowState Returns a discrete value of whether a specified window is open or not. WWAlwaysOnTop Will cause the specified Windows application to remain on top of all other application windows. WWContext Used to determine when the cursor is over a certain region of an InTouch application window. WWControl Allows you to Restore, Minimize, Maximize, or Close an application from InTouch. WWControlPanel Starts the Control Panel and brings up the named applet. WWDosCommand Starts a Windows DOS Box in a specified initial state and runs a specified command line. WWExecute Sends a command (using a DDE Execute ) to a specified Application and Topic. WWExitWindows Allows InTouch user to safely shut down the Windows operating system from inside an InTouch application. WWFreeHandles Returns the number of free Global Memory handles. WWIsDayLightSaving This script function returns 1 if Daylight Savings is enabled and 0 if Daylight Savings is not enabled. WWMoveWindow This script function resizes and moves the window entered to the specified new location. WWPoke Pokes a value (using a DDE Poke) to a specified Application, Topic, and Item. WWRequest Makes a one-time request for a value (using a DDE Request) from a particular Application, Topic, and Item. WWStartApp Starts a specified Windows application and places the application into the desired Window state. Function Description 601. Appendix H Using InTouch on a Tablet PC 602. H-2 Appendix H – Using InTouch on a Tablet PC Wonderware Training Appendix Objectives Introduce highlighted features of the Windows XP for Tablet PCs Introduce highlighted features of Wonderware InTouch Demonstrate the AnnotateLayout script function Change screen orientation from landscape to portrait Introduce Tips for Using Tablet PCs Tablet PCs have been used for years in the Utilities, Oil & Gas, and Emergency Response environments. They are extremely durable and have several features that make them appropriate for industrial settings. Hardware Ruggedized Tablet PCs are sealed units which are waterproof and vibration resistant. Most come equipped with a light sensor which allows for automatic adjustment of screen brightness based on light surrounding them. They have dual batteries which allow batteries to be swapped out on-the- fly when necessary. Most come with docking stations and a digital pan. A wireless network card makes them completely portable in a wireless environment. Operating System Tablet PCs run on Microsoft Windows XP Tablet PC Edition which supports full functionality of all software including pen extensions which allow data input with a digital pen. The digital pen is also used as a pointing device. Target Users These features make tablet PCs an ideal tool to create efficiency in plant settings. They empower users to access InTouch applications anywhere any time when in range of a wireless network. They are perfect for users who need to move around, monitor plant activities, enter small pieces of data, or enter data without a keyboard. They are also ideal for harsh environments. Highlighted Features of the Operating System This information is intended to introduce the features most applicable to Wonderware customers. Please refer to the owner's manual for your specific Tablet PC for detailed instructions. Digital Ink Digital Ink in practical terms is simply electronic handwriting. Using the digital pen, you can input data, change set points, and make notes with handwriting. This is especially useful when the tablet is undocked. 603. Appendix H – Using InTouch on a Tablet PC H-3 InTouch® HMI 9.5 Fundamentals of Application Development Course Windows Journal Windows Journal is a note-taking application that lets you create and organize handwritten notes in a Tablet PC using a digital pen. You can think of it as a version of Notepad that handles "digital ink". It also provides character recognition capabilities so your handwriting can be converted to text; although you can enter, manage and keep your notes in digital ink if you so desire. It includes search and highlight capabilities. 604. H-4 Appendix H – Using InTouch on a Tablet PC Wonderware Training It will also convert your handwriting into text. Screen Rotation The XRT Screen Rotation tool is especially useful when the Tablet is undocked. This allows you to change from landscape orientation to portrait. This is more comfortable when you're holding the Tablet and taking notes. This is done by changing the screen resolution. 605. Appendix H – Using InTouch on a Tablet PC H-5 InTouch® HMI 9.5 Fundamentals of Application Development Course Write Anywhere With the Write Anywhere feature, you can use most of the screen on your Tablet PC as a writing area. This is especially useful for longer writing tasks. The Write Anywhere feature converts your handwriting into typed text and inserts it in a location that you specify, such as a word-processing document. You can use the Write Anywhere feature to enter text anywhere that you can use a standard keyboard to enter text. The Write Anywhere feature recognizes handwriting in English only. This feature also allows you to write on or highlight a live application with the digital pen and can function as a transparency. Access this feature through the Tablet PC Input Panel. Tools / Options and click the Write Anywhere tab. Check Show the Turn on Write Anywhere button on the title bar. Click Apply. Click OK. The Write Anywhere icon will now be visible on your Tablet PC Input Panel. 606. H-6 Appendix H – Using InTouch on a Tablet PC Wonderware Training Highlighted features of InTouch A detailed listing of System Requirements, Installation Information, Enhancements, and so on is contained in the Readme document that comes with InTouch. This document is intended as a brief overview of selected features. AnnotateLayout Script Function InTouch includes a script function called AnnotateLayout. This script function is only available when using the Windows XP Tablet PC Edition operating system. Invoking the script function takes a screen capture of the visible portion of the active window. You can then use the digital pan to make notations and highlight information. You can save this screen capture with your annotation(s) as a .jpg or .gif file for later use. The Annotate Layout dialog box contains a toolbar and menu items and shows the InTouch WindowViewer screen capture in its client area. The dialog box has a Close button on the caption bar, but does not have minimize or maximize buttons. 607. Appendix H – Using InTouch on a Tablet PC H-7 InTouch® HMI 9.5 Fundamentals of Application Development Course Pen Input Panel The digital pen allows handwritten input into any field in InTouch that allows data input in Runtime. InTouch WindowViewer displays edit boxes when the user clicks touch links of Analog or Message types. In addition to these edit boxes, WindowViewer now displays the Pen Input Panel to facilitate data entry using the digital pen. Screen Rotation The XRT Screen Rotation tool is usable in InTouch. Please note that InTouch only checks for Windows screen resolution when an application is started. Changes made while the application is running will result in strange outcomes. You must configure InTouch Node Properties to allow WindowViewer or to dynamically change resolution. 608. H-8 Appendix H – Using InTouch on a Tablet PC Wonderware Training Tips for Using Tablet PCs If you order a tablet PC from Wonderware, InTouch will already be installed as will the license file. If you purchase one from another vendor, please note the following: Installation requires the .NET Framework Version 1.1. This can be installed by using the Start menu. Start / Windows Updates / Scan for updates Scroll to the bottom and select .NET Framework Version 1.1. Click Review and install updates. Tablet PCs can be docked and do have external ports. However, they do not come with CD ROM drives. Plan ahead by creating shares on other nodes to access InTouch and a license file for installation. Mouse/Digital Pen Equivalents One can also use the Tablet PC digital pen to perform commands instead of the mouse. The table below shows examples of common actions performed with the mouse as well as the corresponding default settings for actions using the digital pen. For more information on Tablet PC functionality, refer to the Tablet PC documentation. Control Alt Delete Control Alt Delete combination is accessed by pressing the power button twice. Power Down The tablet PC may be powered down by pressing and holding the power button. Mouse Digital Pen Point Point Click Tap Double-click Double-tap Right-click Tap and hold Click and drag Drag 609. Appendix I Keyboard Shortcuts for InTouch 610. I-2 Appendix I – Keyboard Shortcuts for InTouch Wonderware Training Introduction In order to create a more efficient work environment, InTouch allows several time saving keyboard shortcuts to execute commands. This eliminates the need for extra mouse movements for some common actions. Shortcut Command F2 Select All Ctrl + A Animation Links Ctrl + E Substitute Tags Ctrl + L Substitute Strings Ctrl + T Tagname Dictionary Ctrl + W Window Properties Ctrl + N New Window Ctrl + O Open Window Ctrl + S Save Window Ctrl + Plus Enlarge Font Ctrl + Minus Reduce Font Ctrl + Z Undo Ctrl + Y Redo Ctrl + D Duplicate Ctrl + X Cut Ctrl + C Copy Ctrl + V Paste Del Erase Shift + Plus Enlarge Radius (Rounded Rectangle) Shift + Minus Reduce Radius (Rounded Rectangle) Ctrl + R Reshape Object (Polygon) F9 Send to Back Shift + F9 Bring to Front Ctrl + H Space Horizontal F6 Rotate CW Shift + F6 Rotate CCW F7 Flip Horizontal Shift + F7 Flip Vertical F5 Make Symbol Shift + F5 Break Symbol F3 Make Cell Shift + F3 Break Cell