本文介绍了从Opc.Da客户端连接后,如何从OPC-DA中获取项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Opc.Da客户端连接后,如何从OPC-DA中获取项目?

我有此列表来浏览我的Opc.Da服务器的根元素:



字符串 _hostName = localhost;
string _serverName = OPC.SimaticNET ;
string urlstring = string .Format( opcda:// {0} / {1},_ hostName,_ serverName);
服务器s = 服务器( new Factory(), URL(urlstring));
s.Connect();
ItemIdentifier itemId = null ;
BrowseFilters filters = new BrowseFilters(){BrowseFilter = browseFilter.branch};

// 这里我还使用{BrowseFilter = browseFilter.item}
// 但在那个时间元素的值= null
浏览位置= new BrowsePosition(itemId,filters);

BrowseElement [] 元素 = s.Browse(itemId,filters, out position);





如何浏览每个元素的子元素?意味着我如何浏览每个元素的项目?



请给我一些解决方案!!

解决方案


How brows Items from OPC - DA after connecting from Opc.Da clients?
I have this listing to browse the root elements of my Opc.Da server:

            string _hostName = "localhost";
            string _serverName = "OPC.SimaticNET";
            string urlstring = string.Format("opcda://{0}/{1}", _hostName, _serverName);
            Server s = new Server(new Factory(), new URL(urlstring));
            s.Connect();
            ItemIdentifier itemId = null;
            BrowseFilters filters = new BrowseFilters() { BrowseFilter = browseFilter.branch };

//Here I also use {BrowseFilter = browseFilter.item}
//but in that time value of  elements=null
            BrowsePosition position = new BrowsePosition(itemId, filters);
           
            BrowseElement[] elements= s.Browse(itemId, filters, out position);



how do I browse the children of each element ? Means how do I browse the item of each element?

pls give me some solutions!!

解决方案


这篇关于从Opc.Da客户端连接后,如何从OPC-DA中获取项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 20:57