Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSocket/OPC issues

Hello everybody,

I have two major issues with the DataSocket ActiveX control and I would like to hear what solutions others have found. I'm using it in VB6 applications and will eventually use it in VB.NET applications.

The first and biggest problem is the fact the control does NOT return if I pass a URL to a server (machine or OPC server) that does not exist (or down). I haven't found any way to fix this and it is a really annoying bug because it totally sweeps control away from our application. In many cases the application simply cannot afford to stop running because of the OPC server.

Another equally bad problem we have is that whenever the AccessMode is set to write, writeAutoUpdate or readWriteAutoUpdate, the DataSocket OVERWRITES
the current value upon connection. The problem is really bad with write and writeAutoUpdate because the value sent by the DataSocket is 0 which in most cases compromises the integrity of OPC server and other clients connected to it. For writting we are forced to use ReadWriteAutoUpdate, but this still pushes a value (the same that was read a split second before) which can (theorically) overwrite a value as it is updated.

I would like to hear how others are dealing with those problems in a production context with, for example, unattended data collection programs.

Thanks alot,

Alex.
0 Kudos
Message 1 of 4
(6,095 Views)
Hello


In most cases, you should be able to track any errors by using the OnStatusUpdated event. It should indicate whether the url was valid or not. If the opc server goes down while you were talking to it, to re-connect, try to connect to an empty URL and then try to connect to the actual URL.

This KB describes how to prevent datasocket from reseting the value to 0 when a connection is made. Its in C, but the same thing applies to VB. You need to set the 6th bit for the datasocket connection parameter.

Hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
Message 2 of 4
(6,095 Views)
Thanks alot for the KB, I'll give it a try!

As for the other problem you are right that if the OPC server itself is down or does not exist, then the status will inform me of the problem.

On the other hand, if the *host machine* is down or does not exist, then the Connect function simply never returns. If the host is rebooting for example, our client detects the connection loss, but when it attemps to connect it freezes the application.

Alex.
0 Kudos
Message 3 of 4
(6,095 Views)
I've got some new information on these issues. First off I have tried the fix for the initial write and it works. I strongly suggest to the NI team that this flag be documented more throughly. I would even suggest that it should be set by default.

As for the connection problem I have found another troubling issue. Not only does my application NOT get a status change when the connection with the server is lost but when I close the application it crashes VB with a GPF. This is not good...

Meanwhile we're evaluating another OPC client package as an alternative to the DataSocket. Needless to say we're very disapointed that it comes to that but we've got a plant to keep running and the DataSocket does not currently offer the solidity required to acheive our m
andate.

Alex.
0 Kudos
Message 4 of 4
(6,095 Views)