Example Code

Accessing WSN I/O Variables in LabVIEW 2014 without Direct NI-WSN Support

Code and Documents

Attachment

Description

Overview

NI-WSN 1.5, the most recent released version of the driver, provides support up through LabVIEW 2013. This example program provides a workaround for accessing WSN I/O variables in later versions of LabVIEW.

 

 

Description

NI-WSN 1.5 provides support from LabVIEW 2010 SP1 up through LabVIEW 2013. If you need to access WSN I/O variables in a more recent version of LabVIEW (e.g. LabVIEW 2014), you can deploy the I/O variables to a WSN Gateway, such as the 9792, in a version of LabVIEW with WSN driver support and then access those deployed variables through network-published shared variables in the 2014 environment. As network-published shared variable communication is non-deterministic, this approach will not provide real-time performance. This approach does however provide a workaround so that you can develop applications in LabVIEW 2014 that access WSN nodes.

 

 

 

Steps to Implement or Execute Code

 

1. Configure the WSN system (gateway and nodes) in LabVIEW version supported by NI-WSN (in this example, LAbVIEW 2012 SP1 and WSN-1.5 is used). Please see the included help document for a more complete outline of this process.

 

'Creating Targets (WSN)'

 

 

LabVIEW2012_project.PNGFigure 1. Example Project Explorer with WSN gateway and node

 

2. Run a VI that deploys I/O variables associated with the WSN node.

 

2012_mainVI.PNG

Figure 2. Example block diagram that accesses I/O variables

 

2012_mainVI_frontPanel.PNGFigure 3. Example front panel

 

3. Create a project in LabVIEW 2014. Create a variable library by right-clicking 'My Computer' and selecting 'New' >> 'Library'. Add a variable to that library by right-clicking the library and selecting 'New' >> 'Variable'.

 

LabVIEW2014_proj.PNG

Figure 4: LabVIEW 2014 project with two configured variables

 

To link this variable to the WSN I/O Variable deployed to the WSN gateway, you will need to right-click on the variable and select 'Properties' to open the 'Shared Variable Properties' window:

 

a. Check 'Enable Aliasing'

b. Choose 'PSP URL' in the 'Bind to' drop-down box.

c. Provide the path to the variabnle. The following help document provides a more complete outline of this process.

 

'Binding Shared Variables to an Existing Source'

 

d. Select the data type that matches the data type of the WSN I/O variable.

 

configureVariable.PNG

Figure 5. Configure shared variable properties

 

4. You can then drag-and-drop this variable (and others created in a similar manner) into a block diagram for variable access (both read and write).

 

lv_2014_bd.PNG

Figure 6. LabVIEW 2014 block diagram access of WSN I/O variables through shared variables

 

lv_2014_fp.PNG

Figure 7: LabVIEW 2014 front panel

 

 

Requirements

Software: LabVIEW 2012 SP1, LabVIEW 2014, WSN 1.5

 

Hardware: NI 9792, NI WSN-3212

 

* The above hardware and software were used in the example code and screen shots. The general approach can be used for any version of LabVIEW that has WSN support, any version of LabVIEW without WSN support, any gateway, and any node.

 

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.