locked
OPC Automation RRS feed

  • Question

  • Hello,

    I'want to create an OPC Client for any OPC Server in VB.NET. I use Visual Basic 2005 Express Edition.

    So, I add a reference to my OPCDAAUTO.dll. And at this time, there is just this part of Code :

    Public Class Form1

    Dim WithEvents g_OpcServer As OPCAutomation.OPCServer

    Dim WithEvents g_OpcGroups As OPCAutomation.OPCGroups

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    g_OpcServer = New OPCAutomation.OPCServer

    g_OpcServer.Connect("KEPware.KEPServerEx.V4")

    g_OpcGroups = g_OpcServer.OPCGroups.Add("Grp")

    End Sub

    End Class

    When I Run the App, i go this Error message : Unable to cast COM object of type 'OPCAutomation.OPCGroupClass' to interface type 'OPCAutomation.OPCGroups'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{28E68F95-8D75-11D1-8DC3-3C302A000000}' failed due to the following error: Cette interface n'est pas prise en charge (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

    Anyone can help me ?

    Wednesday, March 29, 2006 10:20 PM

Answers

  •  

    Strangly enough,

    I just happen to be finishing up with an entire wrapper class that interfaces with the OPCDAAuto.Dll.  It handles all the finite details of connecting with the Server (I am using Kepware as well), and reading / writing on seperate threads. I have about 100 hours into it. I wouldn't mind having someone else testing it.

    If you are interested, give me a way of contacting you and I can send it to you.

     

    SteveJ

    Thursday, March 30, 2006 6:10 AM

All replies

  •  

    Strangly enough,

    I just happen to be finishing up with an entire wrapper class that interfaces with the OPCDAAuto.Dll.  It handles all the finite details of connecting with the Server (I am using Kepware as well), and reading / writing on seperate threads. I have about 100 hours into it. I wouldn't mind having someone else testing it.

    If you are interested, give me a way of contacting you and I can send it to you.

     

    SteveJ

    Thursday, March 30, 2006 6:10 AM
  • Hello Steve,

    Well .. as you wich, here is my msn adress : zboonet@hotmail.com

    see you later :-)

    Thursday, March 30, 2006 6:33 PM
  • Hi, I'm very interested in using KEPServerEx with .Net but cannot find any examples. I have emailed Kepware but have had no response.

    I'd be happy to test your class if that's ok - you can contact me at msdn.1.jamieo@spamgourmet.com

    Thanks,

    Jamie

    Wednesday, May 3, 2006 10:54 AM
  • I'd like to test it to

    registrera.REMOVE@yahoo.se

    Regards

     

    JBu

    Thursday, May 18, 2006 9:05 PM
  • Could you please forward it to me, if still available?
    mikebo01<at>hotmail<dot>com
    Thank You,
    Mike
    Thursday, May 25, 2006 12:34 PM
  • Sorry everyone,

    My .net beta expired last month, and its taken a while to get the Pro version ordered. I'm back now though.

    Whomever still wants a copy of this class, you can email me at steves_surfing_email@msn.com

    I need to do documenting and code cleanup, but it works.

    Steve Jackson

    Friday, May 26, 2006 7:55 PM
  •  

    I have received several requests for this class - which is fine, I don't mind sharing it. Actually, I have now changed it into a component and have improved the documentation.

    If you do ask for it, though, I have one request. Please take the time to give some feedback - especially with respect to errors or improvements. I am using it for a business application and need it to be as error-free as possible.

     

    Thanks;

    steves_surfing_email@msn.com

     

    Tuesday, June 13, 2006 3:40 PM
  • Hello,

    some important remarks on your post :

    1. OPCDAAuto.DLL cannot be use as a free dll. it's provide by the Fondation for OPC Foundation member which choose how to redistribute it. But in every case they have to rebuild, rename the DLL and support it.
    2. on the technical point of view it's really bad to use the automation wrapper in .Net. Sure it's possible and it's working but it wa smade possible just for the maintenance of existing project. It's one of the worst thing you can do for a new project.
    3. The best way to access OPC Server from .Net is to use the .NET API. The .Net API is an assembly to create OPC Client. Not only DA client but AE, HDA, DX, etc.

    Regards

     Michel4CE

    Wednesday, November 29, 2006 12:00 AM
  •  

    1. OPCDAAuto.DLL cannot be use as a free dll. it's provide by the Fondation for OPC Foundation member which choose how to redistribute it. But in every case they have to rebuild, rename the DLL and support it.

    OPCDAAutomation is installed at the same time you install your OPC Server, like RSLinx or Kepware Server for example .. so what's wrong ?

    2. on the technical point of view it's really bad to use the automation wrapper in .Net. Sure it's possible and it's working but it wa smade possible just for the maintenance of existing project. It's one of the worst thing you can do for a new project.

    3. The best way to access OPC Server from .Net is to use the .NET API. The .Net API is an assembly to create OPC Client. Not only DA client but AE, HDA, DX, etc.

    Perhaps but as you said earlier, OPC Foundation is not a philanthropist foundation, that's the less thing we can say when you see th price of a OPC member ship ;-) So how does students, and workers whom employer have some hedgehog in thier pockets ? but that is another debate, isn't it ?

     

    Regards,

    ZbooNet

    Saturday, December 2, 2006 11:19 AM
  • ZbooNet,

    The membership for university is $500 per year.  This subscription allow students to  access most of the foundation's SDK and specifications.

    The Foundation is a none profit organization. its tasks are to provide specifications,  ensurefor OPC technology adoption and ensure the quality of OPC products.

    As i already say the Automation wrapper (OPCDAAuto.dll) is a sample to demonstrate that you can access OPC DA Server from Automation compliant language.

    Company that redistibute it must respect rule that come with the a source code, rename the DLL , change IIDs, support it,etc... This is on the legal point of view.

    On the technical point of view to access OPC server from .Net you have to use the .Net API, the Automation wrapper works with .Net application, but this is the worst kind of OPC DA client you could do.

    Finaly, as student you have contact your teacher and find $500. As employee in a company where employer have hedgehog in their pocket can i suggest to find a other company or maybe to kidnap the hedgehog.  and put it on a road.

    Michel4CE

     

    Saturday, December 2, 2006 2:26 PM
  •  

    Michel;

     

    I would be happy to use the .net API. To be honest - endless searches never demonstrated its existence to me. Perhaps you could be kind enough to elaborate on how to do so from vb.net.

     

    Thanks;

     

    SteveJ

    Saturday, December 2, 2006 3:28 PM
  • hey can you send me the code. umpate22@hotmail.com

     

    thank you

    Friday, June 15, 2007 5:50 PM
  • Its depends of the version of the library the version 2.0 presents this problem but the version 2.02 is so good

    Friday, August 10, 2007 1:12 AM
  • There are several threads on this forum dealing with the OPC Automation wrapper, so I thought I'd throw in my two cents...

    Some important background to know about the Automation wrappers and versions.   There actually is a "General" OPC interface dll.   It's called the Automation Wrapper, or OPCDAAuto.dll.     When the first OPC DA specifications were released, the OPC Foundation did not wish to support complied applications, so the source code for the OPCDAAuto.dll was supplied to all OPC members.   Each vendor then recompiled the code under their own GUID (for example Rockwell renamed it RSiOPCAuto.dll).    In November of 2005, the OPC Foundation decided to take the responsibility of maintaining various applications  (DA Wrapper, Compliance tests, proxy stubs etc).    All the bug fixes various vendors had applied over the years was compiled and the OPC Foundation released the 'official' OPCDAAuto.dll v2.02.    Many vendors already were supporting 'their' wrapper so continue to ship the vendor branded version.    

    Version 2.02 of the automation wrapper has been tested with VB.NET on Win2000 and WinXP.   You can read the details on the Foundation website at

    http://www.opcfoundation.org/DownloadFile.aspx?CM=3&RI=305&CN=KEY&CI=274&CU=29

    If you are an OPC Foundation member you can download the files directly.   If you are an end user who is not a member, you need to get the binaries from your OPC Server Vendor.

    Here's some additional information from the OPC Foundation supplied ntoes:
    It is important to note that both the DA Automation Wrapper and the OPC.NET API allow .NET based OPC client applications to communicate with existing COM based OPC servers. However users should keep in mind that the DA Automation Wrapper was intended to used only as a way to facilitate porting of existing VB 6.0 applications to VB .NET. The OPC Foundation recommends that any new VB .NET client development use the .NET API for the following reasons:

    • it provides almost all of the features of the DA automation wrapper;
    • it supports Data Access 3.00 and XML Data Access 1.00 servers;
    • it takes full advantage of new .NET features such as object serialization;
    • it requires one less layer of code between the application and the server;
    • it provides a common API framework for all specifications;
    • it will be the starting point for the Unified Architecture (UA) .NET API; 

    The OPC.NET API is available to OPC Foundation members.

    Hope that helps!

    Eric Murphy - OPC Exchange - http://blog.matrikonopc.com

    Tuesday, May 5, 2009 5:32 PM
  • Mr. Jackson,

    I am also looking for a way to connect to an OPC server to write to a tag for remotely shutting off a PLC driven process. Would you be willing to share your VB code?

    -Emach

    Monday, March 5, 2012 9:12 PM
  • Sorry guys, I wish there were a way to delete this thread. I've moved companies a few times since then and have lost my source code. The only help I can offer at this point is to recommend contacting the folks at Kepware. They offer several (paid) solutions. 

    Cheers. 


    SteveJ

    Monday, March 12, 2012 2:15 PM