Measurement Studio TM User Manual Measurement Studio User Manual Measurement Studio User Manual July 2004 Edition Part Number 323392B-01
Worldwide Technical Support and Product Information ni.
Important Information Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period.
Contents About This Manual How to Use this Manual ................................................................................................vii Conventions ...................................................................................................................viii Chapter 1 Introduction to Measurement Studio Installation Requirements ..............................................................................................1-1 Distribution Requirements ..................................
Contents Analysis ......................................................................................................................... 3-3 Standard Analysis ........................................................................................... 3-3 Professional Analysis ...................................................................................... 3-4 Enterprise Analysis ......................................................................................... 3-4 Common ...................
About This Manual The Measurement Studio User Manual introduces the concepts associated with the Measurement Studio class libraries and development tools. This manual assumes that you have a general working knowledge of Microsoft Visual Studio .NET, including Microsoft Visual Basic .NET, Microsoft Visual C#, or Microsoft Visual C++. How to Use this Manual Measurement Studio 7.1 includes two CDs—one with support for Visual Studio .NET 2003 and one with support for Visual Studio 6.0.
About This Manual Conventions The following conventions appear in this manual: » The » symbol leads you through nested menu items and dialog box options to a final action. The sequence File»Page Setup»Options directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a tip, which alerts you to advisory information. This icon denotes a note, which alerts you to important information.
1 Introduction to Measurement Studio Measurement Studio is an integrated suite of native tools and class libraries that are designed for developers using Visual Basic .NET, Visual C#, and Visual C++ .NET to develop measurement and automation applications.
Chapter 1 Introduction to Measurement Studio Distribution Requirements To distribute an application built with Measurement Studio .NET class libraries, the target computer must have a Windows 2000/XP operating system and the .NET Framework version 1.1. To distribute an application built with Measurement Studio Visual C++ class libraries, the target computer must have a Windows 2000/XP operating system. Installation Instructions Complete the following steps to install Measurement Studio.
Chapter 1 Introduction to Measurement Studio 3. Enter the serial number. You can find your serial number on the Certificate of Ownership card that you received with Measurement Studio. Click Next. 4. Click Next to install all NI software to the default installation directory, or click Browse to select a different installation directory. You must install Measurement Studio to a local drive. Click Next.
Chapter 1 Introduction to Measurement Studio Measurement Studio Package Comparison Chart Table 1-1 lists the features included in the Standard, Professional, and Enterprise Editions of Measurement Studio. Table 1-1.
Chapter 1 Introduction to Measurement Studio Measurement Studio Resources As you work with Measurement Studio, you might need to consult other resources. For detailed Measurement Studio help, including function reference and in-depth documentation on developing with Measurement Studio, refer to the NI Measurement Studio Help within the Visual Studio .NET environment. The NI Measurement Studio Help is fully integrated with the Visual Studio .NET help. You must have Visual Studio .
Chapter 1 Introduction to Measurement Studio If you have not previously installed Measurement Studio for Windows 2000/XP, Version 7.0, the example programs are installed to the following directory: – Visual Basic .NET or Visual C#—Program Files\National Instruments\MeasurementStudioVS2003\DotNET\ Examples – Measurement Studio User Manual Visual C++ .
Measurement Studio .NET Class Libraries 2 This chapter provides overview information about the .NET class libraries included with Measurement Studio. Refer to the Using the Measurement Studio .NET Class Libraries section of the NI Measurement Studio Help for detailed information about these libraries. Measurement Studio .NET Class Libraries Overview Measurement Studio provides .NET class libraries that you can use to develop complete measurement and automation applications in Visual Basic .
Chapter 2 Measurement Studio .NET Class Libraries Analysis The Measurement Studio Analysis .NET class library is in the NationalInstruments.Analysis namespace. The Analysis class library includes a set of classes that provides various digital signal processing, signal filtering, signal generation, peak detection, and other general mathematical functionality. Use this library to analyze acquired data or to generate data.
Chapter 2 Measurement Studio .
Chapter 2 Measurement Studio .NET Class Libraries NI-488.2 The Measurement Studio NI-488.2 .NET class library is in the NationalInstruments.NI4882 namespace. This class library is included on the Device Drivers CD. The NI-488.2 class library includes a set of classes that communicates with GPIB instruments, controls GPIB boards, and acquires GPIB status information. Use this library to design code that communicates with and controls instruments on a GPIB interface. Use the classes in the NI-488.
Chapter 2 Measurement Studio .NET Class Libraries NI-VISA The Measurement Studio NI-VISA .NET class library is in the NationalInstruments.VisaNS namespace. The NI-VISA class library includes a set of classes that provides a rich, object-oriented interface to the NI-VISA driver. Use this library to quickly create bus-independent and/or bus-specific instrument control applications. The NI-VISA class library supports I/O operations, locking, event handling, and interface-specific extensions.
Chapter 2 Measurement Studio .NET Class Libraries • Thermometer • Tank • Numeric edit • Switch • LED Use this class library to add measurement-specific user interface controls to your application. Configure the controls programmatically or through the Properties window in the Windows Forms Designer. The following sections describe each of the Measurement Studio user interface controls. Tip For more information about easily using the .
Chapter 2 Measurement Studio .NET Class Libraries Figure 2-1. Waveform Graph with Cursors and Scatter Graph with XY Point Annotation; Both Graphs Have Corresponding Legends With the waveform graph and scatter graph controls and the classes that interface with the controls, you can perform the following operations: • Plot and chart data. • Configure a graph to contain multiple plots to show separate but related data on the same graph.
Chapter 2 Measurement Studio .NET Class Libraries • Use cursor labels to display X and Y data coordinates that the cursor crosshair points to, and customize the text font and colors of the label. • Use the extensible plot and plot area drawing capabilities and events to customize the graph appearance. • Create custom point and line styles for plots and cursors. • Pan and zoom interactively. • Configure the axis modes to exact or loose autoscaling, fixed, strip chart, or scope chart.
Chapter 2 Measurement Studio .NET Class Libraries Numeric Controls Use the Measurement Studio numeric controls to display numerical information on a Windows Forms user interface with the look of scientific instruments. The numeric controls include a knob, gauge, meter, slide, thermometer, and tank. The following sections describe operations available with the controls and the classes that interface with them.
Chapter 2 Measurement Studio .NET Class Libraries Figure 2-3. Slide, Tank, and Thermometer Controls With the slide, tank, and thermometer controls and the classes that interface with them, you can perform the following operations: • Fill the minimum or maximum value of the scale. • Position the scale horizontally with left, right, or both and position the scale vertically with top, bottom, or both.
Chapter 2 Measurement Studio .NET Class Libraries Numeric Edit Control Use the Measurement Studio numeric edit control, as shown in Figure 2-4, to display numeric values and to provide a way by which end users can edit numeric values. Typically, you use a numeric edit control to input or display double numerical data instead of using a Windows Forms TextBox or NumericUpDown control. Figure 2-4.
Chapter 2 Measurement Studio .NET Class Libraries Switch and LED Controls Use the Measurement Studio switch and LED controls as Boolean controls on a Windows Forms user interface. You typically use a switch control, as shown in Figure 2-5, to receive and control Boolean input on an application user interface. Figure 2-5. Switch Control in Vertical Toggle 3D Style You typically use an LED control, as shown in Figure 2-6, to indicate a Boolean value on an application user interface. Figure 2-6.
Measurement Studio Visual C++ Class Libraries 3 This chapter provides overview information about the Visual C++ class libraries that are available with Measurement Studio. Refer to the Using the Measurement Studio Visual C++ Class Libraries section of the NI Measurement Studio Help for detailed information about these libraries.
Chapter 3 Measurement Studio Visual C++ Class Libraries ActiveX Controls in Visual C++ ActiveX controls are specialized COM servers that implement a specific set of interfaces. The Measurement Studio Visual C++ button, graph, knob, numeric edit, slide, and 3D Graph are ActiveX controls. Measurement Studio includes classes that provide native C++ interfaces to the ActiveX controls. For example, the CNiGraph class provides an interface to the CWGraph ActiveX graph control.
Chapter 3 Measurement Studio Visual C++ Class Libraries • Bind the control to a DataSocket Server to enable automatic read and write functionality. • Use multiple plot styles—point-line, line-point, hidden-line, contour, surface, surface-line, surface-contour, and surface-normal. • Create multiple plots with individual properties, such as name, line and point style, width, and base value. • Configure the axes using customizable ticks, labels, value pairs, and captions.
Chapter 3 Measurement Studio Visual C++ Class Libraries Professional Analysis The Professional Analysis class library, which ships with Measurement Studio Professional Edition, includes the Standard Analysis functionality as well as the following functionality: • Bessel, Chebyshev, Inverse Chebyshev, Windowed Kaiser, and Elliptic Low, High, Bandpass, and Bandstop filters • Signal processing functions such as convolution, deconvolution, correlation, decimation, integration, and differentiation • FFT,
Chapter 3 Measurement Studio Visual C++ Class Libraries Common The Measurement Studio Common Visual C++ class library provides data types and classes that other Measurement Studio Visual C++ class libraries use. The classes that are implemented natively in Visual C++ include the CNiVector and CNiMatrix classes. The Common class library includes the following data types: • CNiScalarVector—Implements a vector object that contains scalar numbers.
Chapter 3 Measurement Studio Visual C++ Class Libraries IVI drivers are divided into two main categories—class drivers and specific drivers. Each class driver provides a consistent interface to a particular type of device. Measurement Studio includes the following class driver class libraries: • IviDcPwr—Provides an interface to the IVI DC power supply class driver. CNiIviDcPwr is the top-level class of this class library. • IviDmm—Provides an interface to the IVI DMM class driver.
Chapter 3 Measurement Studio Visual C++ Class Libraries For more information on using the LabVIEW Real-Time Module, refer to the LabVIEW Real-Time Interface Visual C++ Class Library Overview topic in the NI Measurement Studio Help. For more information about the LabVIEW Real-Time Module, visit ni.com/labviewrt. Tip Microsoft Excel Interface Use the Measurement Studio Excel Visual C++ class library to automatically create Excel spreadsheets and charts from within measurement and automation applications.
Chapter 3 Measurement Studio Visual C++ Class Libraries NI-488.2 Use the Measurement Studio NI-488.2 Visual C++ class library to communicate with and control instruments on a GPIB interface. Use the classes in this library to perform the following operations: • Perform I/O with GPIB instruments and boards. • Configure GPIB instruments and boards. • Perform event handling for GPIB instruments and boards. You can use the NI-488.
Chapter 3 Measurement Studio Visual C++ Class Libraries NI-Reports Use the Measurement Studio NI-Reports Visual C++ class library to generate printed reports from Measurement Studio Visual C++ applications. This class library is included only in the Measurement Studio Enterprise package. For more information about generating printed reports using the NI-Reports class library, refer to the NI-Reports Visual C++ Class Library Overview topic in the NI Measurement Studio Help.
Chapter 3 Measurement Studio Visual C++ Class Libraries User Interface Use the Measurement Studio User Interface Visual C++ class library to add user interface controls to your application. You can configure the user interface controls programmatically or through the property pages in the Visual C++ resource editor. The following sections describe each of the Measurement Studio Visual C++ user interface controls.
Chapter 3 Measurement Studio Visual C++ Class Libraries Graph Control Use the Measurement Studio ActiveX graph control, as shown in Figure 3-3, to plot and chart two-dimensional data. The CNiGraph class provides the Visual C++ interface to the ActiveX graph control. Figure 3-3. ActiveX Graph Control With the graph control and the classes that interface with the control, you can perform the following operations: • Plot and chart data.
Chapter 3 Measurement Studio Visual C++ Class Libraries • Bind properties to a DataSocket source or target. You use binding to read property values from a source and write property values to a target. For more information about easily using the graph control, refer to the Using the Measurement Studio Visual C++ Graph Control section in the NI Measurement Studio Help. Tip Knob Control Use the Measurement Studio ActiveX knob control, as shown in Figure 3-4, to display numerical information.
Chapter 3 Measurement Studio Visual C++ Class Libraries Numeric Edit Control Use the Measurement Studio ActiveX numeric edit control, as shown in Figure 3-5, to display numeric values and provide a way by which end users can edit numeric values. Typically, you use a numeric edit control to input or display numerical data instead of using a text box. The CNiNumEdit class provides the Visual C++ interface to the ActiveX numeric edit control. Figure 3-5.
Chapter 3 Measurement Studio Visual C++ Class Libraries Slide Control Use the Measurement Studio ActiveX slide control, as shown in Figure 3-6, to display numerical data. CNiSlide is the class that provides the Visual C++ interface to the ActiveX slide control. Figure 3-6. ActiveX Slide Control With the slide control and the classes that interface with the control, you can perform the following operations: • Use different display styles—vertical, horizontal, tank, and thermometer.
Chapter 3 Measurement Studio Visual C++ Class Libraries Utility Use the Measurement Studio Utility Visual C++ class library to easily access Windows operating system functionality. Table 3-1 lists classes in the Utility class library and their functionality. Table 3-1. Utility Class Names and Functionalities Utility Class CNiFile Functionality CNiFile extends the MFC CStdioFile class by adding streaming operators for standard Visual C++ data types.
Chapter 3 Measurement Studio Visual C++ Class Libraries Table 3-1. Utility Class Names and Functionalities (Continued) Utility Class Functionality CNiTempFile CNiTempFile extends the functionality of CNiFile to add temporary file creation and manipulation. CNiTimer CNiTimer objects use the Windows multimedia timer to generate high-resolution, asynchronous tick events. Respond to tick events when you want to perform an action at a discrete interval.
Developing with Measurement Studio 4 When you use Measurement Studio in the Visual Studio .NET environment, you have access to measurement and automation tools and features for Visual Basic .NET, Visual C#, and Visual C++ .NET. These integrated tools and features are designed to help you quickly and easily build measurement and automation applications.
Chapter 4 Developing with Measurement Studio Measurement Studio User Manual • Add/Remove Class Libraries Wizard—Use the Measurement Studio Add/Remove Class Libraries wizard to add or remove Measurement Studio class libraries or assemblies in existing Visual Basic .NET, Visual C#, or Visual C++ .NET projects. • Project Conversion Wizard—Use the Project Conversion wizard to convert Measurement Studio 1.0 and 6.0 Visual C++ projects to the current version installed on your machine. Conversion from 7.
Chapter 4 Developing with Measurement Studio • Preferences—Use the Measurement Studio Preferences dialog box to configure Measurement Studio settings, such as conversion options and add-in preferences. • Patents—Use the Patents dialog box to view information about NI patents. • About NI Measurement Studio—Use the NI Measurement Studio About box to view version information.
Chapter 4 Developing with Measurement Studio Figure 4-1. New Project Dialog Box Tip For more information about using project templates to create a new Measurement Studio project, refer to the Creating a New Measurement Studio Project section in the NI Measurement Studio Help. For information about converting Measurement Studio projects, refer to the Converting Measurement Studio Projects section in the NI Measurement Studio Help.
Chapter 4 Developing with Measurement Studio The DAQ Assistant interactively assists you in performing the following operations: • Creating a DAQ task class • Configuring a DAQ task class • Generating a Visual Basic .NET, Visual C#, or Visual C++ .NET class that includes the functionality you configure in the user interface • Generating code that uses a DAQ task class • Using a DAQ task class in a project Figure 4-2.
Chapter 4 Developing with Measurement Studio Creating an NI-DAQmx User Control You can create an NI-DAQmx .NET user control with Measurement Studio that provides a default graphical user interface to an NI-DAQmx task. The NI-DAQmx User Control wizard wraps a configured NI-DAQmx task class in a user-friendly control. You can drop the generated user control from the Visual Studio .NET Toolbox onto a form and use it just as you use any Windows Forms control.
Chapter 4 Developing with Measurement Studio Figure 4-3. Instrument I/O Assistant The Instrument I/O Assistant aids you in performing the following operations: • Creating an instrumentation task class • Configuring an instrumentation task class to communicate with an instrument and parse data you receive from the instrument. For more information about using the Instrument I/O Assistant to create a Measurement Studio NI-488.2 or NI-VISA application, refer to the Creating a Measurement Studio 488.
Chapter 4 Developing with Measurement Studio Adding or Removing Measurement Studio Class Libraries To add or remove Measurement Studio class libraries from a project, use the Measurement Studio Add/Remove Class Libraries wizard on the Measurement Studio menu. This wizard provides an interface, as shown in Figure 4-4, that you can use to select the Measurement Studio class libraries you want to add to or remove from a project.
Chapter 4 Developing with Measurement Studio Selecting a Measurement Studio Parameter Value To access I/O devices or resources, you must specify string constants or scalar values for many method parameters and property values. Use the Measurement Studio Parameter Assistant, on the Measurement Studio menu, to discover and insert into your code valid parameter values for methods and various Measurement Studio class libraries, such as NI-DAQmx, NI-488.2, and NI-VISA.
Chapter 4 Developing with Measurement Studio Calling Instrument Drivers from .NET Languages To use an IVI or VXIplug&play instrument driver with a C DLL in a Measurement Studio .NET application, use the Measurement Studio .NET Instrument Driver wizard to create .NET entry points to the C DLL functions you need to call from your application. Use the Add New Item wizard to select the .NET Instrument Driver Wizard. The Measurement Studio .NET Instrument Driver wizard, as shown in Figure 4-6, generates a .
Technical Support and Professional Services A Visit the following sections of the National Instruments Web site at ni.com for technical support and professional services: • Support—Online technical support resources at ni.
Glossary A ActiveX Set of Microsoft technologies for reusable software components. Formerly called OLE. ActiveX control Reusable software component that adds functionality to any ActiveX control container through exposed properties, methods, and events. The Measurement Studio data acquisition, user interface, and analysis controls are examples of ActiveX controls.
Glossary B button A control used to input or display boolean information or to initiate an action in a program. C channel 1. Physical—a terminal or pin at which you can measure or generate an analog or digital signal. A single physical channel can include more than one terminal, as in the case of a differential analog input channel or a digital port of eight lines.
Glossary context-sensitive help Help for dialog boxes, the controls in dialog boxes, and keywords in source code that you can access with the key or a Help button, or by clicking the link that appears in the Dynamic Help window in Visual Studio .NET. control 1. ActiveX control. See ActiveX control. 2. Object for entering, displaying, or manipulating data on a user interface. counter/timer I/O Reading or writing data based on high-precision timing through a counter or timer.
Glossary distribution Ability to install programs you develop with Measurement Studio to others working on different computers. DLL Dynamic Link Library. A library of functions that link to a program and load at run time rather than being compiled into the program. Loading libraries only when they are needed saves memory in software applications. DMM Digital Multimeter. A common measurement instrument that measures resistance, current, and voltage in a wide variety of applications.
Glossary G gauge A control used to input or display numerical data. GPIB General Purpose Interface Bus. The standard bus used for controlling electronic instruments with a computer. Also called IEEE 488 bus because it is defined by ANSI/IEEE Standards 488-1978, 488.1-1987, and 488.2-1987. graph A 2D or 3D display of one or more plots. H HTTP HyperText Transfer Protocol. Protocol based on TCP/IP, which is used to download Web pages from an HTTP server to a Web browser.
Glossary interface Connection between one or more of the following: hardware, software, and the user. For example, hardware interfaces connect two other pieces of hardware. IVI Interchangeable Virtual Instruments. A technology involving standard programming interfaces for classes of instruments, such as oscilloscopes, DMMs, and function generators, that results in hardware-independent instrument drivers.
Glossary Measurement & Automation Explorer (MAX) National Instruments tool for configuring your National Instruments hardware and driver software; executing system diagnostics; adding new devices, interfaces, and virtual channels; and viewing devices and instruments connected to your system. measurement device DAQ devices such as the E Series multifunction I/O (MIO) devices, SCXI signal conditioning modules, and switch modules.
Glossary numeric edit control A control used to display and edit numeric values. O OCX OLE Control eXtension. Another name for ActiveX controls, reflected by the .ocx file extension of ActiveX control files. OLE Object Linking and Embedding. See ActiveX. OPC OLE for Process Control. An industry standard based on ActiveX and COM technologies that enables you to create a single client application that can communicate with disparate devices. Visit www.opcfoundation.org.
Glossary property pages Window or dialog box that displays current configuration information and allows users to modify the configuration. PXI PCI eXtensions for Instrumentation. Rugged, open platform for modular instrumentation with specialized mechanical, electrical, and software features. Visit www.pxisa.org. R range Region between the limits within which a quantity is measured, received, or transmitted. The range is expressed by stating the lower and upper range values.
Glossary T tank A control used to input or display numerical data. task NI-DAQmx—a set of channels and the channel configurations, timing, and triggering, and other details that define a measurement or generation you want to perform. TCP/IP Transmission Control Protocol/Internet Protocol. A standard format for transferring data in packets from one computer to another.
Index A new Measurement Studio project, 4-3 NI-DAQmx user control, 4-6 ActiveX controls in Visual C++, 3-2 Add/Remove Class Libraries wizard, 4-8 adding or removing Measurement Studio class libraries, 4-8 Analysis .
Index I Microsoft Word Interface Visual C++ class library, 3-7 installation optional, 1-1 procedure, 1-2 requirements, 1-1 instrument driver wizard, .NET, 4-10 instrument drivers (NI resources), A-1 Instrument Drivers Visual C++ class library, 3-5 Instrument I/O Assistant, 4-6 N National Instruments support and services, A-1 .NET class libraries Analysis, 2-2 Common, 2-3 NI-488.
Index O U overview Measurement Studio, 1-1 .NET class libraries, 2-1 Visual C++ class libraries, 3-1 User Interface .
Index W NI-DAQmx, 3-8 NI-Reports, 3-9 NI-VISA, 3-9 overview, 3-1 User Interface, 3-10 Utility, 3-15 Measurement Studio User Manual waveform graph control, 2-6 Web resources, A-1 Windows Forms user interface controls, 2-5 I-4 ni.