Developing a Measurement Plug-In with LabVIEW
- Updated2024-10-16
- 5 minute(s) read
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.
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.
- Open or create a LabVIEW project. Save the project.
-
In the Project Explorer window select
. A dialog box appears.
-
Enter a name for the new measurement plug-in.
-
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.
-
Edit the measurement inputs.
- Within your measurement plug-in library, open the Measurement Configuration.ctl typedef file.
- 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.
- Save and close the typedef file.
-
Edit the measurement outputs.
- Within your measurement plug-in library, open the Measurement Results.ctl typedef file.
- Expand the Measurement Results cluster and add controls to represent output values.
- Save and close the typedef file.
-
Update the measurement logic.
- Within your measurement plug-in library, open Measurement Logic.vi.
-
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.
- Save and close the VI.
- 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.
-
Update the measurement UI.
- Within your measurement plug-in library, open Measurement UI.vi.
- 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.
- Save and close the VI.
-
Optionally, update the measurement details.
- Within your measurement plug-in library, open Get Measurement Details.vi.
- 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.
- Open Get Type Specializations.vi.
- Open the block diagram.
- Modify the existing Type Specializations cluster to add your
parameter.
- Specify a Parameter Name that matches the name of the parameter in your measurement logic.
- Select the Type Specialization for your parameter.
- If you selected Pin as the Type Specialization for your
parameter, use the Annotations cluster to specify the
instrument type.
- Specify a Key of pin.instrument_type.
- Specify a Value. Valid values for NI devices are listed in the comment on the block diagram.
- 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.
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:
- In your LabVIEW project, expand Build Specifications.
- To review or change the destination directory, right-click the build specification and select Properties. The destination directory is specified on the Information page.
- Right click the nested build specification file and select Build.
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.
- Ensure the path value in the service configuration file is correct for your batch file or executable.
-
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.
In This Section
Related Information
- LabVIEW Measurement Development Dependencies
You must install LabVIEW add-on packages to develop Measurement Plug-In measurements using LabVIEW. The required packages are available from vipm.io.
- Measurement Plug-In SDK Examples for LabVIEW on github