.NET 与西门子 PLC S7 200 的接口

发布于 2024-11-26 00:59:35 字数 560 浏览 2 评论 0原文

我正在尝试将 .NET(C# 或 VB 无关紧要)与西门子 PLC S7 200 连接。但是我无法建立连接。我正在使用 Win7 64 位机器,但似乎也无法在 32 位机器上运行。我有两个文件:

Interop.OPCSiemensDAAutomation.dll Siemens_s7-200.dll

来自我试图迁移到较新系统的另一个项目。但是我总是遇到 com 异常。

Retrieving the COM class factory for component with CLSID {01704EBD-44B5-11D3-9C09-00105A3DD3AC} failed due to the following error: 80040154.

我已经尝试过 libnodave 但似乎也无法正常工作。有人可以给我一些指示(请不要有 XKCD 幽默)去哪里看吗?

我无法在这台机器上安装西门子 PC-Access,稍后会在 WinXP 32 位上尝试。我读到一些关于我需要 OPC 服务器或机器上的东西?

第一次与 PLC 交互,请耐心等待:/

I'm trying to interface .NET (C# or VB doesn't matter) with a Siemens PLC S7 200. I can't however get a connection set up. I'm working on a Win7 64bit machine but can't seem to get it working on 32bit either. I got two files:

Interop.OPCSiemensDAAutomation.dll
Siemens_s7-200.dll

From another project which I'm trying to migrate to a newer system. However I get a com exception all the time.

Retrieving the COM class factory for component with CLSID {01704EBD-44B5-11D3-9C09-00105A3DD3AC} failed due to the following error: 80040154.

I've already tried libnodave and can't seem to get that working either. Can somebody provide me with some pointers (please no XKCD humor on that one) to where to look?

I couldn't get Siemens PC-Access to install on this machine, will try on a WinXP 32bit later. I read something about I need an OPC server or something on the machine?

Please bear with me, first time interfacing with a PLC :/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如梦亦如幻 2024-12-03 00:59:35

COM 异常是一种相当常见的错误,表明无法加载 COM 库本身或其依赖项之一。我要检查的一些事情是:

  • COM 库是否在计算机上注册?您可以使用 regsvr32 注册 COM dll。
  • COM 库是否需要计算机上可能没有的其他依赖项?您可以使用 dumpbin /dependents 来解决这个问题。
  • 机器上是否必须安装Siemens PC-Access 软件?您说您无法安装它,这可能解释了为什么无法加载 COM 库。

不幸的是,这是我在解决您的具体问题时可以提供的所有帮助。不过,我可以指出,您可以使用以下产品作为 OPC 服务器并具有与西门子 S7 兼容的驱动程序。这些将是使用西门子 OPC 服务器的替代方案。

我过去使用过这两种产品,而且我很确定我使用其中一款(我不记得是哪一款)与西门子 S7 进行通信。

另外,此处是一个非常好的网站,提供有关在 .NET 中使用 OPC 的信息。

The COM exception is a fairly generic error that indicates that the COM library itself or one its dependencies could not be loaded. Some things I would check are:

  • Is the COM library registered on the machine? You can use regsvr32 to register a COM dll.
  • Does the COM library require other dependencies that may not be on the machine? You can use dumpbin /dependents to figure this out.
  • Does the Siemens PC-Access software have to be installed on the machine? You said that you could not get it to install which probably explains why the COM library could not be loaded.

Unfortunately this about all the help I can provide in solving your specific problem. However, I can point out that you can use the following products which act as OPC servers and have drivers that are compatible with the Siemens S7. These would be alternatives to using the Siemens OPC server.

I have used both products in the past and I am pretty sure I used one of them (I cannot remember which one) to talk to a Siemens S7.

Also here is a really good website with information about using OPC in .NET.

嘿看小鸭子会跑 2024-12-03 00:59:35

我以前曾考虑过做这类事情。如果您尝试直接访问控制器,则可能会遇到各种专有问题。自动化软件公司往往对其协议保持非常严格的控制。如果您只需要数据,那么 OPC 可能是最好的选择。然而,根据我的发现,这也不是免费的。 OPC 基金会 (opcfoundation.org) 有一个 .NET API,我认为其价格在 1-2K 美元之间。

I've looked into doing this type of thing before. If you try to get at the controller directly, you could run into all kinds of proprietary issues. Automation software companies tend to keep a very tight reign over their protocols. If it's only the data you're after, then OPC is probably the best way to go. However, from what I've found, that's not free either. The OPC Foundation (opcfoundation.org) has a .NET API that's available at a cost in the $1-2K range I believe.

江湖彼岸 2024-12-03 00:59:35

再试一次。我已经成功地将libnodave与S7 200、300甚至400和400H(冗余的)一起使用。没有 C# 经验,但它在我的 Linux C 守护程序以及 Delphi 和 Lazarus Windows 应用程序中 24/7(钢铁车间和高炉)工作。如果你做不到,那么准备花费 $$$$ 购买 S7 200 的 OPC 服务器(Kepware、Matrikon...)和 C# 中的 OPC 客户端库。

Try again. I have successfully used libnodave with S7 200, 300 and even 400 and 400H (redundant ones). No experience with C#, but it is working 24/7 (steelshop and blast furnace) in my linux C daemons and in Delphi and Lazarus Windows applications. If you can't make it, then prepare to spend $$$$ on OPC server for S7 200 (Kepware, Matrikon...) and for OPC client library in C#.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文