Author Topic: OPC remote host?  (Read 3902 times)

RobbieNeslon

  • Newbie
  • *
  • Posts: 3
    • View Profile
OPC remote host?
« on: January 28, 2015, 08:02:23 AM »
Is the OPC driver setup to use a remote host or does it have to be on the local machine (127.0.0.1)?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC remote host?
« Reply #1 on: January 28, 2015, 08:38:11 AM »
The current driver only supports OPC on the local machine. You can modify the driver for remote host with a couple easy steps:

- Opening OpcDaCom.vb in the AdvancedHMIDrivers project
- Go to Line 89
- Change "opcda://localhost/"

RobbieNeslon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: OPC remote host?
« Reply #2 on: February 02, 2015, 10:46:31 AM »
Archie,

Your response time is awesome!

I worked on this last week,  but I couldn't get it to work.  Here's where I stand with it.

Using Kepware OPC server V5.  I have two OPC servers running; one local and one remote.  They both have a simulated ramp as the only tag.  I can use the Kepware OPC quick client to connect to both servers (local and remote).  So, I'm assuming it's not a DCOM issue.  I can use my simple AdvancedHMI program with one panel meter to connect to the local OPC server.  I can also run it on the remote server (local to the remote server).  But I can't use it to connect remotely (changing "opcda://localhost/" to "opcda://IPofRemoteServer/").

When I try to connect to the remote server, it shows initial data, but the data doesn't change.  Like it's getting one read, then stopping.  Also when I close the program, it throws an exception as follows:

Code: [Select]
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in OpcNetApi.Com.dll

Additional information: Exception from HRESULT: 0x80040200

@ OpcDaCom.vb line 69 ------  If DLL.IsConnected Then DLL.Disconnect()
« Last Edit: February 02, 2015, 11:26:08 AM by RobbieNeslon »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC remote host?
« Reply #3 on: February 02, 2015, 11:29:54 AM »
It sounds like OPC subscriptions are not updating. When OpcDaCom gets the request from the Meter, it first performs a single read to verify the connection and tag. After that it sets up a subscription and waits for the DataChanged event to be fired by the OPC Server.

Line 444 is where the first read occurs:
Dim values() As Opc.Da.ItemValueResult = DLL.Read(OPCSubscriptionItem)

Line 488 is where the DataChanged call back is. You can try to add a breakpoint at line 489 to see if this callback ever gets data from the OPCServer.

I have never tested this driver on a remote OPC server, so I cannot say for 100% sure that it even works.

RobbieNeslon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: OPC remote host?
« Reply #4 on: February 02, 2015, 01:34:38 PM »
The DataChangeCallback isn't getting called.  On the diagnostics on the OPC server, it shows the OnDataChange getting sent.  However, it's failing.  It show the interface pointer as 0x00000000....  which seems wrong.  The same OnDataChange to the local client show success and a non-zero interface pointer.  Hmmm....

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC remote host?
« Reply #5 on: February 02, 2015, 08:05:01 PM »
You've gone beyond my knowledge of OPC drivers, so I can't be much help from there.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC remote host?
« Reply #6 on: February 11, 2015, 07:22:28 AM »
Just an FYI, the next version (3.97f) will have a new property named OPCServerPath in the OpcDaCom driver