Improving Efficiency of High Channel Count Applications in LabVIEW Datalogging and Supervisory Control Module

Updated Nov 28, 2023

Environment

Software

  • LabVIEW Datalogging and Supervisory Control Module
  • LabVIEW

This document explains how to use the LabVIEW Datalogging and Supervisory Control (DSC) Module to improve the performance of a high channel count application you created using DataSocket to share data.

DataSocket and High Channel Count Applications

NI DataSocket is an easy way to share live data with other VIs on the Web or on a local computer. However, when you increase the connection count in a DataSocket application above approximately 40, the performance and rate of data transfer can suffer. For example, DataSocket might transfer the data at a slower rate, especially for a VI that is trying to read data. A slower transfer rate can stall the execution of VIs waiting on the transmitted values.

DataSocket is an easy-to-use interface that helps you avoid the low-level programming details of data transfer; it is not a solution for you to publish data for high channel count applications. The DSC Module adds features to LabVIEW to make sharing data easy and efficient for high channel count applications.
 

A Solution for Sharing Data in High Channel Count Applications

The DSC Module manages applications with a high channel count while providing networking, security, alarming, data storage, and real-time and historical trending. All of these features allow you to share data, configure who can access an application and data, monitor data for specific conditions, save the data you are transmitting, and view live data and saved data.

The DSC Module includes networking so you do not have to create extra block diagram code to share data. In fact, the DSC Module includes wizards and utilities to help you create network I/O connections automatically from the wizard or the front panel without creating block diagram code. NI designed the DSC Module built-in networking protocol as a data transfer protocol and service. So, increasing the I/O count does not slow down an application. The DSC Module includes the Tag Engine to transfer data using the built-in networking protocol.

Using DataSocket, you create data items to transfer data, but in the DSC Module you create tags to transfer data instead. A tag is a placeholder for the value of either a real-world I/O point or a variable held in memory and carries information about the value it represents. Information about the tag value is called a tag attribute. Tag attributes allow you to specify what information you gather about the data that the Tag Engine is transmitting and what to do with the value. Use tag attributes to set up alarms for tags, log the value to a database, or set deadbands.

After you create tags and configure their attributes, you save that information in a tag configuration (.scf) file. Refer to the LabVIEW Datalogging and Supervisory Control Module Developer Manual for more information about .scf files.

The Tag Engine communicates with many data transfer protocols via servers, such as OPC, FieldPoint, Modbus, and more, and packages and unpacks data for you. When you read data from the Tag Engine, you can immediately display the data or pass it to a VI. Unlike the DataSocket Server, which can transfer all data types supported by LabVIEW, the DSC Module supports only bit array, discrete, numeric, and string data types.

The DSC Module launches the Tag Engine when you run a VI that writes or reads tag values. Refer to the LabVIEW Datalogging and Supervisory Control Module Developer Manual for more information about the Tag Engine.
 

DSC Module Easy-to-Use Utilities

There are several ways to create and configure tags. The DSC Module includes utilities and wizards that allow you to create, configure, and monitor tags.

You can create and configure tags in the Tag Configuration Editor. This utility helps you create tags, configure security for tags, configure historical and alarm logging, browse servers, and more. The Tag Configuration Wizard allows you to create and configure tags by browsing to and selecting data items to import into tags. You also can use the HMI Wizard to create tags to connect to front panel controls and indicators. Refer to the Using the Tag Configuration Wizard to Automatically Create Tags and Enhancing a DSC Module Application sections for more information about using these wizards.

Monitor the value, timestamp, alarm state, and quality for selected tags in an application with the Tag Monitor. Refer to the LabVIEW Datalogging and Supervisory Control Module Developer Manual for more information about using the Tag Monitor.
 

Migrating DataSocket Applications to the DSC Module

To migrate an application using DataSocket transfer protocol to the DSC Module, you must make some changes to the application. Complete the following basic steps to migrate a DataSocket application to a DSC Module application:

  1. In the writer VI, replace the DataSocket Open and DataSocket Write functions with the Write Tag VI. Refer to the Writing and Reading Tag Data section for more information about using the Write Tag VI.

  2. In the reader VI, replace the DataSocket Open, DataSocket Read, and DataSocket Close functions with the Read Multiple Tags VI. Refer to the Writing and Reading Tag Data section for more information about using the Read Multiple Tags VI.

  3. Create tags for the existing DataSocket data items. Refer to the Creating Tags section for information about creating tags in the DSC Module.

  4. Use a tag control to wire the tag values to the Write Tag VI and Read Multiple Tags VI.
     

Writing and Reading Tag Data

To connect the tag to write data, place a tag control on the front panel or a tag constant on the block diagram and select the tag to write. On the block diagram, wire the tag control or constant to the tag name input of the Write Tag VI. You do not have to open a reference to the Tag Engine before you write tag data. The VIs included with the DSC Module communicate with the Tag Engine for you.

To read tag values, place a tag constant on the block diagram and select the tag to read. Wire the tag constant to the tag name input of the Read Multiple Tags VI.

The following figures show the changes you make to existing DataSocket writer and reader VIs to improve the rate of data transfer with DSC Module VIs. To use DataSocket to write data, you use two DataSocket functions to open a reference to the DataSocket Server and to write the data, as shown in Figure 1.

Figure 1. Using DataSocket functions to write data


To write data in the DSC Module, you need only the Write Tag VI, as shown in Figure 2.

Figure 2. Using a DSC Module VI to write data


To read data published by DataSocket, you use three functions to open a connection to the DataSocket Server, read the data, and then close the connection to the DataSocket Server. You also must configure two DataSocket property nodes with the BufferMaxBytes, BufferMaxPackets, BufferUtil(Bytes), and BufferUtil(Packets) properties to buffer and monitor the buffering of the data.

Figure 3. Using DataSocket to read data


To read published data in the DSC Module, use the Read Multiple Tags VI, as shown in Figure 4. The DSC Module networking protocol handles communication of a high number of I/O connections so efficiently that you do not have to implement buffering.

Figure 4. Using the DSC Module to read data

 

Creating Tags

Use the Tag Configuration Editor to create the tags that connect to the existing DataSocket data items. You have options to create tags in the DSC Module, and the method you choose depends on the source of the data you are transmitting and how many changes you are willing to make to an application.

Tag Configuration Editor with a Spreadsheet Editor--Use the Tag Configuration Editor and a spreadsheet editor to create and copy memory tags. Chose this option if you want to make the least amount of changes to existing DataSocket writer and reader VIs and maximize the performance of an application. Memory tags are not connected to a real-world I/O point. Their values are held in DSC Module memory as long as the Tag Engine is running. Use this method if the source of the data you are sharing is a VI or if you have over 100 I/O connections in your application.

Tag Configuration Wizard with a Server--If the source of the data you are sharing is a server and you have less than 100 connections in your application, use the Tag Configuration Wizard to generate tags from data items on a server. The Tag Engine communicates with many data transfer protocols and the Tag Configuration Wizard makes it easy to create tags from different types of servers, such as OPC servers, FieldPoint servers, DDE servers, VI-based servers, and more.

You can also use the Tag Configuration Wizard to generate tags from a DataSocket Server if the source of the data you want to share is the DataSocket Server. You might want to do this to avoid making changes to an existing DataSocket writer VI; however, to reap the performance improvement that the DSC Module provides, use the Tag Configuration Editor to create memory tags and make the necessary changes the DataSocket writer VI. Refer to the Using the Tag Configuration Editor with a Spreadsheet Editor to Create Tags section for information about how to create a large number of tags for a high channel count application.
 

Using the Tag Configuration Editor with a Spreadsheet Editor to Create Tags

Creating tags one-by-one for a VI with a large channel count can be tedious. This method allows you to create many tags at one time. Create memory tags for data items to minimize the changes to an existing application that uses DataSocket to share data. Then export the memory tags to a text (.txt) file so you can open the file in a spreadsheet editor and copy the exported tags. When you import the modified .txt file back into the Tag Configuration Editor, the DSC Module creates the new tags that you copied and pasted in the spreadsheet editor.

Complete the following steps to use the Tag Configuration Editor export and import commands and a spreadsheet editor to quickly create many tags.

  1. Select Tools»DSC Module»Configure Tags to launch the Tag Configuration Editor.

  2. Select File»New to create a new, blank .scf file.

  3. Click the OK button in the File Information dialog box.

  4. Create a five tags to export and copy.

    1. Select Edit»Create and any type of tag. In step 4-b, you will select the tag type that reads and writes DataSocket data.

    2. Click the Connection tab and select Memory from the Tag Access ring control.

    3. Click the Create Next Tag button four times to create a total of five tags.

    4. Click the OK button.

  5. Export the tags you created to a spreadsheet.

    1. Select File»Export to open the Select Tag Fields for Export dialog box.

    2. Enter a path and filename with a .txt extension in the Spreadsheet File (.txt) path control.

    3. Click the OK button to export the tags to a tab-delimited text file.

  6. Open the spreadsheet and copy the tags.

    1. Open the text file in a spreadsheet editor.

    2. Copy the rows of tags as many times as necessary to match the number of data items in the existing DataSocket application.

    3. Create a unique name for each tag in the Tag Name column of the spreadsheet to avoid duplicating tags.

    4. Save the spreadsheet and exit the spreadsheet editor.

  7. Import the tags from the spreadsheet into the Tag Configuration Editor.

    1. In the Tag Configuration Editor, select File»New to create a new, blank .scf file. Do not save changes to the <Untitled> .scf file.

    2. Click the OK button in the File Information dialog box.

    3. Select File»Import and browse to the saved text file.

    4. Click the OK button to import the tags into the Tag Configuration Editor tag list.

  8. Select File»Save As and enter a name for the .scf file that the VI will use to track tags and their values.

The DSC Module loads this .scf file when you run a VI that reads or writes values for the tags you created and saved to the .scf file. To load a .scf file manually, select Tools»DSC Module»Configure Tags to launch the Tag Configuration Editor, then select File»Open to browse to and open the .scf file. Then select File»Save As in the Tag Configuration Editor to make the opened .scf file the active .scf file in the VI.
 

Using the Tag Configuration Wizard to Automatically Create Tags

The Tag Configuration Wizard allows you to create tags one at a time, which can be tedious for high channel count applications. Refer to the Using the Tag Configuration Editor with a Spreadsheet Editor to Create Tags section for more information about creating many tags at one time.

Complete the following steps to use the Tag Configuration Wizard to create tags from data items on a server.

  1. In the Tag Configuration Editor, select Edit»Configuration Wizard to launch the Select Items for Automatic Tag Generation dialog box.

  2. Expand a server branch in the Servers tree to display the devices and items for the server.

  3. Select the items for which you want to create tags. Select a server in the Servers tree to generate tags for all the items in that server. Select a branch of a server to generate tags for all items under that server branch.

  4. Click the Add Item(s) button. The Tag Configuration Wizard moves the selected items to the Selected Items listbox.

  5. (Optional) You also can use the Tag Configuration Wizard to create a tag for a DataSocket data item. To maximize the performance and data transfer rate of a VI, use the Tag Configuration Editor to create memory tags to write data, then copy the tags using a spreadsheet editor. Refer to the Using the Tag Configuration Editor with a Spreadsheet Editor to Create Tags section for more information about creating a large number of tags for a high channel count application.

    1. Click the DataSocket button.

    2. Double-click DataSocket Server to see the data items on the local computer, or browse to a network computer under My Network Places and view its DataSocket items. To browse the DataSocket Server, it must be running on the computer or the network computer if you are creating tags from DataSocket data items on a network computer.

    3. Select the item for which you want to create a tag. You can create only one tag at a time. The tag created from this item uses the entire URL as its tag name (the "/" is replaced with "_"), with the data type and access rights shown.

    4. Click the OK button. Repeat steps a through d for each DataSocket Server data item for which you want to create a tag.

  6. To remove individual items from the Selected Items listbox, select the items in the Selected Items listbox and click the Remove Item(s) button. To remove all items, click the Remove All button.

  7. Click the OK button. The Tag Configuration Editor creates a tag for each item and appends the tag to the current .scf file.

  8. Select File»Save As and enter a name for the .scf file the VI will use to track tags and their values.

  9. Click the OK button in the SCF Summary dialog box.
     

Enhancing a DSC Module Application

After you have configured the I/O, you can take advantage of other DSC Module features to add to the capabilities of an application. Configure the way the DSC Module returns tag data by editing the tag attributes. Tag Attributes are the parameters pertaining to a tag, like its alarm, limits, or engineering units. You can edit the tag attributes either in the Tag Configuration Editor or change them dynamically on the block diagram using the Tag Attributes VIs and the Tag Attribute Ring function.

When you read data from many I/O connections, create tag groups to organize and simplify an application. A tag group is a set of tags primarily used for reporting and acknowledging alarms, but you also can use them to group tags to organize the data in an application. Define tag groups in the Tag Configuration Editor or use the Tag Configuration Editor with a spreadsheet editor similarly to how you created tags in the Using the Tag Configuration Editor with a Spreadsheet Editor to Create Tags section. Refer to the LabVIEW Datalogging and Supervisory Control Module Developer Manual for more information about using tag groups.

Use the Tag Configuration Editor or the Alarms & Events VIs to configure an application to configure, log, and print alarms and events. When you set alarms and events, the DSC Module alerts you to specific changes and conditions in tag values.

A simple way to both connect and display tag data is to use the HMI Wizard. Connect front panel controls and indicators to tags by right-clicking a front panel object and selecting HMI Wizard from the shortcut menu. However, for high channel count applications, using the HMI Wizard to create and connect tags one-by-one can be tedious. Use the HMI Wizard to connect and display a small number of tags.

Configure security for an application with the Security VIs, Tag Configuration Editor, or by right-clicking front panel objects and selecting Security from the shortcut menu. The DSC Module allows you to configure security for individual tags, .scf files, utilities, and front panel controls and indicators.

Use the Tag Configuration Editor and the Historical Logging VIs to retrieve and manage logged data. You can view historical data as well as manage logged data with the Historical Data Viewer in Measurement & Automation Explorer (MAX).

Refer to Getting Started with the LabVIEW Datalogging and Supervisory Control Module and the LabVIEW Datalogging and Supervisory Control Module Developer Manual for more information about the features the DSC Module adds to LabVIEW.