Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: May 15, 2008


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Configuring the DAQ OPC Server and Accessing it from LabVIEW DSC

6 ratings | 4.00 out of 5
Print

Overview

This document describes how to install the data acquisition object linking and embedding (OLE) for process control (DAQ OPC) server and ensure it is working properly.

Confirming that NI-DAQ and the DAQ OPC Server Are Fully Installed

You must have both NI-DAQ and the DAQ OPC server fully installed for the DAQ OPC server to function properly. Complete the following steps to verify both installations:

1. Check whether NI-DAQ is listed under My System»Software in MAX. If NI-DAQ is listed, then it is installed. If NI-DAQ is not listed, refer to ni.com/downloads to install NI-DAQ.

2. Check whether DaqOpc or National Instruments.DaqOpc is included in SE among the list of all OPC Servers installed on the computer. You can download SE from the link at the end of this document. If SE does not have an entry for DaqOpc or National Instruments.DaqOpc, then the DAQ OPC server may not be installed or the server may be incorrectly registered. In this case, refer to the DAQ OPC Server Troubleshooting Wizard link at the end of this document.

Note: National Instruments (NI) strongly recommends using SE as your troubleshooting tool.

Configuring the Hardware


The hardware in your application must be properly installed and configured for the DAQ OPC server to operate successfully. To install and configure the DAQ hardware for your application, refer to the hardware documentation at ni.com/manuals or to the DAQ support pages at ni.com/support/daq.

Creating and Testing Virtual Channels in Measurement & Automation Explorer



1. Launch MAX.

2. Right-click Data Neighborhood, and select Create New. Select Virtual Channel and click Finish.



3. In the Create New Channel dialog box, select the IO type from the drop-down menu, and click Next.

4. In the Enter Channel Name and Description dialog box, enter a channel name and a short description for the virtual channel. Click Next.

5. Select the type of analog input that matches your setup. Check This will be a temperature measurement if it applies to your application. Click Next.

6. Select the units and enter the range of the signal. Click Next.

Note: Although the DAQ OPC server is able to pass the range configuration to an OPC client, it is not able to pass the units. The range configuration is a very important parameter. When the OPC client connects to the server it only subscribes for changes greater than a certain value, or the deadband. The value is described as a percent of the range. For example, if the range is from 0 to 100 and the deadband is 1%, then anytime the value changes more than 1, the server sends the new value to the client. The deadband is a part of the client configuration but not the server configuration. Refer to the documentation for the client for more details.

7. Define the actual values the sensor will return. Click Next.

Note: The default option is No Scaling. Choose the Map Ranges option if, for example, the sensor being used gives a voltage between 0 and 1 V that corresponds to a Celsius temperature between 0 and 100. In such a case, you select Map Ranges, enter 0 and 1 in this dialog box, and enter 0 and 100 in the previous dialog box. The other option is Custom Scaling; refer to the NI-DAQ Function Reference Help (Start»Programs»National Instruments»Ni-daq»NI-DAQ Help) for more information about this option.

8. Select the hardware device and channel that you will use to take the measurements.

9. Verify that the virtual channel operates properly, by clicking Data Neighborhood and right-clicking the virtual channel. Select Test. The Virtual Channel Test Panels dialog box should appear.

Note: If a virtual channel does not function properly in MAX, it is likely that it will not work through the DAQ OPC interface.

10. Repeat steps 2 through 9 as needed to create additional analog input, analog output, or digital virtual channels. You can use any of four types of settings for digital virtual channels, including Read from port, Read from line, Write to port, or Write to line. Working with the whole port can be cumbersome but yields higher performance.



11. Close MAX.

Testing the DAQ OPC Interface in Server Explorer



1. Launch Server Explorer.

2. Right-click DaqOpc and select Wizard.



3. Click Next. If you successfully connect to the server, you briefly see the Connected to OPC Server message, then the OPC Wizard - Group Creation window appears.

Refer to the NI-DAQ Troubleshooting link at the end of this document if you are unable to successfully launch the NI DAQ OPC server.

4. You can accept the defaults by clicking Next. When you see the following window,. notice that the virtual channels you created show up in the Selected OPC Items area. You can remove or add items by using the << and >> buttons. When you have selected the items you want, click Finish.



You should now see a window similar to the one shown below. The signal values are listed in the Value column. Also note the Quality column. The value displayed under this Quality should show Value good.



5. To change an output signal value, right-click the item and select Properties. You see a window with several tabs. Select either the Read & Write SyncIO tab or Read & Write AsyncIO tab.

6. In the Value field of the Write area, enter a new value and click Write!. The status should be Success. Click OK to return to the SE dialog box.

You are now ready to use the DAQ OPC server from any OPC client, such as LabVIEW DSC, Lookout, or DataSocket.

Accessing the DAQ OPC Server from LabVIEW DSC


LabVIEW Datalogging and Supervisory Control (DSC), formally known as BridgeVIEW, is the ideal choice for high channel-count systems. LabVIEW DSC has DAQ OPC connectivity and can connect directly to the DAQ OPC server. For more information about LabVIEW DSC, refer to the LabVIEW DSC link at the end of this document.

Complete the following steps to configure tags that connect to the DAQ OPC Server:

1. Launch LabVIEW DSC.

2. Open a new VI and launch the Tag Configuration Editor (TCE) (Tools»Datalogging & Supervisory Control»Configure Tags).

3. Create a new Tag configuration file by selecting File»New.

4. Open the Configuration Wizard from the Edit menu.

5. Locate the National Instruments.DaqOpc in the tree view. If you do not have the entry, then the NI-DAQ OPC server may not be installed or the server may be incorrectly registered. In this case refer to the NI-DAQ OPC Server Troubleshooting Wizard link at the end of this document.

6. Expand the National Instruments.DaqOpc server folder and subfolders. The folder structure is organized by the channel type (Analog Input, Analog Output, Digital Input and Digital Output). The list of items corresponds to the list of virtual channels configured in MAX. You can highlight any channel and click the Add Item(s) button to add it to your configuration. Note that you do not have to add the items one by one. If you click Add Item(s) while a group is highlighted, all channels from that group will be added. For example, to select all analog input channels, highlight the Analog Input label and click Add Item(s). In most cases, all configured channels are used. To add all channels at once, highlight the National Instruments.DaqOpc entry and click Add Item(s).



7. Click OK to return to the TCE.

8. Save the configuration file (File»Save). A new window appears and asks you where you would like to log data. Choose the defaults by clicking OK.

At this point the configuration is finished.

Note: Before starting the Tag Engine, NI recommends staying a few extra minutes in the TCE and exploring tag configuration. Double-click a tag to open the property window, browse through the available tabs, and bring up the context help by pressing Ctrl+H and mousing over your field of interest.

Complete the following steps to connect to a configured tag:

1. In LabVIEW DSC, create a numeric indicator on the front panel.

2. Pop-up on the indicator and select HMI Wizard.



3. Select an analog input tag from the Tag drop down list and click OK to return to the front panel.

4. Save the VI and start it. Note that the VI automatically launches the Tag Engine. For that reason it might take a few seconds to successfully connect the indicator to the selected tag. The color-coded connection status bar should turn from red to green once the connection is made.



The Tag Engine runs in the background and communicates with the DAQ OPC server, logs data to the historical database (even if the data is not used on a front panel), scales data, and handles alarms. The Tag Engine icon is displayed in the task bar tray. You cannot click the icon to manually manipulate the engine or to display the Tag Engine manager window.



Note: The VI starts the engine, so you do not have to launch the engine manually in order to successfully run a VI. The VI diagram looks similar to the figure below and contains the terminal of the indicator for the selected tag and a while loop that monitors whether the engine is still running. When you start the VI, the Engine Launch.vi is executed. This VI starts the engine, unless it is already started. The while loop checks periodically if the engine is still running. Once the engine is stopped, the Engine Status stops the while loop, which in turn stops the VI, since there is nothing else to execute.



Refer to Help»Datalogging and Supervisory Control for more information.
Related Links:
Drivers & Updates: Server Explorer
NI-DAQ OPC Server Troubleshooting Wizard
Connecting LabVIEW to an OPC Server through DataSocket Connection

6 ratings | 4.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).