Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Plug-In Analysis in BioBench 1.2

0 ratings | 0.00 out of 5
Print

Overview

To increase flexibility for processing data, BioBench 1.2 offers a plug-in architecture to allow implementation of custom LabVIEW-built analysis functions. Through this data interface, you can process data provided by BioBench and observe the results in the BioBench Analysis view. Based on the dynamic loading mechanism of LabVIEW, the plug-in architecture enables you to associate your own subVIs with BioBench. By calling those subVIs dynamically, BioBench can process data based on the requirements of the customer and avoid rewriting or recompiling its source code.

Note: This is an example of a plug-in analysis VI that multiplies acquired data by a constant. It is imperative that you follow these directions precisely to ensure that your plug-in analysis operates properly. General plug-in analysis techniques will be discussed throughout the example in the form of "Note: comment."


I. Creating a Plug-In Custom Analysis VI

A. Building the Front Panel

1. Open the Plug-in Template VI from the \BioBench\plugin\plug-in template\ folder. Save the VI As "Multiply by Const (Configurable).vi" in the \BioBench\plugin\Multiply by Const.llb.

Note: You must save the plug-in VI in a VI library in the BioBench\plugin folder. BioBench looks for the plug-in VI in that BioBench\plugin folder.


2. Review the controls and indicators on the front panel shown in the following illustration.




3. Notice the required controls and indicators:
    Display Name—Display name of this plug-in VI. In plug-in analysis, BioBench enumerates the display name in plug-in selection pull-down list for choice. The label of the Display Name control must be "Display Name" so that BioBench can identify it correctly. However, the content of Display Name can be any desired string. For example, you can use the name of the plug-in VI.

    Config VI Name—If you want the parameters of Plug-in VI to be changeable and configurable, you need a configuration VI. Enter the configuration VI you wish to load in the string indicator labeled Config VI Name. The label of the Config VI Name indicator must be "Config VI Name" so that BioBench can identify it correctly. The content of this string indicator must be the same as the name of the configuration VI.

    Input Array—Data to be processed and output from BioBench. Data type must be single precision (SGL).

    Plot No.—Plot number selected when you click on the Signal label button in BioBench. Data type must be long (I32).

    Sample Rate—Sample rate received from information on data file. Data type must be single precision (SGL).

    Init/cont—Controls the initialization of the internal states. To process a large data sequence which has been split into smaller blocks, set this control to FALSE for the first block, and set this control to TRUE for continuous processing of all remaining
    blocks.

    Output Array—Data processed by plug-in custom analysis, output into BioBench. Data type must be single precision (SGL).

    Error—Indicates whether there are errors in the course of data processing. Output into BioBench.
Note: Data type of all the controls and indicators must be consistent with what is specified. Otherwise, BioBench cannot recognize it and errors occur.


4. Enter "Multiply By Const (Configurable)" in the Display Name control, which represents the Plug-in Analysis name. Leave Config VI Name control blank, which means that configuring the parameters of the plug-in VI is not needed.


5. Right-click the Display Name control and select Data Operations»Make Current Value Default from the shortcut menu. Repeat this procedure with Config VI Name control.

Note: The name that you type in Display Name will be the one listed in the plug-in list. If you fail to enter a name or make the current value default, there will be a blank entry in the plug-in list.


B. Building the Block Diagram

The following example multiplies the input array by 2. However, you can process data with any method you wish.

1. Select Window»Show Diagram to view the block diagram. Build the block diagram according to the following illustration.




2. Save the VI again.

II. Creating a Configuration VI



Complete the following steps to transform your plug-in VI into a configuration VI.

Note: If your plug-in VI is not configurable, these steps are not necessary. Skip to the "Applying Plug-In Analysis" section.


A. Building the Front Panel

1. Create a new VI in LabVIEW. On the front panel, add a digital control called "Sample Rate" (SGL) and a digital control named "Plot No" (I32). The data types of the two controls are the same as those mentioned in the plug-in VI.

Note: These two controls are essential in the configuration VI.


2. Add a digital control and an OK button to the front panel. Label the digital control "Multiplier" (SGL), which is the parameter that should be configured in the configuration VI.


3. Your front panel should look similar to the following illustration.




4. Build the connector pane. Choose the pattern with two inputs and one output. Connect the controls as shown in the following illustration. The connection lines will not actually appear. This is only a representation.



5. To customize the window appearance, select File»VI Properties to display the VI Properties dialog box. Select Window Appearance from the Category pull-down menu. Click the Customize button to view the Customize Window Appearance dialog box. Place a check mark next to the options shown in the following illustration. Click the OK button to enable these customizations.

Note: You need to customize the window appearance in this manner for every configuration VI. These settings only apply for individual VIs, not LabVIEW as a whole.


[+] Enlarge Image



B. Building the Block Diagram

1. Select Window»Show Diagram to view the block diagram. Create a sequence structure. Build Frame 0 as shown in the following illustration.


[+] Enlarge Image



Get Plugin Parameters VI, available in Biobench\plugin\pluginutils.llb (Functions»Select a VI palette). This VI gets the previous value of parameters from plug-in information.glo to initialize the multiplier control. Do not save changes to Get Plugin Parameters VI.

Unflatten From String (Functions»Advanced»Data Manipulation palette). This function converts anything to a string of binary values.

To create the Multiplier local variable, right-click on the block diagram and select Functions»Structures»Local Variable. Place the local variable on the block diagram. Right-click the local variable and select Select Item»Multiplier.


2. Right-click on the sequence to Add Frame After. Build Frame 1 as shown in the following illustration.


[+] Enlarge Image


Set Plugin Parameters VI, available in BioBench\plugin\pluginutils.llb (Functions»Select a VI palette). This VI sets the value of the multiplier control into plug-in information.glo to configure plug-in parameters. Do not save changes to Set Plugin Parameters VI.

Flatten to String (Functions»Advanced»Data Manipulation palette). This function converts binary strings to any data type. It is the reverse operation of Unflatten from String.

Not Function (Functions»Boolean palette). This function inverts the value of the OK button.

Note: NI recommends that you load the Set Plugin Parameters VI to set parameters of plug-in VI and load the Get Plugin Parameters VI to get parameters of plug-in VI. The two VIs are placed in the BioBench\plugin\pluginutils.llb library. You should use this basic sequence set-up for all configuration VIs.


C. Completing the Configuration VI

1. Resize the front panel area to hide the Plot No. and Sample Rate controls and only display the Multiplier control and the OK button to simulate a dialog box.


2. Save the VI as "Constant configuration.vi" in the Biobench\plugin\Multiply by Const (Configurable).llb.

Note: You must save the configuration VI in the same VI library in which the plug-in VI is saved.


3. Open the plug-in VI you created earlier, Multiply by Const (Configurable).vi, in LabVIEW and modify the block diagram as shown in the following illustration.




4. On the front panel, type "Constant configuration.vi" in the Config VI Name control.

Note: The name of the Config VI Name indicator in the plug-in VI must be consistent with the name of the configuration VI.


5. Right-click the Config VI Name control and select Data Operation» Make Current Value Default from the shortcut menu. Your front panel should look similar to the following illustration.




6. Save the VI in BioBench\plugin\Multiply by Const.llb.

Note: You must save the configuration VI in the same VI library in which the plug-in VI is saved. The name of the configuration VI must be consistent with the name of the Config VI Name indicator in the plug-in VI.

III. Applying Plug-In Analysis



A. Procedure

1. Launch BioBench 1.2 and set the Analysis view to the current view.


2. Select File»Open and select BioBench.bb from the Open dialog box.


3. Click the ECG #1 (Up Ramp) signal label to open the Select Signal dialog box. Then click the Plug-in pull-down menu to see that the display name of the plug-in analysis Multiply by Const (Configurable) has been enumerated as shown in the following illustration.


[+] Enlarge Image

4. Select the Multiply by Const (Configurable) plug-in VI in the Select Signal dialog box. The Configure button appears.


5. Click the Configure button to load the configuration VI you built. Type "10.00" in the Multiplier control. Click the OK button to close the Configuration VI.


6. Click the OK button in the Select Signal dialog box to return to the Analysis view. The value of ECG has been multiplied by 10.00.

Note: In general, launch BioBench 1.2 and enter the Analysis view. Open a previously acquired .bb file. To choose a plug-in analysis method for a graph, click the corresponding signal label located in the upper left corner of each graph. Select the type of plug-in option you want to use from the Plug-in list. If the selected plug-in VI is configurable, a Configure button appears. Click the Configure button to launch a configuration VI to configure the parameters of the plug-in VI. If you cannot configure the plug-in VI, the Configure button does not appear. Click the OK button to return to the Analysis view. Your data for the selected graph will now be updated with the applied plug-in analysis.

IV. Troubleshooting Q&A



Q: Why is there a blank entry in the Plug-in list when I try to select my new plug-in?
A: There are two possible causes for a missing entry.
    1. There was nothing entered in the Display Name control.
    2. You didn't select the entered name as default. Refer to step 4 under Creating a Plug-In Custom Analysis.

Q: Why doesn't the Configure button appear for my configurable plug-in?
A: There are two possible causes for this error.
    1. There was nothing entered in the Config VI Name control.
    2. You didn't select the entered name as default. Refer to step 12 under Creating a Configuration VI.

Q: Why do I get error 1031 when I click on the Configure button in the Select Signal window?
A: There are two possible causes for this error.
    1. You didn't wire the connector pane. Refer to step 4 under Creating a Configuration VI.
    2. The representations chosen for Plot No. and Sample Rate in your configuration VI are incorrect. They should be I32 and SGL respectively. Refer to step 1 under Creating a Configuration VI.

Q: Why do I get error 7 when I click on the Configure button in the Select Signal window?
A: There are two possible reasons for this error.
    1. You typed the incorrect name of the configuration VI in the Config VI Name control. Check your spelling and spacing.
    2. The configuration VI that was entered into the Config VI Name control is not present in the same .llb as the plug-in VI. They need to be saved in the same library. Refer to step 9 under Creating a Configuration VI.
0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).