ni / measurement-plugin-labview

LabVIEW framework to develop measurement plug-ins for NI application software. Contains sample measurement plug-ins for InstrumentStudio and TestStand and a generator with a measurement template to get started on a measurement plug-in.
MIT License
10 stars 13 forks source link

Measurement Plug-In SDK for LabVIEW


Introduction

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.


Software support


Installation

  1. Install a supported version of InstrumentStudio
  2. Install a supported version of LabVIEW
  3. Install a supported version of Measurement Plug-In SDK for LabVIEW from VIPM.

Developing a LabVIEW measurement

  1. Create and save a new LabVIEW project.

  2. From the project window, go to ToolsPlug-In SDKsMeasurementsCreate Measurement Plug-in....

    • In the dialog, enter the Measurement Plug-in Name and Measurement Plug-in Description, then click Create Measurement Plug-in.

      New measurement dialog

    • This will create a new measurement service library and a UI library.

      Measurement library files

  3. Add the measurement details to Get Service Descriptor.vi.

    Get Service Descriptor VI

  4. Add the required configuration parameters to Measurement Configuration.ctl. By default, there are controls showing most of the supported data types.

    Measurement Configurations ctl

  5. Add the required output parameters to Measurement Results.ctl. By default, there are indicators for most of the supported data types.

    Measurement Results ctl

  6. Add your measurement logic to Measurement Logic.vi. The VI has an input cluster with the configuration parameters from Measurement Configuration.ctl and an output cluster with the output parameters from Measurement Results.ctl. By default, the measurement logic takes the inputs and writes them to the associated outputs (a loopback measurement).

    Measurement Logic VI

  7. Add your user interface to Measurement UI.vi. The control and indicator labels in the user interface must match the Measurement Configuration and Measurement Results labels. If the data types and labels match, then the data from the controls will be sent to the Measurement Logic.vi and 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 as Measurement 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.

    Measurement UI

Note:


Running a LabVIEW measurement

  1. Open your measurement project.

  2. Run the Run Service.vi. A new window will appear, which provides basic information about the running service.

    Run Service VI


Generating a LabVIEW measurement client

  1. Create and save a new LabVIEW project.

  2. From the project window, go to ToolsPlug-In SDKsMeasurementsCreate Measurement Plug-in Client....

    • A dialog will open displaying the V2 measurement services that are currently running or deployed on the system.

      New measurement client dialog

    • In the dialog, select one or more available measurements, then click Create Measurement Plug-in Client(s).

    • This will create a new measurement client library in the project.

      Measurement client library files

Note:


Running a LabVIEW measurement client

  1. Open your measurement client project.

  2. For non-pin based measurement, open the Run Client.vi.

    • Set the inputs to the configuration control.
    • Run the Run Client.vi to invoke the measurement logic and display the results.

      Run Client VI

  3. For pin-based measurement

    • Create and save a new VI.

    • Navigate to Measurement I/OMeasurement Plug-In SDKPin MapRegister Pin Map.vi in the palette.

      Register Pin Map VI

    • Drag the Register Pin Map.vi to the Block diagram.

    • Wire the Pin Map path of the measurement to this VI to register the Pin Map.

    • Wire the pin map id output of this VI to the pin map context.pin_map_id input of the Run Client VI.

    • Set the pin map context.sites input of the Run Client VI.

    • Set the inputs to the configuration control.

    • Run the Run Client.vi to invoke the measurement logic and display the results.

Note:


Examples

The Source\Example Measurements directory contains example measurement services. See the README.md file for more information.


Using a measurement in InstrumentStudio

  1. Open InstrumentStudio and click on Manual Layout.

  2. Choose the desired measurement and create a panel.

    Selecting a LabVIEW measurement

  3. The layout will be populated with the Measurement UI and the default configuration.

  4. Modify the configuration if necessary and click RUN to run the measurement.

    Running the measurement


Creating a LabVIEW executable for static registration

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'.