LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

delay after binding more than 50 opc vars with DS_OpenEx

Hello,

I am binding a set of about 200 variables by DS_OpenEx from an OPC Server using CVI 8.5.1/9.0.1 , i.e.

loop( iIndex++ ....
DS_OpenEx(chVar, DSConst_ReadWriteAutoUpdate, DSCallback_Val, (void *) Var[iIndex], DSConst_EventModel, DSConst_Asynchronous, &(Var[iIndex]->dsHandleWert) ); )

The binding of the first 30-50 variables takes maybe 3 seconds, but then a sudden delay appears and each binding of one single variable takes a couple of seconds and the process takes even longer the more variables I bind. I tried many things with no improvement - binding in a separate thread, using the polling model instead, calling ProcessSystemEvents() in between the bindings and so on. Running a Thread calling ProcessSystemEvents() as fast as possible seem to help a little bit but not more. A assume that the delay comes from registering callbacks over ActiveX but I see no solution how to handle the problem. Once the binding process has finished the performance is of no problem (I can easily handle 200 updates a second).

If I use the NI ServerExplorer to bind the whole bunch of items it takes only a fraction of a second to do so!

Could I use NetVars instead? Does anybody know how ServerExplorer is made of? Anything to do with ActiveX? Using different CA_InitActiveXThreadStyleForCurrentThread() modes also does not change the behaviour.

Thanks for any ideas or solutions!

0 Kudos
Message 1 of 3
(3,314 Views)

Hi h.baur,

the behavior you observe is caused by the way datasocket connections are established to OPC items. See this KB Do I Need to Create a New DataSocket Connection for Each OPC Item?

Using Datasocket to access OPC items is great for a few tags. However, you will run into performance issues for high tag count. See this thread for more information: DataSocket Open Connection.vi: getting soooo slow as number of items grows...

The Server Explorer establishes one connection with the OPC server instead of multiple. Unfortunately, you cannot do the same using Datasocket. Maybe there is another library available for OPC access that I am not aware of.

 

Regards

 

Peter

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 2 of 3
(3,282 Views)

Hello Peter,

 

thank you for that profound answer about the binding of the opc items via DS. I successfully bound arrays of data which somehow circumvent the lack of grouping but in this special case I cannot change the type of data arrangement which are actually structures arranged by a Siemens S7-200. If I bind the structure I do get an unknown data type, but the binding itself works and the status goes to connected. Do you think I could somehow handle such a structure, meaning to possibliy get a bunch of data (maybe of type void *) and then handle the data myself or is it a must to have a known data type in order to use DS_GetDataValue()? If this is not the case  I probably have to look around for other OPC clients or are you aware of any other library?

 

Thanks Holger 

0 Kudos
Message 3 of 3
(3,265 Views)