I would like to use programmatic access to manipulate shared variables on a computer and an NI cRIO 9033, but cannot get programmatic access to shared variables on the cRIO.
I have boiled the situation down to a very simple example to try to explain what I am seeing. The shared variables are hosted on the cRIO. I am using the same VI to perform the accesses on the computer and the cRIO.
On the computer, access to the shared variable via a shared variable node and programmatic access both work.
On the cRIO, access to the shared variable via a shared variable node is functional, but programmatic access to the shared variable does not work.
The error code received when trying to to a Read Variable or Open Variable Connection on the cRIO to the shared variable is -1950678943.
The error text reads "Timed out while attempting to open a connection to the variable."
I'm quickly becoming confused as to why the cRIO should have trouble reading a shared variable programmatically that is hosted on itself.
The web searches I have done haven't turned up such a simple scenario causing this error, so I'm wondering if I've stumbled into a beginner mistake.
I have attached the code to this post, so if someone could take a look it would be much appreciated.
Back Panel of the VI for accessing the shared variables:
Result of running VI on the computer (all shared variable accesses - via shared variable nodes or programmatic access work):
Result of running VI on the cRIO (all attempts at shared variable programmatic access do not work):
An update. I tried some suggestions given to me in this Stack Overflow thread, but it's still not possible to access the shared variable programatically from the cRIO.
I have attached the update source code. Please take a look!
I'm running out of ideas and it seems strange to not be able to programmatically access shared variables from the cRIO that are hosted on the cRIO.
Updated block diagram:
Result of running VI on computer (shared variable access via shared variable node and programmatically work):
Result of running VI on cRIO (shared variable access via shared variable node works, programmatic access does not work):
Thanks for the link, scotia673. I had checked this post out previously. It seemed to be discussing another issue, namely that the Read Variable VI seemed to not honor the timeout specified for it.
Does anyone have any ideas as to how to accomplish this (seemingly) simple task of programmatic access to shared variables hosted on a cRIO from the same cRIO?
I've recently seen a similar issue where setting the cRIO to a static IP resolved everything. Are you able to try this? To my knowledge this has only happened on a single specifc network. Can you tell me about what kind of router you're using? I'm interested to know if perhaps there's some overlap between your issue and the one I'm working on.
Eric_LV, thanks for taking the time to reach out. I am using a static IP for the cRIO. The router I'm using is a Netgear N600. To be clear as I said above, shared variable node access worked, but programmatic access did not. Do you have any pointers where I would look to try to troubleshoot this and allow me to use it in the future?
Have you tried changing the shared variable path to be an IP address rather than a DNS/target name? I've had problems before with RT not being able to do DNS lookups.
Trying to use an absolute IP in the address for the variable or using localhost might get you different results. Can you ping the cRIO using it's DNS name? The network I'm working with has some irregularities in it's DNS server that we think may be related to this issue. It would be interesting to see if you have similar issues with your DNS server. We're also having the same situation where static variable nodes work and dynamic ones do not. So it does look like we're seeing the same thing, or close to it.
Eric: As far as I know, this is a problem with either:
- If using a static IP, you need to configure a DNS server IP
- I think that even then, sometimes LabVIEW RT just doesn't do DNS lookups properly (I've had the reverse lookup of the IP to String function timeout on myRIOs with a configured DNS server)
Bumping this thread because I have exactly the same problem on LV2015 - cRIO 9035, as no solution were offered.
Anyone from NI could give an explanation as to what might be the problem?
Thank you for your help.
Edit: just a few more info about my program.
0) I use "localhost" in my url name.
1) if I run my main program as a vi, it works only if my subvi in charge of getting the SV Reference is in shared clone reentrant execution mode
2) if I built a rtexe, it doesnt work in any execution mode.
here is a screenshot of my subvi: