0% found this document useful (0 votes)
130 views131 pages

MStudio MeasComp Edition

Software media are warranted not to fail to execute programming instructions for a period of 90 days from date of shipment. National Instruments will repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. A Return Material Authorization (RMA) number must be obtained from the factory before any equipment will be accepted for warranty work.

Uploaded by

Lê Duy Minh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views131 pages

MStudio MeasComp Edition

Software media are warranted not to fail to execute programming instructions for a period of 90 days from date of shipment. National Instruments will repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. A Return Material Authorization (RMA) number must be obtained from the factory before any equipment will be accepted for warranty work.

Uploaded by

Lê Duy Minh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 131

Measurement Studio Measurement Computing Edition

TM TM

User Manual
Measurement Computing Edition User Manual

April 2008 374318B-01

Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Worldwide Offices Australia 1800 300 800, Austria 43 662 457990-0, Belgium 32 (0) 2 757 0020, Brazil 55 11 3262 3599, Canada 800 433 3488, China 86 21 5050 9800, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00, Finland 358 (0) 9 725 72511, France 01 57 66 24 24, Germany 49 89 7413130, India 91 80 41190000, Israel 972 3 6393737, Italy 39 02 41309277, Japan 0120-527196, Korea 82 02 3451 3400, Lebanon 961 (0) 1 33 28 28, Malaysia 1800 887710, Mexico 01 800 010 0793, Netherlands 31 (0) 348 433 466, New Zealand 0800 553 322, Norway 47 (0) 66 90 76 60, Poland 48 22 3390150, Portugal 351 210 311 210, Russia 7 495 783 6851, Singapore 1800 226 5886, Slovenia 386 3 425 42 00, South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 (0) 8 587 895 00, Switzerland 41 56 2005151, Taiwan 886 02 2377 2222, Thailand 662 278 6777, Turkey 90 212 279 3031, United Kingdom 44 (0) 1635 523545 For further support information, refer to the Contacting Measurement Computing Corporation appendix. To comment on National Instruments documentation, refer to the National Instruments Web site at ni.com/info and enter the info code feedback. 20062008 National Instruments Corporation. All rights reserved. Austin, Texas 78759-3504 USA Tel: 512 683 0100

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. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free. A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty. National Instruments believes that the information in this document is accurate. The document has been carefully reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it. EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. CUSTOMERS RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages, defects, malfunctions, or service failures caused by owners failure to follow the National Instruments installation, operation, or maintenance instructions; owners modification of the product; owners abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control.

Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation. National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction.

Trademarks
National Instruments, NI, ni.com, and LabVIEW are trademarks of National Instruments Corporation. Refer to the Terms of Use section on ni.com/legal for more information about National Instruments trademarks. Universal Library and Measurement Computing are trademarks of Measurement Computing Corporation. Other product and company names mentioned herein are trademarks or trade names of their respective companies.

Patents
For patents covering National Instruments products, refer to the appropriate location: HelpPatents in your software, the patents.txt file on your media, or ni.com/patents.

WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS


(1) NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTING FOR A LEVEL OF RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT INJURY TO A HUMAN. (2) IN ANY APPLICATION, INCLUDING THE ABOVE, RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS CAN BE IMPAIRED BY ADVERSE FACTORS, INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY, COMPUTER HARDWARE MALFUNCTIONS, COMPUTER OPERATING SYSTEM SOFTWARE FITNESS, FITNESS OF COMPILERS AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION, INSTALLATION ERRORS, SOFTWARE AND HARDWARE COMPATIBILITY PROBLEMS, MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL DEVICES, TRANSIENT FAILURES OF ELECTRONIC SYSTEMS (HARDWARE AND/OR SOFTWARE), UNANTICIPATED USES OR MISUSES, OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER (ADVERSE FACTORS SUCH AS THESE ARE HEREAFTER COLLECTIVELY TERMED SYSTEM FAILURES). ANY APPLICATION WHERE A SYSTEM FAILURE WOULD CREATE A RISK OF HARM TO PROPERTY OR PERSONS (INCLUDING THE RISK OF BODILY INJURY AND DEATH) SHOULD NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE. TO AVOID DAMAGE, INJURY, OR DEATH, THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS. BECAUSE EACH END-USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS' TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL INSTRUMENTS, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN, PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.

WARNING REGARDING USE OF MEASUREMENT COMPUTING CORPORATION PRODUCTS


MEASUREMENT COMPUTING CORPORATION DOES NOT AUTHORIZE ANY MEASUREMENT COMPUTING CORPORATION PRODUCT FOR USE IN LIFE SUPPORT SYSTEMS AND/OR DEVICES WITHOUT WRITTEN APPROVAL OF THE CEO OF MEASUREMENT COMPUTING CORPORATION. LIFE SUPPORT DEVICES/SYSTEMS ARE DEVICES OR SYSTEMS WHICH, A)ARE INTENDED FOR SURGICAL IMPLANTATION INTO THE BODY, OR B)SUPPORT OR SUSTAIN LIFE AND WHOSE FAILURE TO PERFORM CAN BE REASONABLY EXPECTED TO RESULT IN INJURY. MEASUREMENT COMPUTING CORPORATION PRODUCTS ARE NOT DESIGNED WITH THE COMPONENTS REQUIRED, AND ARE NOT SUBJECT TO THE TESTING REQUIRED TO ENSURE A LEVEL OF RELIABILITY SUITABLE FOR THE TREATMENT AND DIAGNOSIS OF PEOPLE.

Contents
About This Manual
How To Use This Manual..............................................................................................ix Conventions ...................................................................................................................x

Chapter 1 Introduction to Measurement Studio Measurement Computing Edition


Installation Requirements ..............................................................................................1-2 Deployment Requirements ..............................................................................1-2 Installation Instructions..................................................................................................1-3 Installing the Current Version of Measurement Studio over Previous Versions of Measurement Studio ..................................................1-4 Measurement Studio Features........................................................................................1-4 Learning Measurement Studio.......................................................................................1-5

Chapter 2 Measurement Studio Measurement Computing Edition .NET Class Libraries


Measurement Studio Support for Visual Studio .NET Class Library Overview...........2-1 Analysis .........................................................................................................................2-2 Measurements ...................................................................................2-2 Signal Generation..............................................................................2-2 Windowing........................................................................................2-3 Filters ................................................................................................2-3 Signal Processing ..............................................................................2-4 Linear Algebra ..................................................................................2-4 Array and Numeric Operations .........................................................2-5 Curve Fitting .....................................................................................2-5 Statistics ............................................................................................2-6 Common.........................................................................................................................2-6 Network Variable...........................................................................................................2-7 MCC-488.2 ....................................................................................................................2-8 Universal Library ...........................................................................................................2-8 MccDaq Scan Components............................................................................................2-9 User Interface.................................................................................................................2-9 Windows Forms Controls ..............................................................................................2-10 Waveform Graph and Scatter Graph Controls ................................................2-11 Digital Waveform Graph Control....................................................................2-14 Complex Graph Control ..................................................................................2-16

National Instruments Corporation

Measurement Computing Edition User Manual

Contents

Legend Control ............................................................................................... 2-18 Numeric Controls ............................................................................................ 2-18 Numeric Edit Control...................................................................................... 2-20 Switch and LED Controls ............................................................................... 2-21 Property Editor Control................................................................................... 2-22 Windows Forms Array Controls ................................................................................... 2-23 Switch and LED Array Controls ..................................................................... 2-23 Numeric Edit Array Control ........................................................................... 2-25 InstrumentControlStrip Control ...................................................................... 2-26 ASP.NET Web Forms Controls .................................................................................... 2-27 Waveform Graph and Scatter Graph Controls ................................................ 2-28 Digital Waveform Graph Control ................................................................... 2-31 Complex Graph Control.................................................................................. 2-32 Legend Control ............................................................................................... 2-35 Numeric Controls ............................................................................................ 2-35 Numeric Edit Control...................................................................................... 2-38 Switch and LED Controls ............................................................................... 2-39 AutoRefresh Control ....................................................................................... 2-40 AutoRefresh Callback ..................................................................................... 2-40

Chapter 3 Measurement Studio Integrated Tools and Features


Measurement Studio Menu............................................................................................ 3-1 Creating a Measurement Studio Project ........................................................................ 3-4 Adding or Removing Measurement Studio .NET Class Libraries ................................ 3-5

Chapter 4 Getting Started with Measurement Studio


Measurement Studio Walkthroughs .............................................................................. 4-1 Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Analysis................................................................................................. 4-2 Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis................................................................................................. 4-11 Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Network Variable.................................................................................. 4-21 Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Network Variable.................................................................................. 4-30 Walkthrough: Creating a Measurement Studio Measurement Computing DAQ Application........................................................................................................ 4-41 Walkthrough: Creating a Measurement Studio MCCDaq Scan Components Application ................................................................................................................. 4-47 Walkthrough: Creating a Measurement Studio MCC-488.2 Application ..................... 4-53

Measurement Computing Edition User Manual

vi

ni.com

Contents

Appendix A Contacting Measurement Computing Corporation Glossary Index

National Instruments Corporation

vii

Measurement Computing Edition User Manual

About This Manual


The Measurement Studio Measurement Computing Edition 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 and the .NET Framework for .NET application development.

How To Use This Manual


Measurement Studio 8.5 includes support for Visual Studio .NET 2003, Visual Studio 2005, Visual Studio 2008. This manual documents Measurement Studio for Visual Studio 2005/2008. The Measurement Studio support for Visual Studio .NET 2003, Visual Studio 2005, and Visual Studio 2008 CD includes separate, parallel sets of class libraries, integration features, and support documentation for developing with Visual Studio .NET 2003, Visual Studio 2005, and Visual Studio 2008. The Measurement Studio Measurement Computing Edition User Manual is organized into four chapters. Chapter 1, Introduction to Measurement Studio Measurement Computing Edition, is an overview of Measurement Studio Measurement Computing Edition. This chapter includes installation and deployment requirements, installation instructions, and a list of Measurement Studio resources. Chapter 2, Measurement Studio Measurement Computing Edition .NET Class Libraries, includes information about the .NET class libraries. Chapter 3, Measurement Studio Integrated Tools and Features, includes information on using Measurement Studio Measurement Computing Edition tools and features integrated into the Visual Studio environment. Chapter 4, Getting Started with Measurement Studio, includes walkthroughs that guide you through step-by-step instructions on how to develop with Measurement Studio features. Use this manual as a starting point to learn about Measurement Studio. Refer to the NI Measurement Studio Help within the Visual Studio environment for function reference and detailed information about the Measurement Studio class libraries, wizards, assistants, and other features.
Note

Refer to the Measurement Studio Measurement Computing Edition Release Notes for updates or changes to the Measurement Studio Measurement Computing Edition User Manual.

National Instruments Corporation

ix

Measurement Computing Edition User Manual

About This Manual

Conventions
The following conventions appear in this manual: <> Text enclosed in angle brackets represents directory names and parts of paths that may vary on different computers, such as <Windows\System>. The symbol leads you through nested menu items and dialog box options to a final action. The sequence FilePage SetupOptions 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. bold Bold text denotes items that you must select or click on in the software, such as menu items and dialog box options. Bold text also denotes class library member names or emphasis. Italic text denotes parameters, variables, cross-references, or an introduction to a key concept. Italic text also denotes text that is a placeholder for a word or value that you must supply. Text in this font denotes text or characters that you enter from the keyboard, sections of code, programming examples, and syntax examples. This font also is used for the proper names of disk drives, paths, directories, programs, device names, filenames and extensions, and code excerpts.

italic

monospace

Measurement Computing Edition User Manual

ni.com

Introduction to Measurement Studio Measurement Computing Edition

Measurement Studio Measurement Computing Edition is an integrated suite of tools and class libraries that is designed for developers using Microsoft Visual Basic .NET and Visual C# to develop measurement and automation applications. Measurement Studio Measurement Computing Edition dramatically reduces application development time through object-oriented measurement hardware interfaces, advanced analysis libraries, scientific user interface controls for Windows and Web applications, measurement data networking, wizards, interactive code designers, and highly extensible .NET classes. You can use Measurement Studio Measurement Computing Edition to develop a complete measurement and automation application that includes data acquisition, analysis, and presentation functionalities. The Measurement Studio Measurement Computing Edition package includes two CDsone CD with support for Visual Studio .NET 2003, Visual Studio 2005, and Visual Studio 2008 and the other with MCC device drivers. This manual documents Measurement Studio for Visual Studio 2005 and Visual Studio 2008. For help with Visual Studio .NET 2003 support, refer to the Measurement Studio Support for Visual Studio .NET 2003 Readme. After installing Visual Studio .NET 2003 support, you can refer to the Measurement Studio User Manual by selecting StartAll Programs National Instruments<Measurement Studio for .NET 2003> User Manual.
Note

Refer to the Measurement Studio Measurement Computing Edition Release Notes for updates or changes to the Measurement Studio Measurement Computing Edition User Manual.

National Instruments Corporation

1-1

Measurement Computing Edition User Manual

Chapter 1

Introduction to Measurement Studio Measurement Computing Edition

Installation Requirements
To use Measurement Studio, your computer must have the following: Microsoft Windows Vista/XP/2000 for Visual Studio 2005 or Microsoft Windows Vista/XP for Visual Studio 2008

Note

If you have Windows Vista installed you must also have both Visual Studio 2005 Service Pack 1 and Visual Studio Service Pack 1 Update for Windows Vista installed on your machine for Measurement Studio to function properly. Microsoft .NET Framework 2.0 for Visual Studio 2005 or Microsoft .NET Framework 3.5 for Visual Studio 2008 (required only for the Measurement Studio .NET class libraries) Standard, Professional, or Team System edition of Microsoft Visual Studio 2005 or Standard, Professional, or Team System edition of Microsoft Visual Studio 2008 (required to use the Measurement Studio integrated tools) or Visual C# or Visual Basic .NET Express editions of Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008 Intel Pentium III class processor, 1 GHz or higher Video display1024 768, 256 colors (16-bit color recommended for user interface controls) Minimum of 256 MB of RAM (512 MB or higher recommended) Minimum of 250 MB of free hard disk space for Visual Studio 2005 support or minimum of 200 MB of free hard disk space for Visual Studio 2008 support Microsoft-compatible mouse Microsoft Internet Explorer 6.0 or later

Optional InstallationIn order for links from Measurement Studio help topics to .NET Framework help topics to work, you must install the Microsoft .NET Framework SDK 2.0 or Microsoft .NET Framework SDK 3.5.

Deployment Requirements
To deploy an application built with Measurement Studio .NET class libraries, the target computer must have a Windows Vista/XP/2000 operating system and the .NET Framework version 2.0 for Visual Studio 2005 or the .NET Framework version 3.5 for Visual Studio 2008.

Measurement Computing Edition User Manual

1-2

ni.com

Chapter 1

Introduction to Measurement Studio Measurement Computing Edition

Installation Instructions
Complete the following steps to install Measurement Studio. These steps describe a typical installation. Please carefully review all additional licensing and warning dialog boxes. National Instruments recommends that you exit all programs before running the Measurement Studio installer. Applications that run in the background, such as virus scanning utilities, might cause the installer to take longer than average to complete.
Note

There are separate installers for Measurement Studio support for Visual Studio 2005 and Measurement Studio support for Visual Studio 2008. Repeat the installation instructions to install support for both. To install the Measurement Computing drivers, insert the Measurement Computing Driver CD into the CD drive after the Measurement Studio installation is complete for all Measurement Studio Visual Studio support installers that you run. Skip this step if you do not have a driver CD. The option to browse for an installation location is valid only if you have not already installed any Measurement Studio features for the version of Visual Studio or the .NET Framework that you are installing. If you have any Measurement Studio features installed, then Measurement Studio installs to the same root directory to which you installed other Measurement Studio features. Complete the following steps to install Measurement Studio: 1. 2. 3. 4. Log on as an administrator or as a user with administrator privileges. Launch Autorun.exe from the installation CD. Select the version of Visual Studio you want to install support for. Follow the instructions that appear on the screen.

Note

If you want to upgrade a Windows XP machine to Windows Vista, National Instruments recommends first uninstalling all NI software, including both application software and drivers.

National Instruments Corporation

1-3

Measurement Computing Edition User Manual

Chapter 1

Introduction to Measurement Studio Measurement Computing Edition

Installing the Current Version of Measurement Studio over Previous Versions of Measurement Studio
Note

You can have only one version of Measurement Studio installed on a system for each version of Visual Studio or the .NET Framework installed on the system. For example, you can have Measurement Studio 8.1.2 for Visual Studio 2005 installed on the same system as Measurement Studio 8.5 for Visual Studio 2008, but you cannot have Measurement Studio 8.1.2 for Visual Studio 2005 installed on the same system as Measurement Studio 8.5 for Visual Studio 2005. If you install a newer version of Measurement Studio on a machine that has a prior version of Measurement Studio installed, the newer version installer replaces the prior version functionality, including class libraries. However, the prior version assemblies remain in the global assembly cache (GAC); therefore, applications that reference the prior version continue to use the prior version .NET assemblies.

Note This does not apply to NationalInstruments.Common.dll. NationalInstruments.Common.dll uses a publisher policy file to redirect applications to always use the newest version of NationalInstruments.Common.dll

installed on the system, for each version of the .NET Framework. NationalInstruments.Common.dll is backward-compatible.

Measurement Studio Features


The following list contains features included in Measurement Studio. Refer to mccdaq.com/mstudio for more information about the features and functionality included in Measurement Studio. Windows Forms user interface controls Web Forms user interface controls Analysis class library Universal Library class library MccDaq Scan Components class library MCC-488.2 class library

Measurement Computing Edition User Manual

1-4

ni.com

Chapter 1

Introduction to Measurement Studio Measurement Computing Edition

Learning Measurement Studio


As you work with Measurement Studio, you might need to consult additional 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 environment. The NI Measurement Studio Help is fully integrated with the Visual Studio help. You must have Visual Studio installed to view the online help, and you must have the the Microsoft .NET Framework SDK 2.0 for Visual Studio 2005 or the Microsoft .NET Framework SDK 3.5 for Visual Studio 2008 installed in order for links from Measurement Studio help topics to .NET Framework help topics to work. You can launch the NI Measurement Studio Help in the following ways: From the Windows Start menu, select StartAll ProgramsNational Instruments<Measurement Studio>Measurement Studio Documentation. The help launches in a stand-alone help viewer. From Visual Studio, select HelpContents to view the Visual Studio table of contents. The NI Measurement Studio Help is listed in the table of contents. From Visual Studio, select Measurement StudioNI Measurement Studio Help. The help launches within the application.

Tip

As you work through this manual, you will see italicized references to relevant help topics. To find these topics, use the table of contents in the NI Measurement Studio Help installed on your machine. The following resources also are available to provide you with information about Measurement Studio. Getting Started informationRefer to the Measurement Studio Core Overview topic and the Getting Started with the Measurement Studio Class Libraries section in the NI Measurement Studio Help for an introduction to Measurement Studio and for walkthroughs that guide you step-by-step in learning how to develop Measurement Studio applications. For an introduction to Measurement Studio resources, refer to the Using the Measurement Studio Help topic in the NI Measurement Studio Help. ExamplesMeasurement Studio installs examples organized by class library, depending on the component, the version of Visual Studio or the .NET Framework that the example supports, the version of

National Instruments Corporation

1-5

Measurement Computing Edition User Manual

Chapter 1

Introduction to Measurement Studio Measurement Computing Edition

Measurement Studio installed on the system, and the operating system. For more information on example locations, refer to Where To Find Examples. Measurement Computing Technical SupportRefer to Appendix A, Contacting Measurement Computing Corporation, in the Measurement Studio Measurement Computing Edition User Manual for more information.You can find the User Manual at StartAll ProgramsNational Instruments<Measurement Studio> Measurement Studio DocumentationUser Manual. Measurement Studio Measurement Computing Edition Web site, mccdaq.com/mstudioContains Measurement Studio news, support, and downloads. NI Developer Zone, zone.ni.comProvides access to online example programs, tutorials, technical news, and a Measurement Studio Discussion Forum where you can participate in discussion forums for .NET Languages. Measurement Studio .NET Class Hierarchy ChartProvides overviews of class relationships within class libraries. Review the information from the Microsoft Web site on using Visual Studio.

Measurement Computing Edition User Manual

1-6

ni.com

Measurement Studio Measurement Computing Edition .NET Class Libraries

This chapter provides overview information about the .NET class libraries included with Measurement Studio Measurement Computing Edition support for Visual Studio 2005 and Visual Studio 2008. Refer to the Using the Measurement Studio .NET Class Libraries section of the NI Measurement Studio Help for detailed information about these libraries. Refer to Chapter 4, Getting Started with Measurement Studio, for step-by-step instructions on developing applications with these libraries.

Measurement Studio Support for Visual Studio .NET Class Library Overview
Measurement Studio provides .NET class libraries that you can use to develop complete measurement and automation applications in Visual Basic .NET and Visual C#. Measurement Studio includes the following .NET class libraries: Analysis Common Network Variable MCC-488.2 Universal Library MccDaq Scan Components Library User Interface

Refer to the following sections for information about each Measurement Studio .NET class library.

National Instruments Corporation

2-1

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .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. Additionally, the documentation for the Analysis class library includes analysis code snippets that you can copy and paste into an application and use immediately. The Analysis class library includes the following functionality: Sawtooth, sine, square, triangle, and basic function wave generators Bessel, Chebyshev, Inverse Chebyshev, Windowed, Kaiser, and Elliptic Low, High, Bandpass, and Bandstop filters Signal processing functions such as convolution, deconvolution, correlation, decimation, integration, differentiation, and unwrap phase FFT, Inverse FFT, Real FFT, Fast Hartley, Inverse Fast Hartley, Fast Hilbert, Inverse Fast Hilbert, DST, Inverse DST, DCT, and Inverse DCT transformations Linear algebra functions such as determinant, check positive definiteness, calculate dot product, and other various matrix functions Scaled and unscaled windowing classes Common statistical functions such as mean, median, mode, and variance Exponential, linear, and polynomial curve fitting functions Signal generation functions

Refer to the following lists to determine the type of measurements available in the Analysis .NET libraries.

Measurements
Impulse Response Function Network Functions (avg)

Signal Generation
Arbitrary Wave Gaussian White Noise

Measurement Computing Edition User Manual

2-2

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Sine Pattern Sine Wave Square Wave Triangle Wave Uniform White Noise

Windowing
Blackman Window Blackman-Harris Window Blackman-Nuttall Window Cosine Tapered Window Dolph-Chebyshev Window Exact Blackman Window Exponential Window Flat Top Window Force Window Gauss Window General Cosine Window Hamming Window Hanning Window Kaiser-Bessel Window Scaled Time Domain Windows Symmetric Time Domain Windows Triangle Window

Filters
Bessel Butterworth Cascade Chebyshev Elliptic FIR FIR Windowed

National Instruments Corporation

2-3

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

IIR IIR Cascade Inverse Chebyshev Kaiser

Signal Processing
Autocorrelation Convolution Cross Power Cross Correlation Decimate Deconvolution Derivative x(t) Discrete Cosine Transform Discrete Sine Transform Fast Hartley Transform Fast Hilbert Transform Integral x(t) Inverse Real and Complex Fast Fourier Transform (FFT) Inverse Fast Hartley Transform Inverse Fast Hilbert Transform Peak Detection Power Spectrum Pulse Parameters Real and Complex FFT Threshold Peak Detector Unwrap Phase

Linear Algebra
Complex Determinant Complex Dot Product Complex Matrix Condition Number Complex Matrix Norm

Measurement Computing Edition User Manual

2-4

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Complex Matrix Rank Complex Outer Product Complex Pseudo Inverse Matrix Determinant Dot Product Inverse Matrix Matrix Condition Number Matrix Multiplication Matrix Norm Matrix Rank Outer Product Pseudo Inverse Matrix Special Matrix Test Positive Definite Matrix Trace Transpose

Array and Numeric Operations


1D and 2D Array Arithmetic 1D and 2D Linear Evaluation 1D and 2D Polynomial Evaluation 1D Polar to Rectangular 1D Rectangular to Polar Complex Number Arithmetic Find Polynomial Roots Scale 1D and 2D

Curve Fitting
Exponential Fit General Polynomial Fit Linear Fit

National Instruments Corporation

2-5

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Statistics

Tip

Histogram Mean Median and Mode Moment about Mean Root-Mean-Square (RMS) Standard Deviation

For more information about analyzing or generating data with the Analysis class library, refer to the Using the Measurement Studio Analysis .NET Library topic in the NI Measurement Studio Help. For more information about the functionality included in the Analysis class library, visit ni.com/analysis and select Visual Basic, Visual Basic .NET, C++, and C# with Measurement Studio.

Common
The Measurement Studio Common .NET class library is in the NationalInstruments namespace. The Common class library provides a set of classes that facilitates the exchange of data between the acquisition, analysis, and user interface portions of your application. The Common class library includes the following features: A ComplexDouble data type. This data type represents a complex number of type Double that is composed of a real part and an imaginary part. A DigitalWaveform data type. This data type represents a set of digital states that are grouped by samples or signals. A ComplexWaveform data type. This data type represents an analog signal that varies over time and is composed of complex data values. An AnalogWaveform data type. This data type represents an analog signal that varies over time. A DataConverter class that converts data from one data type to another data type, such as converting an array of integers to an array of doubles. An EngineeringFormatInfo class that defines a custom formatter to format numeric values as strings with engineering notation and International System of Units (SI) prefixes and symbols.

Measurement Computing Edition User Manual

2-6

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

A PrecisionWaveformTiming class that you can use to represent the timing of an analog or digital waveform that is accurate to the nearest 264 second. An AnalogWaveformCollection class that contains a strongly typed collection of AnalogWaveform<TData> objects; one object for each channel and record combination. You can access these objects through the 1D indexer or the 2D indexer.

Tip

For more detailed information about the Common class library, refer to the National Instruments section in the NI Measurement Studio Help.

Network Variable
The Measurement Studio Network Variable .NET class library includes three namespaces: NationalInstruments.NetworkVariable, NationalInstruments.NetworkVariable.WindowsForms, and NationalInstruments.NetworkVariable.WebForms. You use the Network Variable class library to transfer live measurement data between applications and servers over the network. You use WindowsForms and WebForms data sources to expose Network Variable data items that you can bind to properties of a Windows Forms or a Web Forms control. Use the features in the Network Variable class library to perform the following operations: Exchange different types of data between Measurement Studio, LabVIEW, LabWindows/CVI, and other applications that support NI-Publish Subscribe Protocol (psp:) and OLE for Process Control (opc:) servers. Exchanging data between Measurement Studio applications and OPC servers requires LabVIEW DSC.

Note Measurement Studio and LabWindows/CVI refer to variables as network variables and LabVIEW refers to variables as shared variables. However, you can read to and write from Measurement Studio and LabWindows/CVI network variables with LabVIEW shared variables.

Use Windows Forms and Web Forms data sources to expose Network Variable data items that you can bind to properties of a Windows Forms or a Web Forms control. Use the Browser classes to discover network variables and processes.

National Instruments Corporation

2-7

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Use the ServerProcess, ServerProcessInfo, ServerVariable, and ServerVariableInfo classes to explicitly create network variables. Use the Network Variable Browser dialog box to quickly locate and select data items on other computers and servers. The Browser Dialog is included in the WindowsForms class.

Tip

For more detailed information about the Network Variable class library, refer to the Using the Measurement Studio Network Variable .NET Library section in the NI Measurement Studio Help.

MCC-488.2
The Measurement Studio MCC-488.2 .NET class library is in the MccDaq.Mcc4882 namespace. This class library is included when you install the MCC-488.2 driver. The MCC-488.2 class library includes a set of classes for communicating with GPIB instruments, controlling GPIB devices, and acquiring GPIB status information. Use this library to design code that communicates with and controls instruments on a GPIB interface. Use the MCC-488.2 class library to configure and communicate with GPIB devices using the Device and Board classes.

Universal Library
The Measurement Studio Universal Library .NET class library is in the MccDaq namespace. This class library is included when you install the Universal Library driver. Use the Universal Library class library to communicate with and control Measurement Computing data acquisition (DAQ) devices. Use the Universal Library class library to perform the following types of tasks: Analog signal measurement Analog signal generation Digital I/O Counting and timing Temperature measurement

Measurement Computing Edition User Manual

2-8

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

MccDaq Scan Components


The Measurement Studio Scan Components .NET class library is in the MccDaq.ScanComponents namespace. The MccDaq Scan Components library includes a set of components for reading and writing multiple channels of analog data. Use the MccDaq Scan Components library to perform the following types of tasks: Analog input scans Analog output scans

User Interface
The Measurement Studio user interface controls are in the Windows Forms and Web Forms .NET class libraries. The following sections list the functionality included with the Measurement Studio Windows Forms and Web Forms controls. Refer to Table 2-1 for the UI controls provided by Measurement Studio.
Table 2-1. Measurement Studio UI Controls

User Interface Controls Waveform graph Scatter graph Digital waveform graph Complex graph Legend Knob Gauge Meter Slide Thermometer Tank Numeric edit

Windows Forms

Web Forms

National Instruments Corporation

2-9

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Table 2-1. Measurement Studio (Continued)UI Controls (Continued)

User Interface Controls Switch LED Property editor Array controls AutoRefresh control InstrumentControlStrip control

Windows Forms

Web Forms

Windows Forms Controls


The Windows Forms .NET class library is in the NationalInstruments.UI.WindowsForms namespace. The Windows Forms class library encapsulates the following Measurement Studio user interface controls: Waveform graph Scatter graph Digital waveform graph Complex graph Legend Knob Gauge Meter Slide Thermometer Tank Numeric edit Switch LED Property editor Array controls

Use this class library to add measurement-specific user interface controls to your application. You can configure the controls programmatically at

Measurement Computing Edition User Manual

2-10

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

design time, through the Properties window in the Windows Forms Designer, or at run time with the property editor control. The following sections describe each of the Measurement Studio Windows Forms user interface controls.
Tip

For more information about using the .NET user interface controls, refer to the Using the Measurement Studio Windows Forms .NET Controls section in the NI Measurement Studio Help.

Waveform Graph and Scatter Graph Controls


Use the Measurement Studio waveform graph and scatter graph controls, as shown in Figure 2-1, to display two-dimensional data on a Windows Forms user interface. Use the waveform graph to display two-dimensional linear data. You explicitly specify each value in one dimension and provide an initial value and interval to implicitly specify the values in the other dimension. Use the scatter graph to display two-dimensional linear or nonlinear data: you explicitly specify each value in both dimensions.

Figure 2-1. Waveform Graph Windows Forms Control with Cursors and Scatter Graph Windows Forms Control with XY Point Annotation; Both Graphs Have Corresponding Legends

National Instruments Corporation

2-11

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

With the waveform graph and scatter graph controls and the classes that interface with the controls, you can perform the following operations:

Plot Operations
Plot and chart arrays of double-precision floating point values, analog waveforms, and complex waveforms. Configure a graph to contain multiple plots to show separate but related data on the same graph. Draw lines or fills from a plot to an X value, Y value, or another plot. Specify plots in the scatter graph control as X and Y data. Specify plots in the waveform graph control as X or Y data and optionally with date and time scaling. Use the extensible plot and plot area drawing capabilities and events to customize the graph appearance. Use plot data tooltips to display X and Y coordinates when a user hovers the mouse over a data point. Create custom point and line styles for plots. Specify anti-aliased plots for plot lines. Calculate and display error bands.

Axis Operations
Configure a graph to include multiple axes or independent ranges so that plot data fits the graph plot area. Configure the axis modes to: fixed; autoscaling, including autoscaling based on the visible data only; strip chart; or scope chart. Use logarithmic axes with configurable bases. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Display origin lines. Display captions on the axis. Display grid lines. Position the axis to display on one or both sides of the graphs plot area. Configure major, minor, and custom divisions and origin lines.

Measurement Computing Edition User Manual

2-12

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Cursor Operations
Use cursors to identify key points in plots and the plot area. Configure cursor snap modes to be fixed, floating, nearest point, or to plot. Use cursor labels to display X and Y data coordinates in a customized format that the cursor crosshair points to, and customize the text font and colors of the label. Create custom point and line styles for cursors. Interactively move the cursor by clicking and dragging the vertical or horizontal crosshair or the center of the cursor. Programmatically move the cursor to previous or next position or to a specified coordinate.

Annotation Operations
Configure text labels, arrows, and drawing shapes to annotate a point anywhere in the plot area of the graph. Configure range area, text labels, and arrows to annotate a range in the plot area of the graph. Show tooltips configured to display data or other custom text.

Additional Operations

Tip

Pan and zoom interactively, as well as programatically. Copy the graph as a BMP, GIF, JPEG, or PNG image to the clipboard or a file. Perform hit testing of mouse cursor coordinates. Bind a plot to a data source on the waveform graph.

For more information about using the waveform and scatter graph controls, refer to the Using the Measurement Studio Windows Forms Scatter and Waveform Graph .NET Controls section in the NI Measurement Studio Help.

National Instruments Corporation

2-13

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Digital Waveform Graph Control


Use the Measurement Studio digital waveform graph control, as shown in Figure 2-2, to display DigitalWaveform data on a Windows Forms user interface.

Figure 2-2. Digital Graph Windows Forms Control

With the digital waveform graph control and the classes that interface with the control, you can perform the following operations:

Plot Operations
Plot digital waveform data. Data values can represent up to eight different digital states. Configure plot labels on the y-axis. Configure plot templates to customize plots that are implicitly created from plotted data. Specify anti-aliased digital plots. Expand and collapse signal plots interactively or programmatically. Display tooltips.

Measurement Computing Edition User Manual

2-14

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Waveform Sample and Signal State Operations


Simultaneously display waveforms and signals or display signals only. Create custom waveform sample and signal state styles. Configure the appearance of sample and state labels. Create custom waveform sample and signal state labels.

Axis Operations
Configure the axis modes to fixed, exact autoscaling, or loose autoscaling. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Display captions on the axis. Display grid lines. Position the axis to display on one or both sides of the graphs plot area. Configure major, minor, and custom divisions.

Additional Operations
Display data in sample or time mode. Perform hit testing of mouse cursor coordinates. Pan with scroll bars. Configure the style and mode of scroll bars. Create custom scroll bars. Pan and zoom interactively and programmatically. Copy the graph as a BMP, GIF, JPEG, or PNG image to the clipboard or a file.

Tip

For more information about using the digital waveform graph control, refer to the Using the Measurement Studio Windows Forms Digital Waveform Graph .NET Control section in the NI Measurement Studio Help.

National Instruments Corporation

2-15

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Complex Graph Control


Use the Measurement Studio complex graph control, as shown in Figure 2-3, to display ComplexDouble data on a Windows Forms user interface. A ComplexDouble consists of a real part and an imaginary part. You can use a waveform graph to plot complex waveform data.

Figure 2-3. Complex Graph Windows Forms Control

With the complex graph control and the classes that interface with the control, you can perform the following operations:

Plot Operations
Plot and chart ComplexDouble data. Configure a graph to contain multiple plots to show separate but related data on the same graph. Draw lines or fills from a plot to an X value, Y value, or another plot. Use the extensible plot and plot area drawing capabilities and events to customize the graph appearance. Configure the plot to display arrows. The arrows indicate the direction of the complex data. Create custom point and line styles for plots. Specify anti-aliased plots for plot lines. Calculate and display error bands. Display tooltips.

Measurement Computing Edition User Manual

2-16

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Axis Operations
Configure a graph to include multiple axes or independent ranges so that plot data fits the graph plot area. Configure the axis modes to: fixed; autoscaling, including autoscaling based on the visible data only; strip chart; or scope chart. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Display origin lines and grid lines. Configure major, minor, and custom divisions and origin lines. Position the axis to display on one or both sides of the graphs plot area. Display captions on the axis.

Cursor Operations
Use cursors to identify key points in plots and the plot area. Configure cursor snap modes to be fixed, floating, nearest point, or to plot. 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. Create custom point and line styles for cursors. Configure the graph to display cursors that are used to determine the real, imaginary, magnitude, and phase data coordinates of a point on the plot area.

Annotation Operations
Configure text labels, arrows, and drawing shapes to annotate a point anywhere in the plot area of the graph. Configure range area, text labels, and arrows to annotate a range in the plot area of the graph. Annotate points and ranges of real, imaginary, and magnitude values. Annotate and label a range of magnitude values for a particular phase.

Additional Operations
Pan and zoom interactively. Copy the graph as a BMP, GIF, JPEG, or PNG image to the clipboard or a file.

National Instruments Corporation

2-17

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Tip

For more information about using the complex graph control, refer to the Using the Measurement Studio Windows Forms Complex Graph .NET Control section in the NI Measurement Studio Help.

Legend Control
Use the Measurement Studio legend control, as shown in Figure 2-1, to display symbols and descriptions for a specific set of elements of another object, such as the plots or cursors of a graph. When you associate the legend control with another object, any changes you make to that object are automatically reflected in the legend. For example, if you associate the legend control with the plots of a graph, any changes you make in the plots collection editor are automatically reflected in the legend.
Tip

For more information about using the legend control, refer to the Using the Measurement Studio Windows Forms Legend .NET Control section in the NI Measurement Studio Help.

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. With all of the numeric controls and the classes that interface with them, you can perform the following operations: Configure the scale to be linear or logarithmic and toggle the visibility of the scale. Fill the scale and configure the range, color, dimensions, and style of the fill. Connect to the Measurement Studio .NET numeric edit control so that if you change the value of one control, it changes the value of the other control. Customize the appearance of the control using 3D lab styles or classic 2D styles and change the color and length of ticks and labels. Configure the format of value labels to engineering or date/time. Display tooltips reflecting the current value of the pointer. Interactively change the value of the control by clicking or dragging and moving the pointer with the mouse.

Measurement Computing Edition User Manual

2-18

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Programmatically move the pointer to previous or next value. Perform hit testing of mouse cursor coordinates. Specify the image format of the control as BMP, GIF, JPEG, or PNG.

Use the Measurement Studio knob, gauge, and meter controls, as shown in Figure 2-4, to input and display numeric data on your user interface.

Figure 2-4. Knob, Gauge, and Meter Windows Forms Controls

With the knob, gauge, and meter controls and the classes that interface with the controls, you can perform the following operations: Specify the start and sweep angle of the arc programmatically or from the Properties window. Use automatic division spacing, custom divisions, and invert the scale.

National Instruments Corporation

2-19

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Use the Measurement Studio slide, tank, and thermometer controls, as shown in Figure 2-5, to input and display numeric data on your interface.

Figure 2-5. .NET 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 to 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.

For more information about using the Windows Forms knob, gauge, meter, slide, tank, or thermometer controls, refer to the Knob, Gauge, Meter, Slide, Tank, or Thermometer Class sections in the NI Measurement Studio Help.
Tip

Numeric Edit Control


Use the Measurement Studio numeric edit control, as shown in Figure 2-6, 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-6. Numeric Edit Windows Forms Control

Measurement Computing Edition User Manual

2-20

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

With the numeric edit control and the classes that interface with the control you can perform the following operations: Use up and down buttons for easy incrementing and decrementing. Perform range checking. Set the minimum range value to negative infinity and the maximum range value to positive infinity. Create custom formats or use built-in numeric formats including generic, engineering, and simple double. Connect to a Measurement Studio numeric control so that if you change the value of one control, it changes the value of the other control. Set the coercion mode property to discrete or continuous values. This property configures the control to allow entry or display of either a discrete set of values or any value. Set the interaction mode to keyboard and mouse, keyboard only, mouse only, or none.

Tip

For more information about using the Windows Forms numeric edit control, refer to the NumericEdit Class section in the NI Measurement Studio Help.

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-7, to receive and control Boolean input on an application user interface.

Figure 2-7. Switch Windows Forms Control in Vertical Toggle 3D Style

You typically use an LED control, as shown in Figure 2-8, to indicate a Boolean value on an application user interface.

Figure 2-8. LED Windows Forms Control in Square 3D Style

National Instruments Corporation

2-21

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

With the switch and LED controls and the classes that interface with the controls, you can perform the following operations: Receive notification before or after the state of the control changes. Configure how the control behaves when you click it with the mouse or press the spacebar when the control has focus. Configure the appearance of the control. Make the control background transparent. Configure the LED control to blink while it is on or off and configure the rate at which the LED control blinks.

Tip

For more information about using the switch and LED controls, refer to the Using the Measurement Studio Windows Forms Switch and LED .NET Controls section in the NI Measurement Studio Help.

Property Editor Control


Use the Measurement Studio property editor control, as shown in Figure 2-9, to configure properties for Windows Forms controls at run time.

Figure 2-9. Property Editor Windows Forms Control for the Knob Control Scale Arc Property

Measurement Computing Edition User Manual

2-22

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

With the property editor control and the classes that interface with the control, you can perform the following operations: Edit any .NET type at run time, including collections. Edit expandable properties that represent nested properties of another object, such as major divisions of an axis. Display custom editors and type converters for properties. Connect to a Windows Forms control so that if you change the value of a property of the control, the Property Editor will update to reflect the change. Configure the display mode as a visual representation of the value, text-only, or both. Set the interaction mode to edit values or indicator.


Tip

For more information about using the property editor control, refer to the Using the Measurement Studio Property Editor Control topic in the NI Measurement Studio Help.

Windows Forms Array Controls


You can create an array of Measurement Studio controls that behave as a single unit. For example, you can use these array controls to visualize and control ports of a digital line or values of an array. Measurement Studio includes switch, LED, and numeric edit array controls. You can create control arrays of other controls if those controls meet the constraints of the generic type parameter TControl.

Switch and LED Array Controls


Use the Measurement Studio switch and LED array controls as an array of Boolean controls on a Windows Forms user interface. You typically use a switch array control, as shown in Figure 2-10, to control ports of a digital line or values of an array. You typically use an LED array control, as shown in Figure 2-10, to visualize ports of a digital line or values of an array.

National Instruments Corporation

2-23

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Figure 2-10. Switch and LED Array Controls

With the switch and LED array controls and the classes that interface with the controls, you can perform the following operations: Set values by passing an array of data. Modify the number of controls displayed based on the length of the specified values. Receive notification before or after the state of the control changes. Configure how the control behaves when you click it with the mouse or press the spacebar when the control has focus. Configure the appearance of the control. Make the control background transparent. Configure the LED controls to blink while they are on or off and configure the rate at which the LED controls blink. Configure the layout of the control to be horizontal or vertical. Bind the value of the control to a data source. Mark an array of Boolean controls so that only one can be true at a time.

Tip

For more information about using the switch and LED array controls, refer to the Using the Measurement Studio Control Array .NET Controls topic in the NI Measurement Studio Help.

Measurement Computing Edition User Manual

2-24

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Numeric Edit Array Control


Use the Measurement Studio numeric edit array control, as shown in Figure 2-11 to control and visualize values of an array of double values. With the numeric edit array control and the classes that interface with the control you can perform the following operations:

Figure 2-11. Numeric Edit Array control

Set values by passing an array of data. Modify the number of controls displayed based on the length of the array of values you specify. Use up and down buttons for easy incrementing and decrementing. Perform range checking. Set the minimum range value to negative infinity and the maximum range value to positive infinity. Create custom formats or use built-in numeric formats including generic, engineering, and simple double. Connect to a numeric control so that if you change the value of one control, it changes the value of the other control. Set the coercion mode property to discrete or continuous values. This property configures the control to allow entry or display of either a discrete set of values or any value. Set the interaction mode to keyboard and mouse, keyboard only, mouse only, or none. Use the edit box to select text programmatically and to validate text values. Configure the layout of the control to be horizontal or vertical. Bind the value of the control to a data source.


Tip

For more information about using the numeric edit array control, refer to the Using the Measurement Studio Control Array .NET Controls topic in the NI Measurement Studio Help.

National Instruments Corporation

2-25

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

InstrumentControlStrip Control
You can use the InstrumentControlStrip control as a toolbar for editing property values of another control through the associated editors at run time. For example, you can populate the InstrumentControlStrip with ToolStripPropertyEditor items that edit property values of a waveform graph through the associated editors at run time. The editor displayed by the ToolStripPropertyEditor is the same editor that displays when you edit the property at design time.

Figure 2-12. InstrumentControlStrip Control

Measurement Computing Edition User Manual

2-26

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Tip

For more information about the InstrumentControlStrip control, refer to Using the Measurement Studio Windows Forms Instrument Control Strip .NET Control topic in the NI Measurement Studio Help.

ASP.NET Web Forms Controls


The Measurement Studio ASP.NET user interface controls are in the Web Forms .NET class library. The Web Forms .NET class library is in the NationalInstruments.UI.WebForms namespace. The Web Forms class library encapsulates the following Measurement Studio user interface controls:
Note

Waveform graph Scatter graph Digital waveform graph Complex graph Legend Knob Gauge Meter Slide Thermometer Tank Numeric edit Switch LED AutoRefresh

All Measurement Studio ASP.NET Web Forms controls for Visual Studio 2008 are designed to work with ASP.NET AJAX controls. The Measurement Studio ASP.NET Web Forms controls for Visual Studio 2005 are not designed to work with Microsoft ASP.NET AJAX controls. Use this class library to add measurement-specific user interface controls to your Web application. You can configure the controls programmatically at design time or through the Properties window in the Web Forms Designer. The following sections describe each of the Measurement Studio Web Forms user interface controls.

National Instruments Corporation

2-27

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Waveform Graph and Scatter Graph Controls


Use the Measurement Studio waveform graph and scatter graph controls, as shown in Figure 2-13, to display two-dimensional data on a Web-based user interface. Use the waveform graph to display two-dimensional linear data. You explicitly specify each value in one dimension and provide an initial value and interval to implicitly specify the values in the other dimension. Use the scatter graph to display two-dimensional linear or nonlinear data: you explicitly specify each value in both dimensions.

Figure 2-13. Waveform Graph and Scatter Graph Web Forms Controls; 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 Operations
Plot and chart arrays of double-precision floating point values, analog waveforms, and complex waveforms. Configure a graph to contain multiple plots to show separate but related data on the same graph.

Measurement Computing Edition User Manual

2-28

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Draw lines or fills from a plot to an X value, Y value, or another plot. Specify plots in the scatter graph control as X and Y data. Specify plots in the waveform graph control as X or Y data and optionally with date and time scaling. Use the extensible plot and plot area drawing capabilities and events to customize the graph appearance. Create custom point and line styles for plots. Specify anti-aliased plots for plot lines. Calculate and display error bands. Configure plot to specify how data is saved and restored across HTTP requests.

Axis Operations
Configure a graph to include multiple axes or independent ranges so that plot data fits the graph plot area. Configure the axis modes to fixed or autoscaling based on the visible data, strip chart, or scope chart. Use logarithmic axes with configurable bases. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Configure major, minor, and custom divisions and origin lines.

Cursor Operations
Use cursors to identify key points in plots and the plot area. Configure cursor snap modes to be floating, nearest point, or to plot. Use cursor labels to display X and Y data coordinates in a customized format that the cursor crosshair points to, and customize the text font and colors of the label. Create custom point and line styles for cursors. Interactively move the cursor by clicking and dragging the vertical or horizontal crosshair or the center of the cursor. Programmatically move the cursor to previous or next position or to a specified coordinate.

National Instruments Corporation

2-29

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Annotation Operations
Configure text labels, arrows, and drawing shapes to annotate a point anywhere in the plot area of the graph. Configure range area, text labels, and arrows to annotate a range in the plot area of the graph.

Additional Operations

Tip

Zoom interactively as well as programatically. Specify the image format of the control as BMP, GIF, JPEG, or PNG.

For more information about using the waveform and scatter graph controls, refer to the Using the Measurement Studio Web Forms Scatter and Waveform Graph .NET Controls section in the NI Measurement Studio Help.

Measurement Computing Edition User Manual

2-30

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Digital Waveform Graph Control


Use the Measurement Studio digital waveform graph control, as shown in Figure 2-14, to display DigitalWaveform data in an ASP.NET Web application.

Figure 2-14. Digital Graph Web Forms Control

With the digital waveform graph control and the classes that interface with the control, you can perform the following operations:

Plot Operations
Plot digital waveform data, including digital signal state data and timing information. Configure plot labels on the y-axis. Configure plot templates to customize plots that are implicitly created from plotted data.

National Instruments Corporation

2-31

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Specify anti-aliased digital plots. Expand and collapse signal plots interactively as well as programmatically.

Waveform Sample and Signal State Operations


Simultaneously display waveforms and signals or display signals only. Create custom waveform sample and signal state styles. Configure the appearance of sample and state labels. Create custom waveform sample and signal state labels.

Axis Operations
Configure the axis modes to fixed, exact autoscaling, or loose autoscaling. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Display captions on the axis and grid lines. Position the axis to display on one or both sides of the graphs plot area. Configure major, minor, and custom divisions.

Additional Operations

Tip

Display data in sample or time mode. Configure the style and mode of scroll bars. Create custom scroll bars. Zoom interactively as well as programmatically. Specify the image format of the control as BMP, GIF, JPEG, or PNG.

For more information about using the digital waveform graph control, refer to the Using the Measurement Studio Web Forms Digital Waveform Graph .NET Control section in the NI Measurement Studio Help.

Complex Graph Control


Use the Measurement Studio complex graph control, as shown in Figure 2-15, to display ComplexDouble data on a ASP.NET Web application. A ComplexDouble consists of a real part and an imaginary part. You can use a waveform graph to plot complex waveform data.

Measurement Computing Edition User Manual

2-32

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Figure 2-15. Complex Graph Web Forms Control

With the complex graph control and the classes that interface with the control, you can perform the following operations:

Plot Operations
Plot and chart ComplexDouble data. Configure a graph to contain multiple plots to show separate but related data on the same graph. Draw lines or fills from a plot to an X value, Y value, or another plot. Use the extensible plot and plot area drawing capabilities and events to customize the graph appearance. Configure the plot to display arrows. The arrows indicate the direction of the complex data. Create custom point and line styles for plots. Specify anti-aliased plots for plot lines. Calculate and display error bands. Configure plot to specify how data is saved and restored across HTTP requests.

National Instruments Corporation

2-33

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Axis Operations
Configure a graph to include multiple axes or independent ranges so that plot data fits the graph plot area. Configure the axis modes to: fixed; autoscaling, including autoscaling based on the visible data only; strip chart; or scope chart. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Display origin lines, captions on the axis, and grid lines. Position the axis to display on one or both sides of the graphs plot area. Configure major, minor, and custom divisions and origin lines.

Cursor Operations
Use cursors to identify key points in plots and the plot area. Configure cursor snap modes to be floating, nearest point, or to plot. Use cursor labels to display X and Y data coordinates in a customized format that the cursor crosshair points to, and customize the text font and colors of the label. Create custom point and line styles for cursors. Interactively move the cursor by clicking and dragging the vertical or horizontal crosshair or the center of the cursor. Programmatically move the cursor to previous or next position or to a specified coordinate.

Annotation Operations
Configure text labels, arrows, and drawing shapes to annotate a point anywhere in the plot area of the graph. Configure range area, text labels, and arrows to annotate a range in the plot area of the graph. Annotate and label a magnitude value. Annotate and label a range of magnitude values for a particular phase.

Additional Operations
Zoom interactively as well as programmatically. Specify the image format of the control as BMP, GIF, JPEG, or PNG.

Measurement Computing Edition User Manual

2-34

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Tip

For more information about using the complex graph control, refer to the Using the Measurement Studio Web Forms Complex Graph .NET Control section in the NI Measurement Studio Help.

Legend Control
Use the Measurement Studio legend control, as shown in Figure 2-13, to display symbols and descriptions for a specific set of elements of another object, such as the plots or cursors of a graph. When you associate the legend control with another object, any changes you make to that object are automatically reflected in the legend. For example, if you associate the legend control with the plots of a graph, any changes you make in the plots collection editor are automatically reflected in the legend.
Tip

For more information about using the legend control, refer to the Using the Measurement Studio Web Forms Legend .NET Control section in the NI Measurement Studio Help.

Numeric Controls
Use the Measurement Studio numeric controls to display numerical information in an ASP.NET Web application 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. With all of the numeric controls and the classes that interface with them, you can perform the following operations: Configure the scale to be linear or logarithmic and toggle the visibility of the scale. Fill the scale and configure the range, color, dimensions, and style of the fill. Connect to a Measurement Studio .NET numeric edit control so that if you change the value of one control, it changes the value of the other control. Customize the appearance of the control using 3D lab styles or classic 2D styles and change the color and length of ticks and labels. Configure the format of value labels to engineering or date/time. Specify the image format of the control as BMP, GIF, JPEG, or PNG. Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels. Display tooltips reflecting the current value of the pointer.

National Instruments Corporation

2-35

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Interactively change the value of the control by clicking the pointer with the mouse. Programmatically move the pointer to previous or next value.

Use the Measurement Studio knob, gauge, and meter controls, as shown in Figure 2-16, to input and display numeric data on your user interface.

Figure 2-16. Knob, Gauge, and Meter Web Forms Controls

With the knob, gauge, and meter controls and the classes that interface with the controls, you can perform the following operations: Specify the start and sweep angle of the arc programmatically or from the Properties window. Use automatic division spacing, custom divisions, and invert the scale.

Measurement Computing Edition User Manual

2-36

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Use the Measurement Studio slide, tank, and thermometer controls, as shown in Figure 2-17, to input and display numeric data on your interface.

Figure 2-17. Slide, Tank, and Thermometer Web Forms Controls

With the slide, tank, and thermometer controls and the classes that interface with them, you can perform the following operations: Fill to 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.

For more information about using the Web Forms knob, gauge, meter, slide, tank, or thermometer controls, refer to the Knob, Gauge, Meter, Slide, Tank, or Thermometer Class sections in the NI Measurement Studio Help.
Tip

National Instruments Corporation

2-37

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Numeric Edit Control


Use the Measurement Studio numeric edit control, as shown in Figure 2-18, 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 Web Forms TextBox control.

Figure 2-18. Numeric Edit Web Forms Control

With the numeric edit control and the classes that interface with the control you can perform the following operations: Perform range checking. Set the minimum range value to negative infinity and the maximum range value to positive infinity. Create custom formats or use built-in numeric formats including generic, engineering, and simple double. Connect to a Measurement Studio numeric control so that if you change the value of one control, it changes the value of the other control. Set the coercion mode property to discrete or continuous values. This property configures the control to allow entry or display of either a discrete set of values or any value. Validate and format data without posting back to the Web server.

Tip

For more information about using the Web Forms numeric edit control, refer to the NumericEdit Class section in the NI Measurement Studio Help.

Measurement Computing Edition User Manual

2-38

ni.com

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

Switch and LED Controls


Use the Measurement Studio switch and LED controls as Boolean controls in an ASP.NET Web application. You typically use a switch control to receive and control Boolean input in an ASP.NET Web application. You typically use an LED control to indicate a Boolean value on an ASP.NET Web application. The switch and LED controls are shown in Figure 2-19.

Figure 2-19. Switch Web Forms Control in Vertical Toggle 3D Style and LED Web Forms Control in Square 3D Style

With the switch and LED controls and the classes that interface with the controls, you can perform the following operations: Receive notification before or after the state of the control changes. Specify the image format of the control as BMP, GIF, JPEG, or PNG. Configure the appearance of the control. Configure the LED control to blink while it is on or off and configure the rate at which the LED control blinks.

Tip

For more information about using the switch and LED controls, refer to the Using the Measurement Studio Web Forms Switch and LED .NET Controls section in the NI Measurement Studio Help.

National Instruments Corporation

2-39

Measurement Computing Edition User Manual

Chapter 2

Measurement Studio Measurement Computing Edition .NET Class Libraries

AutoRefresh Control
Use the AutoRefresh control to update a Web control or a group of Web controls on the client at a specified interval. The AutoRefresh control uses the ASP.NET client callback architecture to update a control or a group of controls at a specified interval. The AutoRefresh control sets up a timer inside the browser using Javascript. When the timer elapses, the AutoRefresh updates the controls in the AutoRefresh group. For down-level browsers, the controls update when the page posts back to the server. If the client browser supports client callbacks, the client-side script rendered by the AutoRefresh control uses a client callback to update the associated controls on the client without posting the page back to the server.
Note

The autorefresh control is designed to work with the ASP.NET AJAX update panel and timer controls in Visual Studio 2008.

AutoRefresh Callback
This feature provides a mechanism for updating the RefreshManager. Enabled and AutoRefresh.Interval properties for AutoRefresh from within the AutoRefresh.Refresh callback, allowing you to turn off the AutoRefresh or change the Interval during an asynchronous HTTP request without causing a postback.

Measurement Computing Edition User Manual

2-40

ni.com

Measurement Studio Integrated Tools and Features

When you use Measurement Studio in the Visual Studio environment, you have access to measurement and automation tools and features for Visual Basic .NET, Visual C#, and ASP.NET. These integrated tools and features are designed to help you quickly and easily build measurement and automation applications. These integrated tools and features are included in support for both Visual Studio 2005 and Visual Studio 2008. This chapter includes the following sections to help you develop applications with Measurement Studio: Measurement Studio Menu Creating a Measurement Studio Project Adding or Removing Measurement Studio .NET Class Libraries

Refer to the Developing with Measurement Studio section in the NI Measurement Studio Help for more information about the functionality of these tools and features.

Measurement Studio Menu


The Measurement Studio Menu provides an easy way to access the following National Instruments resources and tools: Add/Remove .NET Class Libraries WizardUse the Measurement Studio Add/Remove .NET Class Libraries wizard to add or remove Measurement Studio class libraries or assemblies in existing Visual Basic .NET and Visual C# projects. Refresh Project License FileUse the Refresh Project License File to update the licenses.licx file in a Measurement Studio project to the currently referenced Measurement Studio assemblies. The Refresh Project process works by going through the licenses.licx file line by line for the active project and removing each Measurement Studio licensed type that matches the Measurement Studio PublicKeyToken. After all Measurement Studio licensed types are

National Instruments Corporation

3-1

Measurement Computing Edition User Manual

Chapter 3

Measurement Studio Integrated Tools and Features

removed from the licenses.licx file, the current Measurement Studio licensed types that are referenced by the project are added to the licenses.licx file. This ensures all Measurement Studio licensed types used by the project are added to the licenses.licx file. Add 64-Bit Protection to ProjectUpdates your projects platform target to x86 and updates your project to protect it from build error LC0000. Refer to Using Measurement Studio on 64-Bit Operating Systems and Protecting Your Project from LC0000 Build Error in the NI Measurement Studio Help for more information. This menu item is only available in Visual Studio 2005 on a 64-bit Windows OS. Visual Studio 2008 projects function correctly without this protection. Remove 64-Bit Protection from ProjectRemoves protection for build error LC0000 from your project. Refer to Using Measurement Studio on 64-Bit Operating Systems and Protecting Your Project from LC0000 Build Error in the NI Measurement Studio Help for more information. This menu item is only available in Visual Studio 2005 on a 64-bit Windows OS. Visual Studio 2008 projects function correctly without this protection. Update Measurement Studio Project ReferencesUpdates any outdated Measurement Studio references to the latest version installed on the system. Measurement ComputingInstaCalUse InstaCal to configure, calibrate, and test MCC hardware. NI ToolsVariable ManagerUse Variable Manager to create new processes and variables, delete existing processes and variables, start and stop processes, create variables with specific data types or the variant data type, allow multiple writers or restrict write access to a single client, and configure server buffering. Select NI ToolsVariable Manager to access this menu item. MCC ToolsGPIBConfigUse GPIBConfig to configure MCC GPIB hardware. Select MCC ToolsGPIBConfig to access this menu item. NI Measurement Studio HelpUse the NI Measurement Studio Help to access detailed Measurement Studio help, including function reference, walkthroughs, and conceptual topic documentation on developing with Measurement Studio.

Measurement Computing Edition User Manual

3-2

ni.com

Chapter 3

Measurement Studio Integrated Tools and Features

Measurement Studio Online ResourcesMeasurement Studio Home PageUse the Measurement Studio Web site at ni.com/ mstudio to find Measurement Studio news, support, downloads, and evaluation software. Select Measurement Studio Online Resources Measurement Studio Home Page to access this menu item. Measurement Studio Online ResourcesInstrument Driver NetworkUse the NI Instrument Driver Network at ni.com/idnet as a central resource for downloading, developing, and submitting instrument drivers. Select Measurement Studio Online Resources Instrument Driver Network to access this menu item. Measurement Studio Online ResourcesDiscussion ForumsUse the NI Discussion Forums at forums.ni.com to participate in discussion forums and exchange code with measurement and automation developers around the world. Select Measurement Studio Online ResourcesDiscussion Forums to access this menu item. Measurement Studio Online ResourcesSearch Technical SupportUse NI Technical Support at ni.com/support to find support resources available for most products, including software drivers and updates, KnowledgeBase articles, product manuals, step-by-step troubleshooting wizards, conformity documentation, example code, tutorials and application notes, instrument drivers, discussion forums, and a measurement glossary. Select Measurement Studio Online ResourcesSearch Technical Support to access this menu item. PatentsUse the Patents dialog box to view information about NI patents. LicensesUse the Licenses dialog box to view information about NI licenses. About Measurement StudioUse the Measurement Studio About box to view version information. PreferencesUse the Measurement Studio Preferences dialog box to configure Measurement Studio settings, such as conversion options and add-in preferences. Select ToolsOptions to access this menu item.

Tip

For more information about the resources included in the Measurement Studio Menu, refer to the Measurement Studio Menu topic in the NI Measurement Studio Help.

National Instruments Corporation

3-3

Measurement Computing Edition User Manual

Chapter 3

Measurement Studio Integrated Tools and Features

Creating a Measurement Studio Project


Measurement Studio includes class library and application templates that you can use to quickly create measurement applications with Visual Basic .NET, Visual C#, and ASP.NET. Refer to the Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis or Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Network Variable section of Chapter 4, Getting Started with Measurement Studio, for step-by-step instructions on how to create a Measurement Studio project. Use the Visual Studio New Project dialog box, as shown for Visual Studio 2005 in Figure 3-1, to access these templates and to create projects. You can create the following projects in Measurement Studio: Measurement Studio Visual Basic .NET project Measurement Studio Visual C# project Measurement Studio ASP.NET project

Figure 3-1. New Project Dialog Box in Visual Studio 2005

Measurement Computing Edition User Manual

3-4

ni.com

Chapter 3

Measurement Studio Integrated Tools and Features

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.

Adding or Removing Measurement Studio .NET Class Libraries


To add or remove Measurement Studio .NET class libraries from a project, use the Measurement Studio Add/Remove .NET Class Libraries wizard on the Measurement Studio menu. This wizard provides an interface, as shown in Figure 3-2, that you can use to select the Measurement Studio .NET class libraries you want to add to or remove from a project. When you exit the wizard, the wizard adds or removes the appropriate references to or from the project, thus adding or removing the functionality associated with the class library.

Figure 3-2. Measurement Studio Add/Remove Class Libraries Wizard

National Instruments Corporation

3-5

Measurement Computing Edition User Manual

Chapter 3

Measurement Studio Integrated Tools and Features

Tip

For more information about using the Add/Remove .NET Class Libraries wizard to add or remove Measurement Studio .NET class libraries, refer to the Adding or Removing Measurement Studio .NET Class Libraries section in the NI Measurement Studio Help.

Measurement Computing Edition User Manual

3-6

ni.com

Getting Started with Measurement Studio

The following sections include overview information and step-by-step instructions on developing applications with Measurement Studio tools and features. Refer to the Developing with Measurement Studio section and the Getting Started with the Measurement Studio Class Libraries section of the NI Measurement Studio Help for more information about the functionality of these tools and features.

Measurement Studio Walkthroughs


Use the following walkthroughs to help you develop Measurement Studio applications: Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Analysis Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Network Variable Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Network Variable Walkthrough: Creating a Measurement Studio Measurement Computing DAQ Application Walkthrough: Creating a Measurement Studio MCCDaq Scan Components Application Walkthrough: Creating a Measurement Studio MCC-488.2 Application

National Instruments Corporation

4-1

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Analysis
Measurement Studio includes user interface controls, such as a waveform graph control and a gauge control, and analysis functionality, such as signal generation and mathematical functions. This walkthrough is designed to help you learn how to add analysis and presentation functionality to a Windows Forms application by taking you through the following steps: Setting up the projectUsing the Measurement Studio Application Wizard, you will create a new project that references the Measurement Studio Analysis class library and Windows Forms controls. Adding user interface controls to the projectUsing the Toolbox, smart tags, and the Properties window, you will add and configure a button, waveform graph, legend, gauge, and numeric edit user interface control. Generating, plotting, and analyzing the dataUsing
NationalInstruments.Analysis.SignalGeneration.White NoiseSignal and NationalInstruments.Analysis.Math. Statistics.Mean, you will generate data, plot the generated data on

a waveform graph, and calculate the mean of the data. Customizing the user interfaceUsing smart tags and the Collection Editor and Auto Format dialog boxes, you will display the mean value on the gauge and the numeric edit, as well as customize your user interface.

Before you begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Visual Studio 2008 Measurement Studio 8.0.1 or later for Visual Studio 2005 or Measurement Studio 8.5 or later for Visual Studio 2008

Measurement Computing Edition User Manual

4-2

ni.com

Chapter 4

Getting Started with Measurement Studio

Setting up the project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog box launches.

2.

3.

In the Project Types pane, select Measurement Studio under Visual C# or Visual Basic, depending on which language you want to create the project in. In the Templates pane, select NI Windows Application. Specify
MyMeasurementStudioProject for Name and specify a Location

4.

of your choice. 5. Click OK. The Measurement Studio Application Wizard launches.

National Instruments Corporation

4-3

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

6.

Select Analysis Library and Windows Forms User Interface Control Library.

Tip

If you are working with an existing project, you can access the Add/Remove Class Libraries dialog box by selecting Measurement StudioView .NET Class Library Wizard. 7. Click Finish to display Form1 in the Windows Forms Designer.

Adding user interface controls to the project 1. 2. Select ViewToolbox to display the Toolbox. The Toolbox contains components and controls that you can add to your project. Expand the All Windows Forms group. The All Windows Forms group contains controls and components included in the System.WindowsForms namespace. Select the Button control and drag and drop it onto the form. Right-click the button and select Properties to display the Properties window. You configure the properties of the control in the Properties window.

3. 4.

Measurement Computing Edition User Manual

4-4

ni.com

Chapter 4

Getting Started with Measurement Studio

5. 6.

The Text property will be highlighted. Type Start for the button text. Expand the Measurement Studio group in the Toolbox.

7. 8.

Select the WaveformGraph control and drag and drop it onto the form. Right-click the waveform graph and select Edit Plots to display the WaveformPlot Collection Editor dialog box. You use the WaveformPlot Collection Editor dialog box to add or remove plots and to configure plot properties.

National Instruments Corporation

4-5

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Note You can also access the WaveformPlot Collection Editor dialog box by clicking the waveform graph smart tag. To access the smart tag, left click on the control to select it and then left click on the arrow button in the upper right corner of the control.

9.

Type Plot for the Name. Click OK.

10. Before you add the Measurement Studio legend, numeric edit, and gauge controls, you need to resize the form to accommodate them. Select the form and use the double-sided arrow to resize it. 11. Select the Legend control and drag and drop it onto the form. 12. Select the NumericEdit control and drag and drop it onto the form. 13. Select the Gauge control and drag and drop it onto the form.

Measurement Computing Edition User Manual

4-6

ni.com

Chapter 4

Getting Started with Measurement Studio

14. Click the gauge smart tag to display the Gauge Tasks.

15. Type gauge for the name of the gauge.

National Instruments Corporation

4-7

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Generating, plotting, and analyzing the data 1. 2.


[VB.NET]

Double-click the button control to display the Form1 code, with the cursor inside the click event handler of the button control. Add the following code to generate random data, plot the data, calculate the mean of the data, and display the mean on the gauge.

' Declare and initialize an instance of WhiteNoiseSignal. Dim whiteNoise As New WhiteNoiseSignal() ' Store the generated data in a double array named data. Dim data As Double() = whiteNoise.Generate(1000.0, 256) ' Use the PlotY method to plot the data. Plot.PlotY(data) ' Use the Mean method to calculate the mean of the data. Dim mean As Double = Statistics.Mean(data) ' Display the mean on the gauge. gauge.Value = mean [C#]

// Declare and initialize an instance of WhiteNoiseSignal. WhiteNoiseSignal whiteNoise = new WhiteNoiseSignal(); // Store the generated data in a double array named data. double[] data = whiteNoise.Generate(1000.0, 256); // Use the PlotY method to plot the data. Plot.PlotY(data); // Use the Mean method to calculate the mean of the data. double mean = Statistics.Mean(data); // Display the mean on the gauge. gauge.Value = mean;

Measurement Computing Edition User Manual

4-8

ni.com

Chapter 4

Getting Started with Measurement Studio

Customizing your user interface 1. Right-click the legend and select Edit Items to display the LegendItem Collection Editor dialog box. You use the LegendItem Collection Editor dialog box to add or remove legend items and to configure legend item properties.

2.

Select Plot in the Source drop-down list and enter Signal in the Text box. Click OK. Now that you have specified a legend item for the plot, changes you make to the plot will be reflected on the legend. Right-click the graph and select Auto Format to display the Auto Format dialog box. The Auto Format dialog box provides a set of pre-configured control styles. When you select a style and click OK, the Auto Format feature configures the appropriate control properties to reflect the style you chose.

3.

National Instruments Corporation

4-9

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

4.

Select Points Only. Click OK. Notice that the legend changed automatically to match the formatting of the graph.

5. 6. 7. 8. 9.

Click the gauge smart tag to display the Gauge Tasks. Select Auto Format to display the Auto Format dialog box. Select Dark and click OK. Right-click the gauge and select Properties to display the Properties window. Set the Range property for the gauge with the drop-down Range type editor. Type -0.2 for the minimum value and type 0.2 for the maximum value.

10. Click the numeric edit smart tag to display the Numeric Edit Tasks. 11. Select Gauge in the Source drop-down list. Setting the Source property to the gauge allows two-way binding between the controls. 12. Deselect ArrowKeys, Buttons, and Text for the InteractionMode property of the numeric edit control. Deselecting these interaction modes makes the numeric edit an indicator. The numeric edit control only displays the calculated mean. 13. Select the Format Mode property and in the Numeric Edit Format Mode Editor dialog box, change the Precision to 4 to show four decimal places of precision. 14. Select FileSave Form1.cs to save your application.

Measurement Computing Edition User Manual

4-10

ni.com

Chapter 4

Getting Started with Measurement Studio

15. Select DebugStart Without Debugging to run the application. 16. After your program builds, click Start. Notice the graph shows the data plot, and the gauge and the numeric edit display the mean of the data.

Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Analysis
Measurement Studio includes user interface controls, such as a waveform graph control and a gauge control, and Analysis functionality, such as signal generation and mathematical functions. This walkthrough is designed to help you learn how to add analysis and presentation functionality to a Web Forms application by taking you through the following steps: Setting up the projectUsing the Measurement Studio Application Wizard, you will create a new project that references the Measurement Studio Analysis class library and Web Forms controls. Adding user interface controls to the projectUsing the Toolbox and the Properties window, you will add and configure a button, waveform graph, legend, gauge, and numeric edit user interface control. Generating, plotting, and analyzing the dataUsing
NationalInstruments.Analysis.SignalGeneration.White NoiseSignal and NationalInstruments.Analysis.Math. Statistics.Mean, you will generate data, plot the generated data on

a waveform graph, and calculate the mean of the data.

National Instruments Corporation

4-11

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Customizing the user interfaceUsing the Collection Editor and Auto Format dialog boxes, you will display the mean value on the gauge and the numeric edit, as well as customize your user interface.

Before you begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Visual Studio 2008 Measurement Studio 8.0.1 or later for Visual Studio 2005 or Measurement Studio 8.5 or later for Visual Studio 2008

Setting up the project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewWeb Site. The New Web Site dialog box launches.

2.

3.

In the Templates pane, select NI ASP.NET Web Site. Select File


System and specify a file path of your choice.

Measurement Computing Edition User Manual

4-12

ni.com

Chapter 4

Getting Started with Measurement Studio

4. 5. 6.

Use the drop-down box to select Visual C# or Visual Basic, depending on which language you want to create the project in. Click OK. The Measurement Studio ASP.NET Web Site Wizard launches. Select Analysis Library and Web Forms User Interface Control Library.

Tip

If you are working with an existing project, you can access the Add/Remove Class Libraries dialog box by selecting Measurement StudioAdd/Remove .NET Class Libraries Wizard. 7. 8. Click Finish to display Default.aspx in the Web Forms Designer. You can change the title of your Web page. Click inside the <title> tag and rename the title to Measurement Studio Web Forms Controls and Analysis Walkthrough.

National Instruments Corporation

4-13

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Adding user interface controls to the project 1. In this section, you will build a Web page that looks like the following screenshot.

2. 3. 4.

Click Design in the lower left corner to switch from Source View to Design View. Select ViewToolbox to display the Toolbox. The Toolbox contains components and controls that you can add to your project. Expand the HTML group on the Toolbox. Select the Table control in the Toolbox and drag and drop it on the form. You use the table cells to arrange the user interface controls on your Web page, as shown in the previous screenshot. The default table that appears is 3 3. This table provides a customizable form for arranging the user interface controls for your Web page. Expand the table to approximately 300 px (pixels) tall by 550 px wide by clicking and dragging the table borders. If you are using Visual Studio 2005, merge the top two cells of all three columns by selecting the cells, right-clicking, and selecting Merge Cells. If you are using Visual Studio 2008, merge the top two cells of all three columns by selecting the cells, right-clicking, and selecting ModifyMerge Cells. Expand the Standard group on the Toolbox. The Standard group contains ASP.NET server controls included in the System.Web.UI namespace.

5.

6.

7.

Measurement Computing Edition User Manual

4-14

ni.com

Chapter 4

Getting Started with Measurement Studio

8. 9.

Select the Button control and drag and drop it into the lower right table cell. Right-click the button and select Properties to display the Properties window. You configure the properties of the control in the Properties window.

10. Scroll to the Text property in the Properties window. Type Start for the button text. 11. Expand the Measurement Studio group on the Toolbox.

12. Select the WaveformGraph control and drag and drop it into the top table cell. 13. On the waveform graph smart tag, type graph for the name of the waveform graph ID.
Tip

To access the smart tag, left click on a control to select it and then left click on the arrow button in the upper right corner of the control.

National Instruments Corporation

4-15

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

14. Select the Legend control and drag and drop it into the bottom left table cell. 15. Select the NumericEdit control and drag and drop it into the bottom center table cell. 16. On the numeric edit smart tag, type numericedit for the name of the numeric edit ID. 17. Select the Gauge control and drag and drop it into the top table cell, to the right of the waveform graph. Resize controls and table cells as necessary. 18. On the gauge smart tag, type gauge for the name of the gauge ID.

Measurement Computing Edition User Manual

4-16

ni.com

Chapter 4

Getting Started with Measurement Studio

The following screenshot shows Default.aspx with the user controls.

Generating, plotting, and analyzing the data 1. Double-click the button control to display the Default.aspx.cs code, with the cursor inside the click event handler of the button control. Add the following code to generate random data, plot the data, calculate the mean of the data, and display the mean on the gauge.

2.
[VB.NET]

' Declare and initialize an instance of WhiteNoiseSignal. Dim whiteNoise As New WhiteNoiseSignal() ' Store the generated data in a double array named data. Dim data As Double() = whiteNoise.Generate(1000.0, 256) ' Use the PlotY method to plot the data. graph.PlotY(data) ' Use the Mean method to calculate the mean of the data. Dim mean As Double = Statistics.Mean(data) ' Display the mean on the numeric edit. numericedit.Value = mean ' Display the mean on the gauge. gauge.Value = mean

National Instruments Corporation

4-17

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

[C#] // Declare and initialize an instance of WhiteNoiseSignal. WhiteNoiseSignal whiteNoise = new WhiteNoiseSignal(); // Store the generated data in a double array named data. double[] data = whiteNoise.Generate(1000.0, 256); // Use the PlotY method to plot the data. graph.PlotY(data); // Use the Mean method to calculate the mean of the data. double mean = Statistics.Mean(data); // Display the mean on the numeric edit. numericedit.Value = mean; // Display the mean on the gauge. gauge.Value = mean;

Customizing your user interface 1. 2. Select the Default.aspx tab to return to the Web Forms Designer. Right-click the legend and select Edit Items to display the LegendItem Collection Editor dialog box. You use the LegendItem Collection Editor dialog box to add or remove legend items and to configure legend item properties.

Measurement Computing Edition User Manual

4-18

ni.com

Chapter 4

Getting Started with Measurement Studio

3.

Select Plots[0] in the Source drop-down list and enter Signal in the Text box. Click OK. Now that you have specified a legend item for the plot, changes you make to the plot will be reflected on the legend. Right-click the graph and select Auto Format to display the Auto Format dialog box. The Auto Format dialog box provides a set of pre-configured control styles. When you select a style and click OK, the Auto Format feature configures the appropriate control properties to reflect the style you chose. Select Points Only. Click OK. Notice that the legend changed automatically to match the formatting of the graph.

4.

5.

6. 7. 8.

Right-click the gauge and select Auto Format to display the Auto Format dialog box. Select Dark and click OK. On the gauge smart tag, set the Range property for the gauge with the drop-down Range type editor. Type -0.2 for the minimum value and type 0.2 for the maximum value. On the numeric edit smart tag, select Indicator for the InteractionMode property of the numeric edit control.

9.

10. On the numeric edit smart tag, select Format Mode and in the Numeric Format Mode Editor dialog box, change the Precision to 4 to show four decimal places of precision. Click OK.

National Instruments Corporation

4-19

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

11. Select FileSave Default.aspx to save your application. 12. Select DebugStart Without Debugging to run the application. 13. After your program builds, click Start. Notice the graph shows the data plot, and the gauge and the numeric edit display the mean of the data. The following screenshot shows Default.aspx in its final form.

Measurement Computing Edition User Manual

4-20

ni.com

Chapter 4

Getting Started with Measurement Studio

Walkthrough: Creating a Measurement Studio Application with Windows Forms Controls and Network Variable
Measurement Studio includes user interface controls, such as a waveform graph control, and network variable functionality to transfer live measurement data between applications over the network. This walkthrough is designed to help you learn how to add network variable functionality to a Windows Forms application by taking you through the following steps: Writing an array of data to the serverUsing
NationalInstruments.NetworkVariable.NetworkVariable BufferedWriter<TValue>, you will create and run a console

application that writes an array of values to the server. Setting up a Windows Forms projectUsing the Measurement Studio Application Wizard, you will create a new project that references the Measurement Studio Network Variable class library and Windows Forms controls. Configuring the network variable data source controlUsing the Toolbox and the NationalInstruments.NetworkVariable. WindowsForms.NetworkVariableDataSource smart tag, you will add and configure a data source control to your application. Displaying the array of data on a Windows Forms pageUsing the Toolbox, you will add and configure a NationalInstruments. WaveformGraph control to display the data.

Before you begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Visual Studio 2008 Measurement Studio 8.1 or later for Visual Studio 2005 or Measurement Studio 8.5 or later for Visual Studio 2008

National Instruments Corporation

4-21

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Writing an array of data to the server 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog box launches.

2.

3. 4.

In the Project Types pane, select Visual C# or Visual Basic, depending on which language you want to create the project in. In the Templates pane, select Console Application. Specify
NetworkVariableWriter for Name and specify a Location of your

choice. 5. 6. Click OK. Select Measurement StudioAdd/Remove .NET Class Libraries. The Measurement Studio Add/Remove Class Libraries Wizard launches. You use this wizard to add Measurement Studio components to your project.

Measurement Computing Edition User Manual

4-22

ni.com

Chapter 4

Getting Started with Measurement Studio

7.

Select NetworkVariable Communication Library. Click Finish.

8.
[VB.NET]

In Program.cs, add the following code to write an array of data to the server:

Imports NationalInstruments.NetworkVariable Imports System.Threading Module Module1 Private Function GenerateDoubleArray(ByVal phase As Double) As Double() Dim values(999) As Double Dim x As Integer For x = 0 To 999 values(x) = Math.Sin(((2 * Math.PI * x) / 1000) + phase) * 2 Next x Return values End Function Sub Main() Const location As String = "\\localhost\system\double" Dim bufferedWriter As NetworkVariableBufferedWriter(Of Double()) = New NetworkVariableBufferedWriter(Of Double())(location) bufferedWriter.Connect()

National Instruments Corporation

4-23

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Dim phase As Integer = 0 While (True) Dim values As Double() = GenerateDoubleArray(phase) Console.WriteLine("Writing Array") bufferedWriter.WriteValue(values) Thread.Sleep(500) phase = phase + 1 End While End Sub End Module [C#] using System; using System.Collections.Generic; using System.Text; using System.Threading; using NationalInstruments.NetworkVariable; namespace NetworkVariableWriter { class Program { private static double[] GenerateDoubleArray(double phase) { double[] values = new double[1000]; for (int x = 0; x < 1000; x++) values[x] = Math.Sin(((2 * Math.PI * x) / 1000) + phase) * 2; return values; } static void Main(string[] args) { const string Location = @"\\localhost\system\double"; NetworkVariableBufferedWriter<double[]> bufferedWrite = new NetworkVariableBufferedWriter<double[]>(Location); bufferedWrite.Connect(); int phase = 0; while (true) { double[] value = GenerateDoubleArray(phase); Console.WriteLine("Writing array"); bufferedWrite.WriteValue(value); Thread.Sleep(500); phase++; } }

Measurement Computing Edition User Manual

4-24

ni.com

Chapter 4

Getting Started with Measurement Studio

} } Note

You should choose the appropriate code depending on whether you created a VB or C# project. 9. Select DebugStart Without Debugging to run the application.

10. Minimize the console, but keep the application running.

National Instruments Corporation

4-25

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Setting up a Windows Forms project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog box launches.

2.

3.

In the Project types pane, select Measurement Studio under Visual C# or Visual Basic, depending on which language you want to create the project in. In the Templates pane, select NI Windows Application. Name the project WindowsNetworkVariableReader and specify a Location you wish to save to project by clicking Browse and navigating to a directory of your choice. Click OK. The Measurement Studio Application Wizard launches.

4.

5.

Measurement Computing Edition User Manual

4-26

ni.com

Chapter 4

Getting Started with Measurement Studio

6.

Select Network Variable Communication Library and Windows Forms User Interface Control Library.

Tip

If you are working with an existing project, you can access the Add/Remove Class Libraries dialog box by selecting Measurement StudioAdd/Remove Class Libraries Wizard. 7. Click Finish to display Form1 in the Windows Forms Designer.

Configuring the network variable data source control 1. 2. Select ViewToolbox to display the Toolbox. The toolbox contains components and controls that you can add to your project. Expand the Measurement Studio group on the Toolbox.

National Instruments Corporation

4-27

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

3.

Select the NetworkVariableDataSource control in the toolbox and drag and drop it on the form. The NationalInstruments.
NetworkVariable.WindowsForms.NetworkVariableData Source control is a data source control with functionality similar to System.Web.UI.WebControls.ObjectDataSource and System.Web.UI.WebControls.SqlDataSourcein the .NET Framework. The NationalInstruments.NetworkVariable. WindowsForms.NetworkVariableDataSource control encapsulates NationalInstruments.NetworkVariable

functionality. 4. In the NetworkVariableDataSource smart tag, select Edit Bindings to launch the NetworkVariableBinding Collection Editor dialog box.

5.

Select Add to create a connection with the underlying network variable, You can use the NetworkVariableBinding Collection Editor to configure the binding properties. Enter 0 as the DefaultReadValue.

Measurement Computing Edition User Manual

4-28

ni.com

Chapter 4

Getting Started with Measurement Studio

6.

For the Location, browse to the \\localhost\System\double location in the Select Network Item dialog box.

7. 8.

Click OK to return to the NetworkVariableBinding Collection Editor dialog box. After you configure the binding properties, click OK to return to the Windows Forms Designer.

Displaying the array of data on a Windows form 1. 2. Select WaveformGraph in the Toolbox and drag and drop it on the form. Right-click the waveform graph and select Properties to display the Properties window for the graph. You can configure the properties of the control in the Properties window. Expand the Data Bindings group in the Properties window. Select Other Data SourcesForm 1 List Instances networkVariableDataSource1Binding1 from the Binding Data drop-down list. This will bind the waveform graph to the network variable that you are writing to in the console application. The waveform graph will then read and display the data being written to the network variable. Select FileSave Form1 to save your application.

3.

4.

National Instruments Corporation

4-29

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

5.

Select DebugStart Without Debugging to run the application. The waveform graph displays the array of data.

Walkthrough: Creating a Measurement Studio Application with Web Forms Controls and Network Variable
Measurement Studio includes user interface controls, such as a waveform graph control, and network variable functionality to transfer live measurement data between applications over the network. This walkthrough is designed to help you learn how to add network variable functionality to a Web Forms application by taking you through the following steps: Writing an array of data to the serverUsing
NationalInstruments.NetworkVariable.NetworkVariable BufferedWriter<TValue>, you will create and run a console

application that writes an array of values to the server. Setting up a Web Forms projectUsing the Measurement Studio Application Wizard, you will create a new project that references the Measurement Studio Network Variable class library and Web Forms controls. Configuring the network variable data source controlUsing the Toolbox and the NationalInstruments.NetworkVariable. WebForms.NetworkVariableDataSource smart tag, you will add and configure a data source control to your application.

Measurement Computing Edition User Manual

4-30

ni.com

Chapter 4

Getting Started with Measurement Studio

Displaying the array of data on a Web pageUsing the Toolbox, you will add and configure an NationalInstruments.UI. WebForms.AutoRefresh control and a NationalInstruments. UI.WebForms.WaveformGraph control to display the data.

Before you begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Visual Studio 2008 Measurement Studio 8.0.1 or later for Visual Studio 2005 or Measurement Studio 8.5 or later for Visual Studio 2008

Writing an array of data to the server 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog launches.

2.

National Instruments Corporation

4-31

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

3. 4.

In the Project Types pane, select Visual C# or Visual Basic, depending on which language you want to create the project in. In the Templates pane, select Console Application. Specify
NetworkVariableWriter for Name and specify a Location of your

choice. 5. 6. Click OK. Select Measurement StudioAdd/Remove .NET Class Libraries. The Measurement Studio Add/Remove Class Libraries Wizard launches. You use this wizard to add Measurement Studio components to your project. Select NetworkVariable Communcation Library. Click Finish.

7.

Measurement Computing Edition User Manual

4-32

ni.com

Chapter 4

Getting Started with Measurement Studio

8.
[VB.NET]

In Program.cs, add the following code to write an array of data to the server:

Imports NationalInstruments.NetworkVariable Imports System.Threading Module Module1 Private Function GenerateDoubleArray(ByVal phase As Double) As Double() Dim values(999) As Double Dim x As Integer For x = 0 To 999 values(x) = Math.Sin(((2 * Math.PI * x) / 1000) + phase) * 2 Next x Return values End Function Sub Main() Const location As String = "\\localhost\system\double" Dim bufferedWriter As NetworkVariableBufferedWriter(Of Double()) = New NetworkVariableBufferedWriter(Of Double())(location) bufferedWriter.Connect() Dim phase As Integer = 0 While (True) Dim values As Double() = GenerateDoubleArray(phase) Console.WriteLine("Writing Array") bufferedWriter.WriteValue(values) Thread.Sleep(500) phase = phase + 1 End While End Sub End Module [C#] using System; using System.Threading; using NationalInstruments.NetworkVariable; namespace NetworkVariableWriter { class Program { private static double[] GenerateDoubleArray(double phase) { double[] values = new double[1000]; for (int x = 0; x < 1000; x++) values[x] = Math.Sin(((2 * Math.PI * x) / 1000) + phase) * 2;

National Instruments Corporation

4-33

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

return values; } static void Main(string[] args) { const string Location = @"\\localhost\system\double"; NetworkVariableBufferedWriter<double[]> bufferedWriter = new NetworkVariableBufferedWriter<double[]>(Location); bufferedWriter.Connect(); int phase = 0; while (true) { double[] value = GenerateDoubleArray(phase); Console.WriteLine("Writing array"); bufferedWriter.WriteValue(value); Thread.Sleep(500); phase++; } } } }

9.

Select DebugStart Without Debugging to run the application.

10. Minimize the console application, but keep the application running.

Measurement Computing Edition User Manual

4-34

ni.com

Chapter 4

Getting Started with Measurement Studio

Setting up a Web Forms project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewWeb Site. The New Web Site dialog box launches.

2.

3. 4. 5.

In the Templates pane, select NI ASP.NET Web Site. Select File


System for Location and specify a file path of your choice.

Use the drop-down box to select Visual C# or Visual Basic, depending on which language you want to create the project in. Click OK. The Measurement Studio ASP.NET Web Site Wizard launches.

National Instruments Corporation

4-35

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

6.

Select Network Variable Communication Library and Web Forms User Interface Control Library.

Tip

If you are working with an existing project, you can access the Add/Remove Class Libraries dialog box by selecting Measurement StudioAdd/Remove Class Libraries Wizard. 7. 8. Click Finish to display Default.aspx in the Web Forms Designer. You can rename the title of your Web page. Click inside the <title> tag and rename the title to Measurement Studio Network Variable and Web Forms Controls Walkthrough.

Measurement Computing Edition User Manual

4-36

ni.com

Chapter 4

Getting Started with Measurement Studio

Configuring the network variable data source control 1. 2. 3. 4. Click Design in the lower left corner to switch from Source View to Design View. Select ViewToolbox to display the Toolbox. The toolbox contains components and controls that you can add to your project. Expand the Measurement Studio group on the Toolbox. Select the NetworkVariableDataSource control in the toolbox and drag and drop it on the form. The NationalInstruments.
NetworkVariable.WebForms.NetworkVariableDataSource

control is a data source control with functionality similar to System.Web.UI.WebControls.ObjectDataSource and System.Web.UI.WebControls.SqlDataSourcein the .NET Framework. The NationalInstruments.NetworkVariable. WebForms.NetworkVariableDataSource control encapsulates NationalInstruments.NetworkVariable functionality. 5. In the NetworkVariableDataSource smart tag, select Edit Bindings to launch the NetworkVariableBinding Collection Editor dialog box.

6.

Select Add. You add a binding to create a connection with the underlying network variable, and you use the NetworkVariableBinding Collection Editor to configure the binding properties. Select Object for the BindingType. You select Object because this walkthrough binds to NationalInstruments.UI.WebForms. WaveformGraph.BindingData. Enter 0 as the DefaultReadValue.

National Instruments Corporation

4-37

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

7.

Browse to the \\localhost\System\double location in the Select Network Item dialog box.

Measurement Computing Edition User Manual

4-38

ni.com

Chapter 4

Getting Started with Measurement Studio

8. 9.

Click OK to return to the NetworkVariableBinding Collection Editor dialog box. After you configure the binding properties, click OK to return to the ASP.NET Designer.

Displaying the array of data on a Web page 1. 2. 3. Select WaveformGraph in the Toolbox and drag and drop it on the form. Select AutoRefresh in the Toolbox and drag and drop it on the form. In the AutoRefresh smart tag, check Enabled. Select Edit Default Refresh Items to launch the RefreshItem Collection Editor dialog box.

National Instruments Corporation

4-39

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

4.

Select Add. Select WaveformGraph1 for the ItemID and click OK.

5.

Double-click the AutoRefresh control. Add the following code to the AutoRefresh event handler to bind the waveform graph control to the network variable data source control:

[VB.NET] WaveformGraph1.BindingData = NetworkVariableDataSource1.Bindings(0).GetValue() [C#] WaveformGraph1.BindingData = NetworkVariableDataSource1.Bindings[0].GetValue();

6.

Select FileSave Default.aspx to save your application.

Measurement Computing Edition User Manual

4-40

ni.com

Chapter 4

Getting Started with Measurement Studio

7.

Select DebugStart Without Debugging to run the application. The waveform graph displays the array of data.

Note

You can also use the FormView control to bind to NetworkVariableDataSource. Refer to Using the Measurement Studio Network Variable Data Source in Web Forms for more information.

Walkthrough: Creating a Measurement Studio Measurement Computing DAQ Application


Measurement Studio includes class library and application templates that you can use to quickly create Measurement Computing DAQ applications with Visual Basic .NET and Visual C#. Measurement Studio Measurement Computing Edition includes user interface controls, such as a meter control, and Measurement Computing DAQ functionality, such as analog input and digital I/O. This walkthrough is designed to help you learn how to add Measurement Computing DAQ functionality to a Windows Forms application by taking you through the following steps: Setting up the projectUsing the Visual Studio New Project dialog box, you will create a new project that references the Measurement Studio Measurement Computing DAQ class library and Windows Forms controls.

National Instruments Corporation

4-41

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Adding user interface controls to the projectUsing the Toolbox and the Properties window, you will add and configure user interface controls, including a button and meter. Generating and displaying the dataUsing MccDaq.MccBoard.AIn and MccDaq.MccBoard.ToEngUnits, you will read a raw data point from a channel on a Measurement Computing device, convert the data point to volts, and show the value on a meter.

Before You Begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008 Measurement Studio Measurement Computing Edition InstaCal/Universal Library Measurement Computing DAQ device or DEMO-BOARD simulated DAQ device

Note

For information about installing and configuring your Measurement Computing DAQ device, refer to the Quick Start Guide that ships with your device. Alternately, you can use the DEMO-BOARD simulated DAQ device to complete this walkthrough. Setting up the DEMO-BOARD simulated DAQ device 1. 2. 3. Run InstaCal by selecting StartAll ProgramsMeasurement ComputingInstaCal. Right-click on PC Board List, and select Add Board from the popup menu. The Board Selection List dialog opens. Select the ISA tab, scroll down to select DEMO-BOARD, and then click on the Add button. The DEMO-BOARD has been added to InstaCals main form.

Measurement Computing Edition User Manual

4-42

ni.com

Chapter 4

Getting Started with Measurement Studio

4.

Close InstaCal.

Setting up the project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog box launches. In the Project Types pane, expand the Visual Basic or Visual C# folder, depending on which language you want to create the project in, and then select Measurement Studio. In the Templates pane, select NI Windows Application. Specify
MyMCCDAQProject for Name and specify a Location of your choice.

2. 3.

4. 5. 6.

Click OK. The Measurement Studio Application Wizard launches. Select Universal Library and Windows Forms User Interface Control Library. When you select these libraries, the Measurement Studio Application Wizard automatically adds references to the appropriate class libraries.

National Instruments Corporation

4-43

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Tip

If you are working with an existing project, you can access the Add Class Libraries dialog box by selecting Measurement StudioAdd/Remove Class Libraries Wizard. 7. Click Finish to display Form1 in the Windows Forms Designer.

Adding user interface controls to the project 1. 2. Select ViewToolbox to display the Toolbox. The Toolbox contains components and controls that you can add to your project. Select the All Windows Forms tab. The All Windows Forms tab contains controls and components included in the System.Windows.Forms namespace. Select the Button control and drag and drop it onto the form. Right-click the button and select Properties to display the Properties window. You configure the properties of the control in the Properties window. The Text property will be highlighted. Type Start for the button text. Select the Measurement Studio Tools tab on the Toolbox. Select the Meter control and drag and drop it onto the form. Right-click the meter and select Properties to display the Properties window. Set the CoercionIntervalBase property for the meter to 10.

3. 4.

5. 6. 7. 8. 9.

10. Set the Range property for the meter with the drop-down Range type editor. Type 10 for the minimum value. Leave the default of 10 for the maximum value.

Measurement Computing Edition User Manual

4-44

ni.com

Chapter 4

Getting Started with Measurement Studio

The following screenshot shows Form1 with the user controls.

Generating and displaying the data 1. 2. Double-click on Form1 to display the Form1 code. Add the following code to declare a new Measurement Computing board object. To move to Code View, select ViewCode. Add the code below the Form1 class definition.

[VB.NET] ' Declare a new Measurement Computing board object that uses board 0 Private DaqBoard As MccDaq.MccBoard [C#] // Declare a new Measurement Computing board object that uses board 0 private MccDaq.MccBoard daqBoard;

3.
[VB.NET]

Add the following code to the constructor to instantiate a new Measurement Computing board object.

' Instantiate the board object using board # 0 DaqBoard = New MccBoard(0) [C#] // Instantiate the board object using board # 0 daqBoard = new MccDaq.MccBoard(0);

National Instruments Corporation

4-45

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

4. 5.

Double-click the Start button to display the Start button click code. Add the following code to read a raw data point from a specified channel on the Measurement Computing device, convert the data to volts, and display the value on the meter.

[VB.NET] 'Set channel, range, raw value, and volt variables. Dim Channel As Integer = 0 Dim Range As MccDaq.Range = MccDaq.Range.Bip10Volts Dim RawValue As Short = 0 Dim Volts As Single = 0.0F ' Perform analog input operation with Measurement Computing board, ' channel, and range, and return raw value. DaqBoard.AIn(Channel, Range, RawValue) ' Convert raw value to engineering units. DaqBoard.ToEngUnits(Range, RawValue, Volts) ' Display value on meter. Meter1.Value = Volts [C#] // Set channel, range, raw value, and volt variables. int channel = 0; MccDaq.Range range = MccDaq.Range.Bip10Volts; ushort rawValue = 0; float volts = 0.0f; // Perform analog input operation with Measurement Computing board, // channel, and range, and return raw value. daqBoard.AIn(channel, range, out rawValue); // Convert raw value to engineering units. daqBoard.ToEngUnits(range, rawValue, out volts); // Display value on meter. meter1.Value = volts;

6. 7.

Select FileSave Form1.cs to save your application. Select DebugStart Without Debugging to run the application.

Measurement Computing Edition User Manual

4-46

ni.com

Chapter 4

Getting Started with Measurement Studio

8.

After your program builds and runs, click Start. Notice each time you click the Start button, the meter shows the acquired value. The following screenshot shows Form1 with the meter displaying the acquired value.

Walkthrough: Creating a Measurement Studio MCCDaq Scan Components Application


Measurement Studio includes a component library and application templates that you can use to quickly create MccDaq Components applications with Visual Basic .NET and Visual C#. Measurement Studio Measurement Computing Edition includes user interface controls, such as a waveform graph control, and MccDaq scan components that perform analog input scans and analog output scans. This walkthrough is designed to help you learn how to add analog scan and presentation functionality to a Windows Forms application by taking you through the following steps: Setting up the projectUsing the Visual Studio New Project dialog box, you will create a new project that references the Measurement Studio MccDaq Scan Components library and Windows Forms controls. Adding user interface controls to the projectUsing the Toolbox and the Properties window, you will add and configure user interface

National Instruments Corporation

4-47

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

controls and MccDaq.Scan components, including a button, waveform graph, and an AiScan component. Generating and displaying the dataUsing the MccDaq.Scan components, you will read data from a channel on a Measurement Computing device, convert the data object to an array, and show the value on a waveform graph.

Before You Begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008 Measurement Studio Measurement Computing Edition MccDaq Scan Components Measurement Computing DAQ device or DEMO-BOARD simulated DAQ device

Note

For information about installing and configuring your Measurement Computing DAQ device, refer to the Quick Start Guide that ships with your device. You can also use the DEMO-BOARD simulated DAQ device to complete this walkthrough. Setting up the DEMO-BOARD simulated DAQ device 1. 2. 3. Run InstaCal by selecting StartAll ProgramsMeasurement ComputingInstaCal. Right-click on PC Board List, and select Add Board from the popup menu. The Board Selcetion List dialog opens. Select the ISA tab, scroll down to select DEMO-BOARD, and then click on the Add button. The DEMO-BOARD has been added to the InstaCal main form.

Measurement Computing Edition User Manual

4-48

ni.com

Chapter 4

Getting Started with Measurement Studio

4.

Close InstaCal.

Setting up the project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog box launches. In the Project types pane, select the Visual Basic or Visual C# folder, depending on which language you want to create the project in, and then select Measurement Studio. In the Templates pane, select NI Windows Application. Specify
MyMCCScanProject for Name and specify a Location of your

2. 3.

4.

choice. 5. 6. Click OK. The Measurement Studio Application Wizard launches. Select Windows Forms User Interface Control Library. When you select this library, the Measurement Studio Application Wizard automatically adds references to the appropriate class libraries.

National Instruments Corporation

4-49

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Tip

If you are working with an existing project, you can access the Add Class Libraries dialog box by selecting Measurement StudioAdd/Remove Class Libraries Wizard. 7. Click Finish to display Form1 in the Windows Forms Designer.

Adding user interface controls to the project 1. 2. Select ViewToolbox to display the Toolbox. The Toolbox contains components and controls that you can add to your project. Select the All Windows Forms tab. The All Windows Forms tab contains controls and components included in the System.Windows.Forms namespace. Select the Button control and drag and drop it onto the form. Right-click the button and select Properties to display the Properties window. You configure the properties of the control in the Properties window. The Text property is highlighted. Type Start Scan for the button text. Select another button control and drag and drop it onto the form. Type
Stop Scan for the button text.

3. 4.

5. 6. 7. 8. 9.

Select the Measurement Studio Tools tab on the Toolbox. Select the Waveform graph control and drag and drop it onto the form. Double-click the AIScan component (aiScan1) to add it to the component tray beneath the form.

10. Right-click the AIScan component (aiScan1) and select Properties to display the Properties window. 11. Click on the ClockRate property and type 500 for this property setting.

Measurement Computing Edition User Manual

4-50

ni.com

Chapter 4

Getting Started with Measurement Studio

The following screenshot shows Form1 with the user controls.

Generating and displaying the data 1. 2.


[VB.NET] ' This starts the scan AIScan1.Start() [C#] // This starts the scan aiScan1.Start();

Double-click the Start button to display the Form1 code. Add the following line of code to start an analog in scan.

3. 4.
[VB.NET] ' This stops the scan AiScan1.Stop() [C#] // This stops the scan aiScan1.Stop();

Double-click on the Stop Scan button to open the code window. Add the following line of code that stops the analog in scan.

National Instruments Corporation

4-51

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

5.

Double-click the AiScan component in the component tray below the Form Designer and add the following lines of code to the aiScan1 component to copy the analog data and display a message box if an error occurs.

[VB.NET] 'This displays the analog data on a graph WaveformGraph1.PlotY(AiScan1.GetSingleChannelValues(), 0, _ 1.0 / AiScan1.ActualRate) ' This stops the scan and displays the error message AiScan1.Stop() MessageBox.Show(AiScan1.Status, "AI Scan Error") [C#] // This displays the analog data on a graph waveformGraph1.PlotY(aiScan1.GetSingleChannelValues(), 0, 1.0 / aiScan1.ActualRate); // This stops the scan and displays the error message aiScan1.Stop(); MessageBox.Show(aiScan1.Status, "AI Scan Error");

6. 7. 8.

Select FileSave Form1.cs to save your application. Select DebugStart Without Debugging to run the application. After your program builds and runs, click Start Scan.

Measurement Computing Edition User Manual

4-52

ni.com

Chapter 4

Getting Started with Measurement Studio

The following screenshot shows Form1 with the waveform graph displaying the acquired values.

Walkthrough: Creating a Measurement Studio MCC-488.2 Application


Measurement Studio includes a component library and application templates that you can use to quickly create MCC-488.2 applications with Visual Basic .NET and Visual C#. Measurement Studio Measurement Computing Edition includes user interface controls, such as a waveform graph control, and MCC-488.2 components that read and plot data points from a GPIB device. This walkthrough is designed to help you learn how to add data reading and presentation functionality to a Windows Forms application by taking you through the following steps: Setting up the projectUsing the Visual Studio New Project dialog box, you will create a new project that references the Measurement Studio MCC-488.2 class library and Windows Forms controls. Adding user interface controls to the projectUsing the Toolbox and the Properties window, you will add and configure user interface controls, including a button and waveform graph.

National Instruments Corporation

4-53

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

Generating and displaying dataUsing MCC.488.2.Device and MCC.488.2.Address, you will read and plot 100 data points from a GPIB device at the specified address.

Before You Begin The following components are required to complete this walkthrough: Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008 Measurement Studio Measurement Computing Edition MCC-488.2 Library Measurement Computing GPIB Device

Configuring the GPIB device 1. 2. Select StartAll ProgramsGPIB-488GPIB Configuration to configure the MCC GPIB device. Go to the Advanced tab and enable the Assert REN when SC option.

Setting up the project 1. Select StartAll ProgramsMicrosoft Visual Studio 2005 Microsoft Visual Studio 2005 or StartAll ProgramsMicrosoft Visual Studio 2008Microsoft Visual Studio 2008. Select FileNewProject. The New Project dialog box launches. In the Project Types pane, select the Visual Basic Projects or Visual C# Projects folder, depending on which language you want to create the project in, and then select Measurement Studio. In the Templates pane, select NI Windows Application. Specify
MyMCCGPIBProject for Name and select a Location of your choice.

2. 3.

4. 5.
Tip

Click OK. The Measurement Studio Application Wizard launches.

If you are working with an existing project, you can access the Add Class Libraries dialog box by selecting Measurement StudioAdd/Remove Class Libraries Wizard.

Measurement Computing Edition User Manual

4-54

ni.com

Chapter 4

Getting Started with Measurement Studio

6.

In the Application Wizard dialog box, select Windows Forms User Interface Control Library and MCC488.2 Library. The wizard automatically adds references to the appropriate class libraries and sets up the project for you.

7.

Click Finish to display Form1 in the Windows Forms Designer.

Adding user interface controls to the project 1. 2. Select ViewToolbox to display the Toolbox. The Toolbox contains components and controls that you can add to your project. Select the All Windows Forms tab. The Windows Forms tab contains controls and components included in the System.Windows.Forms namespace. Select the Button control and drag and drop it onto the form. Right-click the button and select Properties to display the Properties window. You configure the properties of the control in the Properties window. The Text property is highlighted. Type Run for the button text.

3. 4.

5.

National Instruments Corporation

4-55

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

6. 7. 8.

Select the Measurement Studio tab on the Toolbox. Select the WaveformGraph control and drag and drop it onto the form. Right-click the WaveformGraph and select Edit YAxes to display the yAxis properties. Set the Maximum and Minimum values of the Range property to an appropriate range for the input signal. The following screenshot shows Form1 with the user controls.

9.

Generating and displaying the data 1. 2. Double-click the button control to display the Form1 code, with the cursor inside the click event handler of the button control. Add the following code to read a raw data point from a specified channel on the Measurement Computing device, convert the data to volts, and display the value on the graph.

[VB.NET] Dim I As IntegerDim WrtString As String = "val?" Dim RdBufSize As Integer = 100 Dim NlChar As Char = "\n" Dim NullChar As Char = "\0" Dim PrimaryAddress As New Address(2) Dim BoardNum As Integer = 0 ' Open a gpib device Dim Device As New Device(BoardNum, PrimaryAddress)

Measurement Computing Edition User Manual

4-56

ni.com

Chapter 4

Getting Started with Measurement Studio

' Allocate a buffer to hold the data Dim Buffer As IntPtr = _ System.Runtime.InteropServices.Marshal.AllocHGlobal(RdBufSize) ' Read and plot 100 samples For I = 0 To 99 ' Write the string (val?) to the Fluke45 Device.Write(WrtString) ' Read the response from the Fluke45 Dim S As String = Device.ReadString(RdBufSize) ' Replace the newline character with a null and ' convert the string to a double Dim D As Double = Convert.ToDouble(S.Replace(NlChar, NullChar)) 'Plot the point WaveformGraph1.PlotYAppend(D, 1) Next System.Runtime.InteropServices.Marshal.FreeHGlobal(Buffer) [C#] string wrtString = "val?"; int rdBufSize = 100; char nlChar = '\n'; char nullChar = '\0'; Address primaryAddress = new Address(2); int boardNum = 0; // open a gpib device Device device = new Device(boardNum, primaryAddress); // allocate a buffer to hold the data IntPtr buffer = System.Runtime.InteropServices.Marshal.AllocHGlobal(rdBufSize); // read and plot 100 samples for (int i = 0; i < 100; i++) { // write the string (val?) to the Fluke45 device.Write(wrtString); // read the response from the Fluke45 string s = device.ReadString(rdBufSize); // replace the newline character with a null and // convert the string to a double double d = Convert.ToDouble(s.Replace(nlChar, nullChar)); // plot the point waveformGraph1.PlotYAppend(d, 1); } System.Runtime.InteropServices.Marshal.FreeHGlobal(buffer);

National Instruments Corporation

4-57

Measurement Computing Edition User Manual

Chapter 4

Getting Started with Measurement Studio

3. 4. 5.

Select FileSave Form1.cs to save your application. Select DebugStart Without Debugging to run the application. After your program builds and runs, click Run. Notice each time you click the Run button, the graph shows the acquired value.

The following screenshot shows Form1 with the graph displaying the acquired value.

Measurement Computing Edition User Manual

4-58

ni.com

Contacting Measurement Computing Corporation

You can reach Measurement Computing Corporation through the following ways: Mail Measurement Computing Corporation 10 Commerce Way Suite 1008 Norton, MA 02766 Telephone 508-946-5100 FAX 508-946-9500 Technical Support
[email protected]

Sales
[email protected]

Other correspondence
[email protected]

Visit our Web site at www.measurementcomputing.com.

National Instruments Corporation

A-1

Measurement Computing Edition User Manual

Glossary
A
analog I/O annotate API array control assembly Reading or writing data in continuously variable physical quantities, such as voltage or current. Adding text, arrows, or shapes to describe or highlight a point or region on a graph. Application Programming Interface. A specification of software functions and their input and return parameters. An array of Measurement Studio user interface controls that behave as a single unit. A collection of one or more files that are versioned and deployed as a unit. An assembly is the primary building block of a .NET Framework application. All managed types and resources are contained within an assembly and are marked either as accessible only within the assembly or as accessible from code in other assemblies. Function that begins an operation and returns control to the program prior to the completion or termination of the operation.

asynchronous

B
button A control used to input or display Boolean information or to initiate an action in a program.

C
chart client callback To append new data points to the end of an existing plot over time. In Web Forms, page calls back to the server without fully posting back. Callbacks are asynchronous and are accomplished with XML-HTTP. Client callbacks do not include postback data, and they do not force the page to refresh. Client callbacks do require a browser that supports the XML-HTTP protocol.

National Instruments Corporation

G-1

Measurement Computing Edition User Manual

Glossary

coercion complex graph

Automatic conversion that Measurement Studio controls perform to change the numeric representation of a data element. A control that displays a ComplexDouble data type; the ComplexDouble data type represents a complex number of type Double that is composed of a real part and an imaginary part. 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. Object for entering, displaying, or manipulating data on a user interface. Reading or writing data based on high-precision timing through a counter or timer. By combining a counter with a highly accurate clock, you can create a wide variety of timing and counting applications, such as monitoring and analyzing digital waveforms and generating complex square waves. Flashing rectangle that shows where you may enter text on the screen. If you have a mouse installed, there is a rectangular mouse cursor, or pointer. Text object used to display X and Y coordinates that a cursor crosshair points to on a graph.

context-sensitive help control counter/timer I/O

cursor cursor label

D
DAQ DAQ device Data acquisition. Process of acquiring data, typically from A/D or digital input plug-in boards. A device that acquires or generates data and can contain multiple channels and conversion devices. DAQ devices include plug-in devices which connect to a computer USB port or PCI bus. An instrument or controller you can access as a single entity that controls or monitors real-world I/O points. A device is often connected to a host computer through some type of communication network. Reading or writing digital representations of data in discrete units (the binary digits 1 and 0). Digital information is either on or off. A control that displays DigitalWaveform data on a Windows Forms or Web Forms user interface; the DigitalWaveform data type represents a set of digital states that are grouped by samples or signals.

device

digital I/O digital waveform graph

Measurement Computing Edition User Manual

G-2

ni.com

Glossary

distribution DLL

Ability to install programs you develop with Measurement Studio to others working on different computers. 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. Digital Multimeter. A common measurement instrument that measures resistance, current, and voltage in a wide variety of applications. Previous generation Web browser with limited client interaction. See also uplevel browser. Software that controls a specific hardware device, such as a data acquisition board or GPIB interface board. See also instrument driver.

DMM downlevel browser driver

E
Ethernet event Standard connection type for networks, where computers are connected by coaxial or twisted-pair cable. Object-generated response to some action or change in state, such as a mouse click or a completed acquisition. The event calls an event procedure that processes the event. Program file with a .exe extension that you can run independently of the development environment in which it was created.

executable

F
form front panel Window or area on the screen on which you place controls and indicators to create the user interface for your program. Interactive user interface of a virtual instrument. Modeled after the front panel of physical instruments, it is composed of switches, slides, meters, graphs, charts, gauges, LEDs, and other controls and indicators. File Transfer Protocol. Protocol based on TCP/IP to exchange files between computers.

FTP

National Instruments Corporation

G-3

Measurement Computing Edition User Manual

Glossary

G
gauge GPIB A control used to input or display numerical data. 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. A 2D or 3D display of one or more plots.

graph

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.

I
IEEE 488 indicator installer Shortened notation for ANSI/IEEE Standards 488-1978, 488.1-1987, and 488.2-1987. See also GPIB. A control in read-only mode. Software program that copies program, system, and other necessary files to computers. Library of functions to control and use one specific physical instrument. Also a set of functions that adds specific functionality to an application. Connection between one or more of the following: hardware, software, and the user. For example, hardware interfaces connect two other pieces of hardware.

instrument driver interface

K
knob A control used to input or display numerical data.

Measurement Computing Edition User Manual

G-4

ni.com

Glossary

L
LED Light-Emitting Diode. An indicator that emits a light when current passes through it. For example, an LED shows if your computer or printer is turned on. A control that displays symbols and descriptions for a specific set of elements of another object, such as the plots or cursors of a graph.

legend

M
matrix MB MCC-488.2 Measurement Studio meter method A rectangular array of numbers or mathematical elements that represent the coefficients in a system of linear equations. Megabytes of memory. Driver-level software to control and communicate with Measurement Computing GPIB hardware. National Instruments software that includes tools to build measurement applications in Visual Basic .NET and Visual C#. A control used to input or display numerical data. Function that performs a specific action on or with an object. The operation of the method often depends on the values of the object properties.

N
numeric edit A control used to display and edit numeric values.

O
oscilloscope Measurement instrument widely used in high-speed testing applications, such as telecommunication physical layer testing, video testing, and high-speed digital design verification.

National Instruments Corporation

G-5

Measurement Computing Edition User Manual

Glossary

P
PCI plot Peripheral Component Interconnect. High-performance expansion bus architecture commonly found in PCs. 1. Trace (data line) on a graph representing the data in one row or column of an array. 2. To display a new set of data while deleting any previous data on the graph. Structure that contains two 16-bit integers that represent horizontal and vertical coordinates. The process in which a Web page sends data back to the same page on the server. Attribute that defines the appearance or state of an object. The property can be a specific value or another object with its own properties and methods. For example, a value property is the color (property) of a plot (object), while an object property is a specific Y axis (property) on a graph (object). The Y axis itself is another object with properties, such as minimum and maximum values. A control used to configure properties for Windows Forms controls at run time. Window or dialog box that displays current configuration information and allows users to modify the configuration.

point postback property

property editor property pages

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.

S
scalar scale Number that a point on a scale can represent. The number is a single value as opposed to an array. Part of graph, chart, and some numeric controls and indicators that contains a series of marks or points at known intervals to denote units of measure.

Measurement Computing Edition User Manual

G-6

ni.com

Glossary

scatter graph scope serial slide slider smart tag switch synchronous

A control that displays two-dimensional data on a Windows Forms or Web Forms user interface; displays a graph of X and Y data pairs. See oscilloscope. Standard serial bus on a computer used to communicate with instruments. Also known as RS-232. A control used to input or display numerical data. Moveable part of a slide control. A glyph attached to a Measurement Studio control or component that exposes commonly performed tasks. A control used to receive and control Boolean input in an application user interface. Property or operation that begins and returns control to the program only when the operation is complete.

T
tank TCP/IP A control used to input or display numerical data. Transmission Control Protocol/Internet Protocol. A standard format for transferring data in packets from one computer to another. The two parts of TCP/IP are TCP, which deals with the construction of data pockets, and IP, which routes them from computer to computer. A control used to input or display numerical data.

thermometer

U
UI uplevel browser User Interface. Recent generation Web browser that supports rich client interaction and functionality. See also downlevel browser.

National Instruments Corporation

G-7

Measurement Computing Edition User Manual

Glossary

V
vector VXI 1D array. VME eXtension for Instrumentation. Instrumentation architecture and bus based on the VME standard. Used in high-end test applications.

W
waveform graph A control that displays two-dimensional data on a Windows Forms or Web Forms user interface; displays data that is uniformly spaced in one dimension.

Measurement Computing Edition User Manual

G-8

ni.com

Index
A
Add/Remove Class Libraries wizard, 3-5 adding or removing Measurement Studio class libraries, 3-5 Analysis .NET class library, 2-2 Array and Numeric Operations (list), 2-5 Curve Fitting (list), 2-5 Filters (list), 2-3 Linear Algebra (list), 2-4 Measurements (list), 2-2 Signal Generation (list), 2-2 Signal Processing (list), 2-4 Statistics (list), 2-6 Windowing (list), 2-3 AutoRefresh control, 2-40 Measurement Studio MCC 488.2 Application (walkthrough), 4-53 Measurement Studio MCC DAQ Application (walkthrough), 4-41 Measurement Studio MCC Scan Components Application (walkthrough), 4-47 new Measurement Studio project, 3-4

D
data acquisition (DAQ), 2-8, 2-9 deployment requirements, 1-2 developing with Measurement Studio, 3-1 digital waveform graph control, 2-14, 2-31 documentation conventions used in the manual, x how to use manual set, ix NI resources, A-1

C
Common .NET class library, 2-6 complex graph control, 2-16, 2-32 conventions used in the manual, x creating Measurement Studio Application with Web Forms Controls and Analysis in Visual Studio 2005 (walkthrough), 4-11 Measurement Studio Application with Web Forms Controls and Network Variable in Visual Studio 2005 (walkthrough), 4-30 Measurement Studio Application with Windows Forms Controls and Analysis (walkthrough), 4-2 Measurement Studio Application with Windows Forms Controls and Network Variable (walkthrough), 4-21

G
gauge control, 2-18, 2-35 GPIBConfig, 3-2 graph control complex, 2-16, 2-32 digital waveform, 2-14, 2-31 scatter, 2-11, 2-28 waveform, 2-11, 2-28

H
help NI Measurement Studio Help, 1-5 technical support, A-1 how to use manual set, ix

National Instruments Corporation

I-1

Measurement Computing Edition User Manual

Index

I
InstaCal, 3-2 installation, optional, 1-2

NI Instrument Driver Network, 3-3 numeric controls, 2-18, 2-35 numeric edit .NET control, 2-20, 2-38

K
knob .NET control, 2-19 .NET Web Forms control, 2-36

O
overview, Measurement Studio, 1-1

P L
LED array control, 2-23 LED control, 2-21, 2-39 legend control, 2-18, 2-35 project templates, 3-4 property editor control, 2-22

S
scatter graph control, 2-11, 2-28 slide control, .NET, 2-20, 2-37 support, technical, A-1 switch array control, 2-23 switch control, 2-21, 2-39

M
MCC-488.2 .NET class library, 2-8 Measurement Studio developing with, 3-1 home page, 3-3 Menu, 3-1 overview, 1-1 Preferences, 3-3 resources, 1-5 meter control, 2-19, 2-36

T
tank control, 2-20, 2-37 technical support, A-1 thermometer control, 2-20, 2-37

U N
.NET class libraries Analysis, 2-2 Common, 2-6 MCC-488.2, 2-8 Scan Components, 2-9 Universal Library, 2-8 User Interface, 2-9, 2-27 Network Variable .NET class library, 2-7 NI Discussion Forums, 3-3 Universal Library .NET class library, 2-8 User Interface .NET class library, 2-9, 2-27 AutoRefresh, 2-40 complex graph, 2-16, 2-32 digital waveform graph, 2-14, 2-31 gauge, 2-18, 2-35 knob, 2-18, 2-35 LED, 2-21, 2-39 legend, 2-18, 2-35 meter, 2-18, 2-35

Measurement Computing Edition User Manual

I-2

ni.com

Index

numeric edit, 2-20, 2-38 property editor, 2-22 scatter graph, 2-11, 2-28 slide, 2-20, 2-37 switch, 2-21, 2-39 tank, 2-20, 2-37 thermometer, 2-20, 2-37 waveform graph, 2-11, 2-28

V
Variable Manager, 3-2

W
walkthrough Creating a Measurement Studio Application with Webs Forms Controls and Analysis in Visual Studio 2005, 4-11 Creating a Measurement Studio Application with Webs Forms Controls and Network Variable in Visual Studio 2005, 4-30

Creating a Measurement Studio Application with Windows Forms Controls and Analysis, 4-2 Creating a Measurement Studio Application with Windows Forms Controls and Network Variable, 4-21 Creating a Measurement Studio MCC 488.2 Application, 4-53 Creating a Measurement Studio MCC DAQ Application, 4-41 Creating a Measurement Studio MCC DAQ Scan Components Application, 4-47 waveform graph control, 2-11, 2-28 Web Forms user interface controls, 2-27 Web resources, A-1 Windows Forms array controls, 2-23 LED array control, 2-23 switch array control, 2-23 Windows Forms user interface controls, 2-9

National Instruments Corporation

I-3

Measurement Computing Edition User Manual

You might also like