LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

using shared variable in CVI

Hi all

 

Am using PSP protocol to communicate between my applications running on Real time targets and host applications. I have created about 10 shared variables or data items using LabVIEW and deployed them in a PC. Am connecting to shared variables from RT target applications (created using LabVIEW) using DataSocket functions, in this case the connection is pretty fast and every thing works fine. My host application is a CVI application, even this uses the DataSocket functions to connect to and send and receive data to the shared variables. The host application is able to send and receive data to the shared variables, My only problem comes while I close the host application and use the DS_DiscardObjHandle to discard the handle, the function never returns, also the application hangs and remains in the memory, this happens when am running the application from CVI, if I run the run the application by double clicking the .exe and close, an exception is thrown which says “A break point has reached, click OK to terminate the program”. Can any one please give some input on this. I did not observe this problem if i open connection to only 1 data item. 

 

Thanks and regards

Arun

0 Kudos
Message 1 of 12
(7,551 Views)
Hi Arun,
 
I actually tried doing this myself -- reading & writing to two shared variables using the datasocket API in CVI. The behavior is exactly as you describe. I am able to call DS_DiscardObjHandle on a few datasocket handles, but then it hangs. The same thing happens regardless of whether I use the PSP protocol, Lookout, OPC, etc. It also hangs with datasocket binding through the UIR. I am currently investigating this issue more with our R&D team.
 
In the meantime, it doesn't sound to me that you have to use the shared variable engine at all. If your real-time and CVI code are both using the Datasocket API, why not just use the datasocket server instead? If all else fails, there's also TCP/IP.
 
I will let you know as soon as I find out more -- hope this helps in the meantime!
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 2 of 12
(7,498 Views)

Hi Charlie

Thanks for the reply. Am glad that you will investigate it, and about using DataSocket server, we are actually using it, but with DataSocket server we have another kind of problem, the DataSocket server hangs when am opening connection from my RT machine. I have 4 RT machines which are connected to DataSocket, so if the there is a connection loss due to any reason, and if all the RT machine try to connect togeather to the server, the DataSocket server does not respond at all and the connection is never established. but the connection speed with same function in CVI is much faster. It will be helpfull if you could give some input on this too.

Regards

Arun

0 Kudos
Message 3 of 12
(7,486 Views)
Hi Arun,
 
We've identified the issue with the DataSocket API -- it extends to Measurement Studio as well. The problem has been reported to R&D (#400AHCKU) for further investigation, and I apologize for the inconvenience. As for the DataSocket server issue, I have a few additional questions:
 
1. I assume the DS Server is hosted on the same machine as CVI -- can you connect to it from LabVIEW when targeted to your host machine (instead of RT target)?
2. Does it only hang when all four RT machines try to connect at the same time?
3. If while it's hanging, can you connect to it from any where else? Like another LV program or CVI?
4. "but the connection speed with the same function in CVI is much faster" What are you referring to here (sorry, I was a little confused)
5. What kind of connection loss terminates all the connections for all 4 RT targets?
6. How do you recover from this situation -- reboot? Abort?
 
Perhaps restarting the DS Server programmatically could help with this. You can do that from CVI or LabVIEW.
 
Thanks for the feedback!
 
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 4 of 12
(7,432 Views)

Hi Charlie

Thanks for the responce, here are the anwers to your questions.

 

1. I assume the DS Server is hosted on the same machine as CVI -- can you connect to it from LabVIEW when targeted to your host machine (instead of RT target)? 
Ans: Yes I can connect from LabVIEW targetted to the host machine and the connection is pretty fast.
 
2. Does it only hang when all four RT machines try to connect at the same time?
Ans:No, it also hangs when i connect only 1 RT machine, the Datasocket server does not respond to mouse events, but the situation is much worse if i try to connect all 4 RT machines.

3. If while it's hanging, can you connect to it from any where else? Like another LV program or CVI?

Ans: When the DataSocket server is hanged or does not respond to mouse events none of the applications can connect to it, not even CVI applications.

4. "but the connection speed with the same function in CVI is much faster" What are you referring to here (sorry, I was a little confused)Ans: In normal condition when I try to connect from LabVIEW & CVI the CVI applications connect much faster to the server, the LabVIEW applications easily take around 2 to 10 seconds per connection.
 
5. What kind of connection loss terminates all the connections for all 4 RT targets?
Ans:switch failure, network failure or if some one just pulls the network cable.
 
6. How do you recover from this situation -- reboot? Abort?
Ans:If network fails all RT machines and CVI application try to connect to the DS server and hangs it, unless i start 1 RT machine only after the other RT machine is connected.

Thanks and regards

Arun

0 Kudos
Message 5 of 12
(7,405 Views)
Hi Arun,
 
Thanks for the additional information. I'll admit that this sounds very strange to me. I tried reproducing it here with LabVIEW 8.0.1 RT & CVI 8.0.1 and an 8186, but no luck. Do you have this problem with any sort of datasocket interaction or is it only this application? Can you post code that demonstrates the problem, so that we can test it?
 
Also, when you say DS Server doesn't respond to mouse events, do you mean the actual DS server application that is running on your host machine? (the little window with number of connections, etc) Or something else that you're doing in CVI?
 
Thanks in advance,
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 6 of 12
(7,360 Views)

Did u try connecting from different PXI machines?. Am connectiong about 10 different dataitems in the DataSocket server. you will observe that to connect all 10 dataitems parallely it takes more than a minute.

The DataSocket server am referring to is the same application which shows the number of processes connected, packets sent,received.

Regards

Arun kamath

0 Kudos
Message 7 of 12
(7,335 Views)
Hi Arun,
 
I did as you said: setting up 10 different datasocket items and it did take longer to connect than just one, but no where near one minute. Are your 10 DS items all coming from one RT box or spread across all four when you see this behavior?
 
I'd like to narrow down if this is a generic DS issue, or if it's specific to the datasocket we have installed on the RT boxes. Do you have another desktop that has CVI or LabVIEW installed? (If not, you could build an exe and run on another computer...) I want to see if windows connecting to windows shows the same problem as RT connecting to windows. You might also try switching which PC hosts the Datasocket server. This test can serve multiple purposes -- is it a particular computer with DSS that has the issue, is it RT, is it a network problem, is it a bug, etc.
 
Thanks in advance for your efforts,
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 8 of 12
(7,268 Views)

Hi Chrlie

Thanks for the reply, I checked on what you suggested, I observed that the connection from a windows machine is much faster than when a DataSocket connection is opened from an RT machine. Also observed that when a RT machine tries to connect to the DS server, the DS server immedietely reflects in the "process connected" box that another process is connected, but in the RT machine the DSOpen function has not returned yet.

I have 10 data items on the DS server, and i connect to all 10 data iems from 4 RT machines. Also the opening of the connection to DS server for different data items is spread in to different VI's.

Regards

Arun

0 Kudos
Message 9 of 12
(7,245 Views)
Hi Arun,
 
I'll ask around here for some ideas on this issue. Did you happen to note if using DS server on another Windows PC had any effect on how the RT targets responded? The Windows PC doesn't have to run a VI or anything -- just the datasocket server.
 
Thanks,
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 10 of 12
(7,198 Views)