Developing a Measurement Plug-In with LabVIEW

This topic outlines the required steps for developing a measurement plug-in in LabVIEW. Use the LabVIEW examples in github and the remaining topics in this manual to understand how to develop a working measurement for your application.

Note If you are developing a measurement plug-in for use with TestStand, review the Running a Measurement from TestStand topic to understand additional design considerations.

Creating a LabVIEW Measurement Plug-In

Complete the following steps to add a measurement plug-in to a LabVIEW project. Ensure that you have installed the LabVIEW development dependencies before you begin.

  1. Open or create a LabVIEW project. Save the project.
  2. In the Project Explorer window select Tools » » Create Measurement Service.
    A dialog box appears.
  3. Enter a name for the new measurement plug-in.


  4. Click Create Measurement Service.
    A new library is added to the LabVIEW project. This library contains your measurement plug-in.

    Note The measurement plug-in library also includes a build specification to simplify the process of creating an executable, which you can use to deploy your measurement plug-in.

Configuring a LabVIEW Measurement Plug-In

You must modify a generated LabVIEW measurement plug-in to meet your specific needs.

Note Necessary steps are also documented as bookmarked to-do sections. In the LabVIEW project window select View » Bookmark Manager and browse the #MeasurementToDo bookmarks. Double-click a bookmark to open the relevant VI and code location.
These steps assume that your LabVIEW project is already open.
  1. Edit the measurement inputs.
    1. Within your measurement plug-in library, open the Measurement Configuration.ctl typedef file.
    2. Expand the Measurement Configuration cluster and add controls to represent input values. Change the value of a control to specify a default value for the measurement.
    3. Save and close the typedef file.
  2. Edit the measurement outputs.
    1. Within your measurement plug-in library, open the Measurement Results.ctl typedef file.
    2. Expand the Measurement Results cluster and add controls to represent output values.
    3. Save and close the typedef file.
  3. Update the measurement logic.
    1. Within your measurement plug-in library, open Measurement Logic.vi.
    2. Implement your measurement logic using the existing configuration, results, and error clusters.
      Refer to the Measurement Development Best Practices topic for an abstract overview of useful development patterns.
      To update the interactive UI while the measurement runs, use the Update Results.vi. The UIProgressUpdates example demonstrates this feature.
    3. Save and close the VI.
  4. If you are developing a measurement plug-in for use with TestStand, review the Running a Measurement from TestStand topic to understand additional design considerations.
  5. Update the measurement UI.
    1. Within your measurement plug-in library, open Measurement UI.vi.
    2. Use LabVIEW controls and indicators to implement your UI. To function, control and indicator names and datatypes must correspond to the inputs and outputs of your measurement logic. Note that you can use captions (which have no matching constraint) to supplement labels.
    3. Save and close the VI.
  6. Optionally, update the measurement details.
    1. Within your measurement plug-in library, open Get Measurement Details.vi.
    2. Open and edit the block diagram. View the LabVIEW Measurement Details topic for a description of each field.

Setting Pin or Path Behavior

Use Get Type Specializations.vi to specify whether a string behaves as a pin or path. Setting this behavior is useful when you intend to interact with the measurement logic through a graphical UI.

  1. Open Get Type Specializations.vi.
  2. Open the block diagram.
  3. Modify the existing Type Specializations cluster to add your parameter.
    1. Specify a Parameter Name that matches the name of the parameter in your measurement logic.
    2. Select the Type Specialization for your parameter.
  4. If you selected Pin as the Type Specialization for your parameter, use the Annotations cluster to specify the instrument type.
    1. Specify a Key of pin.instrument_type.
    2. Specify a Value. Valid values for NI devices are listed in the comment on the block diagram.
  5. Close the VI and save your project.

Starting a LabVIEW Measurement Service

To immediately run a LabVIEW measurement plug-in from the LabVIEW project, open and run the Run Service VI located in your measurement plug-in library. The VI runs your plug-in as a service and reports the measurement service port.

Note Starting your measurement service from a development environment temporarily displaces any statically registered measurement service with the same service class. When you stop the service, the statically registered instance is restored upon being called. This behavior is useful for rapid debugging. Ensure a unique service class for each measurement service to avoid unexpected behavior.

To automatically run your measurement plug-in as a service, create a LabVIEW executable and use it to statically register the measurement plug-in. You should statically register your measurement service when you deploy it to a production environment.

Creating an Executable for a LabVIEW Measurement

Use the build specification in your measurement library to package a LabVIEW measurement as an executable, which can then be configured to run as a service.

Complete the following steps to run the build specification for your measurement library:

  1. In your LabVIEW project, expand Build Specifications.
  2. To review or change the destination directory, right-click the build specification and select Properties. The destination directory is specified on the Information page.
  3. Right click the nested build specification file and select Build.
An executable and its dependencies are built to the destination directory specified in the build specification.

Statically Register a Measurement Service

The Measurement Plug-In discovery service automatically registers measurement services that are deployed to the Measurement Plug-In services folder. The discovery service continuously monitors this folder for changes.

You must do the following before you deploy your measurement plug-in:

  • Create a batch file that invokes the measurement logic or compile the measurement project as an executable.
  • Ensure that your measurement plug-in has a valid service configuration (*.serviceconfig) file.
    • LabVIEW measurement plug-ins can generate this file by running the included build specification.
    • For other scenarios, use the service configuration file template to create this file for your plug-in.
Complete the following steps to deploy your measurement plug-in and statically register your measurement service.
  1. Ensure the path value in the service configuration file is correct for your batch file or executable.
  2. Copy the measurement plug-in folder to the following location: <ProgramData>\National Instruments\ Plug-Ins \Services\
    Note The discovery directory is continously monitored. Service configuration file changes take immediate effect.
Once your measurement service is statically registered, the Measurement Plug-In discovery service makes it visible in supported NI applications.