Measurement Studio lecture handout given by Mr. Ashish Chandiok on Measurement Studio in National Workshop on LabVIEW and its Applications.Organized at Dayalbagh Educational Institute,Dayalbagh,AGRA from 28-29 August 2015.
2. Table of Contents
âą What is Measurement Studio
âą Key Features of Measurement Studio
âą Installation
âą Getting Started with Measurement Studio
âą Example
âą Result
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
2
3. What is Measurement Studio
âą Measurement Studio is the only suite of tools designed
for building professional engineering applications in
Microsoft Visual Studio 2010, 2012, and 2013
âą It acquire, analyse, and display measurement data.
âą It offers extensible measurement classes and user
interface (UI) controls for Windows Presentation
Foundation (WPF), Windows, and Web Forms to help
you design an end-to-end test or measurement system
in Visual Basic .NET and Visual C#.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
3
4. Key Features of Measurement
Studio
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
4
Engineering UI Controls
Present Data in an Intuitive and Impactful Format
Use graphs, charts, gauges, knobs, meters, and LEDs that are
designed for engineering applications and are compatible with
hardware-acquired data types.
Easily Create Professional UIs
Choose from a full suite of WPF controls to create a
sophisticated, resolution-independent user experience.
Support Tools in Visual Studio
Start With Integrated Examples, Templates, and Wizards
Get started faster with over 100 fully functional example
applications and built-in project templates.
Access Help and Technical Support
Receive personalized help from trained engineers to design, set up,
and troubleshoot your hardware and software.
5. Key Features of Measurement
Studio
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
5
Hardware Communication
Achieve Shorter Time to Meaningful Measurements
Remove the complexity of hardware communication
through high-level, intuitive, object-oriented hardware
class libraries.
Accelerate Development With Productivity Tools
Interactively configure and generate ready-to-use DAQ
code from within Visual Studio.
Advanced Analysis Libraries
Draw Meaningful Information From Your Data
Access over 500 engineering functions such as frequency
analysis, curve fitting, statistics, and advanced math.
Implement Inline Processing of Raw Data
Perform inline analysis in real time on acquired signals
without the difficult task of writing custom parsing algorithms.
6. Key Features of Measurement
Studio
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
6
Installer Builder
Ensure Proper Run-Time Behavior
Harness Microsoft Windows Installer distribution
technology to package built libraries, executables, drivers,
and dependencies into a single installer.
Stay in Your Native Environment
Launch the Installer Builder from within Visual Studio and
configure options in an intuitive user interface.
Compatibility With NI TestStand
Automate the Test Process
Use Measurement Studio to create the UI for your test
system.
Take Advantage of Flexible Debugging
Edit and debug .NET assemblies from NI TestStand using
Visual Studio with direct integration provided by Measurement
Studio.
7. Getting Started with
Measurement Studio
âą Getting Started informationâRefer to the installed NI Measurement Studio Help
topic to get started with Measurement Studio. For a list of Measurement
Studio resources, refer to the Using the Measurement Studio Help topic in
the NI Measurement Studio Help.
âą ExamplesâMeasurement 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 Measurement
Studio installed on the system, and the operating system. For more
information on example locations, refer to the Where to Find Examples
topic in the NI Measurement Studio Help.
âą Measurement Studio website, ni.com/mstudioâContains Measurement Studio
news, support, downloads, white papers, and product tutorials.
âą NI Technical Support, ni.com/supportâProvides access to online example
programs, tutorials, technical news, and Measurement Studio discussion
forums.
Review the information from the Microsoft website on using Visual Studio.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
7
8. Example:
Creating Measurement Studio App
âą Setting up the projectâUsing the Measurement Studio Application Wizard, we will create a
new project that references the Measurement Studio Analysis class library and Windows
Forms controls.
âą Adding user interface controls to the projectâUsing 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 dataâUsing WhiteNoiseSignal and Mean, you will
generate data, plot the generated data on a waveform graph, and calculate the mean of the
data.
âą Customizing the user interfaceâUsing 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.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
8
9. Example:
Before Creating a project, Requirements
âą Before you begin
The following components are required to complete a project in Measurement Studio:
âą Microsoft Visual Studio 2010 or later
âą Measurement Studio 2010 or later (Professional or Enterprise edition)
âą NIDAQMX Software
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
9
10. Example:
Setting up of the Project
Step 1. Select
Start» All Programs» Microsoft Visual Studio» Microsoft Visual
Studio.
Step 2. Select
File» New» Project. The New Project dialog box launches.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
10
11. Example:
Setting up of the Project
Step 3
In the New Project window, in the pane on the left side, select
Installed Templates, then select Visual C# or Visual Basic,
depending on which language you want to create the project in.
You can then select Measurement Studio to see a list of
Measurement Studio project templates in the center pane.
Step 4
In the center pane, select NI Windows Application. Specify
MyMeasurementStudioProject for Name and specify a Location of
your choice.
Step 5
Click OK. The Measurement Studio Application Wizard launches.
Step 6
Select Analysis Library and Windows Forms User Interface Control
Library.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
11
12. Example:
Setting up of the Project
Step 7
Select Analysis Library and Windows Forms User Interface Control
Library.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
12
13. Example:
Adding User Interface Controls
Step 1
Select View» Toolbox to display the Toolbox. The Toolbox contains
components and controls that you can add to your project.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
13
14. Example:
Adding User Interface Control
Step 2
Expand the All Windows Forms group. The All Windows Forms group
contains controls and components included in the
System.Windows.Forms namespace.
Step 3
Select the Button control and drag and drop it onto the form.
Step 4
Right-click the button and select Properties to display the
Properties window. You configure the properties of the control in
the Properties window.
Step 5
The Text property will be highlighted. Type Start for the button
text.
Step 6
Expand the Measurement Studio group in the Toolbox.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
14
15. Example:
Adding User Interface Control
Step 7
Select the WaveformGraph control and drag and drop it onto the
form.
Step 8
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.
Step 9
Type Plot for the
Name. Click OK.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
15
16. Example:
Adding User Interface Control
Step 7
Select the Waveform Graph control and drag and drop it onto the
form.
Step 10
Select the Legend control and drag and drop it onto the form.
Step 11
Select the Numeric Edit control and drag and drop it onto the
form.
Step 12
Select the Gauge control and drag and drop it onto the form.
Step 13
Click the gauge smart tag to display the Gauge Tasks.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
16
17. Example:
Adding User Interface Control
Step 14
Type gauge for the name of the gauge.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
17
19. Example:
Generating Plotting and Analysing Data
C#
Step 1
Double-click the button control to display the Form1 code, with the cursor
inside the click event handler of the button control.
Step 2
Add the following code to generate random data, plot the data, calculate
the mean of the data, and display the mean on the gauge.
C# code
// 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;
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
19
20. Example:
Generating Plotting and Analysing Data
VB.Net
Step 1
Double-click the button control to display the Form1 code, with the cursor inside the
click event handler of the button control.
Step 2
Add the following code to generate random data, plot the data, calculate the mean of
the data, and display the mean on the gauge.
VB code
' 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
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
20
21. Example:
Customizing user interface
Step 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.
Step 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.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
21
22. Example:
Customizing User Interface
Step 3
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.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
22
23. Example:
Customizing User Interface
Step 3
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.
Step 4
Select Points Only. Click OK.
Notice that the legend
changed automatically to
match the formatting
of the graph.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
23
24. Example:
Customizing User Interface
Step 5
Click the gauge smart tag to display the Gauge Tasks.
Step 6
Select Auto Format to display the Auto Format dialog box.
Step 7
Select Dark and click OK.
Step 8
Right-click the gauge and select Properties to display the
Properties window.
Step 9
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.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
24
25. Example:
Customizing User Interface
Step 10
Click the numeric edit smart tag to display the NumericEdit
Tasks.
Step 11
Select Gauge in the Source drop-down list. Setting the Source
property to the gauge allows two-way binding between the
controls.
Step 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.
Step 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. Click OK.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
25
26. Example:
Customizing User Interface
Step 14
Select File » Save Form1.cs to save your application.
Step 15
Select Debug » Start Without Debugging to run the application.
1-Sep-15
Ashish Chandiok,
Dayalbagh Engineering Institute
26