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 Generate and Deploy a Library of Shared Variables Using the DSC Module

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview

The example demonstrates how to generate shared variables programmatically and store them in a library file.

 

Description

The example will programmatically generate and deploy a library with the NI Shared Variable Engine. It will create multiple variables with different data types (String, Double, Boolean, Integer). After the creation of the library can also be deployed as a process right away.

Since a process in the Shared Variable Engine stays deployed until the process is deleted the example checks at the beginning if a process with the same name already exists and deletes the existing process so the new process can be deployed afterwards.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • LabVIEW 2012 Datalogging and Supervisory Control (DSC) Module (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Open the attached file
  2. Select a path to store the library file to be created
  3. Select if the library should be deployed after the creation
  4. Run the VI
  5. (Optional) Use the Distributed System Manager (DSM) to check if the library has been deployed

 

Additional Information or References

Programmatically create Shared Variables - Front Panel.png

 

Programmatically create Shared Variables - Block Diagram.png

 

Using the LabVIEW Shared Variable

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

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.