Professional OPC
Development Tools

logos

Browsing AddressSpace Using DABrowseFilter.Flat

More
02 Oct 2014 16:59 #2373 by OndrejBlazek
Thank you.

I actually wrote a variant of the recursive version myself, before I saw the other post, but found it to be very slow on a reasonably sized AddressSpace. I am trying to play with the NodeFilter options to see if I can get faster results.

In any case, I do appreciate the clarification that the DABrowseFilter.Flat requires server side support which is often not implemented.

Please Log in or Create an account to join the conversation.

More
02 Oct 2014 16:49 - 02 Oct 2014 16:49 #2372 by support
You are not doing anything wrong, but you are relying on a server functionality that is optional, and very rarely supported.

The "flat" browsing is an option that is simply passed onto the target OPC server (if at all possible - depends on the specs implemented - see below). There are, however, several issues with it:
  • It exists in OPC Data Access 1.0. It does not exist in OPC Data Access 3.0 specification, which has completely different browsing methods. I would have to check whether it exists in OPC Data Access 2.0, but most likely it does not either.
  • Servers that implement it are extremely rare.
  • There are some vague points in the OPC spec about how it should actually work.

Rest assured in knowing that all other OPC server that you see and that show you the hierarchical tree do *not* use the "flat" browsing. They all call the OPC browsing methods repeatedly and recursively, on various branches as needed. The other post you have already located ( www.opclabs.com/forum/browsing/1265-are-the-browsexxx-methods-recursive#2370 ) contains an example of recursive browsing code.

Best regards
Last edit: 02 Oct 2014 16:49 by support.

Please Log in or Create an account to join the conversation.

More
02 Oct 2014 15:56 #2369 by OndrejBlazek
We are doing some testing with ICONICS's SimulatorOPCDA OPC Server. We have used this server with other products with no issues. The module that I am writing needs to collect certain tags from the entire AddressSpace.

The client.BrowseNodes() function seems to only return tags for the current location in the AddressSpace (and not any tags in branches from the current AddressSpace location). Obviously one could recurse the AddressSpace by repeating the BrowseNodes() for each branch but the BrowseNodes() method can take a NodeFilter which, among other settings, allows the use of DABrowseFilter.Flat.

According to the documentation this option "Return leaves only, flattening the address space into a non-hierarchical list.". This seems to imply that by using the DABrowseFilter.Flat one should be able to get all Leaves in a single browse.

To test this, I built some very simple code:
EasyDAClient opc = new EasyDAClient();
DANodeFilter nodeFilter = new DANodeFilter(DABrowseFilter.Flat, "", "", OpcLabs.EasyOpc.VarType.Empty);
DANodeElementCollection nodeElementCollection = opc.BrowseNodes("127.0.0.1", "ICONICS.SimulatorOPCDA.2", "", nodeFilter);
foreach(DANodeElement element in nodeElementCollection)
{
    System.Console.WriteLine("Tag: "+element.Name + " (" + element.BrowsePath + ")");
}

When I try the above code, it does not return any results. When I change the NodeFilter to DABrowseFilter.Any or DABrowseFilter.Leaves then I get results.

Can some explain to me what I am doing wrong? :huh:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.159 seconds

      

 Recommend this on Google