OPC client

wouter
2008-01-24
2008-04-28
  • wouter

    wouter - 2008-01-24

    Hi,

    I am absolutely new to OPC so if anyone could help me with this i would be very happy:

    I want to write a C++ client application that monitors some variables from a project running on a softPLC (under windows xp). As far as i understood from documentation OPC is the solution for this.

    I get the OPC server running but can anyone tell me how i can communicate with the OPC server now from my client application??

    Someone maybe has an example in C++?

    thanks a lot in advance!

    wouter

     
  • Rolf-Geisler

    Rolf-Geisler - 2008-01-31

    Hi,

    http://www.opcconnect.com/cbuilder.php. Guess, this will help. Their pages about OPC programming with Borland DELPHI are really good.

    Regards

    Rolf

     
  • wouter

    wouter - 2008-02-01

    Thank you very much Rolf, I will take a look at these examples!

    For now I am using Visual C++ 2005 and Visual C++ 2008, does it make big difference with Borland C++ Builder 6?

     
  • Rolf-Geisler

    Rolf-Geisler - 2008-02-01

    Sorry, don't know. I am using Borland Delphi exclusively to build the visualization projects.

    However, I think, the differences are IDE related only (usage, compiler toggles etc). The code itself should be the same, not depending on the development system.

    Have success.

     
  • wouter

    wouter - 2008-02-14

    That's a fine example. For now, Ihave coded a client application in visual basic 2005, but later i will switch to c++. Now another question:

    My project is to monitor the status of all machines on a network. So far I managed to do this, with the codesys opc server running locally on my pc. The problem is here that you have first to configure the opc server with 'OPCConfig.exe'. But I would want to automate this from my client application, because you don't know which machines will be on the network, which projects are running on this machines,... Is this possible? Is it maybe a solution to install the opc server on each machine separatly and configure it, and then use DCOM to connect to each server simultaneously?

     
  • Rolf-Geisler

    Rolf-Geisler - 2008-02-17

    Hi Wouter,

    sorry for the late reply. I have been on the roads, so I could not check the forum.

    Regarding your last question, I’m not sure about the answer. Indeed, OPC is based on COM/DCOM. So an OPC client should find a remote server as well. This would allow to install an OPC server at a remote machine.

    On the other hand, you ask to have one OPC client dealing with a number of remote servers. However, each of these servers has the same instance name, given with installation at the remote machines and held in their registries. There’s no way to modify it. I don’t know, what way a client could start such a server at a certain machine. From that point of view, I’m afraid, this solution will not work.

    A better solution could be to have the server and the client at each remote machine. Let the client get the needed data from the PLC and put it into a HTML document, which you can read by TCP/IP or broadcast by a web server at each remote machine.

    Good luck

    Rolf

     
  • timvh

    timvh - 2008-04-28

    You might want to consider using the PLCHandler instead of the OPC server. This gives you greater flexibility and prevents having DCOM problems.

     

Log in to post a comment.