- Measurement Plug-In SDK for LabVIEW
 
The Measurement Plug-In SDK for LabVIEW packages enable measurement developers to quickly create LabVIEW measurements and run them as a service. They also allow developers to generate a LabVIEW client which communicates with the service over gRPC. NI Measurement Plug-In Support allows users to interact with measurement services with a LabVIEW UI in InstrumentStudio.
- InstrumentStudio 2024 Q3 or later
 - LabVIEW 2021 SP1 or later
- JKI VI Package Manager 2021 SP1 or later
 
 
- Install a supported version of InstrumentStudio
 - Install a supported version of LabVIEW
 - Install a supported version of Measurement Plug-In SDK for LabVIEW from VIPM.
 
- 
Create and save a new LabVIEW project.
 - 
From the project window, go to
Tools→Plug-In SDKs→Measurements→Create Measurement Plug-in.... - 
Add the measurement details to
Get Service Descriptor.vi. - 
Add the required configuration parameters to
Measurement Configuration.ctl. By default, there are controls showing most of the supported data types. - 
Add the required output parameters to
Measurement Results.ctl. By default, there are indicators for most of the supported data types. - 
Add your measurement logic to
Measurement Logic.vi. The VI has an input cluster with the configuration parameters fromMeasurement Configuration.ctland an output cluster with the output parameters fromMeasurement Results.ctl. By default, the measurement logic takes the inputs and writes them to the associated outputs (a loopback measurement). - 
Add cancellation logic to
Wait Until Cancelled or Complete.viif needed. For long running or indeterminate measurements (e.g. triggered measurements), it is recommended the measurement monitor for cancellation requests from the client so it can abort the measurement and free up resources for subsequent calls in a timely manner. Failure to do so may result in user interfaces that do not seem responsive when stopped before completing normally from the client. Since the cancellation logic will be specific to each measurement, modify the connector pane to pass inputs as required in order to cancel the measurement. If the measurement will always complete in a short period of time, cancellation logic can be omitted from the measurement. - 
Add your user interface to
Measurement UI.vi. The control and indicator labels in the user interface must match theMeasurement ConfigurationandMeasurement Resultslabels. If the data types and labels match, then the data from the controls will be sent to theMeasurement Logic.viand the results will be published to the indicators after the measurement is run. By default, the UI file consists of controls and indicators mapped to all of the input and output parameters for the measurement service.
If your user interface has dependencies that are not available in the LabVIEW runtime, you will have to build the UI into a packed library. For example, you will have to build a packed library if your UI contains VIs from vi.lib or if your UI depends on user created subVIs or controls. The packed library should be located in a directory at the same level asMeasurement Logic.vi. The measurement template has a build spec for a packed library for the UI demonstrating how to use a packed library user interface. 
Note:
- Additional information can be found in the to-do sections in the code, which
can be viewed using the 
Bookmark Manager. You can open it from theView→Bookmark Managermenu. In this window, you will find the bookmark term#MeasurementToDo. Double-clicking on the items will take you to the VI locations where changes need to be made for creating your unique measurement service. VIs generated under theFramework Definedproject folder do not contain to-dos and should not require modification except in advanced use cases. In contrast, VIs generated under theUser Definedproject folder contain to-dos where measurement specific customization should be implemented. - A list of supported datatypes for the 
ConfigurationandOutputparameters of the measurement can be found in the NI Measurement Plug-In Support manual here 
- 
Open your measurement project.
 - 
Run the
Run Service.vi. A new window will appear, which provides basic information about the running service. 
- 
Create and save a new LabVIEW project.
 - 
From the project window, go to
Tools→Plug-In SDKs→Measurements→Create Measurement Plug-in Client.... 
This facilitates the automation of the measurement client generation in LabVIEW applications, which helps in invoking measurements within the user application.
- To generate a LabVIEW measurement client programmatically
- 
Open the Block Diagram of your application (or) Create and save a new VI.
 - 
Navigate to
Measurement I/O→Measurement Plug-In SDK→Client Generator→Generate Client.viin the palette. - 
Add the
Generate Client.vito the Block diagram. - 
Wire the
service classname of any available measurement plug-in and a validproject pathto this VI to generate client for the measurement plug-in. - 
By default, the
Generate Client.vicreates a measurement plug-in client library named after the service class.- If you want to use a different name for the client library, you can provide a custom name
through the 
client nameinput of the VI. 
 - If you want to use a different name for the client library, you can provide a custom name
through the 
 
 - 
 
Note:
- The Measurement Plug-In Client is compatible with all datatypes supported by the Measurement Plug-In.
 - For Enum datatype, contiguous enums will be represented as enum control and sparse enums will be represented as ring control in the client.
 - If the Measurement Plug-In uses a LabVIEW UI, ring controls in the UI will be represented as numeric controls in the client, maintaining the same representation.
 
- 
Open your measurement client project.
 - 
For non-pin based measurement, open the
Run Client.vi. - 
For pin-based measurement
- 
Create and save a new VI.
 - 
Navigate to
Measurement I/O→Measurement Plug-In SDK→Pin Map→Register Pin Map.viin the palette. - 
Drag the
Register Pin Map.vito the Block diagram. - 
Wire the Pin Map path of the measurement to this VI to register the Pin Map.
 - 
Wire the
pin map idoutput of this VI to thepin map context.pin_map_idinput of the Run Client VI. - 
Set the
pin map context.sitesinput of the Run Client VI. - 
Set the inputs to the configuration control.
 - 
Run the
Run Client.vito invoke the measurement logic and display the results. 
 - 
 
Note:
- To run 
Run Client.viwithout registering the pin map for a pin-based measurement, specify the IOResource name in the configuration control instead of the Pin name. - The 
Run Client.viwill support both stream and non-stream measurements.- For non-stream measurements, 
Run Client.vican be used as a standalone VI or subVI without any modifications. - For stream measurements, when used as a subVI within a framework,
Run Client.viwill only provide the last successful value of the measurement results. To obtain all responses from a stream measurement, replicate the logic insideRun Client.viwithin the framework. 
 - For non-stream measurements, 
 
The Source\Example Measurements directory contains example measurement
services. See the README.md file
for more information.
- 
Open InstrumentStudio and click on
Manual Layout. - 
Choose the desired measurement and create a panel.
 - 
The layout will be populated with the Measurement UI and the default configuration.
 - 
Modify the configuration if necessary and click
RUNto run the measurement. 
The generated measurement service includes two build specifications: one for the UI and another for the service executable. The UI build specification must be built first in order for the measurement service executable build to succeed. To build them, right-click on the desired build specification and choose 'Build'.














