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.

Only 100 nodes returned when browsing

More
07 May 2010 11:37 #18 by support
From: Zbynek Zahradnik
Sent: Thursday, May 06, 2010 8:22 AM
Subject: RE: Data.NET Browse Leaves

R.,

the difference when using one large “chunk” would be that more memory needs to be allocated at once temporarily, and that the operation cannot be stopped “in the middle” – between the chunks (which isn’t currently supported anyway).
This OPC-DA feature (ability to brose by smaller chunks) is not projected to QuickOPC.NET (OPCData.NET) API, by design, to make things simpler for the app coder. What this means is that however large the “chunks” are, the component will attempt to enumerate them all, and needs to create in-memory objects for all the nodes, because it needs to return a full Dictionary of them. The total size of these objects is, at minimum, comparable to the size allocated temporarily for the large “chunk”. Therefore, I think that the customer will not see noticeable difference. If he gets into problems (allocated memory, or processing time), they will be due to the sheer number (10,000) of the tags. Most OPC server I have worked with have realized that with large number of tags, it is always advisable to “structure” them in some way with sub-branches – so, you can have millions of tags, but it’s not a good idea to have them all under one parent node.

Best regards,
Zbynek Zahradnik

From: R.
Sent: Wednesday, May 05, 2010 5:31 PM
To: Zbynek Zahradnik
Subject: RE: Data.NET Browse Leaves

Zbynek,

Thanks for the quick turnaround on this. I just got off the phone with the customer. He ultimately needs to be able to browse for about 10,000 tags. Do you think he will see significant performance issues if he is trying to browse all 10,000 in one chunk? Otherwise, he is okay with the workaround you presented.

Thanks,
R.



From: Zbynek Zahradnik [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: Wednesday, May 05, 2010 2:51 AM
To: R.
Subject: RE: Data.NET Browse Leaves
R.,

I can confirm that there is a bug in the OPC client code which causes this. It appears only when all following conditions are true: 1) The OPC server supports OPC-DA 3.0 (IOPCBrowse::Browse(…)), 2) the OPC server supports continuation points, and 3) the OPC server decides to return FALSE in *pbMoreElements when returning a continuation point (which is a valid behavior, too).

The problem is in QuickOPC-COM (OPCData-COM) up to current recent build (5.00.1182.1) and QuickOPC.NET (OPCData.NET) up to current recent build (5.00.1182.1). I have fixed it now, so it will be OK in any subsequent builds.

Please let me know if your customer can use the workaround for some time, or whether a new build is required right now.

Best regards,
Zbynek Zahradnik

From: R.
Sent: Tuesday, May 04, 2010 9:50 PM
To: Zbynek Zahradnik
Subject: RE: Data.NET Browse Leaves

Hello Zbynek,

I have tried this with [Software Toolbox] TOP Server and [Software Toolbox] NDI Simulation Server. Both will get all the tags when we set the BrowseNodesChunk higher than the tag count. Without this statement, it does cut it off at 100. The code I am using is below.

****************************
Try
Dim EasyOPC As New OpcLabs.EasyOpc.DataAccess.EasyDAClient

Dim Items As IDictionary
Items = EasyOPC.BrowseLeaves("", "NDI.SimulationSvr.1", "src")
For Each Key As Object In Items.Keys
Dim Item As OpcLabs.EasyOpc.DataAccess.DANodeElement = Items.Item(Key)
With Item
ListBox1.Items.Add(Item)
End With
Next

Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message.ToString & ex.InnerException.ToString)
End Try
******************************

W. also tested on his machine with this code:
*******************************
try
{
//create the OPC Client object
OpcLabs.EasyOpc.DataAccess.EasyDAClient easyDAClient1 = new OpcLabs.EasyOpc.DataAccess.EasyDAClient();
///OpcLabs.EasyOpc.DataAccess.EasyDAClient.ClientParameters.BrowseNodesChunk = 300;
string parentItemID = "src";
//Browses the Channel_1.Device_1 branch of the Server for leaves or tags. You can change the parentItemID parameter to Browse other locations for leaves.
IDictionary<string, OpcLabs.EasyOpc.DataAccess.DANodeElement> allTags = easyDAClient1.BrowseLeaves("127.0.0.1", "NDI.SimulationSvr.1", parentItemID);
foreach (KeyValuePair<string, OpcLabs.EasyOpc.DataAccess.DANodeElement> tag in allTags)
{
listBox1.Items.Add(OpcLabs.EasyOpc.DataAccess.EasyDAClient.ClientParameters.BrowseNodesChunk);
//if the value is a branch add it to the listbox.
if (tag.Value.IsLeaf)
{
//add the fully qualified item id
listBox1.Items.Add(string.Format("{0}.{1}", parentItemID, tag.Key.ToString()));
}
}

}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message.ToString());
}
************************************
R.


From: Zbynek Zahradnik [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: Tuesday, May 04, 2010 3:02 PM
To: R.
Subject: RE: Data.NET Browse Leaves
More to this:

The number ‘100’ is likely to be equal to the default “browse nodes chunk”, i.e. how many nodes the component enumerates from the OPC server at a time. If there are more items, the component is supposed to get next chunk; the number should have performance implications only.

If only the first chunk is retrieved while there are more nodes to be enumerated, it is either a bug in the OPC server, or a bug in the client code in OPCData.NET. For this I’d like to have it reproduced here and analyze exactly what is happening under the hoods. It also depends on whether OPC 1.0/2.0 or 3.0 browsing interfaces are supported by the server, and if both are, which interface is selected by the client.

There is, however, a likely workaround: Simply have the user code set ClientParameters.BrowseNodesChunk property of EasyDAClient object to a number that is large enough to provide all nodes in one chunk.

Best regards,
Zbynek Zahradnik

From: Zbynek Zahradnik
Sent: Tuesday, May 04, 2010 6:35 PM
To: R.
Subject: RE: Data.NET Browse Leaves

R,

Which OPC server have you tested/the customer tested with?

Thanks
Zbynek Zahradnik

From: R.
Sent: Tuesday, May 04, 2010 6:15 PM
To: Zbynek Zahradnik
Subject: Data.NET Browse Leaves

Hello Zbynek,

A customer brought up an issue with using the OPCData.NET to browse tags through the code. It appears that the browseleaves call will only bring back a maximum of 100 elements. I have tested this and was able to reproduce this behavior. Any help would be appreciated.

Thanks in advance,
R.

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

Moderators: support
Time to create page: 0.071 seconds