The Plug-In Creation Toolkit
- Updated2023-02-17
- 7 minute(s) read
The Plug-In Creation Toolkit
You can use the Data Record AD Plug-In Creation Toolkit to create and modify I/O plug-ins to interface with your Data Record System to fit your application needs.
Refer to the Data Record AD GitHub Repository at https://www.ni.com/r/datarecord-devguide for examples and detailed information about using the Plug-In Creation Toolkit.
I/O Plug-Ins Overview
All built I/O plug-ins consist of two components: an XML file and a plug-in (.ppl) file. Some built plug-ins may contain additional files.
You can adjust the appearance of a plug-in using the Configuration Editor by changing the icon associated with it. To update a plug-in icon, create a 40x40 pixel PNG file named PluginIcon.png and upload it to the same directory where the XML file for your plug-in is located. To reset the cached plug-in image, you must then temporarily move the plug-in to a different folder, start the Configuration Editor, close the Configuration Editor, move the plug-in back to the original folder, and then start the Configuration Editor again. If no PluginIcon.png file exists, the plug-in displays a default icon.
I/O plug-ins run inside of the Data Record AD data processing engine. By default, each plug-in has a single input terminal that can accept a single-wire connection, but you can adjust this in the Configuration Editor. The number of output terminals per plug-in is user defined. A configuration control (configuration.ctl) file is also included in the I/O plug-in template, and the contents of this file are exposed to the Configuration Editor through the plug-in descriptor XML file next to each built plug-in. Each plug-in goes through its own state machine, where each state is a VI that is built into the I/O plug-in template. You can customize the VIs in the States folder of the plug-in class to adjust the behavior of your plug-in. The parameters are read from the system configuration file and loaded during the read parameters state.
Plug-In States
- Initialize State—The Initialize VI is called only once per session, before the plug-in loads its configuration. You can set timing and synchronization options within this state if you do not intend to expose those options as a configuration parameter.
- Read Parameters State—The Read Parameters VI loads the configuration parameters for the plug-in. In most cases, you do not need to edit this VI.
- Configure Session State—The Configure Session VI configures sessions and references that are used by your plug-in. This VI is called only once per session, after the plug-in loads its configuration. Call the appropriate initialization VIs to open and store any configuration parameter references that are needed during the session. If the plug-in needs information from the configuration file to determine the timing parameters to use, set those parameters in this VI rather than in the Initialize VI.
- Handle Message State—The Handle Message VI receives and processes out-of-band messages from the data processing engine. gRPC messages sent to the datalogger plug-in topic are forwarded to this VI. By default, this VI acknowledges message receipt and echoes the message.
- Process State—The Process VI enables your plug-in to read incoming data, perform required actions, and send data to the data processing engine for other plug-ins to receive. This VI is called throughout the session as frequently as specified in the timing parameters. Ensure any data that needs to persist between calls to the Process VI is stored in the class private data of the plug-in. The plug-in exits the process loop when the application shuts down or when an error is thrown within the Process VI.
- Cleanup Session State—The Cleanup Session VI closes any references opened during the Configure Session state and flushes any buffers that the plug-in used. If the plug-in is restarting, this state is followed by the Configure Session state. If the plug-in is shutting down, this state is followed by the Finalize state.
- Finalize State—The Finalize VI is called as the plug-in shuts down. You can close any global resources or sessions during this state.
Plug-In Timing Parameters
- Periodic—Specifies a period of time, in milliseconds, for the process loop to run.
- Immediate—Runs the process loop as quickly as possible with no added delay between calls. This is useful for data source plug-ins when execution is blocked by a call to hardware.
- On Data Ready—Runs one iteration of the process loop every time data arrives on the input terminal.
I/O Plug-In Timing and Synchronization
The ADAS utilities library exposes rendezvous VIs and sync domain VIs that you can use to enable hardware synchronization and t0 time domain adjustments. Rendezvous VIs and sync domain VIs are located in the following file location: <LabVIEW 2020>\vi.lib\ADAS Record\Utilities\Sync Tools.
A rendezvous ensures that multiple plug-ins wait at a certain execution point before proceeding. Each plug-in that reaches the rendezvous waits until all plug-ins registered for that particular rendezvous are waiting, at which point all plug-ins proceed with execution.
You can use sync domain VIs to share a t0 value between multiple plug-ins. Each plug-in can belong to only one sync domain.
Installing Required Software for
Plug-Ins
- Install the Plug-In Creation Toolkit from the Data Record AD GitHub Repository at https://www.ni.com/r/datarecord-devguide.
- Install any toolkits or drivers required by your sensors.
- Install VI Package Manager.
-
Install the following packages from VI Package Manager:
- OpenG File Library
- JSONText
- Caraya Unit Test Framework
Creating an I/O Plug-In from a
Template
- Launch LabVIEW.
- Select .
-
Select
.
- Enter a name and target directory path for the new plug-in.
-
Click Finish.
LabVIEW creates a project for your plug-in.
Customizing Plug-Ins
- Open the LabVIEW project for your plug-in.
- Select .
- Select Group by Bookmark.
- Examine each #CodeRecommended bookmark to locate areas of the code where you can customize the behavior of the plug-in.
Debugging and Testing I/O Plug-Ins
Each plug-in comes with an included default test case as part of the I/O plug-in template.
You should test each plug-in individually, if possible, but certain plug-ins must be paired with others before they will perform behavior that you can test. Refer to the Data Record AD GitHub Repository at https://www.ni.com/r/datarecord-devguide to learn more about writing functional test cases to test relevant plug-ins together.
Building I/O Plug-Ins
-
(Optional) Edit the plug-in properties to perform tasks such as adding source
file dependencies, modifying pre- and post-build actions, or adjusting
destinations.
-
Double-click the build specification for your plug-in to open the
Properties dialog box.
Figure 6. Example Plug-In Build Specification
Figure 7. Plug-In Properties Dialog Box With Build Actions Selected
- Select the category you want to edit from the left-hand panel.
- Adjust settings for that category as applicable.
- Select OK to save your changes.
-
Double-click the build specification for your plug-in to open the
Properties dialog box.
-
Right-click Build Specifications in the plug-in Project Explorer
window.
- Select Build All to produce the PPL and XML files in the default directory.
- Select Done.
Distributing I/O Plug-Ins
- Locate the folder containing the plug-in files.
-
Choose from one of the following options:
- Copy and paste the plug-in folder onto a USB drive to transfer it to the target machine.
- Transfer the files directly to the target machine through Windows remote file sharing.
-
Save the plug-in folder on the target machine in your desired location.
Data Record AD loads plug-in files from %Public%\Documents\National Instruments\ADAS\Plugins\IOPlugins.
Publishing Data to UI Topics Using I/O
Plug-Ins
The Data Record AD User Interface enables you to publish data to UI topics through I/O plug-ins over the built-in gRPC interface. Alternatively, you can use TCP/IP, SystemLink, or another method enabled by your integrator.
Refer to Communication Between the Data Record AD User Interface and Data Record AD for more information.