LabView DSC Module Tips
LabView DSC Module Tips
LabView DSC Module Tips
The Sharing Live Data Using Shared Variables topic in the LabVIEW
Help contains information about the shared variable in LabVIEW.
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
Enabling Logging for the Project Library ................................ 9
Creating the VI................................................................................. 10
Additional Exercises ............................................................................... 12
Configuring Front Panel Security .................................................... 12
Creating a New Security Domain ............................................. 13
ni.com
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.
2.
3.
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.
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.
Click the Empty Project link in the Getting Started window. The
Project Explorer window appears.
2.
3.
Select FileSave All. The Name the Project dialog box appears.
4.
5.
Click the OK button. The Name the Library dialog box appears.
6.
7.
2.
Select Custom VI Periodic from the I/O Server Type list and click
the Continue button. The Configure Custom VI Periodic I/O
Server dialog box appears.
3.
Click the New button to display the Select VI step of the Custom
VI-based Server Periodic Wizard.
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.
c.
d.
b.
b.
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.
7.
You can select what you want the wizard 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 Wizard will create from the Server
Distribution Component page. Click the Build button. The wizard
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 wizard creates the periodic I/O server, the Configure
Custom VI Periodic I/O Server dialog box appears with the name
of the periodic I/O server and the data items it contains. Click the OK
button. LabVIEW adds the periodic I/O server to the Tank System IO
Server project library.
11. Select FileSave All in the Project Explorer window to save the
project, project library, and periodic I/O server.
Note
Complete the following steps to deploy the Tank1 periodic I/O server and
view the data.
1.
2.
Click the Done button to close the Deploy dialog box when the
deployment is complete.
ni.com
3.
4.
5.
Click each data item and drag it into the upper right pane. The data
items appear in the table.
6.
7.
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.
8.
Close the Shared Variable Monitor. The periodic I/O server continues
to run.
2.
Right-click the new project library you created and select Create
Bound Variables from the shortcut menu to display the Create
Bound Variables dialog box.
3.
4.
5.
Select each shared variable with the data type DBL and click the Add
button to add each variable to the Added variables list.
6.
Click the OK button. The Create Bound Variables dialog box closes
and the shared variables appear in the Multiple Variable Editor
window.
7.
Click the Done button to close the Multiple Variable Editor window.
8.
Select FileSave All. The Name the Library dialog box appears.
9.
Enter Tank System Shared Variables in the File name text box.
10. Click the OK button. LabVIEW binds the shared variables in the Tank
System Shared Variables project library to the corresponding items on
the network.
2.
3.
Double-click the Logging:Alarms and Events cell for the Tank Level
[Gallons] shared variable and select On from the drop-down list that
appears. This option enables alarm and event logging for the shared
variable.
4.
5.
Double-click and enter 0.1 in the Logging:Data cell for the Tank
Level [Gallons] shared variable. This value compresses the value to
one decimal point when the DSC Module logs the values of this shared
variable to the Citadel database.
6.
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.
ni.com
2.
3.
Click the Done button to apply the changes to the shared variable and
to close the Multiple Variable Editor window.
2.
3.
Verify that the options in the DSC Settings: Database page appear
similar to Figure 2.
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
4.
5.
6.
Click the Done button to close the Deploy dialog box when the
deployment is complete.
7.
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.
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.
4.
5.
Use the Positioning tool to resize the Tank Level [Gallons] tank.
10
ni.com
6.
7.
Tip If the Data Binding tab is not visible, scroll through the tabs until you reach the Data
Binding tab.
8.
9.
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 CtrlsPointer 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.
13. Right-click the Tank Valve [%] control and select Replace
Num CtrlsPointer Slide.
14. Select FileSave 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.
11
Additional Exercises
The following exercises introduce some of the additional functionality
available with the DSC Module.
12
ni.com
2.
3.
4.
5.
6.
7.
8.
9.
10. Click the OK button to create the new local domain. MyDomain
appears in the Domain Manager window under My Computer.
2.
3.
Enter User1 in the User name text box on the General tab.
4.
5.
6.
7.
8.
Click the OK button in the User Properties dialog box to add User1
to MyDomain. User1 appears in the Domain Manager window.
13
2.
3.
If the Security tab is not visible, scroll through the tabs until you reach the
Security tab.
Tip
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.
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.
11. Run the VI continuously and select ToolsSecurityLogin 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 ToolsSecurityFront Panel Security.
Tip
14
ni.com
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.
5.
6.
7.
Click the Add button in the Configure Real-Time Trend dialog box.
8.
9.
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.
2.
Expand the Tank System Shared Variables project library in the left
pane to display the shared variables.
3.
15
LabVIEW Help
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: HelpPatents 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.
20002007 National Instruments Corporation. All rights reserved.
372946B-01
Aug07