From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Programmatically Enumerate and Sort Shared Variables From a Library Using the DSC Module

Code and Documents

Attachment

Introduction

This program adapts and uses two previous examples.

http://decibel.ni.com/content/docs/DOC-15518

http://decibel.ni.com/content/docs/DOC-12375

Using these examples, it generates and deploys a library of shared variables, then enumerates that library and sorts the variables into separate arrays by data type.

The purpose of the example is to demonstrate the ease of programmatic Shared Variable Engine control and interaction using the LabVIEW Datalogging and Supervisory control module. These tasks would be much more complex and time consuming (or even impossible) without the DSC functionality. Additionally, this method provides for greater application scalability, as it greatly reduces the difficulty in working with large quantities of variables.

Get SV from process BD.png

Get SV from process FP.png

Instructions
  1. Enter the desired name of the process/library to be generated.
  2. Run the VI.

Additional Notes

This VI does not provide sorting for every datatype, but the framework is in place to allow scalability and handling more datatypes. See block diagram comments for further details.

Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support

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

Contributors