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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Labview opc client to connect to Opto 22 optoopcserver

Hi, thanks in advance for any help you can provide.

I have Opto 22 optoopcserver running on the same PC as Labview 2013. I have the DSC module installed. The Opto 22 software package includes a test client and I am able to successfully read and write tags using the test client. When I connect using Labview, I can successfully create bound variables for the tags and it creates shared varibles which I can put in a VI to test reading and writing them. But the shared variables do not update, there doesn't seem to be a connection. I have the Windows firewall turned off.

Has anyone successfully used Labview to communicate to optoopcserver?

 

0 Kudos
Message 1 of 14
(4,211 Views)

Hi Mosey,

 

Since the firewall is off check the OPTOOPCSERVER™ USER’S GUIDE for more information about the appropriate DCOM settings.

 

Also, try an alternative communication method...run the shipping example "Monitor OPC Items with DataSocket.vi" and see if you get the same behavior.

 

Regards,

 

Alejandro Calvo | Applications Engineer | National Instruments

Alejandro C. | National Instruments
0 Kudos
Message 2 of 14
(4,179 Views)

Thanks. I ran Monitor OPC Items with DataSocket.vi and it's the same thing, I can see the tags but they don't update.

0 Kudos
Message 3 of 14
(4,171 Views)

Interesting, can you please double check that the firewall is absolutely turned off for all locations (domain, private and public networks).

 

Plus, try the following steps (this enables remote communication to the OPC server):

 

1. Run dcomcnfg from command line.
2. Expand Component Services"Computers"My Computer. Right click My Computer and choose properties"Default Properties and activate 'Enable Distributed COM on this computer', select None for 'Default Authentication Level', select Identify for 'Default Impersonation Level'
2.1 Switch to COM Security tab, click 'Edit Limits' to add everyone account for both [Access Permissions] and [Launch and Activation Permissions]. Check all the Permissions for account everyone.
3. Select 'DCOM Config' under My Computer and search for opcenum. Open the properties"General. Authentication Level = None, switch to Security and edit all permissions to allow local end remote access to Everyone.

 

Hopefully this will unlock the block on the communication, make sure the test are performed while the OPC Server is active.

 

Regards,

Alejandro C. | National Instruments
Download All
0 Kudos
Message 4 of 14
(4,162 Views)

Alejandro,

 

Thanks for your help. I have verified that the Windows firewall is off. I went into dcomcnfg and set things as you suggested. I've tried Authentication Level at both "none" and "Connect". Still having the same problem. When I run the Monitor OPC Items with DataSocket.vi the tag shows up in the Optoopcserver window, but the value in the VI doesn't update. Please see attached screenshot.

0 Kudos
Message 5 of 14
(4,152 Views)

I opened the example on my end and did a little modification to the code. Instead of using a floating point number as the expected data type, I changed it to Boolean, generated a new indicator, ran it and it works.

 

Using the OPC Demo project that comes with the NI OPC Server I was able to see correct Boolean values.

Alejandro C. | National Instruments
Download All
0 Kudos
Message 6 of 14
(4,142 Views)

I changed it to a boolean in the Monitor OPC Items with DataSocket.vi and it works. Thanks for pointing that out! So, now I have a connection using Datasockets.

 

Now the question is "why doesn't it work with shared variables?"

 

When I run the Monitor OPC Items with DataSocket.vi the name it creates is:

opc://localhost/Opto22.OpcServer.2/[MMIO|ip|tcp:192.168.2.116:2001]STATE[0]

 

When I try to do it with shared variables I use the following procedure (this procedure worked recently with a different OPC server):

1) In a Labview project, right click on My Computer and select New - I/O Server

2) Select OPC Client

3) Select the OPC server

4)This will create a new library and under that will be an element called OPC1

5) Right click on OPC1 and select Create Bound Variables

6) Browse for the tag and click on Add>>

 

When I try this with the Optoopcserver, a client shows up in the Optoopcserver window with a group under it. But, when I click on "Add>>" the Optoopcserver window goes blank. The shared variable that gets created is:

My Computer\shared var test2.lvlib\OPC1\Opc browser database for silicon diffusion furnace\'C:\Users\Public\Documents\Opto 22\SiliFurn PAC Project\SiliFurn.otg'\'E1_Dig_FR_6 (192.168.2.116)'\D_FR_T56_N2_TransLC\STATE

 

So, it appears the Optoopcserver doesn't like that name for some reason.

 

0 Kudos
Message 7 of 14
(4,113 Views)

Also, since I was able to successfully read the tag using the Monitor OPC Items with DataSocket.vi, I tried to modify it to write the tag. So, I changed DataSocket Read to DataSocket Write. The Detailed Help says DataSocket Write will take any datatype for the data input, but it seems to only take a cluster. I tried creating a cluster and then putting a boolean in it, but it doesn't work. Any idea on how to correctly modify the Monitor OPC Items with DataSocket.vi to write instead of read?

0 Kudos
Message 8 of 14
(4,102 Views)

Regarding datasocket…yes it is possible to read any data type. Using a cluster is not valid in your case because you are opening a reference to a single variable with a unique data type (the expected read data type is not a cluster).

 

About the URL, don’t mix the path where the library is store on your computer with the actual OPC URL. Try following these recommendations to fix the communication problems: Why Can't LabVIEW DSC Connect to My OPC Server When Server Explorer and DataSocket Can?

 

Let me know how it goes

Alejandro C. | National Instruments
0 Kudos
Message 9 of 14
(4,091 Views)

The procedure in  Why Can't LabVIEW DSC Connect to My OPC Server When Server Explorer and DataSocket Can? did the trick, thanks! It's all working now.

 

Change the Identity Property of the OPC Server

  1. Go to Control Panel » Administrative Tools » Component Services to open the Component Services Manager.
  2. Navigate to the OPC server by going to Component Services » Computers » My Computer » DCOM Config.
  3. Right click on the OPC server that is used in the I/O Server and select Properties.  If you are using OPC with FieldPoint or Compact FieldPoint, the OPC Server is FieldPoint OPC2.  (Binding to the OPC Server is not recommended with (c)FP systems.  See Methods for Binding a Shared Variable to a FieldPoint Channel.)
  4. In the properties dialog box, select the Identity tab, and change the user account to be The interactive user.
  5. Restart the computer to apply new DCOM settings.
0 Kudos
Message 10 of 14
(4,041 Views)