LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recovering from loss of datasocket communications

I need to keep a LabVIEW RT system going while the communications line is disconnected, and automatically pick up comms when the line is plugged back in. Are there example VIs out there which do the job?
0 Kudos
Message 1 of 8
(3,506 Views)
Alright, here is a modified version of the RT Datasocket example that ships with LabVIEW RT 7.0. The VI that runs on the RT target has been modified to include a shift register holding the network status--if the network is disconnected the VI stops publishing data to the datasocket and starts repeatedly checking the network connection to see if it has been restored. Otherwise it should work as usual.

Now, the datasocket server (on the host PC) can be stopped and started without stopping the VI running on the RT target. The same modifications can be made to the Host VI so that it will not stop when the network connection is interrupted.

Hope that this addresses your issue!
Darin Gillis
NI - Chief Product Owner - VeriStand
0 Kudos
Message 2 of 8
(3,506 Views)
Next problem, how do I view these examples in LabVIEW 6.1?
0 Kudos
Message 3 of 8
(3,506 Views)
There isn't an easy way to open those examples, you just have to re-write the code in previous versions. Bummer. Here you go, 6.1 style:
Darin Gillis
NI - Chief Product Owner - VeriStand
0 Kudos
Message 4 of 8
(3,506 Views)
Oh actually FYI I just discovered that there is an easy way to take an application that one has written in LabVIEW and change it to a previous version. You can select 'Save with Options' from the File Menu and from there you can save to the previous version (you only get to go back one version; i.e. from 7.0 -> 6.1 is ok, but from 7.0 -> 6.0 will not work).
Darin Gillis
NI - Chief Product Owner - VeriStand
0 Kudos
Message 5 of 8
(3,506 Views)
Thanks Darin. Have run these VIs on my setup and got them communicating OK. When I pull out the comms link briefly, comms re-establishes OK, but on longer interruptions the VI in the RT system stops with error 64. When I added this error into the logic for the faults to be ignored, the RT VI keeps running during the interruption, but the application at the host end does not get updated again, ever. Stopping the host end app and restarting it doesn't help. Also, stopping the datasocket server in the host, restarting it and restarting the host end app doesn't work. Any ideas?
0 Kudos
Message 6 of 8
(3,506 Views)
I do not get that problem on my setup, because I am running LabVIEW RT 7.0. Here was the original bug report from 6.1: If I try to write to a shut-down server from LV, an error 63 is returned. The same action from LV RT results in error 64.

So, that is why you are getting a different error message. Perhaps something else was corrected between LV 6.1 and 7.0 that allows my RT VI to run for several minutes and still reconnect to the datasocket server afterwards. I won't be much help finding a workaround because I'm not running 6.1--but here are a few suggestions:

1. Try just checking for the 64 and not the 63 error on the RT VI... I'm not sure if this will make a difference or not.

2. Try using a Datasocket Write instea
d of a Datasocket Read to check if the connection has been re-established.

3. Use a more complicated mechanism of communication such as TCP/IP or UDP. It seems that it may be better suited to your application--but will require more programming.

4. Perhaps some kind of signal to the RT Box that datasocket communication is active, and to start publishing data to the datasocket server. The signal line could be a TCP/IP message, a physical wire, could be a lot of different things.

5. There's always the 7.0 upgrade...

If the datasocket plan just won't work the way you want it to, you are probably best off using TCP/IP, because it allows for more flexibility. There are plenty of examples shipping w/ LabVIEW indicating how TCP/IP is setup.

Good luck!
Darin Gillis
NI - Chief Product Owner - VeriStand
0 Kudos
Message 7 of 8
(3,506 Views)
Many thanks Darin, I'll keep plugging away!
0 Kudos
Message 8 of 8
(3,506 Views)