Author Topic: 399a and Remote OPC Server  (Read 6397 times)

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
399a and Remote OPC Server
« on: October 31, 2015, 11:02:49 AM »
I am developing an application using Kepware as my Remote OPC Server.

I am having a problem with very slow reads.  When opening the application, it takes 1 minute or more to populate the screen with values.  If I write a value, it changes in the PLC immediately but never seems to update on my application unless I restart the application.

If I run a localhost OPC server, it reads and writes immediately.

Is there anything that might be able to help my read times?

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: 399a and Remote OPC Server
« Reply #1 on: November 01, 2015, 09:47:46 AM »
Trying to do some troubleshooting myself by using breakpoints, I have found that the slow connection comes in at line 423

        SubscriptionOPC = DirectCast(DLL.CreateSubscription(SubscriptionState), Opc.Da.Subscription)
                AddHandler SubscriptionOPC.DataChanged, AddressOf DataChangedCallBack
            Catch ex As Exception
                Dim dbg = 0
            End Try
        End If

After getting through this, a value will appear.

The update problem I can't figure out.  The local opc server and remote opc server both go through the DataChangedCallBack at line 520.

Private Sub DataChangedCallBack(ByVal clientHandle As Object, ByVal requestHandle As Object, ByVal values() As Opc.Da.ItemValueResult)
        For i = 0 To values.Length - 1
            Dim ReturnedValues() As String = {Convert.ToString(values(i).Value)}
            Dim PolledAddress As PolledAddressInfo = DirectCast(values(i).ClientHandle, PolledAddressInfo)

            'For j = 0 To Subscription.Items.Count - 1
            'If PolledAddress.OPCItem.ItemName = DirectCast(Subscription.Items(j).ClientHandle, PolledAddressInfo).OPCItem.ItemName Then

            Dim PLCAddress As String = values(i).ItemName
            '* If there is a Topic, strip it back off before sending back to subscriber
            If m_OPCTopic IsNot Nothing AndAlso Not String.IsNullOrEmpty(m_OPCTopic) Then
                PLCAddress = PLCAddress.Substring(m_OPCTopic.Length + 2)
            End If

            Dim x As New MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs(ReturnedValues, PLCAddress, 0)
            x.SubscriptionID = PolledAddress.ID
                Dim z() As Object = {Me, x}
                m_SynchronizingObject.BeginInvoke(PolledAddress.dlgCallBack, z)
            'End If
            'Next
        Next

  The local seems to update the display here, but the remote does not.  What am I missing?
« Last Edit: November 01, 2015, 10:46:42 AM by baguinn »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: 399a and Remote OPC Server
« Reply #2 on: November 02, 2015, 04:20:15 PM »
I don't have a good answer for the slow update. The OPCDaCom driver is nothing more than a layer on top of the OPC driver. So if the data comes back slow, it is most likely something to do with the OPC server.

If you use an OPC Test Client, how fast will it update?

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: 399a and Remote OPC Server
« Reply #3 on: November 02, 2015, 08:59:38 PM »
After further testing, the slow loading only occurs when using a remote OPC server. The real problem is when using the remote OPC server, OPC driver only updates on loading. It never seems to update again. Writing is almost instantaneous and will continue to write values even though a read never seems to occur.

When using a localhost OPC server everything works as it is suppose to. Is there a time value on read that I am missing that needs extending when working with a remote server that I am missing?

I would appreciate any help you could lend. I am only using OPC due to the lack of a Siemens driver. I am really hoping not to have to buy a local Siemens OPC server for each installation. This would also increase the number of connections on the plc which I would probably run out of fairly quickly.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: 399a and Remote OPC Server
« Reply #4 on: November 02, 2015, 09:37:48 PM »
I would first try this software to see if it works:

http://www.matrikonopc.com/products/opc-desktop-tools/opc-explorer.aspx

That would narrow it down to the OPC server/network connection or AdvancedHMI.

When the AdvancedHMI OPC driver sets up an OPC connection, it first creates a subscription, then performs a single synchronous read. It sounds like only the synchronous read occurs and no AsyncReadCompleteCallback ever is executed.

I'm no OPC expert by any means, but I do read a lot about many DCOM issues with remote servers. Several companies advertise the use of their tunneler to get around this. Here is one for example:

https://www.matrikonopc.com/products/opc-data-management/opc-tunneller.aspx

DougLyons

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
399a and Remote OPC Server
« Reply #5 on: November 02, 2015, 09:55:41 PM »
Baguinn,

Matrikon (www.matrikonopc.com) also publishes some very good White Papers on DCOM settings for OPC.
I suggest that you review and implement their recommendations for your particular operating system.
They are available as a free download, but you do have to register with them.

Another vendor with reference material on DCOM is Software Toolbox (www.softwaretoolbox.com).
Their tutorial is available without registering and is free as well.

I am sure that there are others and you can just do a search and see what you find.
Look for "OPC" and "DCOM Problems" or similar.

Sometimes you have to make DCOM very open on both the OPC Server and the OPC Client.
In general this defeats much of its security, but in a fairly closed network you might be willing to do this.
I would not recommend this for any machine with direct Internet access though.

Doug Lyons

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: 399a and Remote OPC Server
« Reply #6 on: November 02, 2015, 10:12:00 PM »
Thanks guys, I will look into DCOM issues.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: 399a and Remote OPC Server
« Reply #7 on: November 04, 2015, 10:00:00 PM »

... I am only using OPC due to the lack of a Siemens driver. I am really hoping not to have to buy a local Siemens OPC server for each installation. This would also increase the number of connections on the plc which I would probably run out of fairly quickly.

Just curious to know what you have, a Siemens PLC controller and a Kepware OPC server sit in the middle to serve its tag/data?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: 399a and Remote OPC Server
« Reply #8 on: November 04, 2015, 10:55:29 PM »
That is what I have.

Actually,  KepServer is talking to several plc's,  I them use the OPC driver to connect to the OPC server.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: 399a and Remote OPC Server
« Reply #9 on: November 05, 2015, 12:46:46 PM »
Can you try to disable the others and tested with one PLC only?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

baguinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: 399a and Remote OPC Server
« Reply #10 on: November 05, 2015, 07:53:04 PM »
It is not a problem with Kepware connecting to the PLC, it is a problem with the server that kepware is on allowing to be read from.