Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Can't Browse Certain Nodes

More
03 Oct 2014 07:47 - 03 Oct 2014 07:47 #2379 by support
Replied by support on topic Can't Browse Certain Nodes
I am also confused as to the purpose of what you are trying to do.

Yes, the first part does what you have described, but because you give it a precise name of the element you are looking for (and not any wildcards), it returns just one element. In some special scenarios this may be useful, but generally not - why would you want to use browsing just to verify a presence of something? You can just do whatever operation you intend to do, and check whether it has succeeded or not.

The second part: This maybe just a terminology issue, but it does *not* read a property of the SWD00 branch. It just lists all sub-nodes under the "Alarms.SWD00" branch. OPC properties are accessible using other methods we have.

The third part: Totally unclear, sorry. You say that it does what is expected, then in the next sentence ("on my server"?) you say it does not. You also say "The code tries this using both a dot and a slash" but the actual code posted only uses a backslash.

All browsing methods require you to specify the branch whose contents you want to explore. This can be done either

- using ItemID: They are strings that come from the server, and their format is completely dependent on the server. Sometimes they use dots as separator, other times something else, or they may not use anything at all: The ItemID may look unrelated to the position of the node in the tree. If you are writing a code that should work with any OPC server, you must not make any assumptions about ItemIDs (beside a fact that an empty string represents a root), and must not try to "construct" them yourself - the only ItemIDs you can use must come directly from the server itself (from the browsing methods). Obviously, if you are writing a solution that is dedicated to certain OPC server and possibly even certain server configuration, you may decide to write your code so that it creates the ItemIDs itself.

- using browse paths: They represent the "short" names of items, coming from the root, and proceeding to the node you want to represent. Good thing about browse paths, as opposed to ItemIDs, is that the "path", i.e. the individual node names, can truly be obtained from the browse path, or vice versa - the browse path can be constructed from such names. The browse path can be represented as a sequence of strings (the short node names) - e.g. in a List<string> object, or it can be represented by a single string that contains the whole path. In such case, the elements are separated by a FORWARD slash ("/", not a backslash as in your code), and for absolute browse paths, it also has to START with a forward slash. What's more, you cannot just put it in place of ItemID and expect it to be magically recognized as being a browse path. If you truly want to use a browse path to specify a node, you should create a DANodeDescriptor object, and either pass the BrowsePath object to its constructor, or set its BrowsePath property after creation. The BrowsePath object can be created from individual elements (short node names), or from the full string.

Please study the Concepts document for more info about ItemIDs and browse paths.

Best regards
Last edit: 03 Oct 2014 07:47 by support.

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

More
02 Oct 2014 20:24 #2376 by support
Replied by support on topic Can't Browse Certain Nodes
Please post the error messages, and InnerExceptions, that you are getting in the last two cases.

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

More
02 Oct 2014 19:51 #2375 by OndrejBlazek
I am using an ICONICS Alarm (OPC) Server and I am having troubles browsing some of the nodes. Here is a piece of code that I wrote to illustrate my issue:
            DANodeElementCollection nodeElementCollection = null;
            DANodeFilter nodeFilter = null;
            try
            {
                // Confirm SWD00 Branch Exists In Alarms
                nodeFilter = new DANodeFilter(DABrowseFilter.Branches, "SWD00", "", OpcLabs.EasyOpc.VarType.Empty);
                nodeElementCollection = new EasyDAClient().BrowseNodes("127.0.0.1", ServerClass, "Alarms", nodeFilter);
                foreach (DANodeElement item in nodeElementCollection)
                {
                    System.Console.WriteLine("Branch: " + item.ItemId);
                }
                // Read Property Of SWD00 Branch
                System.Console.WriteLine("Tag Value: " + EasyDAClient.SharedInstance.ReadItemValue("127.0.0.1", ServerClass, "Alarms\\SWD00.Area_Active"));
                // Read Property Of Branch In SWD00
                System.Console.WriteLine("Tag Value: " + EasyDAClient.SharedInstance.ReadItemValue("127.0.0.1", ServerClass, "Alarms\\SWD00\\COMM.Area_Active"));
            }
            catch (Exception x)
            {
                System.Console.WriteLine("Error: " + x.Message.ToString());
            }
            try
            {
                // Read All Inside SWD00 Using . Separator
                nodeFilter = new DANodeFilter(DABrowseFilter.All, "", "", OpcLabs.EasyOpc.VarType.Empty);
                nodeElementCollection = new EasyDAClient().BrowseNodes("127.0.0.1", ServerClass, "Alarms.SWD00", nodeFilter);
                foreach (DANodeElement item in nodeElementCollection)
                {
                    System.Console.WriteLine("Tag: " + item.ItemId);
                }
            }
            catch (Exception x)
            {
                System.Console.WriteLine("Failed Using ItemId Notation: " + x.Message.ToString());
            }
            try
            {
                // Read All Inside SWD00 Using \ Separator
                nodeFilter = new DANodeFilter(DABrowseFilter.All, "", "", OpcLabs.EasyOpc.VarType.Empty);
                nodeElementCollection = new EasyDAClient().BrowseNodes("127.0.0.1", ServerClass, @"Alarms\SWD00", nodeFilter);
                foreach (DANodeElement item in nodeElementCollection)
                {
                    System.Console.WriteLine("Tag: " + item.ItemId);
                }
            }
            catch (Exception x)
            {
                System.Console.WriteLine("Failed Using BrowsePath Notation: " + x.Message.ToString());
            }
        }

The first part of the code browses the Alarms browsepath looking for a branch called SWD00.
The second part of the code reads a property of the SWD00 branch.
The third part of the code reads a property of a branch (COMM) in the SWD00 branch.
Lastly the code browses for all nodes in the SWD00 branch. The code tries this using both a dot and a slash as the separator. ItemId seems to return parts separated by a dot while reading tags seem to use slashes.

On my server, the first part of the code finds the SWD00 branch (expected).
On my server, the second part of the code reads the value of the property (expected).
On my server, the third part of the code reads the value of the property (expected).
However, on my server, the last part of the code fails with a OPC-DA operation failure regardless of which separator I use. I don't understand why since the SWD branch obviously has contents (since we read one of its properties and branches prior to the browse).

Does anyone have some ideas why the browse is failing? I am able to browse the name space with a third party client (and obtain the entire address space much quicker than what it would take using the recursive method using EasyDAClient).

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

Moderators: support
Time to create page: 0.059 seconds