Author Topic: OPC connection to remote server  (Read 3148 times)

maxketcham

  • Newbie
  • *
  • Posts: 20
    • View Profile
OPC connection to remote server
« on: August 22, 2016, 11:33:07 AM »
using OpcDaCom, I am tryint to connect to an OPC server on a remote server the server address is  10.224.220.109 using OPC expert https://opcexpert.com/ I can connect by just adding the address of the opc server and it finds Kepware.KEPServerEX.V5 and allows me to connect to it. Why can't I connect to it with Advanced HMI? I have tried changing opcda://localhost to remotehost, the IP address, and several other thnigs but nothing seems to work. What am I doing wrong?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC connection to remote server
« Reply #1 on: August 22, 2016, 04:50:20 PM »
I hate to say it, but every time I see OPC come up in a topic, I cringe. OPC is based on an old Microsoft technology that can be horribly difficult to get it to connect, especially on remote servers.

The top issue is usually getting the OPCServerName correct. It looks like you have identified that, so make sure the OPCServerName property has Kepware.KEPServerEX.V5

For remote connections, the next thing is the OPCServerPath. In your case it looks like this should be opcda://10.224.220.109

I do not thing KepWare uses topics, so the OPCTopic should be left blank.

This now leaves the correct addressing to put in the PLCAddress* properties. This will depend on your device.

maxketcham

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: OPC connection to remote server
« Reply #2 on: August 22, 2016, 08:11:32 PM »
LOL, I can understand that feeling of cringing. I did get it using your method, turned out when I checked it was a DCOM  problem, that is fixed, now I can connect, but the connection will only last 2-3 changes of a bit, then never changes again. This I have no clue about. Your driver does do a callback does it not? or does it poll?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC connection to remote server
« Reply #3 on: August 22, 2016, 08:39:22 PM »
The driver uses the subscription and call back provided by the OPC server. In Solution Explorer, you can expand down the AdvancedHMIDrivers project to see OpcDaCom.vb, right click that file and select View Code

Scroll down to line 525. This is where the callback comes to. You can click in the left margin to add a breakpoint and see if the callback continues to occur.

maxketcham

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: OPC connection to remote server
« Reply #4 on: August 23, 2016, 12:28:10 PM »
nope, never called back, it initializes them all to false, then updates once, but callback is never activated. Guess I'm down to polling

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: OPC connection to remote server
« Reply #5 on: August 23, 2016, 01:29:12 PM »
The driver does an initial read to get the current value, but then relies on the callback to continue the updates. For whatever reason, the read seems to work, but OPC subscriptions do not.

maxketcham

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: OPC connection to remote server
« Reply #6 on: August 24, 2016, 12:07:55 AM »
no matter, Callback would have been convenient, but I can poll just as effectively so that's what I'll do. besides I only need to write and read every second or so for the poll and it will only be 16 bits this time. Love your software, has made my life a lot easier so no complaints.
Thanks for the help