问题描述
大家好......
我正在编写ac#应用程序,它与OPC服务器进行通信,以便在标签之间读写数据。
我的问题是每次我想与它通信时都会创建OPC项目。
例如:
OPCServer opcS = new OPCServer();
OPCGroups opcGx = opcS.OPCGroups;
OPCGroup opcG = opcGx.Add(Type.Missing);
OPCItems opcIx = opcG.OPCItems;
OPCItem opcI = opcIx.AddItem(Channel1.Device1.Tag1,1);
我在阅读时这样做和写作..
我知道这是错误的,可能导致我的OPC项目增长。
我需要一些创建OPC集合的帮助,然后我可以查找标签/项目,如果它们已经存在我只是继续,如果不是我将它们添加到集合中。
感谢任何帮助
Hi guys...
I am coding a c# application which communicates with an OPC server to read and write data to and from tags.
My problem is that I create the OPC "items" each time I want to communicate with it.
Eg:
OPCServer opcS = new OPCServer(); OPCGroups opcGx = opcS.OPCGroups; OPCGroup opcG = opcGx.Add(Type.Missing); OPCItems opcIx = opcG.OPCItems; OPCItem opcI = opcIx.AddItem("Channel1.Device1.Tag1", 1);
I do this when reading and writing..
I know this is wrong and can cause my OPC items to "grow".
I need some help with creating an OPC collection, in which I can then look for the tags/items if they already exist i just continue, if they don't I add them into the collection.
Any assistance is appreciated
这篇关于使用OPC集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!