Professional Documents
Culture Documents
Sushanta Kumar Mandal School of Information Technology Indian Institute of Technology Kharagpur 721302 E-mail: sushantakumar@yahoo.com
1. Introduction
1.1 What is Virtual Instrumentation?
Scientist, researcher and engineers mostly rely on data acquisition solutions for system monitoring, control and instrument characterization. A complete data solution typically consists of sensing, signal conditioning, data acquisition and processing, analyzing, visualization, report generation and actuating. To create complete and optimum data acquisition solution within a minimum time, dedicated hardware and software tools are required so that all data acquisition tasks are available concurrently on real-time. All these tasks cannot be done by using stand-alone traditional instruments. The rapid advancement and adoption of computers in the last two decades has given a great improvement in instrumentation test and measurement. Continuous reduction of personal computers and availability of low cost high performance software packages has boosted the systems for Automatic Test Equipment (ATE) based on programmable instrumentation. GPIB (General Purpose Interface Bus) based programmable instrumentation has gained tremendous spread in the last decade for designing ATE system with the concept of virtual instrumentation. Virtual instruments replace part of signal acquisition, processing and display, in traditional instruments, by using personal computer. By graphical programming, the computer monitor can be turned into the front panel of the traditional instruments and, in fact, with enhanced features. Plug-in data acquisition boards transform personal computers into digital device capable to collect signals from sensors and to send commands to actuators. Different manufacturer like NI [1], HP[2] has defined VI in different way. Therefore in general VI is defined as the combination of hardware and software with industry-standard computer technologies to create user-defined instrumentation solutions. In this type of test instrumentation that is basically software reliant and primarily dependent on a computer to control test hardware and equipment, analyze, and present test results. The power of VI application software lies in the fact that it empowers the user to include test equipments as objects in their programs. There are two basic types of virtual instruments. Simple virtual instruments are PC based instruments. These are basically cards or modules that can simply be plugged into a PC and the accompanying software allows the user to perform relevant measurement and data analysis. Alternatively, a variety of programmable test instruments, communication buses like GPIB (IEEE-488)[3], VXI[4], serial and
application test software such as LabVIEW[5], Agilent VEE[6] are available which can be used together to configure a VI.
Table 1 summarizes the features of some Agilents programmable instruments that conform GPIB: multiple output DC power supply, digital multimeter, 4-channel digital oscilloscope, arbitrary waveform generator and interface card. There are a number of vendors such as NI, Textronix, Fluke etc. provides GPIB compatible instruments. Table 1 Features of instruments that conform Programmable Instrumentation Instruments Interface Agilent 6629A Multiple-output GPIB/RS232 DC Power supply Agilent 34401A DMM GPIB/RS232 Agilent 33250A Function GPIB/RS232 /Arbitrary Waveform Generator Agilent 54615B Digital Storage GPIB Oscilloscope HP 82341A Interface Card GPIB Features 4 Output, 50W, 16V@ 400mA, 50V@1A, 16V@2A 6.5digit, 1000Vdc/ 750Vac, dc/ac 3A, 80 MHz Sine, triangle, square, ramp, noise and more, 12-bit, 200MSa/s, 16,000-point deep arbitrary waveforms 2 Channel, 500 MHz, 1GSa/s, 4 MB SICL and VISA compatible, I/O Port
physical devices. The IEEE-488 Standard defined an instrument with interface and device partitions as shown in Figure 3. Controller
Control, Talk, Listen
Device#1
Talk, Listen
Piggyback Cables
Device #n
Talk, Listen
Figure 2 IEEE-488 Bus Concept Some devices can be set to talk only or to listen only. This lets two devices communicate without the need for a controller in the system. An example is a DVM that outputs readings and a printer that prints the data.
Instrument
GPIB Interface Interface Functions Device Functions
Device#1
Device#2
Device#4
Device#1
Device#3
Device#3
Device#2
to go into remote mode when addressed to listen. When in remote mode, a device should ignore its local front panel controls. SRQ (service request) is like an interrupt and may be sent by any device on the bus that wants service.
2.6 IEEE-488.2
IEEE-488.2 defines a set of standard format for programming GPIB. IEEE 488.2 instruments are easier to program because they respond to common commands and queries in a well defined manner using standard message exchange protocols and data formats. The IEEE 488.2 message exchange protocol is the foundation for the SCPI standard that makes test system programming even easier. All devices must be able to send and receive data, request service, and respond to a device clear message. IEEE 488.2 defines precisely the format of commands sent to instruments and the format and coding of responses sent by instruments. All instruments must perform certain operations to communicate on the bus and report status. Thus the IEEE-488.2 Standard establishes standard instrument message formats, a set of common commands, a standard Status Reporting Structure and controller protocols that would unify the control of instruments made by hundreds of manufacturers. The standard instrument message format terminates a message with a linefeed and or by asserting EOI on the last character. Multiple commands in the same message are separated by semicolons. The common command set defined a subset of ten commands that each IEEE-488.2 compatible instrument must respond to plus additional optional commands for instruments with expanded capabilities. IEEE 488.2 Common Commands and their functions are listed in Table 2 Table 2 IEEE 488.2 Common Commands Functions Identification Query (Company, model and serial number) Reset Self-test query Clear status Operation complete Operation complete query Service request enable Service request enable query (0-255) Event status register query Event status enable Event status enable query Read status byte query (0-255) Wait to complete
Mnemonic *IDN? *RST *TST? *CLS *OPC *OPC? *SRE *SRE? *ESR? *ESE *ESE? *STB? *WAI?
Probably the most familiar Common Command is the *IDN? query. This is a good first command to use with an instrument as its response shows the details identification of the instrument model, serial number and company name and it ensures that you have communication with the instrument.
SENSe
CURRent
VOLTage
RANGe
RESolution
RANGe
RESolution
AUTO
UPPer
AUTO
UPPer
AUTO
AUTO
Figure 7 SCPI Command Structure The command tree is described with nomenclature similar to that used for file systems. The command at the top of the tree is the "root" command, and subsystem commands are linked into "paths" through the tree. For example, one path through the tree is defined by the command sequence: :SENSe:VOLTage:RANGe:AUTO -- which sets the Digital Multimeter (DMM) to read voltages using autoranging. Note how colons (":") are used as path separators. Another path is: :SENSe:CURRent:RANGe:UPPer -- which sets the DMM to read currents and uses the upper current range of the DMM. Note that the full path of a command does not need to be sent to the DMM each time. The parser navigates through the tree as directed by subsystem command strings according to the following rules: After power-on or the *RST common command is sent, the current path is set to the root.
A message terminator, usually a <newline> (line-feed) character, also sets the current path to the root. A colon (":") is, as shown above, a path separator. Each time the parser finds a colon in the subsystem command string it moves down through the command tree one level. If the colon is the first character in the string, however, it specifies the root. A semicolon (";") separates two commands in the same subsystem command string without changing the current path. Whitespace characters, such as <tab> and <space>, are generally ignored. However, whitespace inside a subsytem command keyword is forbidden. For example, MEAS ure is not a legal keyword. Whitespace is also required to separate a parameter from a command. For example, :SOURce:VOLTage6.2 is incorrect, you must use :SOURce:VOLTage 6.2. Commas (",") are used to separate multiple parameters for a single subsystem command. Common commands, such as *RST, are not subsystem commands and are not interpreted as part of a path.
For example: :SENSe:VOLTage:RANGe:AUTO; RESolution:AUTO is the same as executing :SENSe:VOLTage:RANGe:AUTO :SENSe:VOLTage:RESolution:AUTO It should be noted that the spaces around the ";" are strictly window-dressing. The parser ignores them, they're just there to make the string easier to read. Similarly: :SENSe:VOLTage:RANGe:AUTO :SENSe:CURRent:RANGe:UPPer -- is the same as executing both commands separately, since the ":" immediately following the separating ";" resets the current path to root. A feature of compound commands is that the following command starts at the last node of the previous command. This often makes the command line shorter than it would be otherwise. But what if you want a to use a command on a different branch? If this is the case, you must put a colon (:) before the command that follows the semi-colon (;). This returns the command tree to the root. For example this is a valid command line: MEASURE:VOLTAGE:DC?;:MEASURE:CURRENT:DC?
GPIB Instruments
GPIB Instruments
PRINTER
Software Implementation: The software program is developed using graphical programming environment such as LabVIEW, VEE etc. Programs are generally made in modular structures and are expandable.
Instrument drivers
GPIB Instrument
Operating System
The selection of the controller card should allow us to not only configure our current GPIB test configuration, but anticipate future requirements or applications. Will the GPIB setup be used remotely or in a multiboard system? Designing a remotely-operated GPIB test setup has special considerations from a GPIB setup in which all of the components are local. Mulitboard systems may also have unique considerations. Multiboard systems, for example, are effective at controlling more than one GPIB test configuration, provided the computer and the hardware interface to the GPIB controller card can support high-speed transfer. Because of their high bus speeds, GPIB controller cards that interface to the computer through PCI or PCMCIA will do a good job of supporting the load of a multiboard system. Other GPIB interfaces, such as a serial or parallel port, operate at a much slower throughput and can bottleneck a test configuration. A good rule of thumb is to select a controller card that meets all the compatibility issues in Figure 9, including compatibility with the GPIB test software, and uses the fastest computer hardware interface available.
means available to communicate with other applications on a system (Discussed in Case Study using VEE)
4. Case Study: Virtual Instrumentation Based Automated Test System Using Agilents VEE
4.1 Introduction to Agilent VEE
Agilent Visual Engineering Environment (Agilent VEE) [8][9] is a graphical programming language specially designed for controlling programmable instruments such as power supplies, function generators, digital multimeters, oscilloscopes and others. When the instruments are connected to a circuit, the user can send commands and data to the instruments to activate the circuit from a desktop computer, receive the data measured by the instruments, perform mathematical analyses of the data, and display the results graphically or store them in files. In a conventional textual language, rules of syntax and operators control program execution. In Agilent VEE, the program is designed by connecting objects in the workspace together with "wires", lines that connect these objects in a meaningful fashion. These wires dictate when and where data will flow through the program.
Figure 10 VEE Object with different pins Each object acts like a function call, which manipulates certain arguments. It receives data via data input pins on the left side. The object performs some function to this data and then returns any results through data output pins on the right hand side. Each pin is for a specific input/output to the function, though that data may be an array or record of information. Data propagation through a network of objects, analogous to the way a variable passes through functions in C, is determined by the status of each object's pins. Only an object with data supplied to all its Data In pins will execute. Thus the objects with no data input pins execute first in the workspace. Their Data Out pins provide inputs to other objects, then those objects may execute, etc. Multiple objects may have the ability to execute at the same time. The determination of which executes first is indeterminate. However, the programmer may control this propagation by using
sequence pins. An object with its Sequence In pin wired to something else may not execute until data (of any type) is passed to that pin. Then the object may execute, and it is not until this execution is complete that the Sequence Out pin sends its data out, if it is wired up. Consequently, the Sequence pins are acting just like Data In/Out pins, except the data isn't being used for anything. Agilent VEE has a menu bar like all other Windows based application. Just below the menubar is a tool bar with the Agilent logo on it. Buttons located on the toolbar, used to execute your programs (e.g. Run, Stop), will be designated in a similar manner. The left mouse button is used to make choices and perform actions. The right mouse button will open a pop up menu for anything on the screen. The menu displayed when you click the right button over an object, its associated Object Menu, is one you will be seeing frequently.
Figure 11 Soft Front panel of DMM The soft front-panel of an instrument driver makes possible to control online the instrument with the mouse and to read the state and the measured value on the screen. The instrument manager shows all available drivers (if necessary further drivers can be loaded). Using the edit function of the instrument manager, many special parameters of the driver (e.g. name, address, status) can be changed. It is possible to add terminals to the soft front-panel for input or output of data, parameters, instrument functions and control signals.
Select Function Generator (@706) in the dialog box that appears, and click the Panel Driver button. Click anywhere on the working area of the screen to place the instrument. The object can be moved by clicking anywhere on it and dragging the mouse. The actual function generator is immediately in communication with instrument driver through the bus cable. Although several "panels" are available, you will probably need only the Main Panel, which is the default. Make the following changes in the settings, while observing the digital display on the bench instrument: Select the Function window and set the function to one of the choices that appear; Select the Frequency window and set an arbitrary value; you may use units such as m, k, and M for milli, kilo, and mega respectively; Select the Amplitude window and set an arbitrary value.
Try to familiarize with the panel drivers for the digital multimeter and the oscilloscope as well. Figure 10 shows the opened drivers for all three instruments. Figure 11 shows remote control of instruments using panel driver.
Figure 13 Instrument remote control using soft front-panels Direct I/O: Direct I/O object allows us to communicate with any instrument from any vendor over standard interfaces. The application of direct I/O is useful if no instrument driver is available or if only few functions of an instrument are used. The Direct I/O object works by transmitting commands to the instrument and receiving data back from the instrument. Use of Direct I/O generally gives faster execution speeds. Figure 14 shows an example using Direct I/O to control a function generator.
Figure 14 Direct I/O with SCPI Commands Remote Control of Instruments Using Direct I/O and SCPI Commands A command or query is called a program message unit. Such a program message unit consists of a header, or a header separated by a space from one or more parameters (see Figure 14). The header consists of one or more key words.
Figure 15 Syntax of a program message unit One or more program message units (commands) may be sent within a single program message, separated by a semicolon (;). A program message must be finished by a program message terminator; Agilent VEE sends this terminator automatically. SCPI commands have a tree structure. The syntax of a command begins from the root level downwards to the leaf-nodes at the bottom of the command tree. All key words begin with a double point (:). Leaf-nodes are the last key words in the command header. The following notes apply to commands: Key words written into angular brackets can be left out. Basically all commands also have a query form. The response to the query is often the parameter of the command. Commands that do not cause a setting or state to be changed (so-called event commands), do not have a query form. There are also queries that do not have a command form. A command may or may not have parameters. Following data can be used as a parameter: Numeric values, Several key words as a special form of numeric data, i.e. MINimum, MAXimum, DEFault, Other data types, e.g. string, character, Boolean. Long and short form Key words (mnemonics) in SCPI program messages may be sent either in long or short form. The long and short forms essentially obey the following rules: The long form is the full word of the mnemonic but has a maximum of 12 characters (example: INITiate). The short form consists of the first four characters of the long form (example: INIT). Exception: When the fourth character is a vowel and the four characters do not form the long form, then the short form consists of the first three characters only (e.g. long form: SWEEP, short form: SWE). Sometimes a mnemonic is created from a concatenated word or phrase, i.e. PTPeak for peak to peak or AC for alternating current. Either the long form or the short form may be used in a command message. In a response message only the short form will be used. Measurement instructions SCPI offers different possibilities to obtain measurement results. These groups of measurement instruction sets have different levels of complexity and flexibility. :MEASure? The :MEASure? query configures the instrument, starts the data acquisition, and returns the result. Parameters may be added to give further details about the signal to be measured (Figure 16).
Figure 16 Application of the :MEASure? instruction with parameter (1) In this case a numeric value is used as a parameter: the parameter 10 is the expected signal range. It is possible to use a data input of the direct I/O object to transfer the parameter as a variable into the direct I/O transaction (Figure 17, the parameter is the variable A).
Program Examples
4.3.5 The Test Setup Figure 19 shows the setup and circuit schematic for automatic testing of an analog circuit. Figure 20 shows the corresponding VEE programs for automated test structures. Result that is analyzed in the X-Y trace is given in Figure 21.
Conclusions
This article introduces a programmable instrumentation system development connecting programmable instruments to a PC using GPIB interface bus. It also discusses how to design, configure and develop distributed ATE system by implementing communication network. The detailed discussion on GPIB interface bus and VEE test automation software is presented. Real-time program examples are given to demonstrate how the instruments are controlled.
References
[1] National Instruments: Instrumentation Catalogue: Measurement and Automation [2] Hewlett-Packard Company, www.hp.com [3] Caristy, J.: IEEE 488 General Purpose Instrumentation Bus Manual. Academic Press, 1989. [4] Hewlett Packard: Test System and VXI Products Catalog. Hewlett-Packard Company, 1997. [5] National Instruments: LabVIEW Manual. www.ni.com [6] Agilents VEE Pro 6 manual [7] National Instruments: PXI Specification Rev.1.0, National Instruments, 1997. [8] Agilent Technologies: Getting Started with VEE [9] Helsel R.: Visual programming with HP VEE. Hewlett-Packard Professional Books, third edition 1998. [10] Agilent Technologies: Controlling Instruments with HP VEE. [11] Agilent Technologies: 6629A Four-output dc power supply [12] Agilent Technologies: 33401A Digital Mutimeter [12] Agilent Technologies: 33250A Arbitrary Function Generator [13] Agilent Technologies: 54615b Oscilloscope