LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to detect loss of OPC Server connection when using DSC Tags?

I'm using the DSC Module on a new project and I'm pretty impressed so far. The HMI Wizard has saved me quite a bit of time.

My application is configured where the DSC Tags are connected to remote OPC Server Tags.

The issue I'm having is that I cannot detect a loss of the OPC Server when the application is running. Read's of the front panel controls/indicators still return values and the little "connection" icon next them is still green. Even if the connection icon turned red it wouldn't help since the Front Panel is not visible when the main application is running. It is a Sub-VI that's in charge of OPC Data Interfacing. The rest of the application uses the data from the OPC Sub-
VI.

I cannot effect a change on the OPC Servers, so I need a method of detection when the Server is lost on my end.

Any ideas on the best way to do this?

Thanks,

Jim
0 Kudos
Message 1 of 4
(4,513 Views)



Hi Jim,

Ideally, error-reporting and -handling should be the way to handle this. However, if errors are not reported/handled as is sometimes the case with OPC, a quick-n-dirty way to do this would be to check for a "heartbeat" signal from your OPC Server. This could be a boolean tag which toggles On and Off (or a counter ticking). You then read this Tag in DSC in a slow loop using the Read Tag VI (not the front-panel control). And keep track of the Changed? output from this Read Tag VI.

As long as the 'Changed?' output is true, you are receieving data from the OPC Server, and hence it's alive. You may add some deadband logic to wait for a specific period of time before declaring the Server's really dead!

Hope this helps,

K
halid


0 Kudos
Message 2 of 4
(4,513 Views)
Unfortunately I cannot change the server... it is what it is... and it doesn't have a heartbeat.

I found that if I use the "Read Tag" VI in the DSC Module, I can check the tag status. A value less than zero indicates some type of error condition with the tag.

HOWEVER, I can't get that status for tags connected to front panel controls/indicators through the HMI Wizard. If I create a "Datasocket Status" property node off of an indicator connected to a DSC Tag, the status is always ZERO!!!!

If I read the tag using the "Read Tag" VI, the status is truely indicative of what's going on with the Server.

Looks like I can't use the HMI wizard if I want Tag status... quite a let down since the HMI wizard was a very nice time saver.

Any thoughts?

Jim

0 Kudos
Message 3 of 4
(4,513 Views)
You wrote:
"If I read the tag using the "Read Tag" VI, the status is truely indicative of what's going on with the Server."

You only need to read one tag using the Read Tag VI to get the status of the Server. Select a tag which changes most and use it to check the status of the Server. All the rest of the tags can still use the HMI Wizard.

I don't fully know your application details so I maybe missing something.. but I hope this helps.

Khalid


0 Kudos
Message 4 of 4
(4,513 Views)