What Is the DSC Module?

Getting Started with the
LabVIEW Datalogging and
Supervisory Control Module
™
This document provides an introduction to the LabVIEW Datalogging and
Supervisory Control (DSC) Module and contains exercises to help you
understand the functionality that the DSC Module provides. To use this
document effectively, you should be familiar with LabVIEW and the
shared variable and with building an application in LabVIEW.
The following resources contain information you might find useful:
•
The Getting Started with LabVIEW manual, available in the
LabVIEW 8.0\manuals directory, contains introductory information
about LabVIEW.
•
The LabVIEW Help, available by selecting Help»Search the
LabVIEW Help, contains extensive information about LabVIEW.
•
The Sharing Live Data Using Shared Variables topic in the LabVIEW
Help contains information about the shared variable in LabVIEW.
•
The NI Example Finder, available by selecting Help»Find Examples,
contains example VIs and LabVIEW projects.
Contents
What Is the DSC Module? ...................................................................... 2
Building a DSC Module Application...................................................... 3
Opening and Running an Example .................................................. 3
Creating a New Project Library ....................................................... 4
Creating a Periodic I/O Server......................................................... 4
Deploying the Periodic I/O Server................................................... 6
Creating Shared Variables ............................................................... 7
Adding the Project Library to the Project................................. 9
Creating the VI................................................................................. 11
Additional Exercises ............................................................................... 13
Configuring Front Panel Security .................................................... 13
Creating a New Security Domain ............................................. 13
Adding a New User ...................................................................14
Adding Security to a Control ....................................................14
Viewing Real-Time Data..................................................................15
Viewing Alarms Using the Published Variable Monitor .................16
Where to Go from Here ...........................................................................16
What Is the DSC Module?
The DSC Module extends the LabVIEW graphical development
environment with additional functionality for the rapid development of
distributed measurement, control, and high-channel-count monitoring
applications.
The DSC Module also enhances the LabVIEW shared variable. Use the
shared variable to access and pass data among several VIs in a LabVIEW
project or across a network. A shared variable can represent a value or an
I/O point. With the DSC Module, you can log data automatically; add
alarming, scaling, and security to the shared variable; and configure the
shared variable programmatically.
The DSC Module includes the following components:
•
Functions and VIs Palettes—The DSC Module installs the following
palettes: Alarms & Events, Database Management, Database
Writing, DataSets, Engine Control, Event Structure Support,
Historical, IO Primitives, and Security. The DSC Module also
includes the Historical Trend Express VI and the Real-Time Trend
Express VI.
•
DSC Module Controls Palettes—The DSC Module installs the
following controls palettes to help you build user interfaces that
resemble a plant or system and to view real-time data from the plant
or system: 2D Pipes, 2D Valves, 2D Pumps, 3D Pipes, 3D Valves,
3D Pumps, Vessels, and Alarms Controls. The DSC Module also
includes the Historical Trend control and the Real-Time Trend control.
•
Citadel Database—The DSC Module logs shared variable data to the
Citadel database. The Citadel database stores historical data, alarms,
and events. You can access and view Citadel data using the Historical
Data Viewer and using the Historical VIs.
•
Historical Data Viewer—Use the Historical Data Viewer to view
data stored in the Citadel database. Select Tools»DSC Module»
View Historical Data to launch the Measurement & Automation
Explorer (MAX). Expand the Historical Data category to select a
database that appears under Citadel 5 Universe. You also can use the
Call HDV VI to launch the Historical Data Viewer programmatically.
Getting Started with the LabVIEW DSC Module
2
ni.com
•
Published Variable Monitor—Use the Published Variable Monitor
to view the current value of a shared variable and its status and alarm
state. Select Tools»DSC Module»Monitor Variables to launch the
Published Variable Monitor.
The DSC Module also provides tools for graphing historical or real-time
trends, enhancing the security of front panels, and writing custom
I/O servers. You can read or write to OLE for Process Control (OPC)
connections, programmable logic controllers (PLC), or custom I/O servers
that you write. The DSC Module provides solutions for supervisory control
of a wide variety of distributed systems using graphical LabVIEW
programming.
Building a DSC Module Application
In the following exercises, you will build a VI with DSC Module
functionality.
Opening and Running an Example
The DSC Module includes several examples you can use to learn about
DSC Module features and applications. In this exercise you will look at an
example you will use later to create a custom I/O server.
Complete the following steps to run the DSC Tank Simulator example.
1.
Select Help»Find Examples to display the NI Example Finder.
2.
Select Directory Structure in the Browse according to section.
Browse to the lvdsc\Getting Started\Tank Simulator folder
and open the DSC Tank Simulator VI. This VI simulates a tank filling
with water.
3.
Run the VI.
4.
Move the sliders to increase or decrease the rate at which the water fills
the tank. As you move the sliders, notice that you control how fast the
water flows into the tank.
5.
Stop and close the VI.
This VI does not use any DSC Module features. In the exercises that follow,
you will create a DSC Module application based on this VI.
© National Instruments Corporation
3
Getting Started with the LabVIEW DSC Module
Creating a New Project Library
In this exercise you will learn how to create a new LabVIEW project and a
project library. The project allows you to manage shared variables, project
libraries, and VIs in one window. LabVIEW project libraries are
collections of VIs, type definitions, shared variables, palette menu files,
and other files, including other project libraries.
Complete the following steps to create a LabVIEW project library.
1.
Click the Empty Project link in the Getting Started window. The
Project Explorer window appears.
2.
Right-click My Computer in the Project Explorer window and select
New»Library from the shortcut menu.
3.
Select File»Save All. The Name the Project dialog box appears.
4.
Enter Tank System in the File name text box.
5.
Click the OK button. The Name the Library dialog box appears.
6.
Enter Tank System IO Server in the File name text box.
7.
Click the OK button.
You now have a project containing a project library. In the following
exercise you will use the project library in the project to create a periodic
I/O server.
Creating a Periodic I/O Server
A server is an application that communicates with and manages
input/output devices such as PLCs, remote input/output devices, remote
Shared Variable Engines, and data acquisition (DAQ) plug-in devices.
These servers read selected input items and write to them on demand. The
DSC Module can connect to any OPC-compliant server and to many
third-party device servers. You also can create custom I/O servers. You
will build a periodic I/O server in the following exercise. The periodic I/O
server will run as a service and publish NI Publish-Subscribe Protocol
(NI-PSP) data items to the network.
Complete the following steps to add the periodic I/O server to the project.
1.
Right-click the Tank System IO Server.lvlib project library in the
Project Explorer window and select New»I/O Server from the
shortcut menu. The Create New I/O Server dialog box appears.
2.
Select Custom VI – Periodic from the I/O Server Type list and click
the Continue button. The Custom VI – Periodic I/O Server
Configuration dialog box appears.
3.
Click the New button to display the Select VI step of the Custom
VI - Based Server – Periodic Assistant.
Getting Started with the LabVIEW DSC Module
4
ni.com
4.
5.
6.
Complete the following steps to select the VI from the Opening and
Running an Example exercise to convert into a periodic I/O server on
the Select VI page.
a.
Click the button with the file folder icon. The Open dialog box
appears.
b.
Navigate to the LabVIEW 8.0\examples\lvdsc\Getting
Started\Tank Simulator folder in the Open dialog box.
c.
Select the DSC Tank Simulator VI and click the OK button.
d.
Click the Next button in the Custom VI - Based Server – Periodic
Assistant to advance to the Select Controls and Indicators To
Publish step.
Complete the following steps on the Select Controls and Indicators
To Publish page to select the front panel objects you want to publish
as shared variables.
a.
Remove the checkmark from the stop checkbox in the Controls
list. You will publish the remaining controls and indicators.
b.
Click the Next button to advance to the Select Method To Stop
The Server page.
Complete the following steps on the Select Method To Stop The
Server page to select the mechanism you want to use to stop the VI.
a.
Select Stop the following While Loops.
b.
Place a checkmark in the While Loop checkbox.
Click the View on block diagram button to highlight the While Loop you select on
the block diagram. Use this option if you have multiple While Loops on the block diagram
to make sure you select the correct While Loop.
Tip
c.
Click the Next button to advance to the Configure Server
Distribution Component step.
7.
You can select what you want the assistant to build on the Configure
Server Distribution Component page. For this exercise, leave the
default options and click the Next button to advance to the Server
Distribution Component page.
8.
The DSC Module displays a summary of the files that the Custom
VI - Based Server – Periodic Assistant will create from the Server
Distribution Component page. Click the Build button. The assistant
displays the Build Status dialog box as it creates a VI template file,
a registration VI, and a support DLL and VIs.
9.
After the assistant creates the periodic I/O server, the Custom
VI – Periodic I/O Server Configuration dialog box appears with the
name of the periodic I/O server and the data items it contains. Click the
© National Instruments Corporation
5
Getting Started with the LabVIEW DSC Module
OK button. LabVIEW adds the periodic I/O server to the Tank System
IO Server project library.
10. Right-click the Custom VI – Periodic1 item in the Project Explorer
window and select Rename from the shortcut menu. Rename the
periodic I/O server Tank1. The Project Explorer window appears as
shown in Figure 1.
Figure 1. Tank System Project
11. Select File»Save All in the Project Explorer window to save the
project, project library, and periodic I/O server.
Deploying the Periodic I/O Server
Now you must deploy the periodic I/O server so that the data items in the
I/O server are available for use in other VIs and across the network. In this
exercise you will deploy the periodic I/O server and view the I/O server
data in the Published Variable Monitor.
Note The periodic I/O server runs continuously in the background until you undeploy the
library in the Project Explorer window that contains the I/O server.
Complete the following steps to deploy the Tank1 periodic I/O server and
view the data.
1.
Right-click the Tank System IO Server.lvlib project library under the
My Computer item and select Deploy All from the shortcut menu to
deploy the project library.
2.
Select Tools»DSC Module»Monitor Variables. The National
Instruments Published Variable Monitor window appears. Notice
that the Tank System IO Server appears in the left pane of the window.
Getting Started with the LabVIEW DSC Module
6
ni.com
3.
Expand Tank System IO Server»Tank1 in the left pane. Notice that
the controls and indicators of the I/O server appear under Tank1.
Because you deployed the project library in step 1, the I/O server is
running and each control and indicator is an I/O data item.
4.
Click each data item and drag it into the upper right pane. The data
items appear in the table.
5.
Double-click the Tank1.Input Flow Rate [GPM] control in the upper
right pane. The Write Network Item tab appears.
6.
Enter a value of 10 and click the OK button. Notice that the values of
Tank1.Tank Level [Gallons] and Tank1.Tank Output Flowrate
[GPM] begin increasing.
7.
Close the Published Variable Monitor. The periodic I/O server
continues to run.
Creating Shared Variables
In this exercise you will add the network-published shared variables that
represent the data items in the periodic I/O server to the Tank System
Shared Variables project library.
Complete the following steps to add the Tank System Shared Variables
project library to the Tank System project.
1.
Select Tools»DSC Module»Multiple Variable Editor. The Multiple
Variable Editor window appears.
2.
Select Edit»Create Bindings in the Multiple Variable Editor
window. The Create Bound Variables dialog box appears.
3.
Expand localhost»Tank System IO Server»Tank1 on the Network
tab. The shared variables appear under Tank1.
4.
Select each shared variable with the data type DBL and click the Add
button to add each variable to the Added Variables list.
5.
Click the OK button. The Create Bound Variables dialog box closes
and the variables appear in the spreadsheet area at the top of the
Multiple Variable Editor window.
6.
Select File»Save As. The Save Library dialog box appears.
7.
Enter Tank System Shared Variables in the File name text box.
8.
Click the Save button. LabVIEW binds the shared variables in the
Tank System Shared Variables project library to the corresponding
items on the network.
© National Instruments Corporation
7
Getting Started with the LabVIEW DSC Module
Configuring Data Logging
When you add logging to a shared variable, the DSC Module logs shared
variable data, including the shared variable value, timestamp, whether the
value is in an alarm state, and the quality of the value. The DSC Module
logs all data to the Citadel database. Complete the following steps to add
logging for the Tank Level [Gallons] shared variable.
1.
Select the Tank Level [Gallons] shared variable in the spreadsheet
area of the Multiple Variable Editor window.
2.
Select Logging from the Category list.
3.
Place a checkmark in the Enable Logging checkbox. LabVIEW
enables the Log Events checkbox and the Log Data checkbox
automatically. The Log Data option enables historical datalogging for
the shared variable.
4.
Enter 0.1 in the Value Resolution text box. This value compresses the
value to one decimal point when the DSC Module logs the values of
this shared variable to the Citadel database.
5.
Leave the Value Deadband text box with the default value. This value
specifies that the DSC Module log the shared variable value only when
the shared variable value differs from the previous shared variable
value by 1% of the shared variable engineering scale range, which is
0–100 by default.
6.
Click the Apply button to apply the changes to the shared variable.
Configuring Alarming
An alarm is an abnormal condition on a shared variable or a user-defined
condition. An alarm occurs if a shared variable value goes out of its defined
alarm limits or if a shared variable has bad status. In this exercise you will
add an alarm for the Tank Level [Gallons] shared variable.
Complete the following steps to add alarming.
1.
Select Alarming from the Category list in the Multiple Variable
Editor window.
2.
Place a checkmark in the Enable Alarming checkbox.
3.
Click the Configure button to display the Configure Double Alarms
dialog box.
4.
Place a checkmark in the HI checkbox to enable a HI alarm. Notice
that the default value of the HI alarm is 75.
5.
Click the OK button. The Configure Double Alarms dialog box
closes and the alarm appears in the Alarms table of the Multiple
Variable Editor window.
Getting Started with the LabVIEW DSC Module
8
ni.com
6.
Click the Apply button to apply the changes.
7.
Select File»Save.
8.
Select File»Close to close the Multiple Variable Editor window.
Adding the Project Library to the Project
In the following exercise you will add the project library of shared variables
you created in the previous exercises to the Tank System project. You also
will enable data logging and alarm and event logging for the project library.
Complete the following steps to create a project library of shared variables
and to enable data logging and alarm and event logging for the project
library.
1.
Right-click My Computer in the Project Explorer window and select
Add File from the shortcut menu. The Select a File to Insert dialog
box appears.
2.
Navigate to the Tank System Shared Variables project library and click
the Add File button. The Tank System Shared Variables project library
appears in the Project Explorer window.
3.
Right-click the Tank System Shared Variables.lvlib project library
in the Project Explorer window and select Properties from the
shortcut menu. The Project Library Properties dialog box appears.
4.
Select DSC Settings: Database from the Category list.
5.
Verify that the options in the DSC Settings: Database page appear as
shown in Figure 2.
© National Instruments Corporation
9
Getting Started with the LabVIEW DSC Module
Figure 2. DSC Settings: Database Page of the Project Library Properties Dialog Box
The Enable Data Logging option turns on data logging for the project
library. localhost specifies the local computer. Use localhost instead
of the name of the computer to reduce the changes you must make if
you move this project to another computer. The Enable Alarms and
Events Logging option turns on event logging for the project library.
The Use the same database for alarms and events option ensures
that the DSC Module logs alarms and events for this project library to
the same database that it logs data.
You can change the Database name that appears in the Project Library Properties
dialog box to a more useful or descriptive name.
Tip
6.
Click the OK button to close the Project Library Properties dialog
box.
7.
Right-click the Tank System Shared Variables.lvlib project library
in the Project Explorer window and select Deploy All from the
shortcut menu to deploy the shared variables.
8.
Select File»Save All in the Project Explorer window to save the
project, project library, and periodic I/O server.
Getting Started with the LabVIEW DSC Module
10
ni.com
Creating the VI
In this exercise you will create a VI to display data on a front panel. You
do not need to add any code to the block diagram.
Complete the following steps to create a front panel to display the data
items in the periodic I/O server.
1.
Right-click My Computer in the Project Explorer window and select
New»VI from the shortcut menu. A new VI front panel and block
diagram appear.
2.
Select the Tank Level [Gallons] shared variable from the Tank
System Shared Variables.lvlib project library in the Project
Explorer window and drag the shared variable onto the front panel.
The shared variable appears as a numeric control. Notice the triangle
that appears next to the control. The triangle indicates that this control
has been configured for data binding.
3.
Right-click the Tank Level [Gallons] control and select Change to
Indicator from the shortcut menu.
4.
Right-click the Tank Level [Gallons] indicator and select Replace»
DSC Module»Vessels»Open Tank from the shortcut menu.
5.
Use the Positioning tool to resize the Tank Level [Gallons] tank.
6.
Right-click the Tank Level [Gallons] indicator and select Properties
from the shortcut menu. The Properties dialog box appears.
7.
Select the Data Binding tab in the Properties dialog box.
If the Data Binding tab is not visible, scroll through the tabs until you reach the Data
Binding tab.
Tip
8.
Place a checkmark in the Blink while Alarm On checkbox to
configure the control to blink when the water level reaches 75,
the default alarm you set in the Configuring Alarming section of this
document.
9.
Click the OK button.
10. Select the Input Flowrate [GPM] shared variable from the Tank
System Shared Variables.lvlib project library in the Project
Explorer window and drag the shared variable onto the front panel.
11. Right-click the Input Flowrate [GPM] control and select Replace»
Num Ctrls»Pointer Slide.
12. Select the Tank Valve [%] shared variable from the Tank System
Shared Variables.lvlib project library in the Project Explorer
window and drag the shared variable onto the front panel.
© National Instruments Corporation
11
Getting Started with the LabVIEW DSC Module
13. Right-click the Tank Valve [%] control and select Replace»
Num Ctrls»Pointer Slide.
14. Select File»Save As. The Name the VI dialog box appears.
15. Enter Tank System HMI in the File name text box.
16. Click the OK button.
17. Click the Run Continuously button to run the VI. The VI should
function in the same way as the example you ran in the Opening and
Running an Example exercise. Figure 3 illustrates the front panel of the
Tank System VI.
Figure 3. Tank System VI Front Panel
18. Click the Abort button to stop the VI.
Getting Started with the LabVIEW DSC Module
12
ni.com
Additional Exercises
The following exercises introduce some of the additional functionality
available with the DSC Module.
Configuring Front Panel Security
Use the DSC Module to add security to front panel controls. The DSC
Module provides the Front Panel Security dialog box, which you can use
to configure security for more than one control at the same time. You also
can configure security settings for individual controls. Before you can
configure security settings, you must create users and groups. Refer to the
LabVIEW Help for more information about creating users and groups in the
Domain Manager.
In the following exercises, you will add security to controls on an individual
basis.
Creating a New Security Domain
Complete the following steps to create a new domain on the local
computer.
1.
Select Tools»Security»Domain Account Manager. The Domain
Manager window appears.
2.
Select File»New»Local Domain. The Domain Properties dialog box
appears.
3.
Enter MyDomain in the Domain text box on the General tab.
4.
Click the Access Control tab.
5.
Click the Add button in the Grant List section.
6.
Enter localhost in the list.
7.
Click the OK button. The Change Password dialog box appears.
8.
Enter a secure password of six or more characters in the New
password text box.
9.
Enter the same secure password of six or more characters in the
Re-type new password text box.
10. Click the OK button to create the new local domain. MyDomain
appears in the Domain Manager window under My Computer.
© National Instruments Corporation
13
Getting Started with the LabVIEW DSC Module
Adding a New User
Complete the following steps to add a user to MyDomain.
1.
Select MyDomain in the Domain Manager window.
2.
Select File»New»User. The User Properties dialog box appears.
3.
Enter User1 in the User name text box on the General tab.
4.
Click the Change Password button. The Change Password dialog
box appears.
5.
Enter a secure password of six or more characters in the New
password text box.
6.
Enter the same secure password of six or more characters in the
Re-type new password text box.
7.
Click the OK button to close the Change Password dialog box.
8.
Click the OK button in the User Properties dialog box to add User1
to MyDomain. User1 appears in the Domain Manager window.
Adding Security to a Control
Complete the following steps to add security to the Input Flowrate [GPM]
control.
1.
Open the Tank System VI front panel.
2.
Right-click the Input Flowrate [GPM] control and select Properties
from the shortcut menu.
3.
Click the Security tab in the Slide Properties dialog box.
Tip If the Security tab is not visible, scroll through the tabs until you reach the
Security tab.
4.
Click the Add button to add access to a user you created in the Domain
Manager. The Add New Host/User dialog box appears.
5.
Select User 1 from the Users and Groups list and click the OK
button.
6.
Select Full Access from the Access drop-down list for User1.
7.
Click the Add button.
8.
Select Guest from the Users and Groups list and click the OK button.
9.
Select Disabled & Grayed Out from the Access drop-down list for
Guest.
10. Click the OK button. The Add New Host/User dialog box closes and
adds security information to the Input Flowrate [GPM] control.
Getting Started with the LabVIEW DSC Module
14
ni.com
11. Run the VI continuously and select Tools»Security»Login to log in as
User 1. The Input Flowrate [GPM] control should be enabled and
you should be able to move the slider.
12. Log in as Guest. The Input Flowrate [GPM] control should be
disabled and grayed out.
13. Stop the VI.
You can add security to multiple controls at one time in the Front Panel Security
dialog box, available by selecting Tools»Security»Front Panel Security.
Tip
Viewing Real-Time Data
You can use the DSC Module to view live data. The Real-Time Trend
Express VI displays live data from a shared variable on an XY graph. In the
following exercise you will add the ability to view live data to the Tank
System VI.
Complete the following steps to add a Real-Time Trend Express VI to a
block diagram and view live data.
1.
Place the Real-Time Trend Express VI, available on the DSC Module
palette, on the Tank System VI block diagram. The Configure
Real-Time Trend dialog box appears.
2.
Click the down arrow next to the Shared Variable list and select
Browse. The Browse Shared Variables dialog box appears.
3.
Click the button with the folder icon. The Open dialog box appears.
4.
Navigate to the Tank System Shared Variables project library and
click the OK button.
5.
Select Tank Volume [Gallons] in the Library list.
6.
Click the OK button to close the Browse Shared Variables dialog
box.
7.
Click the Add button in the Configure Real-Time Trend dialog box.
8.
Click the OK button to close the Configure Real-Time Trend dialog
box.
9.
Place a waveform chart on the front panel.
10. Wire the trend data output of the Real-Time Trend Express VI to the
waveform chart on the block diagram.
11. Place a While Loop around the waveform chart and Express Real-Time
Trend control.
12. Run the VI. The waveform chart shows the water level. Notice that the
waveform chart displays the changes when you adjust the Input
Flowrate [GPM] control.
© National Instruments Corporation
15
Getting Started with the LabVIEW DSC Module
Viewing Alarms Using the Published Variable Monitor
Complete the following steps to view alarms in the Published Variable
Monitor.
1.
Select Tools»DSC Module»Monitor Variables to display the
Published Variable Monitor.
2.
Expand the Tank System Shared Variables project library in the left
pane to display the shared variables.
3.
Double-click each shared variable to view shared variable information
in the right pane. Notice that the alarm for the Tank Volume [Gallons]
shared variable that you created in the Creating Shared Variables
section of this document appears in the lower right pane.
Where to Go from Here
Refer to the following documentation for more information about
LabVIEW or the DSC Module:
•
LabVIEW Datalogging and Supervisory Control Module Release and
Upgrade Notes
•
LabVIEW Help
Select Help»Find Examples to display the NI Example Finder and browse
LabVIEW and DSC Module examples.
Refer to ni.com for additional developer resources, training, technical
support, and so on.
National Instruments, NI, ni.com, and LabVIEW are trademarks of National Instruments Corporation.
Refer to the Terms of Use section on ni.com/legal for more information about National
Instruments trademarks. Other product and company names mentioned herein are trademarks or trade
names of their respective companies. For patents covering National Instruments products, refer to the
appropriate location: Help»Patents in your software, the patents.txt file on your CD, or
ni.com/patents. In regards to components that use Citadel 5, the following copyright applies.
Copyright © 1994 Hewlett-Packard Company. Refer to the LabVIEW Help for a listing of the conditions
and disclaimers.
© 2000–2005 National Instruments Corporation. All rights reserved.
372946A-01
Oct05