Professional OPC
Development Tools

logos

faster reads for recursive function

More
03 Oct 2014 07:21 #2378 by support
I am afraid that what you are up to may not be possible. There are basically following things in play:

- The efficiency of the actual implementation. Assuming that the "slowness" does not come from your own processing of browse results, we are left with the OPC server, the connection in between, and the OPC Client part in QuickOPC. If you cannot influence the speed of the OPC Server or the connection to it, we are left with the QuickOPC. I have no indication that our implementation of browsing is significantly slower than that of other OPC clients, or ineffective in a particular way. If you have an information to the contrary, let me know, otherwise I think there is no room for improvement either.

- The general approach taken. There you must evaluate whether you actually do need to browse through the whole thing. But, if the answer is yes, then going from branch to branch and getting a list of sub-nodes is the only way to go: That's given by the design of OPC specs, not by our own decision in the client implementation.


As a side note, this kind of things (globally disabling/enabling alarms) is better handled with OPC specs designed with such requirements in mind. For example, in OPC Alarms&Events, all alarms residing in a hierarchical "area" can be enabled/disabled with a single call and with just identifying the area, without even having to know the individual alarms affected.

A cleverly designed system can achieve similar effect with OPC Data Access as well, but only with an OPC server that is already developed with the requirements in mind. There can be, for example, OPC Data Access tags that enable/disable the whole structure at alarms at will.

BTW. I understand that "hours" do not sound good as a time to start up a system. Can you provide some concrete information? Have you measured the actual speed? How many tags are you able to browse in what time?

Also, even if it were hours, why isn't is possible to go through this step once, store an information e.g. in a file, and cache it for long time? OPC is designed in such a way that while the address space CAN generally change, it is assumed to be generally stable for long periods of time.

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

More
02 Oct 2014 18:24 #2374 by OndrejBlazek

support wrote: There isn't much that can be don to speed up the browse operations, maybe except that if that information is stable, you can gather the structure of the address space just once or on demand or infrequenrly, and store it, so that the browsing does not have to be repeated over and over.


I am writing an application with similar requirements. It is a module to disable/enable OPC tags to provide a SCADA inhibit function (e.g. when a faulty device is causing an alarm to constantly toggle, the inhibit module disables the corresponding OPC tag until the device is fixed). Since I want to be able to disable/enable alarms using wild cards, I need to get the complete AddressSpace, store it and then make queries against the stored AddressSpace (to eliminate the need to browse each time). However, the problem is getting that initial AddressSpace copy. I need something that can get the complete AddressSpace in a matter of seconds or minutes as opposed to hours.

Any suggestions on how to get the initial AddressSpace copy as fast as possible? I am currently using the recursive browse example with the leaf tag read functionality removed (i.e. just storing the tag name but not actually reading the tag). Even just that looks like it will take hours to complete.

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

More
05 Apr 2013 04:12 - 05 Apr 2013 04:13 #1282 by support
There are two basic things being done in the code: The BrowseXXXX calls, and the ReadXXXX calls. There isn't much that can be don to speed up the browse operations, maybe except that if that information is stable, you can gather the structure of the address space just once or on demand or infrequenrly, and store it, so that the browsing does not have to be repeated over and over.

The other part that affects the performance is the reading. Reading OPC items one by one is quite unefficient. Assuming that the branches contain (on average) significantly more than one item, you can gain speed by reading all items in each branch using the ReadMultipleItems or ReadMultipleItemValues method.

I will answer the part about Properties in the separate topic you have started.
Last edit: 05 Apr 2013 04:13 by support.

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

More
05 Apr 2013 04:08 #1281 by support
(here is the original post:)


I have an application that has to parse through the nodes, leaves and branches of an OPC server and put all tag names into a database table. some of these servers are gigantic and I was wondering if you could look at the code which was created utilizing your example and tell me if there is a way to get this to run faster. it takes forever to browse through and opc server with say 30,000 tags this takes over 5 hours.
private OpcLabs.EasyOpc.DataAccess.EasyDAClient easyDAClient1 = new OpcLabs.EasyOpc.DataAccess.EasyDAClient();
 
private void Get_OPCTagsNames(string parentItemID) { var nodeFilter = new DANodeFilter();
 
EasyDAClient.ClientParameters.TurnOffActivationSecurity = true;
 
OpcLabs.EasyOpc.DataAccess.DANodeElementCollection allNodes1 = easyDAClient1.BrowseNodes(IP, serverName, parentItemID, nodeFilter);
 
foreach (DANodeElement nodeElement in allNodes1) { if (nodeElement.IsLeaf) { string display; try { object value = client.ReadItemValue(IP, serverName, nodeElement.ItemId); display = String.Format("", value); } catch (OpcException ex) { display = String.Format("** {0} **", ex.GetBaseException().Message); } OPCTags.Add(nodeElement.ItemId + display); } else { if (nodeElement.IsBranch) Get_OPCTagsNames(nodeElement.ItemId);
}
}
 
}

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

More
04 Apr 2013 18:09 - 04 Apr 2013 19:01 #1279 by arahming
I removed some Items from the Code and yes you can post the original
Last edit: 04 Apr 2013 19:01 by arahming.

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

More
04 Apr 2013 06:34 #1271 by support
I did see your post yesterday, but it appears that you have edited it to "NA" later? I was about to answer with a suggestions revolving around the use of ReadMultipleXXXX. Have you already found your solution? And, would you mind if I put your original post back and reply to it, because it might be a useful reading for other users?

Best regards

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

More
03 Apr 2013 16:31 - 03 Apr 2013 21:49 #1268 by arahming
Last edit: 03 Apr 2013 21:49 by arahming.

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

Moderators: support
Time to create page: 0.297 seconds

      

 Recommend this on Google