Agilent VEE Pro VEE Pro User’s Guide Agilent Technologies
Notices © Agilent Technologies, Inc. 2003 Warranty No part of this manual may be reproduced in any form or by any means (including electronic storage and retrieval or translation into a foreign language) without prior agreement and written consent from Agilent Technologies, Inc. as governed by United States and international copyright laws. The material contained in this document is provided “as is,” and is subject to being changed, without notice, in future editions.
VEE Pro User’s Guide VEE Pro User’s Guide Conventions Used in This Manual 4 VEE User’s Guide 3
VEE Pro User’s Guide Conventions Used in This Manual This manual uses the following typographical conventions: Table 1 4 Getting Started Italicized text is used for emphasis. File Computer font represents text that you will see on the screen in Figures, including menu names, features, and buttons. dir filename In this context, the text in computer font represents an argument that you type exactly as shown, and the italicized text represents an argument that you must replace with an actual value.
Table of Contents VEE Pro User’s Guide Conventions Used in This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv Introduction Introduction .......................................................................... 2 Overview of Agilent VEE ............................................................... Advantages of Using Agilent VEE for Test Development ................................. Creating Operator Interfaces in Agilent VEE .
The Mouse and the Menus ......................................................... Starting Agilent VEE ............................................................... The Agilent VEE Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 23 23 25 Working with Objects . . . . . . . .
Changing Object Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Printing the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Saving a Program ................................................................. Exiting (Quitting) Agilent VEE ....................................................... Re-Starting Agilent VEE and Running a Program . . . .
Using the Alphanumeric Displays for Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Resolving Errors ................................................................. Using the Go To Button to Locate an Error ........................................... Using the Call Stack ......................................................
Moving to Other Panels on the Same Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Deleting Data Input or Output Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Using Direct I/O ....................................................................
Using an Agilent VEE Function in the Formula Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Using MATLAB Script in Agilent VEE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Including a MATLAB Script Object in Agilent VEE . . . . . . . . . . . . . . . . . . . . . . . . . .
Building a Record ................................................................ Getting a Field From a Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting a Field in a Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Unbuilding a Record in a Single Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 7 Using .NET with VEE Using .NET with VEE What is .NET? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 VEE and the .
Shared or Static Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Instance Member . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Chapter Checklist 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lab 9-3: Importing and Deleting Libraries Finding Functions in Large Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 Merging Agilent VEE Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 Lab 9-4: Merging a Bar Chart Display Program . . . . . . . . . . . . . . . . . . . . . . .
Key Points Concerning Operator Interfaces ............................................. Creating an Operator Interface ..................................................... Moving Between Panel View and Detail View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customizing an Operator Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 400 401 401 Using Operator Interface Objects . . . . . . . . . . . . . . . .
Other Ways to Optimize Agilent VEE Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 Overview of Compiled Functions ...................................................... Benefits of Using Compiled Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Design Considerations in Using Compiled Functions .................................. Guidelines in Using Compiled Functions . . . . . . . . . . . . . . . . . . . . . .
Restricting Access to Programs Viewed over the Web Chapter Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Appendix A: Additional Lab Exercises Additional Lab Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 General Programming Techniques ...........
14 VEE User’s Guide
Table of Figures Figure 1. The VEE Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 2. The VEE Welcome Screen in Help ........................................... Figure 3. Using the Help Menu ...................................................... Figure 4. VEE Help Contents Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 5. Adding Objects to the Work Area . . . . . . . . . .
Figure 31. The Save File Dialog Box (PC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Figure 32. The Run button on the Tool Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Figure 33. Multiple windows in the Work Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Figure 34. Typical simple-program.vee Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Figure 64. Clear Breakpoint(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 65. Pause or Stop a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 66. Example Runtime Error Message using Go To ............................... Figure 67. Using the Call Stack in Wheel.exe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 68.
Figure 97. Direct I/O Configured to Read a Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 98. Learn String Configuration for HP54100A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 99. Amplicon Data Acquisition Example ....................................... Figure 100. VEE Using a ComputerBoards 100 KHz Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 101. Importing the ComputerBoards I/O Library .....................
Figure 130. The TIME STAMP I/O Transaction Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 131. Storing Data Using the To File Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 132. Selecting String Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 133. Retrieving Data Using the From File Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 134.
Figure 163. The MS Word Document Created by Lab 6-3 ............................... Figure 164. Import Namespaces Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 165. Function & Object Browser - .NET Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 166. Creating a .NET Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 167.
Figure 196. The ReportDisplay Panel View ........................................... Figure 197. The RepGen.vee Library of UserFunctions ................................. Figure 198. Selecting a Function from an Imported Library ............................. Figure 199. Calling a Function from a Library ......................................... Figure 200. The Find Dialog Box .................................................... Figure 201. The Find Results Dialog Box ........................................
Figure 229. The List Selection Box .................................................. Figure 230. A Pop-Up File Selection Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 231. Switches and Alarms Combined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 232. Configuring Panel Properties ............................................ Figure 233. A Softkey Executing a UserFunction ......................................
Figure 262. Changing the Execution Mode in Default Preferences . . . . . . . . . . . . . . . . . . . . . . . Figure 263. Chaos.vee in VEE 3 Mode with Open Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 264. Chaos.vee in VEE 3 Mode with Closed Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 265. Chaos.vee in VEE 4 or Higher Mode with Debugging Disabled . . . . . . . . . . . . . . . . Figure 266. Iterative Math Example in VEE 3 Mode . . . . . . . . . . .
Figure 295. User Functions, Step 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 296. User Functions, Step 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figure 297. Importing and Deleting Libraries ......................................... Figure 298. UserObject to Ask Operator to Input A and B .............................. Figure 299. Panel for Operator to Enter A and B . . . . . . . . . .
Introduction Overview of Agilent VEE 3 Installing and Learning About Agilent VEE 11 MATLAB Script Overview 14 Obtaining Agilent VEE Support 16 Sources of Additional Information for MATLAB 17 VEE Pro User’s Guide 1
Introduction Introduction This chapter introduces Agilent VEE and its major features. You also learn how to install and learn about VEE, and how to obtain VEE support.
Introduction Overview of Agilent VEE Agilent VEE is a graphical programming language optimized for building test and measurement applications, and programs with operator interfaces. This release (version 7.0) of the Agilent VEE product is for groups of engineers that need to create complex test and measurement systems. Advantages of Using Agilent VEE for Test Development VEE offers many advantages in test development: • Increase your productivity dramatically.
Introduction VEE programs are created by selecting objects from menus and connecting them together. The result in VEE resembles a data flow diagram, which is easier to use and understand than traditional lines of code. There is no laborious edit- compile- link- execute cycle using VEE. The following two figures compare a simple function programmed first in a textual language (ANSI C) and then in VEE.
Introduction /* Program to find maximum element in array */ #include main( ) { double num[10],max; int i; for (i=0;i<10;i++){ num[i]=(double) rand( )/pow(2.0,15.0); printf("%f/n",num[i]; } max=num[0]; for {i=1;i<10;i++){ if (num[i]>max)max=num[i]; } printf("/nmax; %f/n",max); } Figure I-1. The “Random” Program in ANSI C Figure I- 2 shows the same program in VEE.
Introduction Figure I-2. The Same “Random” Program in VEE In VEE, the program is built with program elements called objects. Objects are the building blocks of a VEE program. They perform various functions such as I/O operations, analysis, and display. When you view the objects with all of their connections, as shown in Figure I- 2, this is called the detail view. The detail view is analogous to source code in a textual language.
Introduction Using VEE, with its modular programming approach, you can reduce the time it takes to create programs that control instruments, create customized data displays, and develop operator interfaces. This method of test development leads to productivity gains much greater than conventional techniques. NOTE In Figure I-2, some objects are displayed in detail, and some are displayed with only the name showing. The objects that are displayed in detail are shown in open view.
Introduction Figure I-3. Panel View (or Operator Interface) of VEE Program With VEE, you can perform certain tasks in minutes that might take days in a textual language. • Create colorful, intuitive front ends to programs. • Create operator interfaces that can be used with a keyboard and mouse, or keyboard input only. • Choose from a wide assortment of user input and data display features. • Use pop- up panels to create focus and conserve screen space. • Secure programs from unwanted tampering.
Introduction Leveraging Existing Test Programs with Agilent VEE On all supported operating systems, VEE provides mechanisms for linking conventional test programs as well as commercial applications. For example, you could use VEE to sequence existing tests in C, C++, Visual Basic, Fortran, or Pascal (or any compiled or interpreted language on your operating system). You can also use any language that truly supports Visual Studio .NET.
Introduction • Reduced development and maintenance time with graphical programming. • Integration with conventional languages like C, C++, Visual Basic, Pascal, and Fortran. • Convenient and flexible operator interface capabilities. • Support for most popular test platforms. • Use of ActiveX Automation and Controls. • Agilent Technologies’ excellent array of support options. • Easy and powerful documentation tools. • Ease of porting test data to standard spreadsheets and word processors for reports.
Introduction Installing and Learning About Agilent VEE This section gives guidelines to install and learn about VEE, including installing VEE, learning about VEE, using VEE, and obtaining VEE support. Installing Agilent VEE and I/O Libraries You can download or order an evaluation version of VEE. It is a fully functional version of the product. When you install it, you are prompted for a product key, enter “eval” without the quotes.
Introduction For information about the I/O Libraries, refer to the installation materials you received with it. (The I/O Libraries are used by VEE to communicate with instruments.) Installing and Distributing VEE Pro RunTime (in online Help) shows how to install and distribute the RunTime version of VEE Pro. The RunTime version is used to run VEE programs on PCs that do not have the VEE software installed. For more information about the runtime environment, refer to online Help.
Introduction NOTE The VEE programs for many of the lab exercises and programming examples in this manual are included in VEE, under Help ⇒ Open Example... ⇒ Manual ⇒ UsersGuide. Ordering Free Evaluation Software Free evaluation software is available on a CD or by downloading from the VEE website. To order the Agilent Technologies VEE Evaluation Kit CD contact Agilent Technologies offices worldwide at: http://www.agilent.
Introduction MATLAB Script Overview MATLAB® Script is a subset of the standard, full- featured MATLAB from The MathWorks. It gives users direct access to the core set of MATLAB functionality, such as advanced mathematics, data analysis, and scientific and engineering graphics. The MATLAB Script object can be easily included in any Agilent VEE program.
Introduction About Full-Featured MATLAB MATLAB is an integrated technical computing environment that combines numeric computation, advanced graphics and visualization, and a high- level programming language.
Introduction Obtaining Agilent VEE Support You can obtain VEE support via the Web or by telephone (for startup assistance). Obtaining Information on the World Wide Web The VEE website offers a variety of information, including application notes, user tips, technical information, and information about VEE partners, such as PC plug- in board vendors. • Main VEE Website: http://www.agilent.com/find/vee.
Introduction Sources of Additional Information for MATLAB For complete, detailed information on using the MATLAB Script object, refer to the MATLAB Script Help Desk. In VEE, select Help ⇒ MATLAB Script ⇒ Help Desk. The MATLAB Help Desk will appear in a Web browser. For further information about MATLAB, MATLAB Toolboxes, and other products from The MathWorks, visit www.mathworks.com or call 508- 647- 7000. Other sources of information include: • Complete MATLAB documentation: www.mathworks.
Introduction 18 VEE Pro User’s Guide
Using the Agilent VEE Development Environment 1 1 Using the Agilent VEE Development Environment Overview 21 Interacting with Agilent VEE 22 Working with Objects 29 Understanding Pins and Terminals 46 Connecting Objects to Make a Program 52 How Agilent VEE Programs Work 65 Chapter Checklist 72 VEE User’s Guide 19
1 Using the Agilent VEE Development Environment Chapter Using the Agilent VEE Development Environment In this chapter you will learn about: • Supported systems • How to use the Help system • Starting VEE • The VEE window • Working with objects • Managing the workspace • Selecting menu items • Pins and terminals on VEE objects • Connecting objects to make programs • Creating, running, printing, saving, and opening programs • How VEE programs work Average time to complete: 1.
Using the Agilent VEE Development Environment Chapter 1 Overview In this chapter, you will learn how to start VEE, how to use menus, and how to work with objects. You will learn about pins and terminals in VEE. You will connect objects together to build a simple VEE program, and learn how VEE programs work.
1 Using the Agilent VEE Development Environment Chapter Interacting with Agilent VEE This section explains how to use the VEE graphical programming language, including a list of systems supported, how the mouse and menus work, how to get help, how to start VEE, and how to work in the VEE window. Supported Systems This version of VEE is supported on the following operating systems: • Windows 98, Windows 2000, Windows NT 4.0, and Windows XP on a PC.
Using the Agilent VEE Development Environment Chapter 1 Starting Agilent VEE Click Start ⇒ Programs ⇒ Agilent VEE Pro The Agilent VEE Window After you have installed and started VEE, you will see the VEE window shown in Figure 1 Title Bar Menu Bar Tool Bar Properties Work Area Status Bar Figure 1 The VEE Development Environment These items describe the parts of the VEE window.
1 Using the Agilent VEE Development Environment Chapter Table 1 Descriptors for the VEE Window Screen Descriptors Description Title bar The top line in the window contains the VEE icon, the window name, and the minimize, maximize, and close buttons. Move the window by dragging the title bar. Click the VEE icon to get the window’s menu. Menu bar The second line contains menu items, each of which provides VEE commands or objects.
1 Using the Agilent VEE Development Environment Chapter Getting Help VEE provides an online Help system for the VEE environment, and online Help for individual objects and topics. In addition, you can get help in the documentation that came with the computer and its operating system.
1 Using the Agilent VEE Development Environment Chapter VEE online Help is designed for your operating system. Click Help and the menu shown in Figure 3 appears. Help includes contents and index, the Welcome menu (where the Tutorials are located), instrument drivers, Web site information, examples, and version number.
1 Using the Agilent VEE Development Environment Chapter Figure 4 VEE Help Contents Tab The Help Contents tab contains the following topics. Table 2 VEE User’s Guide What’s New in VEE Definition How Do I... Provides “how to” information for common tasks.
1 Using the Agilent VEE Development Environment Chapter Table 2 NOTE What’s New in VEE Definition Tell Me About... Explains VEE concepts. Guide to Agilent VEE Example Programs Summarizes example programs shipped with VEE. Reference Provides reference information for all functions and objects. About Agilent VEE Support Provides information about getting support for VEE. Installing and Distributing Agilent VEE Pro Runtime Explains how to distribute the VEE Pro RunTime environment.
1 Using the Agilent VEE Development Environment Chapter Working with Objects A VEE program consists of connected objects. To create a program, select objects from VEE menus, such as Flow, Data, and Display. Connect the objects via lines that attach to the object pins. (For more information about pins, refer to “Understanding Pins and Terminals" on page 46.). Create a program with a group of connected objects. This section describes how to select and use objects in a program. 1 Start VEE.
1 Using the Agilent VEE Development Environment Chapter Figure 5 Adding Objects to the Work Area An outline of the object appears in the work area. 2 Move the Function Generator to the center of the work area, and click to place the object. The Function Generator appears as shown in Figure 6.
Using the Agilent VEE Development Environment Chapter Figure 6 1 Adding a Function Generator Object Having placed an object in the work area, you can move the object by dragging its title bar, just as you move a window. NOTE NOTE Throughout the rest of this manual, a shorthand notation is used to explain instructions.
1 Using the Agilent VEE Development Environment Chapter Minimize button Open View Figure 7 Icon View Object in Open View and Icon View The iconic view conserves space in the work area and makes programs more readable. The open view provides more detail and allows you to edit the properties and settings of an object. 1 To switch from an open to iconic view, click the Minimize button (the box on the right end of the object's title bar).
Using the Agilent VEE Development Environment Chapter 1 Selecting an Object Menu Each VEE object has an object menu that lets you perform actions on the object, such as Clone, Size, Move, and Minimize. Most objects have similar attributes, but there are differences, depending on the functionality of the object. See online help for the specific object from the object menu. 1 To select the object menu, click once on the object menu button. (All object menus open the same way.
1 Using the Agilent VEE Development Environment Chapter Moving an Object 1 To move the Function Generator object, click Move in the object menu, then click and hold the left mouse button. An outline of the object appears. 2 Move the outline to the new location while continuing to hold the mouse button down, as shown in Figure 9. Release the mouse button, and the object moves to the new location.
Using the Agilent VEE Development Environment Chapter NOTE 1 “Object Location Information, located on the status bar (at the bottom of the VEE window) gives the X and Y position (in pixels) of the upper-left corner of the outline relative to the upper-left corner of the workspace. To view an object’s exact location, left click on an object to select it and hold the left mouse button down. The location is displayed in the status bar.
1 Using the Agilent VEE Development Environment Chapter Copying an Object This action copies an object to the clipboard, so you could Paste it to VEE or another application such as MS Paint or MS Word. Click on an object to highlight it, then click Edit ⇒ Copy. - ORClick on an object to highlight it, then press Ctrl-C. Deleting an Object To delete an object from the work area, go to the object menu for the object you want to delete and click Delete.
Using the Agilent VEE Development Environment Chapter 1 After an object has been copied or deleted, click Edit ⇒ Paste. An outline of the object appears. Place the object and click to release it. - ORPress Ctrl-V. Changing the Size of an Object Place the mouse pointer over any of the four corners of the object until you see a sizing arrow, then click- and- drag to the desired size. Release to resize. Figure 11 shows an object being resized with the sizing arrow. - OROpen the object menu and click Size.
1 Using the Agilent VEE Development Environment Chapter Changing the Name (Title) of an Object 1 Open the object menu and select Properties... A Properties window appears on the left side of your screen. Select the Title property and change the property value to whatever you would like, in Figure 12. 2 The new title appears in the title area. If you minimize the object, the new title appears in the icon. - ORDouble- click the object title bar to go directly to the Properties dialog box.
Using the Agilent VEE Development Environment Chapter 1 Selecting or Deselecting Objects 1 To select an object, click on the object and a shadow appears behind it. For example, in Figure 13, the For Count object is selected. 2 To deselect an object, move the mouse pointer over any open area and click. The shadow disappears. For example, in Figure 13, the Formula object is not selected.
1 Using the Agilent VEE Development Environment Chapter Selecting/Deselecting All Objects 1 To select all objects, click Edit ⇒ Select All. (Or press Ctrl-A.) 2 To deselect all objects, click on an open area in the window. Copying Multiple Objects Copy the selected objects by placing the cursor on an object. Press and hold Ctrl while using the left mouse button to drag the multiple objects (outlines) to a desired location. A new instance of each object appears in the desired location.
Using the Agilent VEE Development Environment Chapter 1 Editing Objects There are several ways to edit objects in VEE. Different editing menus display different choices. Choose an editing menu or icon as follows: Click Edit on the VEE menu bar to display the Edit menu, and select the operation you want. The commands in the Edit menu are the same for all of VEE. - ORClick on an icon on the VEE toolbar. The VEE toolbar contains icons for frequently used editing commands such as Cut, Copy, and Paste.
1 Using the Agilent VEE Development Environment Chapter Figure 15. (A line appears behind the pointer as you move from one pin to the other.) 2 Release the cursor and VEE draws a line between the two objects. Notice that if you reposition the objects, VEE maintains the line between them. NOTE For more information on pins, see “Understanding Pins and Terminals" on page 46.
Using the Agilent VEE Development Environment Chapter 1 Moving the Entire Work Area (Make sure there is at least one icon in the work area.) Place the mouse pointer anywhere on the background of the work area, press and hold the left mouse button, and move the work area in any direction. NOTE Scroll bars appear if your program is larger than the work area, as shown in Figure 16. NOTE If you click near a terminal, a line or “wire” may appear.
1 Using the Agilent VEE Development Environment Chapter Clearing the Work Area Click Edit ⇒ Select All and then click the Cut button on the toolbar. This cuts all objects in the active window to the Cut buffer. - ORSelect File ⇒ New, or click the New button on the toolbar. VEE asks you if you want to save changes. - ORClear individual objects by clicking an object to make it active, and then clicking the Cut button on the toolbar.
1 Using the Agilent VEE Development Environment Chapter Figure 17 Default Preferences Dialog Box This dialog box has tabs that let you select options to edit. Table 3 Description of the Default Preferences Dialog Tabs Tab Name Description General The default tab when the Default Preferences dialog box appears (shown previously). You can change the values of the displayed parameters; for example, Environment and Execution Mode. Colors Lets you customize the colors in the VEE environment.
1 Using the Agilent VEE Development Environment Chapter Understanding Pins and Terminals A VEE program consists of the objects in the work area and the lines that connect them. The lines that connect VEE objects are connected between object pins. Each object has several pins, as shown in Figure 18. Figure 18 uses the Formula object as an example. You can use any object. . Sequence Input Pin Data Input Pin Data Output Pin Sequence Output Pin Figure 18 Data and Sequence Pins Table 4 Pin Type .
Using the Agilent VEE Development Environment Chapter NOTE 1 For more information, refer to “Following the Order of Events Inside an Object" on page 109. In an object’s open view, the data input and output pins appear as input and output terminals. (If the object is in icon view, double- click it to switch to open view.) The terminals carry detailed information such as the name of the terminal, and the type and value of the data being transmitted.
1 Using the Agilent VEE Development Environment Chapter Figure 20 Setting the ShowTerminals Property Select the property and set ShowTerminals to False. Select the property again and set ShowTerminals to True. Adding a Terminal You can add terminals to an object. For example, you can add a second data input terminal to the Formula object. Open the object menu and select Add Terminal ⇒ Data Input.
Using the Agilent VEE Development Environment Chapter Figure 21 1 Adding a Terminal Editing Terminal Information To obtain information about a terminal, double- click the label area. For example, double- clicking B causes the dialog box in Figure 22 to appear.
1 Using the Agilent VEE Development Environment Chapter You can now edit the terminal. The dialog box has three kinds of fields: Table 5 Field Type Description entry field A field with a white background, but no arrow. It becomes a type-in field when you click it. For example, you can click B in the Name field and rename the terminal. status field A field with a gray background that cannot be edited. For example, the Mode field cannot be edited.
Using the Agilent VEE Development Environment Chapter 1 Required Shape fields set to Any. For more information, select Help ⇒ Contents and Index from the VEE menu bar. Then, browse How Do I..., Tell Me About..., or Reference. Deleting a Terminal Open the object menu and select Delete Terminal ⇒ Input... or Delete Terminal ⇒ Output, choose the input or output to delete, and click OK. For example, Figure 24 shows the dialog box that appears when you choose Delete Terminal ⇒ Input....
1 Using the Agilent VEE Development Environment Chapter Connecting Objects to Make a Program This section introduces VEE programs. In Lab 1- 1, you will create a VEE program, print the VEE screen, and save the program to a file. Lab 1-1 Display Waveform Program A VEE program consists of VEE objects connected in an executable object diagram. The following program displays a waveform. (If VEE is running, clear the workspace by clicking the New button on the toolbar, or use File ⇒ New.
Using the Agilent VEE Development Environment Chapter Figure 25 1 Creating a Program In Figure 25, the Func label on the Function Generator object denotes a data output pin, and the Trace1 label on the Waveform(Time) object denotes a data input pin. In VEE programs, you connect the data pins among the objects, and this determines the flow of the program.
1 Using the Agilent VEE Development Environment Chapter Try (Do line two moving one of the objects by dragging on its title bar. not drag a pin or terminal, or a line will appear.) The automatically reroutes to the logical path between the objects. If the lines appear to be scrambled, use Edit ⇒ Clean Up Lines to reroute the lines in the program. Running a Program 5 Continuing with the same exercise, click the Run button on the toolbar to run the program, or use Debug ⇒ Run.
1 Using the Agilent VEE Development Environment Chapter Resume button (same as the Run button) to resume. You can use the Step Into button on the toolbar to run a program one object at a time. When instructed to run the program, click the Run button on the toolbar, or press Ctrl+G.
1 Using the Agilent VEE Development Environment Chapter Figure 27 Changing the Function Field to Sine Wave Some fields in dialog boxes do not have arrows. These are entry fields, which become type- in fields when you click them. Just click a field and a cursor appears. You can use standard keyboard and mouse editing techniques to move the cursor and enter a desired value.
Using the Agilent VEE Development Environment Chapter Figure 28 1 Highlighting a Frequency Field Number 8 Press Delete to delete the last 0, changing the Frequency value to 10. Run the program. It should look like Figure 29. Figure 29 Example: Changing the Frequency Field to 10 Hz The displayed waveform is now a 10 Hz sine wave.
1 Using the Agilent VEE Development Environment Chapter • Click Deg (or the arrow) in the Function Generator object and change the phase units to Rad. Next, click the Phase value field and enter the value PI. Run the program and note the phase shift in the displayed waveform. Then, change the Phase value back to 0 and the units back to Deg. • The y- axis limits of the Waveform (Time) object are preset to - 1 through 1. Click the y- axis name Mag to open a dialog that lets you change the settings.
Using the Agilent VEE Development Environment Chapter 1 When you click OK, VEE prints the screen on the default printer named in the dialog box. You can select another printer, change the print range, and enter the number of copies. Click the Properties button for more selections. Different print drivers may use different dialog boxes. For further information about using Windows dialog boxes, see Microsoft Windows Help.
1 Using the Agilent VEE Development Environment Chapter 11 By default, VEE for Windows saves files in the VEE Programs sub- directory in your My Document directory. To save the current program, type in the name simple-program in the File name field and click Save. If you do not type it in, VEE automatically adds the .vee extension to the file name. NOTE You can use the long file names allowed by Windows 98, Windows 2000, Windows NT 4.0, and Windows XP.
1 Using the Agilent VEE Development Environment Chapter Table 7 File Save Options File Save Option Description Save I/O (Optional) If you have configured an instrument in the configuration with Instrument Manager, and you want others who load the program program to get the instruments you configured rather than their defaults, it is recommended that you check this item. When checked, VEE saves the I/O configuration as part of the program.
1 Using the Agilent VEE Development Environment Chapter Re-Starting Agilent VEE and Running a Program 1 Click Start ⇒ Programs ⇒ Agilent VEE Pro 2 Select File ⇒ Open and complete the Open File dialog box. The format is the same as for the Save File dialog box. Note that the default directory for user programs is the VEE_USER directory, unless you specified something else during installation. VEE opens the program in the Main window. 3 Click the Run button.
Using the Agilent VEE Development Environment Chapter 1 UserObjects and UserFunctions as subroutines or subprograms to the main program. UserObjects and UserFunctions are discussed in more detail in the section “Lab 2- 1: Creating a UserObject" on page 76 in Chapter , “Agilent VEE Programming Techniques.”) They are mentioned here to show how VEE helps you manage programs that have multiple windows. Figure 33 shows a program with four windows.
1 Using the Agilent VEE Development Environment Chapter As Figure 33 shows, the Program Explorer lists the hierarchy of the program. This built- in modular structure allows easy access to all parts of the program. If the Program Explorer is not displayed, click View ⇒ Program Explorer. The default is for Program Explorer to appear. If you remove the check and click the Save button in File ⇒ Default Preferences, the Program Explorer does not appear the next time you start VEE.
Using the Agilent VEE Development Environment Chapter 1 How Agilent VEE Programs Work In VEE, the general flow of execution through a program is called propagation. Propagation through a program is not determined by the geographic locations of the objects in the program, but rather by the way the objects are connected. Propagation is primarily determined by data flow, which, in turn, is determined by how the data input and output pins of the objects are connected.
1 Using the Agilent VEE Development Environment Chapter Lab 1-2: Viewing Data Flow and Propagation To see how data flow works, open the program you created earlier. Open the program simple-program.vee by clicking the Open button on the toolbar. (The program simple-program.vee is described in the section called “Lab 1- 1 Display Waveform Program" on page 52.) Now run the program. It should appear as shown in Figure 34, although you may have different values for parameters.
1 Using the Agilent VEE Development Environment Chapter Figure 35 NOTE Example: Adding a Noise Generator Object The VEE programs for many of the lab exercises and programming examples in this manual are included in VEE, under Help ⇒ Open Example... ⇒ Manual ⇒ UsersGuide. 1 Delete the line connecting the Function Generator and Waveform (Time) objects in the original program. Click the Delete Line button on the toolbar and then click the line. Or, press and hold Shift+Ctrl and click the line.
1 Using the Agilent VEE Development Environment Chapter Figure 36 Function and Object Browser 1 Connect the input and output pins as shown in Figure 37. 2 Run the program. Notice that the A+B object does not execute until the Function Generator and the Noise Generator objects execute. However, it does not matter whether the Function Generator or the Noise Generator executes first, because the result is the same.
Using the Agilent VEE Development Environment Chapter 1 To see the order of execution, turn on the Debug commands Show Execution Flow and Show Data Flow, or click their respective buttons on the toolbar. Run the program again. Each object highlights when it executes and a small, square marker moves down the lines to show data flow. NOTE Show Execution Flow and Show Data Flow can be enabled together or individually by clicking their toolbar buttons or their commands in the Debug menu.
1 Using the Agilent VEE Development Environment Chapter 3 Add a Real64 Slider object (Data ⇒ Continuous ⇒ Real64 Slider) and connect its data output pin to the Amplitude terminal, as shown in Figure 38. Run the program. Figure 38 Example: Adding a Real64 Slider Object Try changing the amplitude of the noise, by dragging the slide control on the Real64 Slider object. The amplitude of the noise does not change until you run the program.
Using the Agilent VEE Development Environment Chapter NOTE 1 You can display the value of an output by using the mouse to hover over the line. For example, hovering over the line from the Real64 Slider object to the Noise Generator displays a value of 0.401. Notice that the value on the line (0.401) matches the value shown on the Real64 Slider, as shown in Figure 39. (Note that the objects are shown in iconized view.
1 Using the Agilent VEE Development Environment Chapter Chapter Checklist You should now be able to do any of the following tasks. Review topics as needed, before going on to the next chapter. • Look up on- line help documentation from the main menu bar and from the object menus. • Start VEE. • Identify the main menu bar, toolbar buttons, work area, and status bar. • Explain the Program Explorer and its purpose. • Select menu items from the main menu and object menus.
Agilent VEE Programming Techniques Chapter 2 2 Agilent VEE Programming Techniques Overview 75 General Techniques 76 Using Online Help 97 Debugging Programs in Agilent VEE 100 Practice Programs 115 Documenting Agilent VEE Programs 119 Chapter Checklist 125 VEE User’s Guide 73
2 Agilent VEE Programming Techniques Chapter Agilent VEE Programming Techniques In this chapter you will learn about: • Creating a UserObject • Adding a dialog box for user input • Using data files • Creating panel views (an operator interface) • Mathematically processing data • Communicating with instruments • Documenting a program • Using debugging tools Average time to complete: 2 hours 74 VEE User’s Guide
Agilent VEE Programming Techniques Chapter 2 Overview In this chapter, you will learn selected VEE programming techniques to help you build your own programs. For example, VEE allows you to create customized objects called UserObjects. You can also create interfaces for operators to use that show only the necessary parts of the program. These are displayed in the Panel view of the program. You can write data from VEE to a file, and read data from a file into VEE.
2 Agilent VEE Programming Techniques Chapter General Techniques Inside the Main VEE program, you can create logical groups of objects, called UserObjects. A UserObject object (called UserObject hereafter) is created by placing a logical group of objects in a UserObject window. Inside the UserObject window, you connect inputs and outputs in the same way as the main program. The UserObject itself is connected to other objects in the main program with inputs and outputs, like any other object.
2 Agilent VEE Programming Techniques Chapter Figure 40 UserObject Window Once you have created a UserObject, it is part of the main program. The UserObject window can be displayed as an icon, in open view, or minimized at the bottom of the screen as follows: • Close the window by clicking the close button, and the UserObject is displayed as an icon in the main window.
2 Agilent VEE Programming Techniques Chapter NOTE Before you begin, make sure Program Explorer in the View menu is deselected to give yourself more screen space in Main Now, you will create a UserObject for a program. 1 Open the program (simple-program.vee) you created in “Lab 1- 4: Adding an Amplitude Input and Real64 Slider" on page 69. The program should appear in the main work area. 2 Remove the Real64 Slider from the program. (It is not used in this exercise.
2 Agilent VEE Programming Techniques Chapter Figure 41 usrobj-program.vee at an Early Stage 6 Select the Noise Generator and A+B objects, using the shortcut Ctrl+left mouse button. Click Edit ⇒ Create UserObject. A dialog box appears labeled Create UserObject. (You could rename the object by typing in a new name if you wish. For now, click OK to create the UserObject.
2 Agilent VEE Programming Techniques Chapter Figure 42 NOTE 80 Creating a UserObject Rearranging the positions of the objects before executing Create UserObject is one of convenience. If you do not collect the objects to be included into one area, the UserObject will size itself to encompass all the selected objects. You can then rearrange and resize the work area of the UserObject and move the UserObject to an appropriate place in the work area.
2 Agilent VEE Programming Techniques Chapter NOTE You can use Edit ⇒ Clean Up Lines to clean up the line routing within a program. This command is context dependent. To clean up the lines for the UserObject, it must be the active window. Click the UserObject window, then, use Edit ⇒ Clean Up Lines. Creating a UserObject in its edit window and then using the icon view of the UserObject lets you save screen space. 7 To help you keep track of the UserObject, change the title from UserObject to AddNoise.
2 Agilent VEE Programming Techniques Chapter Figure 43 UserObject Renamed AddNoise 8 Click the Run button to display the noisy cosine wave as shown in Figure 44. Note that AddNoise is minimized, and appears in icon form at the bottom of the work space. To minimize AddNoise, click on the minimize button in its title bar, shown as the underline symbol (_). Figure 44 Noisy Cosine Wave The key to effective UserObjects is to make sure they serve a logical purpose within the program.
Agilent VEE Programming Techniques Chapter 2 You will continue with this example in the following section. However, if you want to quit now, save the program as usrobj-program3.vee. Lab 2-2: Creating a Dialog Box for User Input If it is not already open, open the program usrobj-program3.vee. In the Data ⇒ Dialog Box submenu are six choices for dialog: Text Input, Int32 Input, and Real64 Input, as well as Message Box, List Box, and File Name Selection boxes.
2 Agilent VEE Programming Techniques Chapter 3 Open the Object Menu for the Function Generator, and choose Add Terminal ⇒ Data Input. In the dialog box for Select input to add, choose Frequency and click OK. 4 Connect the top output pin of the Int32 Input object to the input pin on the Function Generator. Notice that Frequency can only be changed through the input pin now, and you can no longer edit the Frequency input field. The program should look like Figure 46.
Agilent VEE Programming Techniques Chapter Figure 47 2 Runtime Pop-Up Input Box You will get an error message box if you enter frequencies above 193. Notice that you get the exact error message that you configured. You will continue with this example in the following section. However, if you want to quit now, save the program as usrobj1-program4.vee. NOTE The VEE programs for many of the lab exercises and programming examples in this manual are included in VEE, under Help ⇒ Open Example...
2 Agilent VEE Programming Techniques Chapter If it is not already open, open the program usrobj-program4.vee. 1 Select I/O ⇒ To ⇒ File and place it in the Main work area. 2 Change the default filename, myFile, to wavedata. If there is no check mark to the left of Clear File At PreRun & Open, then click on the small input box. To File defaults to appending data to the existing file. In this case, however, you want to clear the file each time you run the program.
Agilent VEE Programming Techniques Chapter Figure 49 2 Choosing an I/O Transaction 4 Connect the data output pin of the AddNoise UserObject to the data input pin of To File. The program should now look like Figure 50. NOTE VEE User’s Guide You can connect one data output pin to several data input pins.
2 Agilent VEE Programming Techniques Chapter Figure 50 Adding a To File Object 5 Click the Run button on the tool bar again to test the program. The program now displays the noisy cosine wave output by the AddNoise UserObject and writes a container of waveform data to the file wavedata. Double- click the To File object to get the open view, then double- click the input terminal a to examine its contents. You should see an array of 256 points. Add a From File object to the program to read the data back.
Agilent VEE Programming Techniques Chapter 2 AddNoise and the Waveform (Time) object, and connect the objects as shown in Figure 51. The sequence line between To File and From File ensures the data is written to the file before it is read. 7 Run the program. It should look similar to Figure 51. Save the program as usrobj-program.vee.
2 Agilent VEE Programming Techniques Chapter Lab 2-4: Creating a Panel View (Operator Interface) After you develop a program, you may want to create an operator interface. To do so, create a panel view of the program. This exercise uses the program you created in “Lab 1- 2: Viewing Data Flow and Propagation" on page 66. 1 Open the program simple-program.vee. The program should look like Figure 52. Figure 52 simple-program.
Agilent VEE Programming Techniques Chapter 2 You can size and move the objects in the panel view to appropriate locations to create a panel similar to the one shown in Figure 53. Figure 53 Example: Creating a Panel View 4 Press the To Detail button in the upper left Main window title bar to go to the detail view. Click the To Panel button to return to the panel view. The detail view is the normal window in which you edit a program.
2 Agilent VEE Programming Techniques Chapter • To change colors on the panel, select Properties from the Main window object menu in panel view. Select the BackColor property, and select the color you want. • To change colors or fonts on any object, just double- click its title bar to get the Properties window. Then click the Colors or Fonts property you wish to change.
2 Agilent VEE Programming Techniques Chapter 4 Add an A+B object. Select Device ⇒ Function & Object Browser to get the Function & Object Browser. Then, select Type: Operators; Category: Arithmetic; Operators: +. Click Create Formula to create the object. 5 Add an AlphaNumeric object by selecting Display ⇒ AlphaNumeric. Connect the objects as shown in Figure 54. Type in the value 1.53 in the data entry field of the Real64 Constant object and the complex value (2,1) in the Complex object.
2 Agilent VEE Programming Techniques Chapter The following program creates a one- dimensional, ten- element array, calculates the median of the 10 values, and then displays the median value. 1 Select File ⇒ New to clear the work area. 2 Add a For Range object, by selecting Flow ⇒ Repeat ⇒ For Range. 3 Add a Sliding Collector object, by selecting Data ⇒ Sliding Collector. 4 Add a median(x) object. Select Device ⇒ Function & Object Browser.
Agilent VEE Programming Techniques Chapter 2 The predefined operator and function objects are available via Device ⇒ Function & Object Browser (or fx on the toolbar). You select them from the Function & Object Browser by clicking entities in three lists: Type:, Category:, and Functions:. Click Create Formula to create the object. Besides using predefined operators and functions, you can create any valid VEE mathematical expression within the Formula object, which is found under the Device menu.
2 Agilent VEE Programming Techniques Chapter Figure 56 Creating a Formula Object Program When you run the program, the Formula object takes the waveform input A and the real value B, and adds B to the absolute value of A. In effect, the expression abs(A)+B “rectifies” the sine wave and adds a “dc offset.” You could have produced the same effect by using the A+B and abs(x) objects, but it is easier to read an expression in a Formula object. (This also saves space.
2 Agilent VEE Programming Techniques Chapter Using Online Help Now that you have created a few simple programs, here are some ways to teach yourself more about VEE. 1 First, run the Multimedia Tutorials located in the Help ⇒ Welcome menu. The tutorials demonstrate many of the main features of VEE. They will help bring you up to speed quickly. The tutorials display screen demonstrations of VEE programs being built and run, and describe what you are seeing.
2 Agilent VEE Programming Techniques Chapter You can browse, use the keyword index, use hyperlinks to related topics, or even do a search. There are many Help features available in VEE that you can use as you develop programs. NOTE VEE also includes other helpful features for developing and debugging programs, such as line probe.
Agilent VEE Programming Techniques Chapter 2 • Select Help ⇒ Contents and Index ⇒ How Do I... ⇒ Use the Keyboard Shortcuts ⇒ Editing Programs ⇒ To Cut an Object or Text. • Look up the word “terminal.” Select Help ⇒ Contents ⇒ Reference ⇒ Glossary ⇒ Terminal. • Look up the VEE version number. Select Help ⇒ About VEE Pro. • Find out what is new in this version of Agilent VEE. Select Help ⇒ Contents and Index ⇒ What’s New in Agilent VEE Pro.
2 Agilent VEE Programming Techniques Chapter Debugging Programs in Agilent VEE This exercise uses the program you created in “Lab 2- 4: Creating a Panel View (Operator Interface)” on page 90. Select File ⇒ Open, highlight simple-program_with_panel.vee, and click OK. VEE displays error messages during development and when a program runs, and can display caution, error, and informational messages as follows: • When you run a program, VEE may display a yellow- titled Caution box.
Agilent VEE Programming Techniques Chapter 2 (To turn it off, click it again.) When you run the program, you will see small squares moving along the data lines to indicate the flow of data. Figure 58 Data Flow in simple-program.vee For example, in Figure 58, data moves from the Real64 Slider to the Noise Generator. The output from the Noise Generator and the Function Generator are input to the A+B object, and the results are displayed in the Waveform (Time) display.
2 Agilent VEE Programming Techniques Chapter Showing Execution Flow 1 Click the Show Execution Flow button on the tool bar as shown in Figure 59. (Or click Debug ⇒ Show Execution Flow.) Show Execution Flow button on toolbar Figure 59 Show Execution Flow When you run the program, you will see a colored outline around the objects as they execute. Use Data Flow and Execution Flow to understand how a program is operating, but turn them off to get higher performance.
Agilent VEE Programming Techniques Chapter 2 For example, Figure 60 shows part of a VEE program with the output displayed from the iconized Function Generator. The output shows the Function Generator generates a 256- point waveform array. Line Tip Figure 60 Displaying the Value on an Output Pin If you click on a data line, a dialog box appears with all the information about the data on the line.
2 Agilent VEE Programming Techniques Chapter Figure 61 Displaying Information about a Line Examining Terminals To examine a terminal, double- click it in the open view as mentioned in “Understanding Pins and Terminals" on page 46. If an object is iconized, place the mouse pointer over the terminal, and VEE automatically pops up the name of the terminal.
2 Agilent VEE Programming Techniques Chapter (either a Scalar or Array 1D) displays consecutive input as a history of previous values. You can also use a Counter to see how many times an object ran. Using Breakpoints A breakpoint causes a program to pause before it executes a particular object. You can set breakpoints in a program to examine the data. When a breakpoint is set on an object, the object is highlighted with an orange colored outline.
2 Agilent VEE Programming Techniques Chapter Resume Button (same as Run Button) Figure 63 Resume Program (same as the Run Button) 4 Now clear breakpoints from the program. Select the objects with breakpoints. Click the Toggle Breakpoint(s) button on the tool bar, shown in Figure 64. You can also select Debug ⇒ Clear All Breakpoints. Toggle Breakpoint Button Figure 64 Clear Breakpoint(s) 5 To pause or stop the program, click the Pause or Stop buttons on the tool bar, shown in Figure 65.
2 Agilent VEE Programming Techniques Chapter Figure 65 Pause or Stop a Program Resolving Errors If you get an error message when you run a program, VEE automatically puts a red outline around the object where the error was found. You can either correct the error and the outline will disappear, or you can click the Stop button, which will remove the red outline, and then fix the error. If you click Stop, you can look at the error again before resuming, with View ⇒ Last Error.
2 Agilent VEE Programming Techniques Chapter Figure 66 Example Runtime Error Message using Go To Using the Call Stack If an error is in the Main program, it may be easy to see. However, in a large program, the Call Stack helps locate errors that are nested several levels deep. 1 Press the Pause button on the tool bar (next to the Run button). 2 Press the Call Stack button on the error dialog box, or select View ⇒ Call Stack. Call Stack lists the hierarchy of the execution of the program.
Agilent VEE Programming Techniques Chapter Figure 67 2 Using the Call Stack in Wheel.exe The Call Stack shows the hierarchy of the execution of the program. Figure 67 shows an example program that is shipped with VEE: the Wheel.exe program in Examples/Games. In Figure 67, the program is currently executing AMovie_Wait_Until_Finished() user function which was called by AMovie_Play_Sound_Sync which was called by ...Next_Puzzle in Main.
2 Agilent VEE Programming Techniques Chapter 1 (if connected) 3 4 2 5 Figure 68 The Order of Events in an Object In Figure 68, the pins operate as follows: Table 9 110 Pin Operation Sequence 1 If the sequence input pin is connected, the object will not operate until it receives a message to execute (a “ping” in VEE terms). However, the sequence input pin does not have to be connected. 2 All data input pins must have data before the object operates.
Agilent VEE Programming Techniques Chapter 2 There are exceptions to this sequence of events: • You can add error output pins to trap errors inside an object. The error output pins override the standard object behavior. If an error occurs when the object executes, the error pin will send out a message and the data output pins will not fire. • You can add control input pins to some objects, and they may cause the object to perform some immediate action.
2 Agilent VEE Programming Techniques Chapter Figure 69 Control Line Used to Execute Custom Title Following the Execution Order of Objects in a Program As a VEE program runs, the objects execute in the following order: 1 Start objects operate first. Figure 70 shows a VEE program with two threads, which are sets of objects connected by solid lines in a VEE program. The Start objects, located under Flow ⇒ Start, are used to operate the individual threads in a program.
2 Agilent VEE Programming Techniques Chapter Stepping Through a Program Stepping through a program is a very effective debugging tool. VEE has functions to Step Into, Step Over, and Step Out of objects. To activate stepping, click the Step Into, Step Over, or Step Out buttons on the tool bar, shown in Figure 71. Step Into Figure 71 Step Over Step Out Step Into, Step Over, and Step Out Buttons on the Toolbar • Step Into executes a program one object at a time.
2 Agilent VEE Programming Techniques Chapter so they execute first in no defined order. If you wanted them to execute in a particular order, you could control this by connecting their sequence pins. Data flows left to right, so you see the data generators executing next in no particular order. The addition (A+B) object cannot execute until both inputs are satisfied. Then the Waveform (Time) object executes.
2 Agilent VEE Programming Techniques Chapter Practice Programs The practice programs in this section illustrate more VEE features. 2-6: Generate a Random Number 1 Document the program: a Select Display ⇒ Note Pad and place it at the top center of the work area. Click on the editing area to get a cursor and remove any template that might be there. Then enter: This program, Random, generates a real number between 0 and 1, then displays the results. 2 Select Device ⇒ Function & Object Browser.
2 Agilent VEE Programming Techniques Chapter NOTE If for some reason you want to terminate the line connecting operation before you have completed the link, double-click the mouse and the line will disappear. 6 Click the Run button on the tool bar, and you will see a random number displayed as shown in Figure 72. Figure 72 The Random Program 7 Select File ⇒ Save As..., type Random.VEE, and click OK. This name will appear next to VEE in the title bar when you open it in the future.
2 Agilent VEE Programming Techniques Chapter number of type Real64. (For more information about VEE data types, see Chapter , “Analyzing and Displaying Test Data.”) 1 Select Display ⇒ Note Pad and place it at the top- center of the work area. Click on the upper left- hand corner of the editing area to get a cursor, remove any template that might be there, and then enter the following information: Set and Get a Global Variable prompts the user to enter a real number.
2 Agilent VEE Programming Techniques Chapter 7 Connect the Set num sequence output pin to the Get num sequence input pin. NOTE A global variable has to be set before you can use it. Therefore, you need to use the sequence pins in this case to make sure that the variable num has been set, before you retrieve it with Get num. 8 Select Display ⇒ AlphaNumeric and place it to the right of the Get num object. 9 Connect the Get num data output pin to the AlphaNumeric data input pin.
2 Agilent VEE Programming Techniques Chapter Documenting Agilent VEE Programs By using the File ⇒ Save Documentation... command, you can automatically generate program documentation. VEE lists all objects, with key settings, the default and user names, the Description entries, and any “nesting.” For example, objects within a UserObject are nested one level from the main VEE environment, and these levels are indicated by numbers. You can also document individual objects using a Description.
2 Agilent VEE Programming Techniques Chapter 3 Note that the Description box is a rich text format (RTF) box. You can retrieve files from any program that creates RTF files. The RTF format gives you a great deal of flexibility in the presentation of your text data. 4 In the Main object menu, click Description. Type text in the dialog box: The Random.vee program generates random numbers. Click OK when you are done.
Agilent VEE Programming Techniques Chapter 2 Source file: "C:\\My Documents\\VEE Programs\\Random.vee" File last revised: Mon Jan 03 15:29:02 2003 Date documented: Mon Feb 28 14:43:27 2003 VEE revision: 7.
2 Agilent VEE Programming Techniques Chapter M: Main Device Type : Main Description : 1. The program, Random, generates a real number between 0 and 1 2. and then displays the results.
Agilent VEE Programming Techniques Chapter 2 In Figure 76, the VEE objects are described along with their settings. The number before each object indicates where the object is located. For example, the first object in Main is listed as M1. Figure 77 shows the remainder of this documentation file for your reference. M.
2 Agilent VEE Programming Techniques Chapter NOTE 124 After you run the Save Documentation command, run a File ⇒ Print Program command to put identification numbers on the objects, so you can match the text documentation to the printer output.
2 Agilent VEE Programming Techniques Chapter Chapter Checklist You should now be able to perform the following tasks. Review topics, if necessary, before proceeding to the next chapter. • Create a UserObject, and explain how UserObjects give programs structure and save space on screen. • Create pop- up dialog boxes and sliders (or knobs) for user input. • Use data files to save data to a file and load data from a file. • Create an operator interface, using a Panel view of the program.
2 126 Agilent VEE Programming Techniques Chapter VEE User’s Guide
Easy Ways to Control Instruments Chapter 3 3 Easy Ways to Control Instruments Overview 129 Configuring an Instrument 133 Using a Panel Driver 142 Using Direct I/O 147 Using PC Plug-in Boards 157 Using a VXIplug&play Driver 163 Other I/O Features 168 Chapter Checklist 169 VEE User’s Guide 127
3 Easy Ways to Control Instruments Chapter Easy Ways To Control Instruments In this chapter you will learn about: • Configuring an instrument • Using a panel driver • Using the Direct I/O object • Controlling PC plug- in boards • Using a VXIplug&play driver Average time to complete: 1 hour 128 VEE User’s Manual
Easy Ways to Control Instruments Chapter 3 Overview In this chapter, you will learn how to use VEE to control instruments. With VEE, you can control instruments in several ways: • “Panel” drivers give you a simple user interface (or “front panel”) to control an instrument from your computer screen. When you change parameters in the VEE panel driver, the corresponding state of the instrument is changed.
3 Easy Ways to Control Instruments Chapter Figure 78 The HP54600A Scope Panel Driver Direct I/O Object VEE’s Direct I/O object allows you to communicate with any instrument from any vendor over standard interfaces (whether or not there is a driver available for the instrument). The Direct I/O object works by transmitting commands to the instrument and receiving data back from the instrument. Using Direct I/O generally yields faster execution speeds.
3 Easy Ways to Control Instruments Chapter PC Plug-in Boards with I/O Library I/O libraries, usually shipped as Dynamically Linked Libraries (or DLLs) for PC Plug- in boards, are supplied by the vendor of the PC Plug- in board. VEE enables you to control the PC Plug- in board by calling library functions with the Call object. Figure 80 shows an example of the Import Library object that makes the functions available in VEE.
3 Easy Ways to Control Instruments Chapter Figure 81 132 Calls to a VXIplug&play Driver from VEE VEE User’s Manual
3 Easy Ways to Control Instruments Chapter Configuring an Instrument With VEE you can develop programs without the instruments present. In this exercise, you will configure an oscilloscope for use with a panel driver. Then you will add the physical instrument to the configuration. Lab 3-1: Configuring an Instrument without the Instrument Present 1 Select I/O ⇒ Instrument Manager.... Move the dialog box to the upper- left work area by clicking and dragging its title bar, as shown in Figure 82.
3 Easy Ways to Control Instruments Chapter NOTE If you have any instruments connected and powered on, VEE can find the instruments and automatically find the drivers for them. For more information about automatically finding and configuring instruments, refer to the online Tutorials under Help ⇒ Welcome ⇒ Tutorials in the main VEE screen. By default, there are no instruments configured, and this example assumes that no instruments appear in the Instrument Manager list.
3 Easy Ways to Control Instruments Chapter Table 10 Instrument Properties Entries Entry Description Name The name the instrument will be called in the program. Choose a name that follows these syntax guidelines: • Instrument names must start with an alphabetic character, followed by alphanumeric characters or underscore characters. • You cannot use embedded blanks in instrument names. Interface Type of interface. Choose from GPIB, Serial, GPIO, USB, LAN, or VXI.
3 Easy Ways to Control Instruments Chapter Figure 84 The Advanced Instrument Properties Dialog The entries in the General folder are as follows: Table 11 General Folder Entries Entry Description Timeout The maximum number of seconds allowed for an I/O transaction to complete before you get an error message. Live Mode Specifies whether there is live communication with the instrument. Set this to OFF unless you have an instrument present. VEE defaults to the ON setting.
3 Easy Ways to Control Instruments Chapter Figure 85 The Panel Driver Folder 5 Click the field to the right of ID Filename to obtain a list box entitled Read from what Instrument Driver?. This list includes all of the panel driver files loaded with your revision of VEE in the directory specified. NOTE You need to install the panel drivers from the VEE CD-ROM to complete the example. The *.cid files signify the compiled instrument driver files. 6 Scroll down the list to highlight hp54504a.
3 Easy Ways to Control Instruments Chapter Table 12 Panel Driver Configuraton Panel Driver Entries Descriptions Sub Address Leave this field blank. Sub Address is used only by non-VXI cardcage instruments for identifying plug-in modules. Error Checking Leave the default setting ON. Error Checking can be turned off for extra throughput, but then it does not check for I/O errors. Incremental Mode Leave the default setting ON.
Easy Ways to Control Instruments Chapter Figure 86 3 Scope Added to List of Instruments 8 Click Save to close the Instrument Manager box. (You could also click Panel Driver under Create I/O Object to put it in the program immediately, and VEE would save the configuration automatically.) You have now added the HP 54504A oscilloscope named scope to the instrument list. You can use this driver while programming, even though the actual instrument is not present.
3 Easy Ways to Control Instruments Chapter NOTE In the Instrument Manager, you can often create different types of objects under Create I/O Object, depending on the type of instrument configured. For example, if you had chosen Direct I/O rather than Panel Driver for this exercise, you would get a Direct I/O object with the name scope(@(NOT LIVE)).VEE also provides a Component Driver, which uses a subset of the functions provided by a Panel Driver.
Easy Ways to Control Instruments Chapter 3 3 Click Advanced: and toggle Live Mode to ON, then click OK. Click OK to close the Instrument Properties box. 4 Click Save to save the changes.
3 Easy Ways to Control Instruments Chapter Using a Panel Driver These exercises use the HP 3325B Function Generator as the example. The principles are the same in using any VEE panel driver. By using a panel driver instead of programming an instrument directly, you save time developing and modifying programs. Changes in the instrument settings are made through menu selections or by editing fields in dialog boxes.
3 Easy Ways to Control Instruments Chapter 4 Under Create I/O Object, click Panel Driver. Place the object on the left side of the workspace. (This process would be the same regardless of the instrument, as long as the instrument had been configured and added to the list.) NOTE You are programming without the instrument attached. If the instrument was attached, you would edit the configuration to the proper address.
3 Easy Ways to Control Instruments Chapter Moving to Other Panels on the Same Driver Most drivers have more than one panel to simplify the user interface. To move to a different panel, click Main Panel in the object to get a menu of panels. 1 In the Panel Driver object, click Main Panel and select Sweep in the Discrete Component MENU presented as shown in Figure 89. 2 Click OK to display the Sweep Panel. You can also look at the other panels to see what is available.
3 Easy Ways to Control Instruments Chapter Adding Inputs and/or Outputs to a Panel Driver In addition to interacting with the panel directly, you can control settings or read data from an instrument in a program by adding data inputs and/or outputs to the driver. The input and output areas are shown in Figure 90.
3 Easy Ways to Control Instruments Chapter Deleting Data Input or Output Terminals Place the mouse pointer over the terminal and press CTRL-D. NOTE You could also open the object menu and select Delete Terminal ⇒ Input... from the object menu and choose the appropriate input from the menu presented. On Your Own Set a state on the HP 3325B Function Generator, or any other function generator available. Change the Function setting to a Square wave. Add input components for Amplitude and Frequency.
3 Easy Ways to Control Instruments Chapter Using Direct I/O If there is not a driver available for a particular instrument, or you want higher throughput, use the Direct I/O object. Lab 3-3: Using Direct I/O In this exercise, you will configure the HP 3325B function generator using Direct I/O. 1 Select I/O ⇒ Instrument Manager.... 2 Highlight the fgen(@(NOT LIVE)) entry and select Instrument ⇒ Properties. 3 Click on Advanced. Select the Direct I/O folder as shown in Figure 91.
3 Easy Ways to Control Instruments Chapter 4 To place the object on the screen, make sure that fgen(@(NOT LIVE)) is still highlighted, and click Create I/O Object ⇒ Direct I/O. Figure 92 shows the Direct I/O object. Figure 92 A Direct I/O Object To use a Direct I/O object in a program, you have to configure I/O transactions. The next section explains writing text commands, reading data, and uploading/downloading instrument states.
Easy Ways to Control Instruments Chapter 3 This exercise uses the HP 3325B function generator configured in the previous section. If necessary, go back to “Using Direct I/O" on page 147 and configure the instrument before you continue. 1 In the fgen(@(NOT LIVE))object, double- click the transaction bar to get the I/O Transaction dialog box, as shown in Figure 93. Figure 93 The I/O Transaction Dialog Box The down arrow next to WRITE shows a menu of transactions: READ, WRITE, EXECUTE, and WAIT.
3 Easy Ways to Control Instruments Chapter Figure 94 A Direct I/O Transaction In most cases, the process will be the same for sending text commands to instruments. However, there are instruments that specify characters sent at the end of each command or at the end of a group of commands. You need to get this information from the instrument documentation, then include it in the Direct I/O Configuration dialog box.
Easy Ways to Control Instruments Chapter 3 3 Select Flow ⇒ Repeat ⇒ For Range and place it to the left of the Direct I/O object. 4 Connect the For Range data output pin to the Direct I/O data input pin. 5 Edit the fields in For Range to: From 10, Thru 1.8M, and Step 50k. For Range will now send out numbers ranging from 10 to 1.8 million in steps of 50,000. As the numbers are received by the Direct I/O object, the command string causes the function generator to output the frequencies.
3 Easy Ways to Control Instruments Chapter In this example, an HP3478A Multimeter is connected to the HP3325B Function Generator described in the last exercise. When the generator sends out a certain frequency, the multimeter triggers a reading and sends the results back to VEE. The following steps describe how to configure the transactions for the multimeter. NOTE This example describes a READ TEXT transaction.
Easy Ways to Control Instruments Chapter NOTE 3 Names are not case sensitive. 8 Leave the REAL64 FORMAT default. The multimeter returns single readings as real numbers. 9 Leave DEFAULT NUM CHARS as is. The default for the number of characters is 20. If you want to change the number, click on DEFAULT NUM CHARS to toggle to MAX NUM CHARS and change the number 20 to the desired number. 10 Leave SCALAR as is and click OK. You will see the transaction displayed on the bar as READ TEXT X REAL64.
3 Easy Ways to Control Instruments Chapter Figure 96 Configuring a READ Transaction 11 Add a Display ⇒ AlphaNumeric to the right and connect its input to the Direct I/O output labeled x. The two Direct I/O transactions should look like Figure 97. Figure 97 Direct I/O Configured to Read a Measurement The process to configure a transaction is similar, regardless of the data format for the READ TEXT transaction. You can explore the other formats available.
Easy Ways to Control Instruments Chapter 3 To create a complete test program, this multimeter object and a function generator object could be combined with VEE data and display objects. Fully functional test programs are easy to create in VEE. However, it is beyond the scope of this introductory chapter to show specific details for all the various instruments you might be using. For more complex examples, refer to the VEE Pro Advanced Techniques manual.
3 Easy Ways to Control Instruments Chapter Figure 98 Learn String Configuration for HP54100A Conformance can support IEEE 488 or IEEE 488.2. This example uses the HP 54100A Digitizing Oscilloscope, which conforms to IEEE 488 and requires a "SETUP?" to query the learn string and "SETUP" to precede the learn string when downloading. When you select Configured for State (Learn String) two more fields appear, labeled Upload String and Download String.
3 Easy Ways to Control Instruments Chapter Using PC Plug-in Boards VEE provides three ways to control PC plug- in boards or cards: 1 Data Translation's Visual Programming Interface. (Order the VPI application directly through Data Translation.) 2 Dynamic link libraries supplied by the PC board manufacturer, such as ComputerBoards or Meilhaus. (See “Using Dynamic Link Libraries" on page 453 for information on using dynamic link libraries.
3 Easy Ways to Control Instruments Chapter Figure 99 shows the VEE runtime software (provided free with Amplicon analog output boards PCI224 and PCI234 and analog input boards PCI230 and PCI260) providing concurrent input and output signals on a PC. Figure 99 Amplicon Data Acquisition Example ComputerBoards PC Plug-ins ComputerBoards offers low cost, powerful PC plug- in boards that are compatible with VEE.
3 Easy Ways to Control Instruments Chapter Figure 100 VEE Using a ComputerBoards 100 KHz Board Figure 100 shows the panel view of the demonstration program using this 100 KHz A/D board. Figure 101 shows VEE importing the ComputerBoards I/O library that made these data acquisition function calls possible.
3 Easy Ways to Control Instruments Chapter Meilhaus Electronic ME-DriverSystem Meilhaus Electronic is one of the leading European designers, producers and sales companies for PC- based data acquisition and interface technology. The ME- DriverSystem for Windows on CD- ROM is included with all data acquisition boards made by Meilhaus Electronic (i.e. ME series). The ME- DriverSystem is also integrated into the VEE menu structure.
Easy Ways to Control Instruments Chapter 3 Figure 103 User Panel for Data Acquisition Board ME-3000 Finally, in the third menu, the actual functions are located, such as me3000AISingle. Figure 104 shows the function panel.
3 Easy Ways to Control Instruments Chapter Figure 104 Function Panel for ME-DriverSystem 162 VEE User’s Manual
Easy Ways to Control Instruments Chapter 3 Using a VXIplug&play Driver VXIplug&play drivers are issued and supported by the various instrument vendors. These are C- based drivers and are designed for the maximum performance and ease of use. Agilent VEE is fully VXIplug&play compatible. All available VXIplug&play drivers from Agilent Technologies ship as a separate product, and are also available on the Web at http://www.agilent.
3 Easy Ways to Control Instruments Chapter Figure 105 Selecting a VXIplug&play Driver Select the hpe1412 driver, click OK to return to the Instrument Properties dialog box, and click OK to return to the Instrument Manager. There should now be an entry for Instrument(@(NOT LIVE)). 4 Highlight Instrument(@(NOT LIVE)), and under Create I/O Object, select Plug&play Driver. Click to place the object. NOTE In VEE, a VXIplug&play driver resembles a Direct I/O object.
Easy Ways to Control Instruments Chapter NOTE 3 VEE automatically initializes the instrument. You do not have to use an init function, as you would in other languages. Figure 106 Selecting a Function for a VXIplug&play Driver 6 Click Configure Present Settings ⇒ Measurement Type ⇒ Measurement Type Setup. The Edit Function Panel is displayed. Under func, click to display the drop- down list. Select the default DC Voltage, as shown in Figure 107.
3 Easy Ways to Control Instruments Chapter Figure 107 The hpe1412 Edit Function Panel 7 Click OK. The To/From Instrument object now contains an entry for hpe1412_configure(instruHandle,hpe1412_CONF_VOLT_DC), as shown in Figure 108.
Easy Ways to Control Instruments Chapter 3 8 In the To/From Instrument object, double- click to add a function and select Take Measurement under Measure. Click on the Configuration folder to display the dialog box shown in Figure 109. Figure 109 Configuration Folder in Edit Function Panel 9 Click OK. A second function call is listed in the To/From Instrument object as shown in Figure 110.
3 Easy Ways to Control Instruments Chapter Other I/O Features 1 Explore the full power of VEE's I/O capabilities in the I/O ⇒ Advanced I/O submenu: Interface Operations, Instrument Event, Interface Event, and MultiInstrument Direct I/O. 2 You can display, print, or store bus activity for debugging with the Bus I/O Monitor in the I/O menu. 3 VEE includes an ActiveX Automation server to programmatically find instruments. For further information, see the VEE Pro Advanced Techniques manual.
3 Easy Ways to Control Instruments Chapter Chapter Checklist You should now be able to perform the following tasks. Review the appropriate topics, if necessary, before going on to the next chapter. • Explain the benefits of using instrument drivers and Direct I/O. • Explain the process for controlling instruments. • Configure an instrument for a state driver. • Configure an instrument for Direct I/O. • Change settings on an instrument driver. • Add and delete component inputs and outputs.
3 170 Easy Ways to Control Instruments Chapter VEE User’s Manual
Analyzing and Displaying Test Data Chapter 4 4 Analyzing and Displaying Test Data Overview 173 Agilent VEE Data Shapes and Data Types 174 Agilent VEE Analysis Capabilities 177 Using Built-In Math Objects 178 Creating Expressions with the Formula Object 182 Using MATLAB Script in Agilent VEE 188 Displaying Test Data 195 Customizing Test Data Displays 197 Chapter Checklist 201 VEE User’s Guide 171
4 Analyzing and Displaying Test Data Chapter Analyzing and Displaying Test Data In this chapter you will learn about: • VEE data types • VEE analysis capabilities • Using math objects • Using the Formula object • Using the MATLAB Script object • VEE display capabilities • Customizing displays Average Time to Complete: 1.
Analyzing and Displaying Test Data Chapter 4 Overview In this chapter, you will learn about VEE analytical and display capabilities. You will learn how to locate the right math objects for your applications and how to display test results, so that you can turn data into useful information easily and quickly. You can also use other familiar applications such as MS Excel to analyze the data using ActiveX Automation.
4 Analyzing and Displaying Test Data Chapter Agilent VEE Data Shapes and Data Types In a VEE program, data is transmitted across the lines between objects and is then processed by subsequent objects. In order to specify a set of data, VEE packages it into a container that has both a data shape (scalar or array) and a data type (such as Int32, Real64, or Text).
4 Analyzing and Displaying Test Data Chapter Table 14 VEE User’s Guide Agilent VEE Data Types Data Type Description Int32 A 32-bit two's complement integer (-2147483648 to 2147483647). Real32 A 32-bit floating point number that conforms to the IEEE 754 standard (+/-3.40282347E+/-38). Real64 A 64-bit floating point number that conforms to the IEEE 754 standard (+/- 1.797693138623157 E308). PComplex A magnitude and phase component in the form (mag, @phase).
4 Analyzing and Displaying Test Data Chapter Table 14 NOTE 176 Agilent VEE Data Types Data Type Description Object Used only for ActiveX Automation and Controls, a reference to an ActiveX control or a reference returned from an Automation call. Literally, this is a reference to an IDispatch or IUnknown interface. Variant Used only for ActiveX Automation and Controls, a data type that is required for some ActiveX method calls as a By Ref parameter type.
Analyzing and Displaying Test Data Chapter 4 Agilent VEE Analysis Capabilities VEE supports common math operations and hundreds of other functions. In addition, VEE also includes the MATLAB Script feature. The MATLAB Script feature is a subset of the standard full- featured MATLAB from The MathWorks. It provides additional mathematical capabilities in VEE including Signal Processing, advanced mathematics, data analysis, and scientific and engineering graphics.
4 Analyzing and Displaying Test Data Chapter Using Built-In Math Objects In the VEE Device ⇒ Function & Object Browser, you can access built- in (preprogrammed) mathematical expressions for both VEE and MATLAB. Accessing a Built-in Operator or Function To access VEE mathematical operators and functions, select Device ⇒ Function & Object Browser.
Analyzing and Displaying Test Data Chapter 4 Notice that the Function & Object Browser displays a brief description of the current selection, as shown in Figure 111. You can also click on the Help button for a more detailed description of the current selection and get information such as the definition, use, syntax and examples. To access MATLAB operators and functions, select Device ⇒ Function & Object Browser, and under Type: select MATLAB Functions.
4 Analyzing and Displaying Test Data Chapter Lab 4-1: Calculating Standard Deviation Generate a cosine waveform at a frequency of 1 kHz, amplitude of 1 V, a time span of 20 ms, represented by 256 points. Calculate its standard deviation and display it. 5 Select Device ⇒ Virtual Source ⇒ Function Generator. Set the Frequency appropriately and iconize it. 6 Select Device ⇒ Function & Object Browser, then select Built- in Functions, Probability & Statistics, and sdev. Click Create Formula.
Analyzing and Displaying Test Data Chapter 4 Figure 114 Calculating Standard Deviation VEE User’s Guide 181
4 Analyzing and Displaying Test Data Chapter Creating Expressions with the Formula Object The Formula object can be used to write mathematical expressions in VEE. The variables in the expression are the data input pin names or global variables. The result of the evaluation of the expression will be put on the data output pin. Figure 115 shows a Formula object. The input field for the expression is in the center of the object. A default expression (2*A+3) indicates where to enter the formula.
4 Analyzing and Displaying Test Data Chapter NOTE All the functions created from the Devices ⇒ Function & Object Browser Built-in type are simply Formulas that already have their expressions set appropriately. They can be modified to combine functions and add (or delete) inputs. You can also do multiple-line entry in the Formula object, and assign values to output terminals. Evaluating an Expression with the Formula Object In this example, you will evaluate the expression, 2*A^6-B, where A=2 and B=1.
4 Analyzing and Displaying Test Data Chapter Figure 116 Evaluating an Expression Using an Agilent VEE Function in the Formula Object This example generates a cosine wave and calculates the standard deviation and root mean square using the Formula object. 1 Select the Function Generator, Formula, and AlphaNumeric objects and connect them together using their data pins. 2 Clone the Formula object by opening the object menu and selecting Clone, and place it just below the first one.
4 Analyzing and Displaying Test Data Chapter Figure 117 Formula Examples Using VEE Functions Now calculate the standard deviation and root mean square using only one Formula object. Formulas can have multiple output terminals with values assigned to them. 6 Double- click the object menu to Cut one of the Formula objects.
4 Analyzing and Displaying Test Data Chapter 8 In the Formula object, add an output terminal. Rename the output terminals B and C. Connect output terminal B to one of the Alphanumeric objects, and output terminal C to the other Alphanumeric object. 9 Run the program. It should look like Figure 118. Figure 118 VEE Functions Using One Formula Object On Your Own Complete the following exercises and check the results as shown in Figure 119.
Analyzing and Displaying Test Data Chapter 4 Figure 119 On Your Own Solution: Ramp and SDEV For the second and third exercises, you have to delete the input terminal A on the Formula object to avoid an error message, because all data input pins must be connected and have data before an object can operate.
4 Analyzing and Displaying Test Data Chapter Using MATLAB Script in Agilent VEE VEE includes the MATLAB Script object, which gives you access to the functionality of MATLAB. VEE can pass data to the MATLAB Script Engine and receive data back, enabling you to include MATLAB mathematical functions in VEE programs. NOTE If you already have MATLAB installed, VEE will use your installed MATLAB to process MATLAB Script.
Analyzing and Displaying Test Data Chapter 4 • Returning results from the MATLAB Script object and using the results in other parts of the VEE program. • Performing sophisticated filter design and implementation in the MATLAB Script object by using MATLAB’s Signal Processing Toolbox functionality. • Visualizing data using 2- D or 3- D graphs. Figure 120 shows how the MATLAB Script object appears in a VEE program.
4 Analyzing and Displaying Test Data Chapter Figure 121 Graph Generated by the Program When you include MATLAB Script objects in a VEE program, VEE calls the MATLAB Script Engine to perform the operations in the MATLAB Script objects. Information is passed from VEE to MATLAB and back again. Some notes about MATLAB: • The first MATLAB Script object that executes in a program opens a single MATLAB session. All other instances of MATLAB Script objects share the session.
4 Analyzing and Displaying Test Data Chapter • VEE does not perform any syntax checking of MATLAB commands before the MATLAB Script Engine is called. Errors and warnings generated by MATLAB are shown in the regular VEE dialog boxes, just like any other VEE error or caution. • Unlike VEE, MATLAB is case sensitive. If you name a MATLAB Script object input or output terminal with a capital X, be sure to use a capital X in MATLAB, not a lower- case x.
4 Analyzing and Displaying Test Data Chapter Figure 122 Adding Predefined MATLAB Objects to a VEE Program Notice that each object is named MATLAB Script to help you distinguish it from other VEE formula objects. Each object already includes the function it will perform, and the input and output pins that are likely to be needed, just like built- in VEE formula objects. You can also edit MATLAB Script objects exactly as you can edit any other VEE object.
4 Analyzing and Displaying Test Data Chapter NOTE For a complete listing and description of the automatic conversions between VEE data types and MATLAB data types, refer to the VEE online Help. You can also use input terminal data type constraints to ensure that the data input from another object is converted to a supported type, as shown in the following example. 1 Select Data ⇒ Constant ⇒ Int32 and click to place the object. Change the value to 7.
4 Analyzing and Displaying Test Data Chapter Figure 123 Changing Input Terminal Data Type 194 VEE User’s Guide
4 Analyzing and Displaying Test Data Chapter Displaying Test Data Table 15 describes the display capabilities for the different VEE objects. Table 15 VEE User’s Guide Displays Display Description Alphanumeric Displays values as text or numbers. Requires SCALAR, ARRAY 1D, or ARRAY 2D. Beep Gives an audible tone to highlight a place in your program. Complex Plane Displays Complex, Polar Complex (PComplex), or Coord data values on a Real vs. Imaginary axis.
4 Analyzing and Displaying Test Data Chapter Table 15 196 Displays Display Description Spectrum (Freq) A menu that contains frequency domain displays: Magnitude Spectrum, Phase Spectrum, Magnitude vs. Phase (Polar), and Magnitude vs. Phase (Smith). Inputs must be Waveform, Spectrum, or an array of Coords. Waveform inputs are automatically changed to the frequency domain with a Fast Fourier Transform (fft).
4 Analyzing and Displaying Test Data Chapter Customizing Test Data Displays Displays may be customized in a variety of ways. Not only can you label, move, and size displays like all VEE objects, but you can also change the x/y scales, modify the traces, add markers, or zoom in on parts of the graphical display. The following example illustrates some of these features. It uses the Noise Generator to generate a waveform, and then displays it with the Waveform (Time) display.
4 Analyzing and Displaying Test Data Chapter Figure 124 Displaying a Waveform Changing the X and Y Scales 1 Double- click the Waveform (Time) title bar to get the Y Plot Properties box, select the Scales folder, select 20m for the X Maximum and enter 1m. This alters the time span of the display from 20 milliseconds to 1 millisecond. 2 Double- click the Minimum field on the Y axis where it says -1, and enter - .5. Click OK.
Analyzing and Displaying Test Data Chapter 4 You will see two white arrows pointing up and down at one of the data points on the waveform. Also, notice that the display records the x and y coordinates of these markers at the bottom of the display. To measure the x or y distance between two peaks, click- and- drag the arrows to the peaks you want to measure. You will see one of the markers move to those new peaks with the new coordinates recorded at the bottom of the display, as shown in Figure 125.
4 Analyzing and Displaying Test Data Chapter Changing the Color of the Trace 1 Double- click the title bar to get to Properties, then double click the Trace property. You can select the Color, LineStyle, Name, and PointStyle properties for the Trace selected in this folder. NOTE You can also change these values at run time by using the Traces or Scales control inputs. For more information, see the VEE Pro Advanced Techniques manual. 2 The trace will now be displayed in the new color.
4 Analyzing and Displaying Test Data Chapter Chapter Checklist You should now be able to do the following tasks. Review topics as needed, before going on to the next chapter. • Describe the main data types in VEE. • Describe some of the main areas of analytical capabilities in VEE. • Find an online Help explanation for any object in the Function & Browser dialog box. • Describe the relationship between input pins and variables in a VEE math object.
4 202 Analyzing and Displaying Test Data Chapter VEE User’s Guide
Storing and Retrieving Test Results Chapter 5 5 Storing and Retrieving Test Results Overview 205 Using Arrays to Store Test Results 206 Using the To/From File Objects 210 Using Records to Store Mixed Data Types 222 Using DataSets to Store and Retrieve Records 232 Customizing a Simple Test Database 237 Chapter Checklist 246 VEE User’s Guide 203
5 Storing and Retrieving Test Results Chapter Storing and Retrieving Test Results In this chapter you will learn about: • Putting test data into arrays • Using the Collector object • Using the To/From File objects • Creating mixed data types using Records • Performing search and sort operations using DataSets • Creating simple test databases using the Dataset objects Average Time to Complete: 2 hours 204 VEE User’s Guide
Storing and Retrieving Test Results Chapter 5 Overview In this chapter, you will learn the fundamentals of storing and retrieving test data. You will create arrays of the right data type and size to hold your test results, and then access the data or part of the data for analysis or display. This chapter also describes the To/From File objects, the Record data type, and Dataset files. The To File and From File objects read data to and from files based on I/O transactions.
5 Storing and Retrieving Test Results Chapter Using Arrays to Store Test Results Data types can be stored in two ways: • Scalar values (that is, a single number such as 9 or (32, @10)) - OR• Arrays from 1 to 10 dimensions. NOTE The overview of VEE data types is described in the Chapter , “Analyzing and Displaying Test Data.” Indexing for arrays is zero- based in VEE, and brackets are used to indicate the position of the array element.
5 Storing and Retrieving Test Results Chapter Lab 5-1: Creating an Array for Test Results The easiest way to create an array is to use the Collector object. This exercise uses the For Count object to simulate four readings from an instrument. The readings are put into an array and the results are printed.
5 Storing and Retrieving Test Results Chapter The XEQ pin, a special trigger pin that exists on several different objects, determines when the object executes. In this case, you want the object to fire after all of the data for the array has been collected. 5 Connect the Collector data output pin to the AlphaNumeric data input pin. 6 Enlarge AlphaNumeric to accommodate the array by clicking and dragging on any corner of the object.
Storing and Retrieving Test Results Chapter 5 Shift-Ctrl, and then clicking the left mouse button. Then iconize the Collector. 2 Select Device ⇒ Formula and clone it. Move AlphaNumeric to the right, and put both Formula objects to the right of the Collector. 3 Connect the Collector data output to the data inputs of the Formula objects. Enter A[2] in the upper Formula input field, and A[1:3] in the lower Formula input field.
5 Storing and Retrieving Test Results Chapter Using the To/From File Objects The To File and From File objects read data to and from files based on I/O transactions. They have the following characteristics: • A data file is opened on the first READ or WRITE transaction. When the program ends, VEE closes any open files automatically. • VEE maintains one read pointer and one write pointer per file regardless of how many objects are accessing the file.
5 Storing and Retrieving Test Results Chapter Figure 128 The To File Object The To File object shown in Figure 128 sends data to the specified file myFile. It can include inputs, called transactions, to accept data from a program. For example, this To File object includes the transaction WRITE TEXT a EOL. When you double- click the transaction, an I/O Transaction dialog box appears as shown in Figure 129, which configures the specific transaction statement.
5 Storing and Retrieving Test Results Chapter I/O Transaction Format An I/O transaction to write data is usually in the following format: Table 18 describes the most common actions: READ, WRITE, EXECUTE, and WAIT. Table 18 NOTE Types of I/O Transactions Action Description READ Reads data from the specified source using the specified encoding and format. WRITE Writes data to the specified target using the specified encoding format.
5 Storing and Retrieving Test Results Chapter Table 19 I/O Transaction Encoding Encoding Explanations TEXT Reads or writes all data types in a human-readable form (ASCII) that can easily be edited or ported to other software applications. VEE numeric data is automatically converted to text. BYTE Converts numeric data to binary integer and sends or receives the least significant byte. CASE Maps an enumerated value or an integer to a string and reads/writes that string.
5 Storing and Retrieving Test Results Chapter Lab 5-3: Using the To/From File Objects This lab exercise describes the process of getting test data to and from files. In this exercise, you will store and retrieve three common test result items: a test name, a time stamp, and a one- dimensional array of Real values. The same process will apply to all VEE data types. Sending a Text String to a File 1 Select I/O ⇒ To ⇒ File.
5 Storing and Retrieving Test Results Chapter Table 21 Writing the Default Transaction Entry Description a (expression field) The expression list field is highlighted and contains the default a. Type "Test1", then click OK. (You need the quotation marks to indicate a Text string. If you typed Test1 without the quotation marks, VEE would interpret this as a terminal name or global variable name.) WRITE Use the default WRITE. TEXT Use the default TEXT.
5 Storing and Retrieving Test Results Chapter Therefore, now() returns a value about 63G. VEE provides this format because it is easier to manipulate mathematically and conserves storage space. If you want to store the time stamp in a more readable format, use the TIME STAMP FORMAT in the To File object. Follow these steps to send a time stamp to a file. 1 In the same To File object, double- click in the transaction area to display the I/O Transaction box.
5 Storing and Retrieving Test Results Chapter Figure 130 The TIME STAMP I/O Transaction Box 4 Click OK to return to the To File box. The second transaction bar should now contain the statement WRITE TEXT now() TIME:HM:H12 EOL. Sending a Real Array to a File Create a one- dimensional array of four elements using the For Count and Collector objects, and append it to myFile. 1 Select Flow ⇒ Repeat ⇒ For Count. Change the default value in For Count to 4. 2 Select Data ⇒ Collector.
5 Storing and Retrieving Test Results Chapter 6 Click OK to close the I/O Transaction box. The transaction bar in the To File object should now contain the statement WRITE TEXT a REAL64 STD EOL. Notice that VEE also automatically adds an input terminal a. 7 Connect the output from the Collector to the input a of To File. The program should now look like Figure 131. (The configured I/O Transaction box is also displayed.
Storing and Retrieving Test Results Chapter 5 In this example, the name of a test is stored in a String Format, followed by a time stamp in Time Stamp Format and an array of Real64 numbers. You will create three transactions in From File to read the data back into VEE. 1 Select I/O ⇒ From ⇒ File and place it below the To File object. 2 Connect the sequence output pin of the To File object to the sequence input pin of the From File object.
5 Storing and Retrieving Test Results Chapter Now add two more transactions to read back the time stamp and the real array. 5 In the same From File object, double- click below the first transaction bar. The I/O Transaction dialog box appears. Double- click on the expression list input field to highlight x and type y, for the second transaction to read data back to pin y.
Storing and Retrieving Test Results Chapter 5 The transaction bar in the From File object should now contain the statements READ TEXT y STR and READ TEXT z REAL64 ARRAY:4. Notice that VEE automatically adds the data output terminals for x, y, and z. You can also manually add or delete input and output terminals under object menu ⇒ Add Terminal, Delete Terminal, or using the shortcuts Ctrl-A and Ctrl-D. 7 Select Display ⇒ AlphaNumeric and clone it twice to get three displays.
5 Storing and Retrieving Test Results Chapter Using Records to Store Mixed Data Types The Record data type can store different data types in a single data container. Record can include any VEE data type. The data can be in the shape of a Scalar or an Array. You can store a test name, a time stamp, and a real array in a single data structure. The individual elements in a Record are stored as fields and are accessed using a dot notation. For example, Rec.
Storing and Retrieving Test Results Chapter 5 Lab 5-4: Using Records This exercise describes how to use the Record datatype. You will learn how to build a record, how to retrieve a particular field in that record, how to set a chosen field, and how to unbuild the entire record in a single step. This exercise also uses the time stamp function now() in a different way.
5 Storing and Retrieving Test Results Chapter double- clicking over the terminal and rename the three input terminals to testname, time, and data. The Output Shape on the Build Record object toggles between Scalar and Array. The Scalar default will be the correct choice for the majority of situations. (For more information, see the VEE Pro Advanced Techniques manual.
Storing and Retrieving Test Results Chapter 5 You can see the three fields and their values. If you click on the Real64: Array 1D button, a list box shows the actual values. Notice that the time stamp has been stored as a Real64 Scalar. In the next exercise, you will convert it to a more readable form. Click OK to close the Output Terminal Information dialog box. Save the program as records.vee.
5 Storing and Retrieving Test Results Chapter 8 Open the second AlphaNumeric display object menu and select Properties, then select the Number folder. Click to the left of Global Format to remove the check mark. Set the display format. Open the Standard menu in the Real section. Select Time Stamp and click OK. 9 Click HH:MM:SS to toggle to HH:MM. Click 24 HOUR to toggle to 12 HOUR. See Figure 135. Figure 135 The AlphaNumeric Properties Box 10 Run the program and save it as getfield.vee.
Storing and Retrieving Test Results Chapter 5 Figure 136 Using the Get Field Object Notice that the second display lists the weekday, the date, and the time expressed in hours, minutes, and an a.m. or p.m. designation. Setting a Field in a Record This exercise shows how to change data in specific fields of a record. NOTE VEE User’s Guide You can re-use the same Record with different tests.
5 Storing and Retrieving Test Results Chapter 1 Open the getfield.vee program. 2 Delete all objects after Build Record, by selecting objects and pressing Ctrl-X. 1 Select Data ⇒ Access Record ⇒ Set Field and place it to the right of Build Record. Connect the output from Build Record to the rec input of Set Field. The title will be rec.field = b. Set Field works by assigning the expression on the right side of the assignment symbol (=) to the left hand side.
5 Storing and Retrieving Test Results Chapter 4 Select Data ⇒ Access Record ⇒ Get Field and place the object under the Set Field (rec.field=b) object. Edit the Get Field object expression from rec.field to rec.data. Connect the data output of rec.field = b to the data input of rec.field. NOTE You could also use a Formula object with A.data in the expression field. 5 Select an AlphaNumeric display, size it to accommodate an array, and connect it to the rec.field output pin.
5 Storing and Retrieving Test Results Chapter Unbuilding a Record in a Single Step To extract all record fields and get a list of the field names and their types, use the UnBuild Record object. 1 Open the setfield.vee program. Delete all objects after Build Record. 2 Select Data ⇒ UnBuild Data ⇒ Record and place it under Build Record, switch the open view, and connect the output of Build Record to the input of UnBuild Record.
Storing and Retrieving Test Results Chapter 5 Figure 138 Using the UnBuild Record Object Notice that the Name List pin gives the names testname, time, and data of the three fields in the record, just as the Type List identifies testname as Text, and time and data as Real64 types.
5 Storing and Retrieving Test Results Chapter Using DataSets to Store and Retrieve Records DataSets can retrieve one or more records. VEE objects unpack the records. Therefore, by storing records to DataSets instead of files, you do not have to remember the data types. You can also perform sort and search operations on the data, creating your own customized test database. Lab 5-5: Using DataSets A DataSet is simply an array of Records stored in a file.
Storing and Retrieving Test Results Chapter 5 4 Select the Function & Object Browser icon from the tool bar. a Choose Built- in Functions, Probability & Statistics, and random to create the random (low, high) object. Place the object below the Formula object. b Delete the input terminals, and change the input parameters from low to 0, and from high to 1. c Rename the object Random Number, and connect its data output to the B terminal of Build Record.
5 Storing and Retrieving Test Results Chapter Figure 139 Storing an Array of Records in a DataSet Now retrieve the array of records and display it using the From DataSet and Record Constant objects. 9 Select I/O ⇒ From ⇒ DataSet and place the object below For Count. Leave the default file name, myFile. Click the Get Records field to toggle from One to All. Finally, leave the default of 1 in the expression field at the bottom.
Storing and Retrieving Test Results Chapter 5 Control Input. Click Default Value from the list box presented, then click OK. Resize the Record object to be larger, so you can see the results when you run the program. The record received will become the default value. In this case, Record will receive an array of records from the From Data Set object, and it will format itself to display that array of records. 11 Connect the From Data Set output pin Rec to the Default Value pin on Record.
5 Storing and Retrieving Test Results Chapter Figure 140 Storing and Retrieving Data Using DataSets NOTE 236 A From Data Set object must include at least one record that meets the criterion, or VEE issues an error message. To avoid an error, add an EOF (end-of-file) output pin to the object which activates if no records meet the criterion. You can then add actions to the program when the EOF results.
5 Storing and Retrieving Test Results Chapter Customizing a Simple Test Database You can search and sort a DataSet for information, such as test name, time stamps, test parameters, test values, pass or fail indicators, and test descriptions. Therefore, DataSet records can act as a test database. To search for information, you can use the From Data Set object as follows: • The expression field in the From Data Set object is used for search operations.
5 Storing and Retrieving Test Results Chapter Figure 141 A Search Operation with DataSets Creating an Operator Interface for a Search Operation This exercise adds a menu for an operator to extract data from the test results database. The operator interface is secured to avoid accidental modifications to the program.
5 Storing and Retrieving Test Results Chapter Follow these steps to create the program. 1 Open the dataset2.vee program. Add a control input that will allow you to input the expression in the From Data Set object programmatically. 2 Open the From Data Set object menu and select Add Terminal... ⇒ Control Input.... Select Formula from the menu presented. A Formula input terminal appears. Click the Get records field to toggle from All to One to access one test record at a time.
5 Storing and Retrieving Test Results Chapter the For Count sequence input pin. The program should look like Figure 142. Figure 142 Adding the Test Menu object 6 The output of the Test Menu goes into a Formula object, which then sends the correct formula to the From Data Set object. Select Device ⇒ Formula, and place the object below Test Menu. (You may want to rearrange and/or resize objects as you add items during the exercise.) In the new Formula object, enter the following expression: "Rec.
5 Storing and Retrieving Test Results Chapter Table 24 How to Interpret the Formula Element Description A VEE looks at the first field A of all records in the DataSet file, and selects the first record that equals the selected test name. “\”” The escape character for a quotation mark is \”. The escape character is then put into quotes to indicate a text string. The test name comes from the Test Menu as an Enum data type. Quotes are required to put the correct formula into the From DataSet object.
5 Storing and Retrieving Test Results Chapter Test Menu object has AutoExecute turned on, make a menu selection to run the program. Figure 143 Adding a Menu to the Search Operation Next, create the operator interface. 14 Press Ctrl and click these objects: Test Menu, Test Results Database Instructions, and Test Results. All objects selected show a shadow. Verify no other objects are selected. Then select Edit ⇒ Add to Panel, and the operator interface appears as a panel view.
Storing and Retrieving Test Results Chapter 5 Figure 144 The Operator Interface for the Database 15 Run the program a few times by making selections in Test Menu. Save the program as database.vee. Notice that you can get more detailed information on any given record by clicking the field names or the values in the Record Constant object (named Test Results). NOTE VEE User’s Guide To secure the operator interface and program from changes, select File ⇒ Create RunTime Version....
5 Storing and Retrieving Test Results Chapter Performing a Sort Operation on a Record Field This exercise uses the dataset2.vee program from a previous exercise. The dataset2.vee program sets a condition in the From DataSet object such as Rec.B>=0.5, and VEE extracts all the records that meet the requirement. The array of resulting records is displayed in the Record Constant object. In this exercise, dataset2.
Storing and Retrieving Test Results Chapter 5 Figure 145 A Sort Operation on a Record Field VEE User’s Guide 245
5 Storing and Retrieving Test Results Chapter Chapter Checklist You should now be able to perform the following tasks. Review topics, if necessary, before proceeding to the next chapter. • Explain the basic notation for using arrays. • Create an array using the Collector object. • Extract elements from an array using the Formula object. • Send a string, time stamp, and real array to a file. • Retrieve a string, time stamp, and real array from a file. • Use the function now() for a time stamp.
6 Creating Reports Easily Using ActiveX Chapter 6 Creating Reports Easily Using ActiveX Overview 249 ActiveX Automation in Agilent VEE 250 Sending Agilent VEE Data to MS Excel 255 Creating an Agilent VEE to MS Excel Template 264 Using MS Word for Agilent VEE Reports 270 Chapter Checklist 277 VEE User’s Guide 247
6 Creating Reports Easily Using ActiveX Chapter Creating Reports Easily Using ActiveX In this chapter you will learn about: • ActiveX Automation in VEE • Using ActiveX for reports with MS Excel • Using ActiveX for reports with MS Word Average time to complete: 1.
Creating Reports Easily Using ActiveX Chapter 6 Overview In this chapter, you will learn how to generate reports in other applications, such as MS Excel, by sending data from the VEE program to the MS Excel program. VEE uses ActiveX Automation to control other applications, which provides a fast process for creating detailed and effective reports. The first lab exercise describes how to send data to an MS Excel spreadsheet automatically using ActiveX Automation.
6 Creating Reports Easily Using ActiveX Chapter ActiveX Automation in Agilent VEE In this chapter, the term ActiveX Automation refers to VEE’s ability to act as an Automation Controller of Automation Server applications such as MS Excel, MS Word, and MS Access. The exercises focus on the practical application of Microsoft’s ActiveX technology to generate test and measurement program reports.
Creating Reports Easily Using ActiveX Chapter 6 When you put a check next to a Type Library in the ActiveX Automation References box, the library objects become available for use in a VEE program. For example, in Figure 146, Microsoft Excel 9.0 is checked. Figure 146 The ActiveX Automation Reference Box Creating and Using ActiveX Programs with Agilent VEE VEE includes a data type called Object for ActiveX programs.
6 Creating Reports Easily Using ActiveX Chapter For example, if you select Data ⇒ Variable ⇒ Declare Variable, set the Name to App, and set the data type as Object, you can use the variable App to point to an ActiveX Automation object such as the Excel Automation Server. Figure 147 shows an example of a data type Object.
Creating Reports Easily Using ActiveX Chapter 6 Figure 148 Commands to Set Up Excel Worksheet to Display Test Reults VEE uses standard Microsoft Visual Basic syntax to create the commands or statements like those shown in Figure 148. The commands or statements perform three types of operations: get properties, set properties, or call methods. • Get property statements usually refer to getting some type of data. The syntax is
6 Creating Reports Easily Using ActiveX Chapter Using CreateObject and GetObject Notice that one of the statements in Set Up Excel Worksheet in Figure 148 contains the CreateObject() function call. CreateObject() and GetObject() are functions in the VEE Function & Object Browser, and they are designed specifically to return a pointer to an ActiveX object in VEE. For example, CreateObject("Excel.Sheet")starts up Excel and returns a reference to a workbook in it.
6 Creating Reports Easily Using ActiveX Chapter Sending Agilent VEE Data to MS Excel This section introduces the VEE objects and MS Excel function calls for generating reports. Lab 6-1: Sending Agilent VEE Data to MS Excel In this lab, you will generate virtual test data for MS Excel. (The example uses MS Office 2000 and the MS Excel 9.0 Object Library, and should also work with MS Office 97 and the MS Excel 8.0 Object Library.
6 Creating Reports Easily Using ActiveX Chapter 5 After you have compared the entries to Figure 150, iconize the four objects. Figure 150 The Globals UserFunction Notice that by using the datatype Objects in the globals UserFunction, you could specify the Object Type and Class. There are two reasons to specify Object Type and Class: more specific type checking, and catching events. More Specific Type Checking: For example, if you specify an Object app as being of type Excel.
Creating Reports Easily Using ActiveX Chapter 6 Events are useful for ActiveX Controls, where you need a way for the control to communicate back to VEE. For more information, refer to the VEE Pro Advanced Techniques manual. 6 Open the UserFunction globals object menu and click Generate ⇒ Call. This generates a Call globals object configured correctly. Place it to the left in the Main window and iconize the globals UserFunction window.
6 Creating Reports Easily Using ActiveX Chapter Table 25 Setting up an Excel Worksheet in the Formula Object Command Description set sheet = The keyword set is used to assign or set whatever is on the right-hand side of the assignment operator (in this case, the equal sign) to the variable on the left-hand side of the expression. For example, set app sets the application sheet.application, which has been defined as an Excel worksheet. CreateObject (“Excel.Sheet”).
Creating Reports Easily Using ActiveX Chapter Table 25 NOTE 6 Setting up an Excel Worksheet in the Formula Object Command Description set window = app.windows(1); References the first window. window.caption = “Test System Results”; Sets the first window’s caption to “Test System Results.” For more information about the Application Server libraries, refer to the many books available about ActiveX Automation and MS Visual Basic.
6 Creating Reports Easily Using ActiveX Chapter Figure 152 Adding the Title and Data to the Sheet The instructions in the Formula objects and the For Range object are described as follows: Table 26 260 Instructions in Formula Objects and the For Range Object Formula Description sheet.cells(1,1) = “DC Volts” Refers to the first row and column in the Excel worksheet. The text DC Volts will be placed there. This sets the default property (which is value) of cell (1,1), to "DC Volts".
6 Creating Reports Easily Using ActiveX Chapter Table 26 Instructions in Formula Objects and the For Range Object Formula Description sheet.cells(A+1,1) This statement is shorthand for sheet.cells(A+1,1).value=random(1,100). = random(1,100) The worksheet cell at row A+1, col 1 gets the row number by adding 1 to the input pin A value but stays in column 1. The value between 1 and 100 returned by random is assigned to the specified cell in the worksheet.
6 Creating Reports Easily Using ActiveX Chapter Figure 153 The Results Average Program The entries in the Formula object are as follows: Table 27 Formula Object Entries Entry Description set range = sheet.range(“A2:A21"); A2 to A21 on the Excel worksheet. (A refers to the Sets the VEE variable range to reference the range first column in a worksheet.) range.NumberFormat = “##,#00.00"; 262 Assigns the format to each of those cells with the pound signs (#) allowing for larger numbers, if necessary.
Creating Reports Easily Using ActiveX Chapter Table 27 6 Formula Object Entries Entry Description app.worksheetFunction. average(range); Calls an Excel method average() that returns the average value of the designated range of values, which is displayed in Results Average. 11 Save the program as results_average.vee. Run the program. MS Excel will launch with a worksheet like the one shown in Figure 154.
6 Creating Reports Easily Using ActiveX Chapter Creating an Agilent VEE to MS Excel Template In this exercise, you will create a program to display an array of VEE test data in MS Excel. You can use this program as a template for displaying the results of other tests in MS Excel spreadsheets. Lab 6-2: Creating an Agilent VEE to MS Excel Template 1 Open results_average.vee. 2 Change the For Range object to loop 10 times. 3 Add the input B to Fill in Cells and change the statement inside to read: sheet.
Creating Reports Easily Using ActiveX Chapter 6 Figure 155 Excel Worksheet for Array of Test Data VEE User’s Guide 265
6 Creating Reports Easily Using ActiveX Chapter Figure 156 Program for Array of Test Data You can re- use this program as a template for displaying test results in MS Excel. You simply put the test data into arrays and modify the rest of the template to fill in the appropriate cells in the right format. To find additional methods and properties in the MS Excel library, look at the Function & Object Browser and choose the ActiveX Objects under Type and Excel under Library.
Creating Reports Easily Using ActiveX Chapter 6 On Your Own Generate a waveform and strip out the Time Span to get an array. Create a VEE object for MS Excel with a worksheet and set it to an Object variable. Make the application visible. Then put the 256 point array into the worksheet range "A1:A256" in one step, instead of one cell at a time. Use an Unbuild Waveform object. Use the [a] build array syntax to create a 2D array from a 1D array.
6 Creating Reports Easily Using ActiveX Chapter Figure 158 A VEE to MS Excel Program Example The entries in Figure 158 are as follows: Table 28 268 Description of Figure 13’s Entries Item Description MS Excel Window Size Notice the Drop-Down List in the upper right work area. This allows you to choose one of three options xlMaximized, xlMinimized, xlNormal to select the size of the worksheet window inside Excel when it comes up.
6 Creating Reports Easily Using ActiveX Chapter Table 28 VEE User’s Guide Description of Figure 13’s Entries Item Description Memory Tracking (Click Show Terminals in the Properties boxes on the Formula and Meter objects.) Notice the memoryTotal and memoryUsed properties in the Excel library that are assigned to the VEE variables memTotal and memUsed. These values are then used to calculate the ranges to configure a VEE meter before it displays the memory being used by MS Excel.
6 Creating Reports Easily Using ActiveX Chapter Using MS Word for Agilent VEE Reports This lab describes how to display VEE test information in an MS Word document, including text, a time stamp, and a screen dump of a VEE pop- up panel with an XY Display. Consult Microsoft documentation to find out more elaborate ways of controlling MS Word from other applications using ActiveX Automation. Lab 6-3: Using MS Word for Agilent VEE Reports To begin, follow the steps to declare five variables as type Object.
Creating Reports Easily Using ActiveX Chapter 6 Figure 159 Object Variables 3 Create a UserFunction called Graph, which uses a Function Generator virtual source to send a sine wave to a Waveform (Time) display. Create a panel view of the display only. Then generate a Call Graph object in the Main window. (Recall that the UserFunction object menu includes an easy way to generate a call.) Now create a bitmap file of the Panel with the Waveform display to use in the report in MS Word.
6 Creating Reports Easily Using ActiveX Chapter sequence \\ to specify the ASCII character \.) Delete input terminal A. If you installed in c:\Program Files\Agilent\ for example, you would then generate the following text string on the Result output pin: C:\Program Files\Agilent\VEE Pro 6.0\panel.bmp. 5 Create another Formula object and enter savePanelImage("Graph", FileName, 256). Rename the input terminal to FileName. 6 This saves the screen dump from the UserFunction Graph in the panel.
Creating Reports Easily Using ActiveX Chapter 6 8 Click Device ⇒ Formula and enter the statements shown in Figure 161, which are also described below. Rename input terminal A to FileName. Connect the data input and sequence input pins as shown in Figure 161. Figure 161 Adding the ActiveX Statements In Figure 161, notice that you can nest property and method calls together with the Object’s dot notation. Refer to ActiveX documentation to find the right properties in the target applications.
6 Creating Reports Easily Using ActiveX Chapter Table 29 274 Entries in the Formula Object Entry Description Set Doc = App.Documents. Add(); Adds a Document in MS Word and assigns it to the Object variable Doc. Note: In the Excel example, Excel was started with a blank worksheet using CreateObject(Excel.Sheet). In this example, Word is started and the method Add() adds an empty Document to it. Either application can be created either way. Doc.Activate(); Activates the Document above.
Creating Reports Easily Using ActiveX Chapter 6 9 Add three more Formula objects and one If/Then/Else object, configure, and connect them as shown in Figure 162. Figure 162 The Complete Program for Report in MS Word The entries in the additional objects are as follows: Table 30 VEE User’s Guide Additional Objects in Figure 17 Object Description App.ActivePrinter Requests the default printer in a string including its port.
6 Creating Reports Easily Using ActiveX Chapter 10 Run the program. It should look like Figure 163. (If the colors look strange in the screen dump, iconize any open applications, so the PC has a full palette of colors to work with.) Figure 163 The MS Word Document Created by Lab 6-3 For more information about controlling MS Excel and MS Word using ActiveX Automation, refer to Microsoft documentation.
6 Creating Reports Easily Using ActiveX Chapter Chapter Checklist • You should now be able to perform the following tasks. Review topics, if necessary, before going on to the next chapter. • Describe the basic concept behind ActiveX Automation in VEE. • Send data from VEE to MS Excel. • Use a generic template to send arrays of test data to an MS Excel worksheet. (Make sure you know how to send an array to the spreadsheet in one step.
6 278 Creating Reports Easily Using ActiveX Chapter VEE User’s Guide
Using .NET with VEE 7 7 Using .NET with VEE What is .NET? 281 .NET Terminology 316 VEE and the .NET Framework 282 Importing a Namespace into VEE 288 VEE and Primary Interop Assemblies 292 Programming Practices 293 .NET and IVI Drivers 311 Distributing the VEE Runtime 314 VEE and .NET Security 315 .
7 Using .NET with VEE Using .NET with VEE In this chapter you will learn about: • Some of the basic .NET Terminology • How to import a namespace into VEE • What a PIA is and why it is important • Special .NET considerations for distributing the VEE Runtime • VEE and .NET Security Average time to complete: 1.
7 Using .NET with VEE What is .NET? Visual Studio .NET is Microsoft’s latest development platform. Unlike previous products, such as Visual Studio 6, .NET addresses the needs of both desktop programmers and World Wide Web developers. The strength of .NET from a VEE perspective is the free .NET Framework that is distributed with VEE 7.0. In fact, this free runtime is integral to several of VEE’s new features. The key features and benefits of the .
7 Using .NET with VEE VEE and the .NET Framework Before beginning a review of how the .NET Framework interacts with VEE, review the .NET Framework by looking up the “.NET Framework – getting started” in the MSDN index at this unfortunately long address: (http://msdn.microsoft.com/library/en- us/cpguide/html/cpovri ntroductiontonetframeworksdk.asp). Under the Device menu there is a new menu option called .NET Assembly References, which is very similar to References for ActiveX.
Using .NET with VEE 7 Figure 164 Import Namespaces Dialog Box .NET Assembly References There are many assemblies you could select. These assemblies are located in the directory where your VEE program is stored or in the directory where the .NET Framework is installed. If you are using an assembly that is not in one of these two directories, use the Browse button to select it. There is also a checkbox for Import namespaces after closing .
7 Using .NET with VEE The most commonly used assembly, mscorlib, is selected in the previous graphic. Go ahead and select this assembly. mscorlib encapsulates many functions useful to VEE users, such as file system manipulation, collection management, and data type conversion. Another very commonly used assembly is System, which contains functions such as process management, web request and response, and regular expressions.
Using .NET with VEE 7 other type libraries) in the directory where the program is saved. After VEE gets the Interop Assembly, it gets all of the type information from it. NOTE To avoid the overhead of VEE having to copy the generated Interop Assemblies from a temporary directory to your VEE program directory, save your VEE program first. This way, the generated Interop Assemblies will be directly saved in your VEE program directory. Go ahead and select the COM tab.
7 Using .NET with VEE Figure 165 Function & Object Browser - .NET Objects All of the namespaces of the selected assembly are listed in the Namespace list box. For each Namespace, all of its types are listed in the Type list box and all the members of each Type are listed in the Members list box. Members include constructors, fields, properties, methods, and enumerations. If you have used ActiveX in VEE, you will find that selecting a .NET class member is almost exactly the same process.
Using .NET with VEE 7 Browser to get yourself familiarized with the syntax. See “Lab 7- 2: Using .NET to Perform DateTime Operations" on page 305 for an example. 2 Instance object variables are generated with the first letter in lower case. This is a clue to you that you are calling a method or property on an instance member of an object. This also means that you need to create a .NET object. 3 To create a .NET object, select a Constructor (constructors and methods share this icon ) in the member list.
7 Using .NET with VEE Importing a Namespace into VEE To reiterate the definition for a namespace: “.NET Framework types use a dot syntax naming scheme that connotes a hierarchy. This technique groups related types into namespaces so they can be searched and referenced more easily. The first part of the full name — up to the rightmost dot — is the namespace name. The last part of the name is the type name. For example, System.Collections.ArrayList represents the ArrayList type, which belongs to the System.
Using .
7 Using .NET with VEE Figure 168 .
7 Using .NET with VEE Figure 169 Namespaces Selection List If you have not imported a namespace for a class, the formula templates generated for the static members and enumerations for that class will contain fully qualified type names. This will make your formula boxes much larger.
7 Using .NET with VEE VEE and Primary Interop Assemblies When you choose the COM tab in Device ⇒ .NET Assembly References, VEE goes through the registry and finds all registered COM type libraries on your machine. As you select COM type libraries, if the library has a PIA and the PrimaryInteropAssemblyCodeBase key for the COM type library is registered, then the PIA location is shown in the Function & Object Browser description area.
7 Using .NET with VEE Programming Practices Converting Data Types Between .NET and VEE VEE converts data types between VEE and .NET automatically for all data types that both VEE and .NET natively support. For example, Int16, Int32, Real64, etc. You may wish to “undo” this automatic conversion so you can use the data as a true .NET object. In those cases, you can use the new asClrType() type conversion function to convert a VEE data type to a .NET/CLR type.
7 294 Using .NET with VEE System.Char Object You can use a System.Convert.To* method to convert it to a .NET data type that VEE can convert automatically, e.g., ToInt32(). System.DateTime Object See examples\dotnet\DateTime.vee. System.Decimal Object You can use a System.Convert.To* method to convert it to a .NET data type that VEE can convert automatically, e.g., ToInt32(). If the value does not fit in an Int32, an error 751 will occur indicating a System.OverflowException. The System.
7 Using .NET with VEE System.String Text VEE automatically converts String to Text. If you want to use the many useful functionalities in the System.String class, you may use asClrType() to convert the text back to System.String, e.g., Set dotNetString = asClrType(veeText, System.String); ModifiedString = dotnetString.Replace(“ “,”_”); Also see examples\dotnet\ stringsplit.vee for an example System.UInt16 Object You can use a System.Convert.To* method to convert it to a .
7 Using .NET with VEE Real32 System.Single Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation. Real64 System.Double Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation. Text System.String Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation. UInt8 System.Byte Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation. System.
7 Using .NET with VEE System.Char Array Object The VEE object holds a pointer to a System.Array .NET object. You can use the formula CreateInstance(“mscorlib”,”System.String”, charArray).ToString(); to convert an array to a .NET data type that VEE can convert automatically. System.DateTime Array Object The VEE object holds a pointer to a System.Array .NET object. System.Decimal Array Object The VEE object holds a pointer to a System.Array .NET object. You can use a System.Convert.
7 Using .NET with VEE System.SByte Array Object The VEE object holds a pointer to a System.Array .NET object. You can use a System.Convert.To* method to convert each array member to a .NET data type that VEE can convert automatically, e.g., ToInt16(). System.Single Array Real32 Array System.String Array Text Array VEE automatically converts String to Text. If you want to use the many useful functions in the System.String class, you can use asClrType() to convert the text array back to a System.
7 Using .NET with VEE Table 34 Convert From VEE Data Type Converting VEE array data types to .NET data types in VEE 7.0 Convert To .NET Data Type * Notes Int16 Array System.Int16 Array Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation. Int32 Array System.Int32 Array Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation. Real32 Array System.Single Array Use asClrType() to convert to other .NET/CLR types. See asClrType() documentation.
7 Using .NET with VEE Table 35 .NET data type modifiers ref, out, ByRef .NET Data Type Modifers VEE Type Either scaler or array of the type indicated by the mapping table above Notes Use the VEE keyword ByRef. Not using the ByRef keyword will not cause a .NET operation exception, but the passed-in parameter will not be changed. This is probably not what the .NET class designer intended. Calling an Instance Method When calling an instance method, be sure to declare and create the .NET object first.
Using .NET with VEE 7 Calling a Shared/Static Method When you call a .NET member, if the member is Shared/Static, the word STATIC appears in the Function & Object Browser description box. Static methods are called on a .NET class directly, not on an object. Thus, you do not need to create a .NET object first. Figure 171 illustrates an example. Figure 171 Static Method without Namespace Imported If you imported the namespace System.
7 Using .NET with VEE • The formula template generated for Instance members always begins with a lower case letter. Static members have a fully qualified name (namespace plus classname) unless their namespace has been imported. • When you call a .NET member, if the member is Static the word STATIC appears in the description box. Static methods are called on a .NET class directly, not on an instance of an object. Thus, you do not need to create a .NET object first. • Enums in .
Using .NET with VEE 7 5 Highlight the OpenFileDialog Type and the Constructor Member. Select Create Instance. Figure 173 Function & Object Browser Creating an Instance 6 Declare a global variable named openFileDialog and set its type to Object. 7 Since you have declared openFileDialog as a global variable, delete the openFileDialog output pin from the CreateInstance formula box. 8 Change the title of the CreateInstance(“System.Windows.
7 Using .NET with VEE “System.Windows.Forms.OpenFileDialog”) Formula object to Open File Dialog. Within the object do the following steps: a Set the directory where the program will open the dialog box. b Set the openFileDialog property Multiselect to True. (Tip: You will need asVariantBool or asClrType to get System.Boolean). This lets you choose multiple files from the Open File Dialog Box. c Set up the file extension filter, in this case DLL files.
Using .NET with VEE 7 Figure 174 openFileDialog Program Lab 7-2: Using .NET to Perform DateTime Operations Use both instance and static members of the .NET type DateTime. .NET’s DateTime type provides more functionality than VEE’s DateTime functions.
7 Using .NET with VEE the week, current year, and to query whether it is a leap year. The complete example is found in examples\dotnet\ DateTime.vee. 1 Select Device ⇒ .NET Assembly References. 2 From the .NET tab, select the mscorlib checkbox. Choose OK. 3 In the Import .NET Namespaces dialog box, select the System checkbox. Choose OK. 4 Open the Function & Object Browser and select .NET/CLR Objects. 5 Highlight the System namespace. 6 Highlight the DateTime type and the static property Now.
7 Using .NET with VEE Figure 175 Step 10 of Lab 7-2 13 Repeat step 4 and 5, highlight the DateTime type and the property Year. Choose the Create Get Formula button. 14 Wire the result pin of DateTime.Now formula box to the dateTime input pin of the dateTime.Year formula box. 15 Add an Alphanumeric and wire its input pin to the output pin of the dateTime.Year formula box. 16 Repeat step 4 and 5, highlight the DateTime type and the static method IsLeapYear. Choose the Create Call button.
7 Using .
7 Using .NET with VEE Lab 7-3: Using .NET to Get File Information The .NET System.IO namespace provides a tremendous amount of functionality for dealing with the file system. This functionality is more accessible than ever. In this exercise, you will query a file about its creation time, last access time, and length. The complete example is in examples\dotnet\ FileInfo.vee. 1 Choose Device ⇒ .NET Assembly References. 2 From the .NET tab, select the mscorlib checkbox. Choose OK. 3 If the Import .
7 Using .NET with VEE 11 Repeat steps 8 and 9 to create and wire the formula box for the fileInfo.LastAccessTime property. 12 Add an Alphanumeric and wire it to the output pin of the fileinfo.LastAccess formula box. 13 Repeat steps 8 and 9 to create and wire the formula box for the fileInfo.Length property. 14 Add an Alphanumeric and wire it to the output pin of the fileinfo.Length formula box.
7 Using .NET with VEE .NET and IVI Drivers What is IVI? IVI is a new instrument driver standard being developed by the IVI Foundation. The IVI Foundation is a consortium established to promote specifications for programming test instruments. These specifications provide multiple benefits but primarily make instrument interchangeability simpler. For a review of the IVI Foundation, go to http://www.ivifoundation.org/.
7 Using .NET with VEE For further information about IVI- COM, connect to www.agilent.com/find/adn. Login in, go to the Knowledge Library, and choose IVI- COM information. There are many white papers at this location.
7 Using .NET with VEE Assemblies Installing a New Assembly Assemblies are the basic building blocks of the .NET Framework. They take the form of an executable (.exe) or dynamic link library (.dll) file. Assemblies may be installed in the Global Assembly Cache (GAC). You will need the appropriate privileges and need to use extra caution as the GAC is a machine wide resource. The assemblies installed in the GAC are seen by all the applications on your computer. (Please refer to MSDN for more details.
7 Using .NET with VEE Distributing the VEE Runtime If your VEE program references shared assemblies (the ones installed in the GAC), you will need to install those assemblies to the destination machine's GAC. If the shared assembly is a Microsoft .NET Framework assembly, then the assembly should have been installed when the Microsoft .NET Framework redist package was installed. NOTE The .NET Framework redist package needs to be installed before installing the VEE Runtime.
7 Using .NET with VEE VEE and .NET Security VEE’s use of the .NET Framework introduces one security issue. If you see the following dialog box, make the following adjustments to your .NET Framework security profile: 1 Go to your system drive 2 Go to directory \[winnt or windows]\Microsoft.NET\ Framework\v1.1.
7 Using .NET with VEE .NET Terminology You will find these terms throughout the chapter, so use these Microsoft definitions as a resource while you read or you can review them now. Assembly “Components are packaged in assemblies. Assemblies are the reusable, versionable, self- describing building blocks of .NET applications. The simplest assembly is a single executable that contains all the information necessary for deployment and versioning. An Assembly is the fundamental building block of the .
7 Using .NET with VEE Reference To use an Assembly, you must add a reference to it. Class “If you are familiar with object- oriented programming, you know that a class defines the operations an object can perform (methods, events, or properties) and defines a value that holds the state of the object (fields). Although a class generally includes both definition and implementation, it can have one or more members that have no implementation. An instance of a class is an object.
7 Using .NET with VEE Chapter Checklist You should now be able to perform the following tasks. Review topics, if necessary, before proceeding to the next chapter. • Know the basic terminology of .NET • Know how to import a namespace into VEE • Define a PIA • Know how to distribute the VEE Runtime • Know how to adjust .
Integrating Programs for the PC Chapter 8 8 Integrating Programs for the PC Overview 321 Understanding the Execute Program Object 322 Using a System Command 324 Chapter Checklist 328 VEE User’s Guide 319
8 Integrating Programs for the PC Chapter Integrating Programs In Other Languages In this chapter you will learn about: • The Execute Program object • Using operating system commands from VEE • Making VEE programs portable across platforms Average time to complete: 30 minutes 320 VEE User’s Guide
Integrating Programs for the PC Chapter 8 Overview In this chapter, you will learn the easiest way to integrate compiled programs and operating system commands with VEE. One of the great advantages of VEE is that it integrates well with other applications and programs. Furthermore, by using ActiveX, you can use components from other programs. (For more information, refer to the Chapter , “Creating Reports Easily Using ActiveX.
8 Integrating Programs for the PC Chapter Understanding the Execute Program Object In addition to ActiveX Automation, there are three ways to run programs in other languages from VEE: 1 Use the Execute Program object to escape VEE and run another program, application, or operating system command. This method is the most versatile and easy to use. 2 Link compiled functions in other languages to VEE through Dynamic Link Libraries on the PC.
8 Integrating Programs for the PC Chapter • Any document or URL with a recognized extension. The “open” action is invoked in the files. If an “open” action does not exist, the default action is invoked with the file. An example of a URL would be http://www.agilent.com/find/vee. The fields in the Execute Program Object are: Table 36 VEE User’s Guide Execute Program Object Fields Field Name Description Run Style Determines the window size.
8 Integrating Programs for the PC Chapter Using a System Command To call a compiled program in another language, you can type in the executable file and any parameters in the Execute Program object. However, to execute an MS DOS system command, you must first run the DOS command interpreter. In this exercise, you will run the DOS command interpreter and execute an MS DOS system command. Lab 8-1: Using a System Command 1 Select I/O ⇒ Execute Program.
Integrating Programs for the PC Chapter 8 3 Double- click the transaction bar to get the I/O Transaction box. a Change REAL64 FORMAT to STRING FORMAT. b Change SCALAR to ARRAY 1D. c Click on the SIZE: (10) field to toggle it to TO END: (*), then click OK. The transaction bar should now read: READ TEXT x STR ARRAY:* . This transaction will read the contents of the bob file. 4 Select Display ⇒ Logging AlphaNumeric and connect its data input pin to the From File data output. 5 Run the program.
8 Integrating Programs for the PC Chapter Writing Programs That Port Easily If you plan to integrate programs in other languages, write the VEE programs so they port easily to other operating systems. VEE includes system information objects in Function & Object Browser ⇒ System Information, as shown in Figure 180. These objects can also be used as functions.
8 Integrating Programs for the PC Chapter Table 37 System Information Functions Function Name Description installDir Specifies the VEE installation directory. whichOS Determines the operating system and sends out one of the following strings: Windows_98, Windows_2000, Windows_NT, Windows XP. The program can branch based on these results when incorporating programs in other languages. For example, look at manual49.
8 Integrating Programs for the PC Chapter Chapter Checklist You should now be able to perform the following tasks. Review topics, if necessary, before going on to the next chapter. • Explain the purpose of the Execute Program object. • Give an overview of the configuration settings on the Execute Program object. • Explain the general process of how the Execute Program object sends data to/from a program on a PC platform. • Run operating system commands from VEE.
Using Agilent VEE Functions Chapter 9 9 Using Agilent VEE Functions Overview 331 Using Functions 332 Using Libraries With Agilent VEE UserFunctions 344 Finding Functions in Large Programs 356 Merging Agilent VEE Programs 358 Chapter Checklist 360 VEE User’s Guide 329
9 Using Agilent VEE Functions Chapter Using Agilent VEE Functions In this chapter you will learn about: • Defining a user function • Creating, calling, and editing functions • Creating, merging, importing, and deleting function libraries • Finding functions in large programs • Merging existing VEE programs with tests Average Time to Complete: 1 hour 330 VEE User’s Guide
Using Agilent VEE Functions Chapter 9 Overview In this chapter, you will learn about VEE UserFunctions, compiled functions, and remote functions. Functions are re- usable, modular code that can help you significantly reduce the time it takes to develop tests. By re- using functions that have been created in previous programs, you can leverage existing work, reduce the code size of programs, and make it easier to maintain test programs.
9 Using Agilent VEE Functions Chapter Using Functions Like many programming languages, VEE uses functions to create subprograms that perform specific tasks. The lab exercises in this chapter describe how to create, call, and edit VEE user- defined functions. You will also learn how to create libraries of functions, which can be merged into programs in the development phase or imported at runtime. Defining an Agilent VEE Function There are three types of user- defined functions in VEE.
Using Agilent VEE Functions Chapter 9 • To call a compiled function, you use the Call myFunction object or write an expression within a VEE object. 3 Remote Functions • Similar to UserFunctions, except that they run on a remote host computer connected on your network. The Differences Between UserObjects and UserFunctions In previous chapters, you have already created and used UserObjects.
9 Using Agilent VEE Functions Chapter Creating a UserFunction 1 Select Device ⇒ Formula, delete its default input pin, and change its default expression to ramp(1024,1,1024). This will create a 1024 element array with values from 1 to 1024. 2 Select Device ⇒ UserFunction. Rename it ArrayStats. a Add one data input terminal for the array b Add four data output terminals for the results. c Rename the output terminals: Max, Min, Mean, and Sdev.
9 Using Agilent VEE Functions Chapter Figure 181 The Main and ArrayStats Windows 3 Iconize ArrayStats. It appears as an icon at the bottom of the workspace. 4 Click Device ⇒ Call, open the object menu, and click Select Function as shown in Figure 182. Then click OK. Notice that VEE renames the object automatically and adds the correct pins. Figure 182 Configuring the Pins for Call myFunction 5 Connect the output of Formula to the Call ArrayStats input.
9 Using Agilent VEE Functions Chapter Figure 183 Calling the User Function ArrayStats To use ArrayStats elsewhere in the program, you would click on Device ⇒ Call, open the Select Function box from the object menu, and choose ArrayStats. VEE would automatically rename the object Call ArrayStats, and add the necessary input and output terminals. From the UserFunction object menu, select Generate ⇒ Call to bring up the Call ArrayStats object.
9 Using Agilent VEE Functions Chapter 5 Select Data ⇒ Build Data ⇒ Record and place it to the right side of the ArrayStats window. a Add two data input terminals. b Label the four terminals after the statistical functions: max, min, mean, and sdev. c Connect the four Formula object outputs to the inputs on Build Record. d Rename the Max output terminal X by double- clicking Max, typing the new name, and clicking OK. e Delete the other ArrayStats data output terminals.
9 Using Agilent VEE Functions Chapter NOTE In order to update the number of pins, you must open the object and click Configure Pinout whenever you change the number of inputs or outputs in a UserFunction. Or you can manually update the Call object’s input and output pins, but using Configure Pinout is much simpler. You can use Find to find all the Call objects and expressions that call a UserFunction. For more information, refer to “Finding Functions in Large Programs" on page 356.
9 Using Agilent VEE Functions Chapter Calling a UserFunction from an Expression In this exercise, you will learn how to call ArrayStats from an expression in the Formula object. 1 Select Device ⇒ Formula and replace the default formula with ArrayStats(A). Click Replace in the Call ArrayStats object menu. The Status Bar at the bottom of the VEE screen prompts you to select the replacement object. Click on the Formula object that calls the ArrayStats function.
9 Using Agilent VEE Functions Chapter Notice that the functionality of ArrayStats in the Formula object is exactly the same as it was in the Call ArrayStats object. This example uses a Formula object, but you could call ArrayStats from any input field that accepts expressions, such as the To File object. NOTE When you call a UserFunction from an expression, the UserFunction will only deliver a single output (the uppermost data output pin).
9 Using Agilent VEE Functions Chapter In this exercise, you will learn how to generate the ArrayStats object in the Main program from the ArrayStats UserFunction. 1 In the same example used in Figure 186, double- click the Formula object ArrayStats to delete the object. (You could also select the object menu and select Cut.) 2 In the UserFunction ArrayStats, select the object menu and select Generate ⇒ Formula Call. Figure 187 shows the Generate menu in a UserFunction object menu.
9 Using Agilent VEE Functions Chapter 4 Connect the output from the Formula object to ArrayStats(A), and connect the output from ArrayStats(A) to Record. 5 Run the program. It should look like Figure 188. Open a UserFunction object menu and select the Generate menu to review the other objects that can be placed into a program to call a UserFunction. They include Call, Formula Call (used in this example), If/Then/Else Call, ShowPanel, and HidePanel objects.
Using Agilent VEE Functions Chapter 9 Program Explorer Figure 189 Program Explorer Icon on the Toolbar Figure 190 shows the Program Explorer being used.
9 Using Agilent VEE Functions Chapter Using Libraries With Agilent VEE UserFunctions To leverage existing VEE test programs, you can re- use UserFunctions. When you save a program, the UserFunctions are automatically saved as well. A UserFunction can hold a VEE program or a library of logically related UserFunctions. There are two ways to put existing UserFunctions into a new program: Put a copy of the original UserFunctions into the current program, using the File ⇒ Merge Library...
9 Using Agilent VEE Functions Chapter Creating a Library of UserFunctions 1 Create the top level program (without programming the details of the UserFunctions). a Create four UserFunctions: BuildRecAry with one output pin, ReportHeader, ReportBody with one input pin, and ReportDisplay. Iconize all the UserFunctions. b In Main, create four Device ⇒ Call objects configured and connected as shown in Figure 191. Save the program as Report.vee. Figure 191 Report.
9 Using Agilent VEE Functions Chapter The four UserFunctions are a library. You can see them listed by clicking Edit ⇒ Edit UserFunction.... Click Cancel to close the list box. 2 Program the four UserFunctions as shown in the following figures. Figure 192 shows the BuildRecAry UserFunction. It includes a Formula object with the triadic expression testing if A<=5. If the expression evaluates to TRUE, then the object outputs "PASS". Otherwise, the object outputs "FAIL".
Using Agilent VEE Functions Chapter 9 Figure 193 shows the ReportHeader UserFunction. Figure 193 The ReportHeader UserFunction Figure 194 shows the ReportBody UserFunction. Note the array of records A[B]. As the Value of B changes from 0 to 1 to 2, you can access the particular field in that Record, including Value, Limit, and PassFail, using the . notation. Note that the For Count outputs start with zero. Note also that the first transaction has EOL off.
9 Using Agilent VEE Functions Chapter Figure 194 The ReportBody UserFunction Figure 195 shows the ReportDisplay UserFunction in detail view. Note that it reads a string array to the end of the file, specified by the asterisk sign (*) after the STR ARRAY format.
Using Agilent VEE Functions Chapter 9 Figure 195 The ReportDisplay Detail View Figure 196 shows the panel view of the ReportDisplay UserFunction with Show Panel on Execute selected in the Properties box. In the Properties box, the Pop- up Panel Title has also been changed to ReportDisplay. To create the panel, select the Confirm (OK) and Logging AlphaNumeric objects, and click Edit ⇒ Add to Panel. Note that the Logging AlphaNumeric display has Show Title Bar deselected.
9 Using Agilent VEE Functions Chapter Figure 196 The ReportDisplay Panel View Creating Another Program and Merging in the Library In this exercise, you will create a new program and merge the library into it. This exercise builds a library of functions for generating reports. The new program contains a Note Pad object explaining each function in the library. It will be named RepGen.
9 Using Agilent VEE Functions Chapter 3 Select Display ⇒ Note Pad and type the UserFunction descriptions similar to the ones shown in Figure 197. Then save the program as RepGen.vee. NOTE You can save a “program” of UserFunctions for the purpose of creating a library, even though there is no actual VEE program calling the functions. Figure 197 The RepGen.
9 Using Agilent VEE Functions Chapter Table 38 Import Library Fields Import Library Fields Description Library Type The menu in the Library Type field allows you to select a UserFunction, a Compiled Function, or a Remote Function. In this case you want a UserFunction library, so leave the default. Library Name The Library Name shows myLib as a default. This name is used as a “handle” by the VEE program to distinguish between different libraries being imported.
Using Agilent VEE Functions Chapter 9 4 Select Device ⇒ Call and place it below the Import Library object. Connect the output sequence pin from Import Library to input sequence pin on the Call object. 5 Open the Call Function object menu and click Select Function to show a list of the functions imported with the Load Lib command. Select myLib.BuildRecAry as shown in Figure 198.
9 Using Agilent VEE Functions Chapter 7 Select Device ⇒ Delete Library and place it below the Call object. Connect the sequence pins, so the library is deleted after the BuildRecAry function has been called. You can leave the default Library Name, since this is the same name you used with the Import Library object. 8 Run the program. It should look like Figure 199. Save the program as libraries.vee.
Using Agilent VEE Functions Chapter 9 • If two imported libraries have the same function names, the results will be indeterminate. Notice that the Call object uses the Library name myLib.BuildRecAry, so there is no confusion. Even if there were another local function or other imported function with the same name, this specifies the name and location of BuildRecAry.
9 Using Agilent VEE Functions Chapter Finding Functions in Large Programs VEE provides a Find feature located in the Edit menu to help you locate objects and text in a large program. For example, open the Solitaire.vee program in the Examples\Games directory. Go to the detail view and click Edit ⇒ Find... to display the dialog box shown in Figure 200. Figure 200 The Find Dialog Box Type makeamove (a UserFunction in the Solitaire.vee program), as shown in the figure, and click Find.
Using Agilent VEE Functions Chapter 9 Figure 201 The Find Results Dialog Box You can use Find to locate any object or text such as variables, titles, settings on objects, etc. Double- click on any line in the Find Results box to locate an object. NOTE VEE User’s Guide Find can also be used by placing the mouse pointer over objects in the Program Explorer and clicking the right button. This will limit the scope of the search to the particular UserFunction or UserObject.
9 Using Agilent VEE Functions Chapter Merging Agilent VEE Programs The easiest way to leverage existing programs is to merge a past program with the current test. You can re- use programs by merging them and then editing them to suit your current needs. The File ⇒ Merge... command adds the contents of a program or set of saved objects into the work area while keeping the existing contents of the work area. By default, File ⇒ Merge... displays a directory of programs that are shipped with VEE.
Using Agilent VEE Functions Chapter 9 Figure 202 Merging the BarChart Program Notice that the Bar Chart Display takes a one- dimensional array and displays the values as vertical bars. It uses the number of bars necessary to display the values in the array. To see how the program is created, open the detail view of the display. You can look at examples in the library directory for more ideas about programs. NOTE VEE User’s Guide The File ⇒ Merge command is used to merge in UserObjects and objects.
9 Using Agilent VEE Functions Chapter Chapter Checklist You should now be able to perform the following tasks. Review topics, if necessary, before going on to the next chapter. • Define a UserFunction and compare it to a Compiled Function and a Remote Function. • Create, call, and edit a UserFunction. • Create, merge, import, and delete UserFunction libraries. • Use the Find feature in one of the game programs. • Merge an entire VEE program with the current program.
Test Sequencing Chapter 10 10 Test Sequencing Overview 363 Using the Sequencer Object 365 Creating a Test Execution Order 366 Passing Data in the Sequencer 377 Analyzing Data from the Sequencer 389 Storing and Retrieving Logged Data 393 Chapter Checklist 396 VEE User’s Guide 361
10 Test Sequencing Chapter Test Sequencing In this chapter you will learn about: • The Sequencer object • Configuring a test for the Sequencer • Creating a test execution order based on run time results • Accessing data logged by the Sequencer • Ways to pass data to or from Sequencer tests • Performing analysis on logged data from the Sequencer • Storing Sequencer test data Average time to complete: 2 hours 362 VEE User’s Guide
Test Sequencing Chapter 10 Overview In this chapter, you will learn the fundamentals of using the Sequencer object. The Sequencer object can execute a series of sequence transactions, each of which may call a UserFunction, Compiled Function, or Remote Function. Typically, the Sequencer is used to perform a series of tests.
10 Test Sequencing Chapter NOTE 364 In addition to the lab exercises in this chapter, you can get more practice in using the Sequencer by completing the exercise in “Test Sequencing" on page 541 in Appendix , “Test Sequencing 541.
Test Sequencing Chapter 10 Using the Sequencer Object The Sequencer object executes tests in a specified order based on runtime results. Each test may be a VEE UserFunction, a Compiled Function, a Remote Function, or any other expression which returns a single result. That result is compared to a test specification to determine whether or not it passes. The Sequencer then uses a pass or fail indicator to determine the next test it should perform.
10 Test Sequencing Chapter Creating a Test Execution Order In this lab you will simulate test results using the random() function, establish a test execution order, learn how to modify that order, and retrieve specific data from the logged results. Lab 10-1: Configuring a Test NOTE The example explains how to implement the random() function with a certain range of test results expected, but you can use the same principles to configure other tests.
Test Sequencing Chapter Table 39 10 Sequencer Transaction Fields Field Name Description SPEC NOMINAL: Represents the expected test value. The default is .5. Change this to .25, and then alter the upper RANGE field (on the far right) from 1 to .5. FUNCTION: The default entry testFunc(a) holds the actual function that performs the test. In this case, replace the default field with the random()function. Random() will return a Real64 value between 0 and 1 simulating a test result.
10 Test Sequencing Chapter Click OK to close the dialog box. You will see the transaction test1 0 <= (.25) <= .5 on the first transaction bar. This means that test1 will pass if the returned value is in the range from 0 to .5 with the end points included. The expected result is about .25. 4 Run the program. It should display the name of the test, the test result, and the pass- fail indicator (1 for PASS, 0 for FAIL) in the display, as shown in Figure 204.
Test Sequencing Chapter Table 40 10 Sequence Transaction Dialog Box Sequence Transaction Field Description TEST: Unique name used to reference the test in the Sequencer. The default names start with test1 and increment with each test. Choosing TEST: means that a test result will be compared to specifications and branching will occur to the next test based on the configuration. The TEST: button toggles to EXEC:.
10 Test Sequencing Chapter Table 40 Sequence Transaction Dialog Box Sequence Transaction Field Description FUNCTION: Specifies the test to run. You can call UserFunctions, Compiled Functions, Remote Functions, or you can write in an expression to be evaluated. The result of the function you call (or expression you evaluate) is tested against the specifications. If a UserFunction returns more than one value, VEE assumes the top output pin holds the result to be tested.
10 Test Sequencing Chapter Table 40 VEE User’s Guide Sequence Transaction Dialog Box Sequence Transaction Field Description THEN CONTINUE Determines test branching.The drop-down menu THEN CONTINUE (for IF PASS and IF FAIL) contains six branching options: • THEN CONTINUE executes the next test configured in the Sequencer. • THEN RETURN: tells VEE to stop executing tests and put the specified expression on the Return output pin of the Sequencer. • THEN GOTO: jumps to the test named in its field.
10 Test Sequencing Chapter Adding or Inserting or Deleting a Test In this section, you add another test transaction to the Sequencer object. You can use the same random() function to simulate a test result, but this time you will compare the result to a limit instead of a range of values. 1 Double- click below the first Sequencer transaction bar to get the Sequence Transaction dialog box. Fill in the fields as follows: Table 41 Sequencer Transaction Dialog Box Item Description test2 Use the default.
Test Sequencing Chapter Table 42 10 Inserting a Transaction Field Description TEST Change the name field to Insert. FUNCTION Change to random(). Click OK. You will now see Insert 0 <= (.5) <= 1 on the second transaction bar. Run the program to see the three records from the three tests. (You may have to enlarge the display to see all the entries.) 3 Now delete Insert by clicking the Insert transaction bar, placing the mouse pointer over the Insert transaction bar, and pressing Ctrl-K.
10 Test Sequencing Chapter Figure 205 A Simple Sequencer Example The braces indicate a Record data type. The Sequencer outputs a Record of Records, as shown in the AlphaNumeric display. This means you could put the sequencer in a loop and run the same sequence of tests several times yielding an array of Records of Records. Accessing Logged Test Data The Sequencer outputs a Record of Records. Each test uses the test name as its field name in the Sequencer record.
Test Sequencing Chapter 10 . Figure 206 A Logged Record or Records The following steps access test results. 1 Open seq1.vee. 2 Select Device ⇒ Formula and place it below the display. Change the expression to Log.Test1.Result. (Remember that VEE is not case sensitive and the capitals in the names are for clarity in documentation.) Change the input terminal name from A to Log. (You could leave the default name A. The formula would then read A.Test1.Result.
10 Test Sequencing Chapter Figure 207 Accessing Logged Data NOTE Each test creates a record, named with the test name, as it executes within the Sequencer. This record can be used in subsequent tests. For example, you could enable test2 if test1 passed (ENABLED IF: test1.pass == 1). If you need to access test data in an expression field while the test is still running, test data is stored in the temporary record thistest. 5 Change the formula to read Log.test1 and run the program again.
Test Sequencing Chapter 10 Passing Data in the Sequencer In this lab, you will create a UserFunction and call it from three different tests. In the first part, you will pass data to the UserFunctions through an input terminal on the Sequencer. In the second part, you will modify the program to use a global variable instead of an input terminal. This will give you a chance to call a function in EXEC mode rather than TEST mode. In the third part, you will learn how to test a waveform output against a mask.
10 Test Sequencing Chapter Figure 208 The Rand UserFunction 5 Save the program as seqdat1.vee. Close the Rand window using the x button on its top right corner. NOTE Closing the window does not remove the UserFunction. If you want to check this, just click on Edit ⇒ Edit UserFunction and you will see Rand come up in a list box of UserFunctions to edit. Or you can iconize the Rand function and you will see the icon for it in the bottom of the VEE screen.
Test Sequencing Chapter 10 Make sure the transaction is highlighted, place the cursor on the transaction bar, press Ctrl-K to cut the test, then press Ctrl-Y three times to paste the test back into the Sequencer. (You could also cut and paste using the object menus.) The default test names will be test1x2, test1x1, and test1. Open the three Sequence Transaction dialog boxes and change these names to test1, test2, and test3 for clarity.
10 Test Sequencing Chapter Figure 209 Passing Data Using an Input Terminal As the number of tests increases, passing data using an input terminal requires more and more input pins. To reduce the input pins, you could pass records to input terminals and use individual fields in the records for the separate tests. You could also use a separate UserFunction to set up global variables, which can then be called by other UserFunctions or any expression field within the program.
10 Test Sequencing Chapter To display the function on the screen for an operator to select a number, add a pop- up panel view. Include a Confirm (OK) button, so that the panel remains on the screen until the operator has made a selection. (It is also possible to do these tasks with a Real Input Dialog Box inside the global() UserFunction.) 7 Select Flow ⇒ Confirm(OK) and place it above the Real64 Slider object. Connect the OK data output pin to the Real64 Slider sequence input pin.
10 Test Sequencing Chapter Open the UserFunction Properties window. In the General folder under Pop- up Panel, set the ShowPanelonExecute property to True. Figure 210 shows the UserFunction in detail view, and Figure 211 shows the panel view.
Test Sequencing Chapter 10 Figure 211 The Global UserFunction (Panel) 10 Save the program as seqdat2 and run it. When the pop- up panel appears, select a value and press OK. It should look like Figure 212. NOTE VEE User’s Guide The pop-up panel will appear in the center of the screen by default. To move it, click and drag the title bar.
10 Test Sequencing Chapter Figure 212 Passing data Using a Global Variable Comparing a Waveform Output with a Mask In this exercise, you will create a UserFunction called noisyWv and call it from a single transaction bar in the Sequencer. The operator will be able to vary the amplitude of the wave from 0 to 1.
Test Sequencing Chapter 10 waveform. You will use the Coord object in the Data ⇒ Constant menu to create a straight line mask at 0.6, which the Sequencer will use to test the noisy waveform. 1 Create the UserFunction called noisyWv, as shown in Figure 213 in the Detail view. Figure 213 The noisyWv UserFunction (Detail) 2 Press Ctrl and click on the OK button, the Real64 Slider, and the Note Pad to highlight them for creating a Panel view. Select Edit ⇒ Add To Panel.
10 Test Sequencing Chapter Figure 214 The noisyWv UserObject (Panel) 3 Select Device ⇒ Sequencer and place it left- center of Main. Add a data input terminal and name it mask. 4 Click the transaction bar to get the Sequence Transaction dialog box. Change fields as follows: Table 43 Sequence Transaction Dialog Box Field Description FUNCTION Type in noisyWv(). RANGE Click and select LIMIT from the pop-up menu. Leave the <=, and the LIMIT terminal name field type mask.
10 Test Sequencing Chapter 5 Select Data ⇒ Constant ⇒ Coord and place it above the Sequencer. Connect its output to the Sequencer input terminal mask. Open the Coord object menu, click Properties, and set fields as follows: Table 44 Properties of the Coord Object Property Description DataShape Set to 1D Array. ArraySize Type in 2 (you only need two pairs of coordinates to specify a straight line.) 6 In the Coord object, you now see two indices for pairs of coordinates.
10 Test Sequencing Chapter 8 Save the program as seqdat3 and run it. It should look like Figure 215. Figure 215 Comparing a Waveform to a Mask This completes the exercises about passing data with the Sequencer. In the next exercise, you will learn how to access and analyze data from several iterations of the Sequencer.
Test Sequencing Chapter 10 Analyzing Data from the Sequencer As mentioned earlier, Sequencer data comes out as a record of records. In many cases, however, the Sequencer may run through a series of tests several times. This generates an array of records. Each record represents one run through the Sequencer and holds other records, representing each test within a run. The easiest way to visualize this is to imagine a cube of data in memory, as shown in Figure 216.
10 Test Sequencing Chapter • Within the record Test1 there are three fields: Name, Result, and Pass. The same holds for the record Test2. • Therefore, Log.Test1.Result gives an array of four values, each representing one of the four runs. Log[0].Test1.Result outputs a scalar value, the Result of Test1 in the first run (Log[0]). The logged array of records simplifies analyzing and investigating the data. For example, you might want to know how many tests passed in a particular run.
Test Sequencing Chapter 10 Now use the Formula object to extract part of the data to analyze. This exercise uses the results of test1 for all three runs as an example, and finds the mean of that array. 4 Select Device ⇒ Formula and place it below the display. Connect the Formula input pin to the output of the Collector. Change the Formula input field to read: a[*].test1.result. Connect a mean(x) object to Formula, and an AlphaNumeric display to mean(x). The a refers to the array on the input terminal A.
10 Test Sequencing Chapter Although this exercise accesses a single array, the principle is the same for extracting other arrays of data from the Sequencer output. Note that you can easily change which fields are saved for each by opening the Logging folder in the Sequencer Properties dialog box.
Test Sequencing Chapter 10 Storing and Retrieving Logged Data This exercise shows how to use the To/From File objects and To/From DataSet objects. Lab 10-4: Using the To/From File Objects with Logged Data 1 Open the seqdat2 file and delete the data line to the display. 2 Select Flow ⇒ Repeat ⇒ For Count and place it to the left of the Sequencer. Change the For Count number to 3, and connect its data output pin to the sequence input pin on the Sequencer.
10 Test Sequencing Chapter Figure 218 Storing Logged Data with To/From File Using the To/From DataSet Objects with Logged Data Since you are storing test data as records, you may prefer to use the To/From DataSet objects. In this case you do not need a Collector, because you can append each run of the Sequencer to the end of the DataSet. Modify the last program to look like Figure 219. The To/From DataSet objects are in the I/O menu. Notice the sequence line going into From DataSet.
10 Test Sequencing Chapter One reason you might use the To/From DataSet objects to collect data instead of the To/From File objects is because you can convert the data to useful information with the Search Specifier feature in the From DataSet object. NOTE Remember to change the Get records field in From DataSet from One to All.
10 Test Sequencing Chapter Chapter Checklist Use the following checklist to determine whether there are topics you need to review before going on to the next chapter. • Describe the Sequencer object conceptually. • Configure a test for the Sequencer. • Add, insert, and delete operations for a Sequencer test. • Access logged data from the Sequencer. • Use Sequencer input terminals to pass data to tests. • Use Global variables to pass data to tests. • Compare a waveform output to a mask.
Using Operator Interfaces Chapter 11 11 Using Operator Interfaces Overview 399 Key Points Concerning Operator Interfaces 400 Using Operator Interface Objects 403 Common Tasks In Creating Operator Interfaces 419 VEE User’s Guide 397
11 Using Operator Interfaces Chapter Using Operator Interfaces In this chapter you will learn about: • Building operator interfaces • Using menus for an operator • Importing bitmaps to add clarity • Securing test programs • Operator interface features • Using ActiveX Controls to extend capabilities of VEE Average Time To Complete: 2 hours 398 VEE User’s Guide
Using Operator Interfaces Chapter 11 Overview In this chapter, you will learn more about operator interfaces, including adding menus, customizing interfaces, adding warning signals, and importing bitmaps. This chapter expands on the exercises in previous chapters, where you created operator interfaces and pop- up panels.
11 Using Operator Interfaces Chapter Key Points Concerning Operator Interfaces This section is an overview of how to create an operator interface in VEE. Creating an Operator Interface VEE includes a wide range of selection controls, pop- up dialog boxes, indicators, and displays to create operator interfaces. Selection controls include items such as buttons, switches, check boxes, drop- down menus, and list boxes.
Using Operator Interfaces Chapter 11 Moving Between Panel View and Detail View To move between the Panel view and the Detail view of a VEE program, click the panel or detail icon on the title bar of the window as shown in Figure 220. NOTE You must create a Panel view of the program to have the panel view button displayed in a window title bar. Typically, you develop the program in Detail view and then create a Panel view for the operator interface.
11 Using Operator Interfaces Chapter In panel view, you can choose different colors and fonts to add emphasis, and scalable bitmaps to add clarity. You can also document the panel view for the operator by editing title bars, using the Note Pad and Label objects, and using the Description option in the object menus. Figure 221 shows some of the VEE indicators available.
Using Operator Interfaces Chapter 11 Using Operator Interface Objects This section introduces the operator interface objects and options that are available in VEE. You can skim through this section to get an idea of the items you can choose to create operator interfaces for programs, and how you can customize them. Then do the lab exercises to see how to set up operator interfaces for some common tasks.
11 Using Operator Interfaces Chapter Graphic Images You can import bitmaps into the panel view by setting the PanelBackgroundPicture property. VEE imports *.jpeg, *.png, *.wmf, *.GIF, and *.bmp files to serve as the background for your Main, UserObject, or UserFunction panel. When a bitmap is set as the background picture, other VEE objects will appear on top of the picture. (For more information about how to do this, refer to “Lab 11- 2: Importing Bitmaps for Panel Backgrounds" on page 425.
Using Operator Interfaces Chapter 11 Figure 223 A Cropped Image in VEE NOTE You can also change bitmaps for any icon using the Properties ⇒ Icon tab. Displaying a Control for Operator Input There are various ways to set up a program so that an operator can control it by entering input. You can get user input from pop- up dialog boxes, any data constant, sliders, and knobs. To choose a control, look in menus such as Data ⇒ Selection Control, Data ⇒ Toggle Control, and Data ⇒ Continuous.
11 Using Operator Interfaces Chapter Figure 224 Controls from Various Data Submenus For each of the objects shown in Figure 224, you can also customize the object’s look and feel. For example, see the Real64 Knob Properties dialog box in Figure 225. To configure the object, choose a property such as ForeColor and make selections. NOTE 406 With ActiveX you can also use controls and displays from other applications, as shown in the example “Lab 11-4: Using an ActiveX Control" on page 432.
Using Operator Interfaces Chapter VEE User’s Guide 11 407
11 Using Operator Interfaces Chapter Figure 225 The Properties Dialog Box Displaying a Dialog Box for Operator Input VEE includes built- in pop- up dialog boxes with automatic error checking, prompts, and error messages. They are located under Data ⇒ Dialog Box. For example, a program could require the operator to enter a real number when the program runs. You can include a Real64 Input object in the program that automatically displays a Real64 Input box for the operator when the program runs.
Using Operator Interfaces Chapter 11 Figure 227 An Example of Automatic Error Checking The input boxes for Int32 and Text, which are also located in Data ⇒ Dialog Box, are similar to the Real64 Input. In addition, the Data ⇒ Dialog Box menu includes choices for Message Box, List Box, and File Name Selection. Figure 228 shows a dialog box that pops up to display a message. Figure 228 A Pop-Up Message Box Figure 229 shows a dialog box that pops up for an operator to enter a list.
11 Using Operator Interfaces Chapter Figure 230 shows a dialog box that pops up for an operator to select a file name. Figure 230 A Pop-Up File Selection Box Displaying a Toggle Control for the Operator VEE includes built- in toggle controls that can be used to send out a 0 or a 1. To use a toggle control, set the initial state, and execute a subprogram when the toggle is activated. You can also put custom bitmaps on a Toggle.
Using Operator Interfaces Chapter 11 Figure 231 Switches and Alarms Combined Aligning Objects in the Operator Interface In the panel view, the grid is displayed by default. You can turn the grid off by toggling the PanelDrawGrid property to False. There is also an automatic “snap- to- grid” feature to help align objects. You can display the grid and change the PanelGridSize property from 10 to 1 (10 is the default) to make very accurate alignments, as shown in Figure 232.
11 Using Operator Interfaces Chapter Figure 232 Configuring Panel Properties Other Panel Formatting Features There are additional features that help you create a more professional look for your Panel: Tab Order and Front/Back. With tab order, every object on your panel is assigned a number that represents its order as you tab from one object to another. You can change this order as you like, which makes it easy to change the order that the operator interacts with the Panel objects.
Using Operator Interfaces Chapter 11 For example, you can configure the OK object to act as a softkey. Typically you configure it so that it is attached to one of the Function keys. The operator can then press Function keys to control the program, as shown in Figure 233. Figure 233 A Softkey Executing a UserFunction Figure 234 shows how to configure an OK object using the Properties... dialog box to connect to a function key, Enter, or Esc keys.
11 Using Operator Interfaces Chapter Figure 234 Configuring the Confirm (OK) Object as a Softkey Furthermore, the program can be controlled with the keyboard in panel view. VEE automatically highlights a button for the panel with a dotted outline. If the operator presses Enter, that button will be “pressed.” If the operator is editing a text input area, pressing the Enter key accepts the edit, and pressing the Esc aborts the edit.
Using Operator Interfaces Chapter 11 Table 45 Key Combination Description Ctrl-G Run or Continue (Resume) Ctrl-P Pause Ctrl-T Step Selecting Screen Colors To select screen colors, use the File ⇒ Default Preferences dialog box. Set the VEE environment as desired and save the changes. Figure 235 and Figure 236 show how to change particular screen elements to the desired color.
11 Using Operator Interfaces Chapter Figure 236 Color Selection for Screen Elements Securing a Program (Creating a RunTime Version) To prevent an operator from accidentally altering a program, or to prevent others from seeing how a program works (by displaying it in Detail view), you can create a run time version of a VEE program. Save the original program and the run time version in separate files. NOTE 416 When you create a run time version of a VEE program, the run time version cannot be edited.
Using Operator Interfaces Chapter 11 To create a RunTime version of a VEE program, follow these steps: 1 Create a panel view for the run time version of the program. 2 Save the program so that you have a copy you can edit. 3 Select File ⇒ Create RunTime Version.... VEE will automatically use a *.vxe extension to indicate a run time version. Displaying a Pop-Up Panel During Execution You can cause a panel to pop up when a UserObject or UserFunction executes in a program.
11 Using Operator Interfaces Chapter Figure 237 Creating a Status Panel 418 VEE User’s Guide
11 Using Operator Interfaces Chapter Common Tasks In Creating Operator Interfaces In the following exercises, you will learn how to implement many operator interface features. Specifically, you will learn how create menus, create warnings, create a status panel, and import bitmaps to add more visual impact to programs. All of the labs will give you a chance to customize the interfaces.
11 Using Operator Interfaces Chapter You should now have a picture of a die with one dot on its top. 4 Select Flow ⇒ Confirm (OK) and place it below the die. Connect the Picture sequence output pin to the OK sequence input pin. 5 Select the Picture and the OK objects (press Ctrl and click the objects to create a shadow). Open the pop- up Edit menu by placing the mouse pointer on the background and pressing the right mouse button. Select Add to Panel. 6 Change the UserFunction Title and Panel Title to die1.
Using Operator Interfaces Chapter 11 Figure 238 Early Stage in the Dice Program Create a menu to select one of these three functions to call. 8 Select Data ⇒ Selection Control ⇒ Radio Buttons. Radio Buttons is an object that outputs an enumerated value (the Enum data type: a text string with an ordinal number associated to it) from a user- defined list on its upper output pin.
11 Using Operator Interfaces Chapter ordinal position appears on the lower output pin. Read the Help entry in the object menu for a more detailed explanation. 9 Open the Radio Buttons object menu and select Edit Enum Values.... Type in the names of the functions die1, die2, and die3 by pressing the Tab key between each entry except the last. Click OK. NOTE There are six menu formats for data selection control. Radio Buttons displays entries as buttons.
11 Using Operator Interfaces Chapter Figure 239 The Dice Program (Detail View) NOTE The Call input terminal requires a Text Scalar, so VEE converts the Enum Scalar to a Text Scalar. Remember the dotted line indicates a control pin. When Auto Execute is turned on, Radio Buttons executes whenever you make a change to it and sends the selection to Call. The control pin on Call Function replaces the function name as soon as the pin receives data.
11 Using Operator Interfaces Chapter The program should look like Figure 240 when executing. Figure 240 The Dice Program (Panel View) There are a few things to note before the next lab exercise: • You can use the same techniques in the exercise above to create menus for any program. • Radio Buttons could also be used to select a compiled language program by using the Execute Program object with a control pin (“Command”) that indicated the program to call.
Using Operator Interfaces Chapter 11 • You will usually use Run instead of AutoExecute on more complicated programs. You can have the program pause at a data constant or selection control object by using Wait for Input instead of AutoExecute. See Help for more information. Lab 11-2: Importing Bitmaps for Panel Backgrounds Bitmaps are not essential to your programs, but they can add clarity and impact to tests. For example, you might want to import a schematic to better illustrate what is being tested.
11 Using Operator Interfaces Chapter Table 46 Label Object Properties Label Properties Description Title: Change to Bitmap Function. Justification Change to Center. BackColor Select Light Gray and click OK. Font Choose a larger font with bold type, and click OK. Check Automatically Resize Object on Font Change. Border Click on Raised. Click OK to make the changes and close the Properties dialog. 7 Position the title Bitmap Function and the OK button as desired.
Using Operator Interfaces Chapter 11 Lab 11-3: Creating a High Impact Warning This exercise includes several UserFunctions that are nested. The first UserFunction is the alarm itself, which displays a red square and beeps. The second UserFunction calls the alarm repeatedly creating a blinking light effect and a pulsing sound, until the operator turns the alarm off. Begin by programming the alarm function. 1 Select Device ⇒ UserFunction. Change the name to alarm.
11 Using Operator Interfaces Chapter 6 Select Flow ⇒ Delay, set it to 1, and connect its sequence input pin to the Color Alarm sequence out pin. The alarm will then last one second. 7 Select Display ⇒ Note Pad and remove the template. Add the message: TURN OFF INSTRUMENTS!. Size the Note Pad as needed. 8 Go to the Main window. Choose Device ⇒ Call, choose Select Function from the Call object menu, and select alarm. Run the program to test it.
Using Operator Interfaces Chapter Table 47 11 Notepad Properties Property Description ShowTitleBar False EditEnabled False Border Change to a Raised border. 10 Change the Color Alarm to a Raised Border as well. 11 Click on open space within UserFunction to get the Properties dialog box, and select ShowPanelonExecute. Set the property ShowTitleBar to False. Change the Panel Title to alarm. Iconize alarm. 12 Go to the Main window and delete the Call object.
11 Using Operator Interfaces Chapter This creates an input object that uses a Check Box. If the operator clicks the box, an X will appear and the object outputs a 1; otherwise, the object outputs a 0. The output can be tested with an If/Then/Else object to tell VEE what to do next. 18 Select Flow ⇒ If/Then/Else and place it to the right of the Toggle. Connect the Toggle data output to the data input A of the If/Then/Else object. Edit the expression in the If/Then/Else object to: a == 1.
Using Operator Interfaces Chapter 11 21 Open the warning UserFunction Properties box, select ShowPanelonExecute, set the ShowPopupPanelTitle to False (since the title serves no purpose to the operator). 22 Go to Main and click Device ⇒ Call, open its object menu, click Select Function, then select warning. Move the Call object to the top center of the screen. Iconize the Main window.
11 Using Operator Interfaces Chapter Figure 244 The Warning Program Lab 11-4: Using an ActiveX Control This lab shows how to use an ActiveX Control within VEE. You can incorporate ActiveX Controls from other applications into VEE programs. In this case, you will incorporate a ProgressBar control and use a loop to show the progress bar 0% to 100% complete. The same general principles apply to other ActiveX Controls. 1 Click Device ⇒ ActiveX Control References...
Using Operator Interfaces Chapter 11 3 Click Device ⇒ Formula & Object Browser, and select ActiveX Objects, Library: MSComcltLib, Class: ProgressBar, Members: Value, and click Create Set Formula. Place the object at top center in the Main window. 4 To loop from zero to one hundred and show the percent complete, you will add a For Range object. Select Flow ⇒ Repeat ⇒ For Range, place the object below the ProgressBar, and set it as follows: From: 0, Thru: 100, and Step:10.
11 Using Operator Interfaces Chapter Examine all the control examples that ship with VEE to get a better understanding of how they work. Then look for other controls and displays in the marketplace you might want to add to enhance the user interface capabilities in VEE. Figure 246 shows another example of VEE incorporating a control from MS Chart.
Using Operator Interfaces Chapter 11 there are a number of tests and you want to see the results as they are returned. You will use the function random(), which returns a real value between 0 and 1, when using the default settings. 1 Click Device ⇒ Sequencer. Double- click the transaction bar, and configure your test using the default name, test1, and replacing the FUNCTION: field with random(). See Figure 247. Figure 247 Configuring Test1 2 Configure a second test the same way named test2.
11 Using Operator Interfaces Chapter Sequencer sequence input pin. ShowPanel outputs a 1 if it succeeded. LogTest is the name of the UserFunction. The other two parameters are X and Y coordinates on your screen starting from the upper left corner. This tells VEE where to place the UserFunction panel when it is shown. (The panel dimensions are not included in this example.) 5 Create the UserFunction named logTest, as shown below. Add an input pin. (The logging Record will be the input.
Using Operator Interfaces Chapter 11 Figure 249 The UserFunction LogTest (Panel) 6 Select hidePanel from the Function & Object Browser box and Flow ⇒ Confirm(OK). Change the hidePanel() parameter to logTest. Delete the input pin. Connect the objects as shown in Figure 250. Figure 250 Status Panel Program (before running) 7 Run the program. It should look like Figure 251.
11 Using Operator Interfaces Chapter Figure 251 The Status Panel Program (running) In summary, the showPanel object displays the UserFunction panel, but does not call the UserFunction. The Sequencer calls the UserFunction twice through its logging function, and each call updates the panel. Then, when the operator is done, he or she can press OK and the panel is hidden. This example uses an OK object to trigger the hidePanel object, but you could put it elsewhere in the program to time its execution.
Using Operator Interfaces Chapter 11 Chapter Checklist You should now be able to perform the following tasks. Review, if necessary, before going on to the next chapter. • Summarize the key points concerning operator interfaces. • Use a menu to select tests on an operator interface. • Import a bitmap for an operator interface. • Create a status panel. • List some of the operator interface features that VEE provides. • Secure a program. • Create a high impact warning.
11 Using Operator Interfaces Chapter 440 VEE User’s Guide
Optimizing Agilent VEE Programs Chapter 12 12 Optimizing Agilent VEE Programs Overview 443 Basic Techniques for Optimizing Programs 444 Overview of Compiled Functions 450 Using Dynamic Link Libraries 453 Agilent VEE Execution Modes 460 The Agilent VEE Profiler 468 Chapter Checklist 470 VEE User’s Guide 441
12 Optimizing Agilent VEE Programs Chapter Optimizing Agilent VEE Programs In this chapter you will learn about: • Basic techniques for optimizing programs • Using Dynamic Link Libraries (DLLs) • Optimizing with compiled functions • Using the VEE Compiler • Using the VEE Profiler Average Time To Complete: 2 hours 442 VEE User’s Guide
Optimizing Agilent VEE Programs Chapter 12 Overview In this chapter, you will learn how to improve the execution speed of VEE programs. There are three basic components in test program performance: the speed of taking the measurement, the rate at which the data is transferred to the computer, and the speed at which the program processes the data. By optimizing the VEE program, you can increase its processing speed. In the first section, you will learn the basic principles for optimizing a VEE program.
12 Optimizing Agilent VEE Programs Chapter Basic Techniques for Optimizing Programs To optimize VEE programs, read the information in this section. You can use the techniques described here to develop good programming habits in VEE. Perform Math on Arrays Whenever Possible Performing mathematical operations on arrays greatly improves program performance. For example, suppose a test must find the square root of measurements being taken.
Optimizing Agilent VEE Programs Chapter 12 Figure 253 Calculating Square Roots using Math Array The difference in the execution speeds of the two programs is due to the time required for an object to execute. There is a fixed amount of overhead when an object executes. Therefore, when you reduce the number of times an object executes by using arrays rather than scalar values, the program runs faster. Using the Do object is a good idea when timing to make sure the timer triggers first in both programs.
12 Optimizing Agilent VEE Programs Chapter such as the Counter, instead of using open views. The example in Figure 254 operates about 46 times faster using an iconic view for the For Count and Counter object. Figure 254 Optimizing Programs by Using Icons Reduce the Number of Objects in Programs As you become more experienced, you will tend to use less objects in VEE programs.
Optimizing Agilent VEE Programs Chapter 12 function call to ramp is nested in the call to randomize, resulting in slightly faster program execution.
12 Optimizing Agilent VEE Programs Chapter Figure 256 Function Calls with Optimization Other Ways to Optimize Agilent VEE Programs There are other optimization techniques that you can use in programs when appropriate, as follows: • Make sure you are using the VEE compiler by running your programs in VEE 4 or higher Execution Mode. For more information, refer to “Agilent VEE Execution Modes” on page 460. • Run the program from the panel view instead of the detailed view.
12 Optimizing Agilent VEE Programs Chapter • Collect data for graphical displays and plot the entire array at once rather than plotting each individual scalar point. If the X values of a plot are regularly spaced, use an XY Trace display rather than an X vs. Y Plot. • Use one If/Then/Else object with multiple conditions instead of multiple If/Then/Else objects. • Set graphical displays to be as plain as possible.
12 Optimizing Agilent VEE Programs Chapter Overview of Compiled Functions You can use a compiled function in a VEE program, such as a DLL (Dynamic Link Library). To do so, you must obtain the compiled function or follow these steps to create it: 1 Write functions in C, C++, Fortran, or Pascal and compile them. 2 Write a definition file for the functions. 3 Create a shared library containing the compiled functions.
Optimizing Agilent VEE Programs Chapter 12 • You need to provide error checking within your compiled function, since VEE cannot trap errors in an external routine. • You must de- allocate any memory you allocated in your external routine. • When passing data to an external routine, make sure you configure the Call object input terminals to the type and shape of data that the routine requires. • System I/O resources may become locked, so your external routine should be able to handle this type of event.
12 Optimizing Agilent VEE Programs Chapter • Reconfigure the Call input and output terminals by selecting Configure Pinout in the object menu. For either method, VEE configures the Call object with the input terminals required by the function, and with a Ret Value output terminal for the return value of the function. In addition, there will be an output terminal corresponding to each input that is passed by reference.
Optimizing Agilent VEE Programs Chapter 12 Using Dynamic Link Libraries On PCs, you can use the compiled functions from Dynamic Link Libraries (DLLs) as a part of a VEE program. DLLs may be compiled functions that you have written yourself (contact Microsoft for documentation about writing DLLs), or DLLs that you have purchased or downloaded from the Web. NOTE VEE supports both the "_cdecl" and "_stdcall" calling conventions. Most customer-written DLLs use the _cdec1 calling convention.
12 Optimizing Agilent VEE Programs Chapter The fields are described as follows: Table 48 NOTE Import Library Fields Field Description Library Name The name VEE uses to identify the library. Generally, this is used if you want to delete the library after it has been used in the program. File Name File that holds the shared library. Definition File The include file with the prototypes of the functions. This is usually a *.h file.
12 Optimizing Agilent VEE Programs Chapter VEE automatically configures the Call object with the function name, and the proper number of input and output pins. The second, third... output pins map to any parameters passed by reference to the function. If you have entered the function name, you can also configure the object by selecting Configure Pinout in the object menu. NOTE You can also call a DLL function from an expression field, provided the library has been loaded.
12 Optimizing Agilent VEE Programs Chapter Figure 259 A Program Using a DLL (MANUAL49) Table 49 Elements of Figure 259 Element Description Import Library Before the first call to the compiled function Call Function, the DLL must be loaded using the Import Library object (in the Device menu). Call Function MANUAL49 calls a compiled function called myFunc. MyFunc requires a C datatype called long, which is the same as a VEE Int32. This number specifies the size of an array.
Optimizing Agilent VEE Programs Chapter Table 49 12 Elements of Figure 259 Element Description totSize The totsize object (in the Math & Functions box) is used to determine the size of the waveform, which is output to the arraySize input pin on Call myFunc.
12 Optimizing Agilent VEE Programs Chapter Figure 260 The Shared Library Name UserObject The whichos() function has been used in a renamed Formula object to identify the operating system. An expanded If/Then/Else object examines the output of the whichos() function, then triggers the appropriate text constant. This filename extension is then added to the MANUAL49 file using a renamed Formula object. (The input terminal on the Formula object labeled shared library has also been changed to ext.
12 Optimizing Agilent VEE Programs Chapter Execute Program Object The Execute Program object has these characteristics: • Easier to use • Longer start- up time • Protected address space • Choice of synchronous or asynchronous execution • Service of asynchronous events • Safer (If the program called crashes, you get an error message.
12 Optimizing Agilent VEE Programs Chapter Agilent VEE Execution Modes Agilent VEE Execution Modes allow you to run programs that were created using previous versions of VEE. The Execution Modes allow a newer version of VEE to run programs created with an older version of VEE in exactly the same way the older VEE version ran them. This makes VEE backward compatible to support your existing programs. NOTE Execution Mode was known as compatibility mode in previous versions of VEE.
Optimizing Agilent VEE Programs Chapter 12 Execution mode Figure 261 Execution Mode Display in VEE Status Bar The Agilent VEE Compiler The VEE compiler is automatically enabled in VEE 4 and higher Execution Modes. The compiler provides much faster program execution, as well as more predictable object propagation. For more information about the compiler and details of the differences between the Execution Modes, refer to the VEE Pro Advanced Techniques manual.
12 Optimizing Agilent VEE Programs Chapter a new feature from VEE 6.0, you should change the execution mode to VEE 6. Otherwise, the VEE 5.0 program may not run correctly. To change the execution mode, follow these steps: 1 From the main VEE menu, click File ⇒ Default Preferences, or press the Default Preferences button on the tool bar as shown in Figure .
12 Optimizing Agilent VEE Programs Chapter Figure 262 Changing the Execution Mode in Default Preferences Effect of Changing the Execution Mode The following example demonstrates the increase in speed when a program is updated. This example focuses on the program speed without instrument I/O. 1 Open the chaos.vee program in the examples\Applications subdirectory. This program illustrates explosive population growth. You can modify the program, as shown here, by using a Timer object to check the results.
12 Optimizing Agilent VEE Programs Chapter Timer Figure 263 Chaos.vee in VEE 3 Mode with Open Displays In Figure 264, the displays are iconized to improve speed without turning on the compiler. This cuts execution time about 1/6.
Optimizing Agilent VEE Programs Chapter 12 Figure 264 Chaos.vee in VEE 3 Mode with Closed Displays Finally, in Figure 265, the compiler is turned on with the debugging features disabled. For optimum performance, check the Disable Debug Features box in File ⇒ Default Preferences when the program is fully debugged and ready to use. The debugging features enable tools including the Show Execution Flow and Activate Breakpoints.
12 Optimizing Agilent VEE Programs Chapter Figure 265 Chaos.vee in VEE 4 or Higher Mode with Debugging Disabled In Figure 266 and Figure 267, the VEE speed improvements use the compiler on areas of programs involving iterative scalar math routines. The example calculates the square root of a scalar value. (The result is not kept.) By using the compiler, the speed is approximately 107 times faster than using the VEE 3 execution mode.
Optimizing Agilent VEE Programs Chapter 12 Figure 266 Iterative Math Example in VEE 3 Mode Figure 267 Iterative Math Example Using VEE 4 or Higher Mode VEE includes the execution modes because there are a few programming choices allowed in older versions of VEE that are not permitted in the current version (they now produce error messages).
12 Optimizing Agilent VEE Programs Chapter The Agilent VEE Profiler The Profiler is a feature in the Professional Development Environment in VEE. The Profiler helps you optimize programs by displaying the execution speeds of UserFunctions or UserObjects in the program. You can use the Profiler to identify the slow points in a program and apply the techniques described in this chapter to increase the program speed. Figure 268 shows the examples\ Applications\mfgtest.vee program.
Optimizing Agilent VEE Programs Chapter 12 Figure 268 An Example of the Profiler VEE User’s Guide 469
12 Optimizing Agilent VEE Programs Chapter Chapter Checklist You should now be able to perform the following tasks. Review topics, if necessary. • Explain three basic techniques for optimizing VEE programs and give examples of each. • Explain at least two more techniques in addition to the three above. • Explain the basic concept of a DLL. • Import a DLL, call a function within it, then delete the DLL.
Platform Specifics and Web Monitoring Chapter 13 13 Platform Specifics and Web Monitoring Overview 473 The Callable VEE ActiveX Automation Server 474 Web-enablement Technologies 475 Web Monitoring with Agilent VEE 479 Chapter Checklist 495 VEE User’s Guide 471
13 Platform Specifics and Web Monitoring Chapter Platform Specifics and Web Monitoring In this chapter you will learn about: • Calling VEE functions from other applications using the VEE ActiveX Automation Server • Web Monitoring Average Time To Complete: 2 hours 472 VEE User’s Guide
13 Platform Specifics and Web Monitoring Chapter Overview In this chapter, you will learn about one of the most important techniques for incorporating VEE functions into other applications or programs using the Callable VEE ActiveX Automation Server. Finally, you will learn key concepts in web monitoring.
13 Platform Specifics and Web Monitoring Chapter The Callable VEE ActiveX Automation Server In VEE on Windows 98, Windows NT 4.0, Windows 2000, and Windows XP, you can integrate VEE objects into other commercial and proprietary test systems written in standard languages, such as MS Visual Basic or C. The Callable VEE ActiveX Automation Server encapsulates VEE UserFunctions for integration into Automation applications, such as MS Excel and MS Visual Basic.
Platform Specifics and Web Monitoring Chapter 13 Web-enablement Technologies You can use VEE to disseminate data you have collected in programs, to monitor test systems, or to review test results remotely. This section describes web- enablement technologies for test and measurement applications, and how VEE supports these technologies. Overview of Web Technologies This example describes how to create a web site internal to an organization (an intranet web site) that provides reference data as a server.
13 Platform Specifics and Web Monitoring Chapter • The device under test (DUT), or sensor, or instrument sends information to the server application through the network I/O layer. The network I/O layer includes the interface and backplane (GPIB, RS232, VXI, MXI, USB, LAN, PC Plug- in), and the I/O programming layer such as drivers, VISA, or SICL. • The server application is the VEE program that generates the measurement data.
Platform Specifics and Web Monitoring Chapter 13 The scripting language is an interpreted language supported by the browser. The scripting language can extend the limitations of HTML to provide a more interactive Web page. Because they are interpreted, scripting languages must be embedded into the Web page and supported by the browser. They are not independent programs. This is graphically illustrated in Figure 270.
13 Platform Specifics and Web Monitoring Chapter used to provide user interface functionality and is designed to run on the client computer. ActiveX Controls are optimized software components that used to be called OLE Controls.
Platform Specifics and Web Monitoring Chapter 13 Web Monitoring with Agilent VEE VEE includes a built- in Web server that can communicate with other programs via HTTP. You can allow remote users to access VEE programs and information that resides on your computer. This section describes how you would share VEE data, and how a remote user would access the data. General Guidelines and Tips • The VEE program running on your system is the VEE program that the remote user will access.
13 Platform Specifics and Web Monitoring Chapter 4 Enable the Web Server by selecting the File ⇒ Default Preferences ⇒ Web Server dialog box settings which are described in more detail below. 5 Have the remote user run a Web browser such as Internet Explorer or Netscape.
Platform Specifics and Web Monitoring Chapter 13 Web Server Dialog Box When you select File ⇒ Default Preferences ⇒ Web Server, the Web Server dialog box appears as shown in Figure 271.
13 Platform Specifics and Web Monitoring Chapter Table 50 The Web Server Dialog Box Fields Field Name Description Enable Server When checked, Enable Server turns on VEE’s built-in Web server. The Web server allows a remote user to view, monitor and troubleshoot VEE programs on your system, by using a Web browser to display your VEE program. VEE’s Web server uses the standard HTTP protocol. By default, Enable Server is OFF (not checked).
13 Platform Specifics and Web Monitoring Chapter Table 50 The Web Server Dialog Box Fields Field Name Description HTTP Port Number Specifies the port number for the VEE Web server. The default port number is 80. The only time you need to change the default port number is when another Web server, such as another instance of VEE, is running on the same system, or if you want to restrict the remote user access to your VEE Web server.
13 Platform Specifics and Web Monitoring Chapter 3 The remote user must enter a URL address for your system. (You provide the address to the remote user, which is explained in more detail below.) NOTE The remote user does not have to be running VEE or even have VEE installed in order to access VEE programs on your system. The remote user connects to the network and runs the browser, and enters a URL. You will tell the remote user the URL to enter based on the following information.
13 Platform Specifics and Web Monitoring Chapter Table 51 URL Commands and Parameters Field Name Description Hostname (Required) Identifies your system, where VEE is running, in the format .domain.com. You may choose to have a remote user type in only the in a URL, such as http://. This command opens your VEE Web Server Home Page index.html and displays it to the remote user.
13 Platform Specifics and Web Monitoring Chapter Table 51 URL Commands and Parameters Field Name Description Panel view of ViewMainPanel main VEE program For example, http://hostname/ViewMainPanel Detail view of ViewMainDetail main VEE program For example, http://hostname/ViewMainDetail VEE execution window during runtime ViewExecWindow VEE UserFunction in Panel view http://hostname/ViewPanel? For example http://hostname/ViewExecWindow For example, if the UserFunction is AddNois
Platform Specifics and Web Monitoring Chapter 13 displaying your VEE program. The default VEE Web Server Home Page is shown in Figure 272. You can also edit the page, in MS Word, for example, to suit your needs. Figure 272 The Index.html Default Page NOTE VEE User’s Guide To display this menu on your own system, you can refer to your system as localhost.
13 Platform Specifics and Web Monitoring Chapter When the remote user displays the menu shown in Figure 272, he or she can access various parts of a VEE program by making choices in the menu. For example, the user can click on Main Detail to view the Main VEE program in Detail view. Making the choice in the menu displays the same information as having the remote user enter the command http://hostname/ViewMainDetail in the network browser.
Platform Specifics and Web Monitoring Chapter 13 Figure 273 Viewing the Main Solitaire.vee Program in the Browser Figure 273 displays the Main program in VEE. NOTE For this exercise, the Solitaire.vee program includes an error that is not in the VEE program example. If you would like to view the program, it is located in Help ⇒ Open Example... ⇒ Games ⇒ Solitaire.vee. 5 The remote user clicks Back in the browser to display the VEE Web Server Home Page and chooses Last Error Message.
13 Platform Specifics and Web Monitoring Chapter Figure 274 Displaying a VEE Error Message, using the Browser Notice that the VEE error message specifies the UserFunction makeAMove. 6 The remote user goes back to the VEE Web Server Home Page once again and clicks on Detail View of UserFunction, and types in the UserFunction name makeAMove. The browser displays the UserFunction makeAMove as shown in Figure 275.
Platform Specifics and Web Monitoring Chapter 13 Figure 275 Detail View of a UserFunction Displayed in the Browser The remote user is able to see the error in the VEE program. There is an input pin not connected on the JCT object shown in Figure 275. The remote user could now help you troubleshoot Solitaire.vee and resolve the error. Using a similar process of working together over the Web, you could collaborate with remote users or develop programs together.
13 Platform Specifics and Web Monitoring Chapter system, you want to make sure that only certain remote users are able to access particular programs or Web directory files. To prevent remote users from viewing parts of a VEE program on the Web, you can protect the program in three different ways: Change the port number in the Default Preferences ⇒ Web Server folder so only authorized users may view the program. - ORCreate a secured RunTime version of the VEE program.
Platform Specifics and Web Monitoring Chapter 13 Figure 276 Example of Displaying HTML Message Instead of VEE Program You could also use an *.html file for other purposes, such as putting password protection on a VEE program so that only users with the password can view the program. Figure 277 shows an example of password protection.
13 Platform Specifics and Web Monitoring Chapter Figure 277 An Example of a Password Window 494 VEE User’s Guide
Platform Specifics and Web Monitoring Chapter 13 Chapter Checklist You should now be able to perform the following tasks: • Explain how to use the Callable VEE ActiveX Automation Server, and when you would use it. • Explain how you could integrate VEE functionality into other applications or programs. • Explain the key concepts in using the web to monitor VEE programs.
13 Platform Specifics and Web Monitoring Chapter 496 VEE User’s Guide
Appendix Appendix A: Additional Lab Exercises General Programming Techniques 499 Using Strings and Globals 514 Optimizing Techniques 516 UserObjects 518 Agilent VEE UserFunctions 521 Creating Operator Panels and Pop-ups 528 Working with Files 533 Records 535 Test Sequencing 541 VEE User’s Guide 497
Appendix Additional Lab Exercises The following exercises give you a chance to practice the VEE concepts you have learned in this book. The exercises are divided into categories. To use this appendix, develop a solution and then compare it to the answers listed. There are many ways to program a given task, so you have a valid solution if it meets the problem specifications. However, programs that execute more quickly and are easier to use are probably better solutions.
Appendix General Programming Techniques Apple Bagger You want to know how many apples it takes to fill a ten pound basket. Create a VEE program that counts how many apples it takes to fill the basket. Each apple weighs between 0 and 1 pound. Suggestions This program can be created with 10 or fewer objects.
Appendix Figure 278 Apple Bagger, Solution 1 Key Points Optimal Solutions: To optimize the performance of programs, use fewer objects, if possible. This solution uses six objects. The program could also be implemented with 10 objects, as Figure 279 shows. Until Break and Break Objects: Use these objects for loops that require testing a condition. In this example, the loop should stop when the total weight of the apples is greater than 10 pounds.
Appendix Figure 279 Apple Bagger, Solution 2 Key Points Start: Using a Start object for this program is redundant, since you can use the Run button on the main menu bar. Start is best used when you have two programs on a screen, and you want to be able to run them independently. Or you have a program with a feedback loop, and you want to define where to initiate execution. Shift Register: You use a Shift Register to access the previous values of the output.
Appendix Create a program that allows a user to enter a number between 0 and 100. If the number is greater than or equal to 50, display the number. If it is less than 50, display a pop- up box with the message “Please enter a number between 50 and 100.” Suggestions This program can be created with 5 or fewer objects.
Appendix Figure 280 Testing Numbers (pop-up shown) Testing Numbers, Step 2 After the model is working with five objects (the Message Box produces the pop- up), try programming it with four objects without using the Gate object.
Appendix Figure 281 shows the solution to the Testing Numbers exercise with four objects. Figure 281 Testing Numbers, Step 2 Key Points Auto Execute: All input objects such as the Int32 Slider have an Auto Execute selection in the Properties Box. If chosen, the object operates whenever its value is changed without needing to press Start or the Run button. Consolidating Formulas: The expression (A>=50)*A in the If/Then/Else object evaluates to a 1*A, if A>=50 is true, or 0, if false.
Appendix want the value of A on the Result pin; otherwise, you want the string “FALSE” on the Result pin. You would use the following triadic expression: (A<10 ? A : "FALSE"). Solution—Testing Numbers, Step 3 Figure 282 shows the solution to the Testing Numbers exercise using only three objects. Figure 282 Testing Numbers, Step 3 NOTE This could be implemented using a Real64 Input dialog box with its automatic error-checking capability.
Appendix This program can be created with six or fewer objects. Choose from the following objects: Start For Range Until Break randomseed() function random() function Collector Formula Set Values Alloc Int32 Logging AlphaNumeric Strip Chart Meter Date/Time Timer Now() Break Do Hint: To improve performance, send the data to the display only once by first collecting the data into an array using the Collector object. Note the performance differences.
Appendix Figure 283 Collecting Random Numbers Key Points Logging AlphaNumeric vs. AlphaNumeric: Use Logging AlphaNumeric to display consecutive input (either Scalar or Array 1D) as a history of previous values. Use AlphaNumeric to display data from only one execution (the last) as a single value, an Array 1D, or an Array 2D. The Logging display is an array without index values; the AlphaNumeric display is the same array with optional index numbers and values.
Appendix Timing Pins: The Do object controls which object executes first. The end of the program is timed from the sequence out pin of the For Count object, because that pin does not fire until all objects inside the loop have executed. Random Number Generator Random Number Generator, Step 1 Create a random number generator that requires external inputs. Display the numbers on a strip chart.
Appendix Layout of Slider Objects: You can select either a vertical or horizontal format for the screen image of the slider objects by clicking on Horizontal under Layout in the Properties box. XY Trace: Use an XY Trace to display the recent history of data that is continuously generated. Random Number Generator, Step 2 Collect the random numbers into an array. Find the moving average and display it with the numbers.
Appendix MovingAvg(x, numPts): Use this object located in the Function & Object Browser, Data Filtering category to smooth the input data using the average of a specified number of data points preceding the point of interest to calculate the smoothed data point. Using Masks Mask Test, Step 1 Create a 50 Hz sine wave with an adjustable amount of noise. Test the noisy sine wave to be certain that it stays below the following limits: (0,0.5) (2.2m, 1.2) (7.2m, 1.2) (10.2m, 0.5) (20m, 0.
Appendix Figure 286 The Mask Test, Step 1 Using Masks, Step 2 Add to the program to calculate and display the percentage of failures. Solution—Using Masks, Step 2 Figure 287 shows a solution for step 2.
Appendix Figure 287 Mask Test, Step 2 Key Points Mask: The mask is created using the Data ⇒ Constant ⇒ Coord object, then configuring it for five array elements. You input the coordinate pairs separated by commas and VEE adds the parentheses. The x values were chosen knowing that the time span of the waveform was 20 milliseconds. Also, note that the Waveform (Time) display will accept a Coord data type as an input.
Appendix TotSize: This object simply gives you the number of elements in an array. Since this array contains the number of failures, dividing this by the total number of elements in the original waveform, 256, and multiplying by 100 gives us the percentage of failures. Formula: A/256*100 is the formula used to compute the percentage of failures, since the Function Generator and Noise Generator are set to put out 256 points.
Appendix Using Strings and Globals Manipulating Strings and Globals Using string objects or functions, create a program that accepts a user's name in the following format: . After the user enters a name, have the program strip off the first name and only print the last name. Store the string into a global variable. Retrieve the string using the Formula object.
Appendix Key Points String Objects and Functions: StrTrim(str) first strips off any spaces or tabs from the front and back of the name. StrPosChar(str1, " ") yields the index of the space character between the firstname and lastname. StrLen(str), of course, gives the length of the string. All of these were performed using the string objects, but they could also be done using string functions within a Formula object.
Appendix Optimizing Techniques For this lab, you will build a VEE program two different ways and note the difference in execution speed. Optimizing Techniques, Step 1 Create a program that sends the range 0 to 710 step 10 through both a sine function and cosine function. Put the results of the functions on an X vs.Y display. Use the Timer object to clock how long the program takes. (Set your default preferences for Trig Mode to Radians.
Appendix Clone all of the objects from the first program. Modify the new set to collect the range into an array. Now, the sine and cosine functions are run against an array of points, and only plotted one time. Note the time savings. Solution—Optimizing Techniques, Step 2 Figure 290 shows a solution to step 2. Figure 290 Optimizing VEE Programs, Step 2 Key Points Optimizing with Arrays: Note the increase in performance between step 1 and step 2 that comes from using arrays.
Appendix UserObjects Random Noise UserObject Random Noise UserObject, Step 1 Create a UserObject that generates a random noise waveform. Display the noisy waveform and the noise spectrum outside the UserObject. Provide control outside the UserObject for the following: amplitude, number of points, interval (time span), DC offset. NOTE Do not use a virtual source inside the UserObject. Use objects such as Build Waveform and Random to create the UserObject.
Appendix Figure 291 A Random Noise UserObject Solution—NoiseGen Object in Random Noise Figure 292 shows a solution for the NoiseGen UserObject.
Appendix Figure 292 The NoiseGen UserObject Key Points UserObject: Notice that the UserObjects you build are essentially customized objects that you add to VEE. Build Waveform: This object creates a Waveform data type from a Real array of amplitude values and a time span (the length of time in seconds over which the y data was sampled).
Appendix Agilent VEE UserFunctions Using UserFunctions UserFunctions, Step 1 Create a function called NoiseGen that accepts an amplitude value (0- 1) from a slider and returns a noisy waveform. Do Not Use Virtual Source For Count For Range Do Use Formula Ramp Build Waveform Hint: Use randomize(array, -a,a) where the array must be 256 points, and a is the amplitude. Build a simple main program that calls this function to be certain the function works correctly.
Appendix Figure 293 User Functions, Step 1 Key Points Ramp(): Notice that the ramp() function is used to generate an array of 256 points within the parameter list for randomize(). Build Waveform: Notice that the default time span is 20 milliseconds, so that you only need to send an array to this object to build a waveform.
Appendix In the same program, create another function called AddNoise that calls the first function NoiseGen. AddNoise should add the noisy waveform from the NoiseGen function to a sine wave. AddNoise should have two inputs, one for the NoiseGen amplitude and one for the sine wave. It should have one output for the result. Build a simple main program with a slider for the noise amplitude, and the Virtual Source ⇒ Function Generator (sine wave, Freq = 100 Hz) for the good waveform to add to the noise.
Appendix Debug ⇒ Show Data Flow. Leave the AddNoise window open and run the program. Notice how useful this capability is for debugging. Solution—UserFunctions, Step 3 Figure 295 shows a solution for step 3.
Appendix Now change the program so that the slider sets a global variable called Amplitude. Have the NoiseGen function use that global (so NoiseGen will no longer require an input pin). Make the program run correctly. Save this file as uflab.vee. Solution—Using UserFunctions, Step 4 Figure 296 shows a solution for step 4. Figure 296 User Functions, Step 4 Hint: Notice the Call AddNoise and Formula objects use the global Amplitude, so both of the objects need to run after the Set Amplitude object executes.
Appendix Importing and Deleting Libraries of UserFunctions Build a simple program to import the uflab.vee functions from the previous exercise. Call the function that adds the noise, and then delete the library programmatically. Use the Select Function choice in the object menu of the Call object. Hint: Click on Load Lib in the Import Library object menu to manually load the library you specified, so that you can use the Select Function feature in Call.
Appendix Select Function: Notice that this selection will configure the proper input and output pins for the function you select. Editing UserFunctions: If you import a library of UserFunctions programmatically, you will not be able to edit them. You can view them and set breakpoints to debug. If you want to edit the UserFunctions you import, use the Merge Library command.
Appendix Creating Operator Panels and Pop-ups Creating Operator Panels and Pop- ups, Step 1 Create a panel to ask an operator to enter numbers. Create a UserObject to interact with an operator. Ask the operator for 2 inputs, A and B. Send both inputs to a display. Use a UserObject with Show On Execute checked to display the panel. Solution—Creating Operator Panels and Pop- ups, Step 1 Figure 298 shows a solution in detail view. Figure 299 shows the panel that appears when the program runs.
Appendix Figure 299 Panel for Operator to Enter A and B Key Points UserObject Properties: In the UserObject Properties dialog box, select Pop- Up Panel and click to turn on Show Panel On Execute. Change the Pop-Up Panel ⇒ Panel Title name to “Enter A or B.” Creating Operator Panels and Pop- ups, Step 2 Instead of displaying both A and B, ask the operator whether to display A or B if the two numbers are different. After asking for the two values, if the values A and B are equal, display the value.
Appendix Figure 300 UserObject to Ask Operator Whether to Display A or B Figure 301 Panel for Operator to Choose Whether to Display A or B Key Points 530 VEE User’s Guide
Appendix Gate: The Gate object only sends a value if the two numbers are equal. Junction: The JCT object allows multiple inputs to the object Alphanumeric. The JCT object is a “wired OR” object. Note the use of the Data ⇒ Selection Controls ⇒ List object edited for two choices and formatted for a list. This configuration will output a text A or B. If you need the ordinal value (0 or 1), then use the List object's ordinal data output instead.
Appendix Figure 302 Generate an Error if Operator Does Not Enter a Choice Key Points Exit UserObject: If the user responds in under 10 seconds, this object will exit the UserObject, even though the Delay object may not have finished executing. Delay and Raise Error: After 10 seconds the Delay object pings the Raise Error object, which will pause execution of the program and display the Error Message you have typed in.
Appendix Working with Files Moving Data To and From Files Create a VEE program to write the time of day to a file. Generate 100 random points and write them to the file. Calculate the mean and standard deviation of the numbers and append them to the file in the following format: Mean: xxxxxx Std Dev: yyyyyy Next, read only the mean and standard deviation from the file. Figure 303 shows moving data to and from files.
Appendix Generating an Array: Use randomize(ramp(100,0,1), 0, 1) in the Formula object to create an array of 100 random numbers. The ramp() function generates an ordered array and delivers it to the randomize() function, which then generates random values between 0 and 1. Time Stamp: The now() function is used in the expression field of the I/O Transaction dialog box for transaction one in the To File object.
Appendix Records Manipulating Records Manipulating Records, Step 1 Build a record with three fields holding an integer, the time right now as a string, and a four element array of reals. The fields should be named int, daytime, and rarry, respectively. Merge this record with another that holds a random number between 0 and 1, and a waveform. Name these fields rand and wave. Solution—Manipulating Records, Step 1 The resulting record should have five fields, as shown in Figure 304.
Appendix Figure 304 Manipulating Records, Step 1 Key Points Time Stamp: Use the now() function within the To String object to create your time stamp for this program. Then you can specify the format. Configuring a Data Constant as an Array: Any data type in the Data ⇒ Constant menu can become an array by selecting Properties, then under Configuration choose 1D Array. The size may be entered here, or as you are typing in the values an Enter will keep appending values.
Appendix Naming Fields: By renaming the input terminals on the Build Record object, you can give your record specific field names such as int, rand, and wave. The Default Value Control Input: A Record Constant makes an excellent interactive display object by adding a Default Value Control pin. The Record Constant will automatically configure itself for the record it receives.
Appendix Figure 305 Manipulating Records, Step 2 Key Points Using a Conditional Expression: VEE supports a conditional expression, which provides an efficient way to implement an if- then- else action. The conditional expression in this Formula object is known as a triadic. It is (a.rand < 0.5? a.rand: "More than 0.5"). Notice that it is all one expression, and you can write it with line breaks in the Formula object as shown.
Appendix Replace the integer input for the first field with a For Count object and step through 10 iterations. Be certain to “ping” the random number generator and the time function on each iteration. Send the complete record into a To DataSet object. In a separate thread, retrieve all records from the dataset where the random value is greater than 0.5. Put the resultant records into a record constant Hint: You'll need a control pin for a Default Value on the Record Constant object.
Appendix Key Points The To DataSet Object: The Clear File at PreRun option only clears the file before data is sent the first time. Notice that the program sends 10 different records to the same file sequentially, and they are appended to the file. The From DataSet Object: This object is configured to retrieve all records where the rand field is greater than 0.5. In this case, five out of ten records meet that criterion and the first record is shown with an index number of 0.
Appendix Test Sequencing Using the Test Sequencer, Step 1 Create a simple UserFunction called UpperLimit that is a pop- up panel with a Real64 Slider and a Confirm (OK) object. Send the output of the slider to a global variable called UpLimit and also to an output terminal. Create a Sequencer object, and configure test1 in the Sequencer as an EXEC transaction that calls UpperLimit. Create another function called AddRand that simulates the test you might call.
Appendix Figure 307 Using the Test Sequencer, Step 1 Key Points Setting Global Variables with a UserFunction: A typical use of the first Sequencer transaction is to call a UserFunction that sets the Global Variables, as it does in this case. Then you can utilize these variables in any test that follows, as is shown here. The Sequencer Return Pin: The Return pin in this example delivers a PASS or FAIL message plus the test value.
Appendix Disable the first test. Assuming that you do not need the global anywhere else, you can call the UpperLimit function directly. Change test2 so that it compares the return value of AddRand(0) against the result of the UpperLimit function. Hint: For disabling the first test, use the Sequencer Transaction box as shown in Figure 308.
Appendix Figure 309 Using the Test Sequencer, Step 2 Key Points The UserFunction in an Expression Field: In this example, instead of comparing a test result to the UpLimit variable, you can type the function name UpperLimit() in the expression field where the variable would go. Using the Test Sequencer, Step 3 Edit the test2 Sequencer transaction that calls the VEE function random (0,1). Compare the result against a limit less than 0.5.
Appendix Solution—Using the Test Sequencer, Step 3 Figure 310 shows a solution to Step 3. Figure 310 Using the Test Sequencer, Step 3 Key Points The Data Format for Several Runs of the Sequencer (First Thread): When the Sequencer executes once, it outputs a Record of Records. The first record has field names that match the test names, then each field holds a record containing the different pieces of data for that particular test.
Appendix which can then be investigated. If you use the [*].. format in the Formula object, you will get an array of data. In this case, you get an array of real values giving the test results for five runs of test2. You can then calculate the minimum, maximum, mean, and standard deviation from this array. You could specify a single run of test2 by indicating a particular element in the array of records of records.
Appendix Figure 311 Add a Time Stamp to the Logging Record Solution—Using the Test Sequencer, Step 4 Figure 312 shows a solution to step 4 of using the test sequencer.
Appendix Figure 312 Using the Test Sequencer, Step 4 Hint: To display a record, click on the Record ⇒ Record: Scaler field for one of the tests and the Record Field Data dialog box appears. Figure 313 shows the Record Field Data dialog box.
Appendix Figure 313 Checking a Record Using the Test Sequencer, Step 5 Print the time stamp fields from the records on a Logging Alphanumeric display. Hint: Use four Formula objects (one for each test). To show all four Formula results in one Logging Alphanumeric display, add a Junction object. Use a To String to format the 63G time stamp value into a more readable string.
Appendix Figure 314 shows the program thread to print the time stamps to a display, step 5 of using the test sequencer. Figure 314 Using the Test Sequencer, Step 5 Key Points Converting Time Stamp Formats: The To String object before Logging AlphaNumeric converts the time stamps from a Real format to a Time Stamp format for more clarity.
Appendix If the Sequencer includes many tests, it can become cumbersome to use many individual Formula objects connected to a Junction. Instead, you can use a Formula that contains an expression, generate the expression at run time, and loop through the possible expressions. First the example will generate the expression strings. In a separate thread, use a Loop and a Formula to generate a test expression string. Output the information as a string in a Logging Alphanumeric.
Appendix Formula Control Pin on the Formula Object: The Formula you want to evaluate is generated by the Formula inside the Loop. You can create a second Formula box with a control input for its Formula expression. The expression the second Formula evaluates is generated at runtime. Solution—Using the Test Sequencer, Step 7 Figure 316 shows a solution to step 7. Figure 316 Using the Test Sequencer, Step 7 Key Points • The To String object is still being used to format the Real64 into a time stamp format.
Appendix Solution—Using the Test Sequencer, Step 8 Figure 317 shows a solution to the final step in using the test sequencer. Figure 317 Using the Test Sequencer, Step 8 Key Points The EOF Pin on the From Data Set Object (Second Thread): The EOF pin is added in case there are no records that fit the criteria. If this happens then the EOF pin will fire, instead of VEE halting the program with an error message.
Appendix The Conditional Expression in the From Data Set Object (Second Thread): The expression is (Rec.test1.pass==1) OR (Rec.test2.pass==0), with the same .. format. Rec is the name of each record in the dataset as it is read and tested. Test1 and test2 specify which tests VEE should examine, and the field name pass is the default name for the pass- fail indicator (1 or 0) assigned by VEE.
Glossary Glossary This Glossary defines terms used in this manual. For a complete glossary of VEE terms, select Help ⇒ Contents and Index. Next, select Reference. Then, select Glossary. In the glossary, clicking a term displays a definition. When you have finished reading the definition, click anywhere to clear the text. Button A graphical object in VEE that simulates a momentary switch or selection button, and which appears to pop out from the screen.
Glossary Component Driver An instrument control object that reads and writes values to components you specifically select. Use component drivers to control an instrument using a driver by setting the values of only a few components at a time. (Component drivers do not support coupling.) Container See Data Container. Context A level of the work area that can contain other levels of work areas (such as nested UserObjects), but is independent of them.
Glossary Data Shape Each data container has both a shape and type. The data shape can be either a scalar or an array of one or more dimensions. In VEE, a one- dimension array is called Array 1D, a two- dimension array is Array 2D, and so forth. Data Type Each data container has both a type and shape. VEE supports many data types including Text, Real64, Real32, and Int32. Detail View The view of a VEE program that shows all the objects and the lines that connect them.
Glossary Font VEE allows you to change the font size and style of type used to display text for various VEE objects, titles, and so forth. Grayed Feature A menu feature that is displayed in gray rather than black, indicating that the feature is not active or not available. Dialog box items such as buttons, checkboxes, or radio buttons may also be grayed. Group Window A group window in Microsoft Windows is a window that contains icons for a group of applications.
Glossary Minimize Button A button on an object, or the VEE window, that iconifies the object, or the VEE window. Object: 1 A graphical representation of an element in a program, such as an instrument, control, display, or mathematical operator. An object is placed in the work area and connected to other objects to create a program. 2 A data type used for ActiveX Automation and Controls.
Glossary Pointer The graphical image that maps to the movement of the mouse. The pointer allows you to make selections and provides you feedback on a particular process underway. VEE has pointers of different shapes that correspond to process modes, such as an arrow, crosshairs, and hourglass. Pop-Up Menu A menu that is raised by clicking the right mouse button. For example, you can raise the Edit menu by clicking the right mouse button in an empty area within the work area.
Glossary Scroll Bar A rectangular bar that, when dragged, scrolls through a list of data files or other choices in a dialog box, or moves the work area. Select To choose an object, an action to be performed, or a menu item. Usually you make a selection by clicking the mouse. Selection Field A field in an object or dialog box that allows you to select choices from a drop- down list. Sequence Input Pin The top pin of an object.
Glossary Toolbar The rectangular bar at the top of the VEE window which provides buttons for quick access to frequently used commands. The buttons run commands from menus such as File, Edit, View, Device, and Debug. Transaction The specifications for input and output (I/O) used by certain objects in VEE. Examples include the To File, From File, Sequencer, and Direct I/O objects. Transactions appear as phrases listed in the open view of these objects.
Symbols *.dll file extension, 457 *.h file extension, 454 *.vxe files, 417, 426 .NET and IVI Drivers, 311 .NET Programming Tips, 301 _cdec1, 453 _stdcall, 453 Numerics 24 hour time stamp format, 216 A Access Array => Get Values, 208 accessing logged data, 374, 375 ActiveX data type Variant, 176 add objects, 29 terminal, 48 to panel, 420 address, interface, 135 Agilent VEE closing program, 61 compiler, 460 data flow in program, 68 debugging, 100 exiting, 59 Go To, 107 graphical vs.
call UserFunction, 332 call UserFunction from expression, 339 Calling a Shared/Static Method, 301 Calling an Instance Method, 300 case sensitivity VEE vs. MATLAB, 191 caution boxes in VEE programs Agilent VEE error messages in VEE, 100 changing object views, 32 preferences, 44 properties, 47 settings, 44 size of an object, 37 Clean Up Lines, 54 clearing the work area, 44 click, 22 cloning an object, 35 cloning vs.
date & time, time stamp format, 216 debugging adding Alphanumeric displays, 104 breakpoints, 105 examine data on line, 102 examining terminals, 104 line probe, 102 programs in VEE, 100 Show Data Flow, 100 Show Execution Flow, 102 step functions, 113 default changing preferences, 44 delete "undoing" a delete, 37 data lines between objects, 42 object, 36 Delta markers, 199 description dialog boxes, 119 deselect objects, 39 detail view button on icon bar, 401 cannot access if panel view secured, 417 definition
displaying pop-up panels, 417 Execute Program object, 458 modes, 460 order in program, 112 Show Data flow, 69 Show Execution Flow, 69 execution modes optimizing programs, 445 exiting VEE, 61 expression field calling DLLs, 455 expressions calling UserFunctions, 339 Formula object, 185 send expression list to instrument, 150 F field getting a field from a Record, 225 file sending real array to, 217 sending time stamp to, 215 To/From file objects, 210 File menu Default Preferences, 403 Merge, 358 merge Librar
I I/O To File object, 211 transaction dialog box, 211 transaction format (syntax), 212 understanding I/O transactions, 210 I/O configuration, save, 61 I/O libraries, 129 I/O Transaction box format, 212 select array dimension, 153 I/O transaction timeout, 136 icons changing, 404 displaying text description, 24 icon view of object, 32 iconic view, 32 improving execution time, 445 minimize button on object, 32 Run button on tool bar, 62 If Pass Sequencer transaction field, 370 import UserFunctions, 344 Indicat
logging enabled Sequencer transaction field, 370 M Main window description, 23 displaying in VEE, 64 managing the work space, 62 math Device => Function & Object Browser, 178 performing math on arrays, 444 mathematically processing data, 92 MATLAB, 188 to 192 case sensitivity, 191 data types supported, 192 feature, 177 graph, 190 in Function & Object Browser, 179 including Script object in VEE program, 191 object in VEE program, 189 overview, 14 Signal Processing Toolbox, 14 support information, 17 uses of
changing name, 38 changing parameters, 55, 58 changing title, 38 changing views, 32 cloning, 35 Confirm (OK), 417 connecting, 52 copy, 36 creating data lines, 42 creating UserFunction, 334 cutting, 36 Data, Build Data, Record, 337 Data, Constant, Record, 338 Delete Library, 351 deleting, 36 deleting data lines, 42 deselecting, 39 Device => Function & Object Browser, 94 Device, Import Library, 344 display Help about, 98 dragging, 34 duplicating, 35 editing, 41 Execute Program, 458 execution order in program,
adding object to, 400 adding objects, 420 aligning objects, 411 Beep object, 427 button on icon bar, 401 create operator interface, 90 displaying, 91 moving objects, 420 radio buttons, 421 securing, 417 snap-to-grid, 411 softkeys and function keys, 413 switching to Detail view, 91 panel view, creating, 90 parameters changing, 55, 58 parentheses in Call object, 345 pass Sequencer, 370 pasting an object, 36 Pause, 55 PC plug-in boards, 157, 159 PComplex data type, 175 physical instrument adding to configurati
Sequencer transaction field, 369 READ I/O transaction, 212 reading data from instrument, 151 real array, sending to file, 217 Real32 datat type, 175 Real64 data type, 175 Real64 slider, 69 Record avoiding match errors with EOF, 236 building, 223 getting a field, 225 set field, 227 sort operation on a field, 244 storing and retrieving from DataSet, 232 unbuilding, 230 using DataSets to store and retrieve, 232 using to store mixed data types, 222 record Data, Build Data, Record object, 337 Sequencer, 376 Reco
displays, 196 Spectrum data type, 175 speed, execution, 468 standard deviation lab, 180 starting VEE, 23 Static members, 286 status bar display, 23 locating objects exactly, 35 Step Into, 55, 113 Step Out, 113 Step Over, 113 stop VEE, 61 storing data, 393 storing mixed data types, 222 storing test results, 206 to 209 string download string, 155 learn string, 155 upload string, 155 Strip Chart displays, 196 subprograms UserObjects and UserFunctions, 332 support Agilent VEE support, 16 MATLAB, 17 supported sy
differences from UserObjects, 333 editing, 352 Import and Delete Library objects, 351 Import Library, 344 libraries of, re-using, 344 locating with Find, 356 Merge Library, 344 Merge Library command, 344 merging, 359 modifying, 344 Profiler, 468 saving as program, 351 UserObject creating, 76 to 83 differences from UserFunction, 333 icon view, 63 locating with Find, 356 merging, 359 minimized, 63 open view, 63 Profiler, 468 Using .NET to Select Files, 302 Using .
Z zooming in on waveform, 198 574 VEE User’s Guide