Noob guide to OPC: how to write a C# Hello World client?

一笑奈何 提交于 2019-12-09 06:46:18

问题


here is my situation:

We have a software that is used to monitor solar power plants developed. I have to introduce OPC as a new way to acquire data from the physical devices themselves, so thats why i ended up trying to learn about opc, which so far is being frustrating.

I have installed the Matrikon simulator and using the Matrikon explorer i can see that data is being simulated. what i need now is to create a very basic proof of concept that i can connect to it and print something using C#. As i understand it, i have to use some proprietary API/SDK. Im only testing things so i dont want to commit to a proprietary way to do things right now. Wasnt OPC created to exactly avoid that?

Is there a simple Opensource DLL that i can use to connect to the OPC server, that supports DA, HDA and AE, allowing me to work without worrying about vendors/sdks?

To add to the confusion i have found OPC Xi and OPC UA.... and i havent found a tutorial from gound zero up, which is what im looking for.


回答1:


First you need to know which OPC you want to use.

  • "Classical OPC" DA/HDA and A&E based on Windows COM/DCOM
  • OPC XML/DA, DA as a web service but with some limited perfomance.
  • OPC UA, the last specification allowing you to implement it on non Windows platform and merging DA, HDA and A&E.

After that, you could choose the language you want to use and so use some SDK free or not.

One good website for OPC : http://www.opcconnect.com/source.php has lists of Toolkits you could use.




回答2:


I recommend you use the newest flavor of OPC, OPC UA.

You can build a simple HMI app in C# using these free tools:

1.Microsoft Visual Studio Express 2013 for Windows Desktop available from: http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop.

2.The latest source from this site: https://github.com/convertersystems/opc-ua-samples

With this kit you can: Browse OPC UA servers directly from the Visual Studio IDE. Drag and drop the variable nodes to create a data subscription. Use bindings to animate your UI control's properties from the subscription's data values.

Check out the sample application 'Workstation'.




回答3:


Providing you with a tutorial... but a little bit of information first:

OPC is everything but open (in an open source way)... the OPC foundation has specified a lot of things to standardize the way automation can communicate - on top of which you could build your own stack. Be warned, the stuf is HUGE(!). So to ease the workload a little, there is a hand full of companies providing you with stacks for different programming languages. Matrikon, Prosys, Unified Automation to name some of them.

However to connect to a demoserver you need to implement a provider and do still need a stack providing you with the basic functionality and to download such a stack, your company must register with the supplier. There is no way round I'm afraid. However there were OpenSource projects: http://www.openopcua.org/ never tried the code though.

BUT just to prove the usefulness check this tutorial http://doc.unifiedautomation.com/

And a book written by the company owner of UA (maybe your company has "Springerlink" access?) http://www.springer.com/computer/information+systems+and+applications/book/978-3-540-68898-3




回答4:


You can download all OPC materials from OPC Foundation, specifically you are looking for the OPC .NET API 2.00 Source Code Download Link. It contains a solution that has the OPC dlls and sample clients (AE, DA, DX, HDA) to give you an idea of how OPC works. This source and DLLs are the basis for the OPC standards. Using these you can call to any proprietary OPC server that is compliant with the OPC standards.




回答5:


I suggest you to look at the OpenOpcUa initiative. The full code for OPC UA client and server is available for download. This code run Windows, Linux and WVWorks. more information at www.openopcua.org



来源:https://stackoverflow.com/questions/18275449/noob-guide-to-opc-how-to-write-a-c-sharp-hello-world-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!