LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Host to RT target, variable discovery

Hello all,

 

I am somewhat new to Real-Time (and to LV in general), and am hoping you guys can point me in the right direction.

 

My company is just starting to use sbRIO and cRIO hardware, and we would like to duplicate an existing host-to-target communications method that we previously developed for non-NI hardware. With this method, a host PC can connect to an embedded target and the target will enumerate a list of variables that are available for read/write. This list includes tagnames, datatypes, permissions, etc. After the host PC discovers what variables are available, it can read/write these variables as needed.

 

The cool thing about this communication method is that the host does not need to know the available variables before connecting to the target. So, if you change the RT code and add/remove variables, the host will "discover" all of the available variables when it connects.

 

Is there any existing NI solution to do this? I have looked at network shared variables, but it seems that both the host and the RT target require a pre-defined library of shared variables to make this work. Also, shared variables seem WAY to slow (I need to update roughly (350) 32-bit variables every 10-15 ms).

 

To clarify, I am not asking how to use low level communications protocols. I can roll my own custom TCP driver if I have to. I am just curious if there is an existing solution that allows variables to be "discovered" from a remote target (and yes, I have read http://www.ni.com/white-paper/12079/en among many others Smiley Happy).

 

Thanks!

0 Kudos
Message 1 of 4
(2,576 Views)

Hi Shansen1,


It sounds like you may need to take a look at PSP primitive access to NSVs, rather than the project-style access I believe you're referring to.  This is also referred to as programmatic access.

 

These functions are available in the Data Communication>>Shared Variable palette; the Search Variable Container primitive should allow you to enumerate variables hosted at a given network location/target by name, library, or data type.

 

Edit: As for speed, I don't see that there would be any issue using that number of variables within that time frame, although you may want to consider bundling some of them into arrays or clusters. Could you elaborate on how you're currently using the shareed variables and what sort of performance you're seeing that's causing concern?

 

Regards,

 

 

Tom L.
0 Kudos
Message 2 of 4
(2,569 Views)

Thanks Tom, that's exactly the kind of feedback I'm looking for. I'll definitely take a look at programmatic NSV access.

 

As far as speed issues with shared variables, I haven't actually run any tests yet! I am only going off of what I have read. Specifically, I saw one document (http://www.ni.com/white-paper/14675/en) that shows very high CPU usage for updating shared variables at only 10 Hz! As I am looking for rates approaching 50-100 Hz, I assumed that shared variables wouldn't work out. I'll write some actual code and do my own benchmark to make sure.

0 Kudos
Message 3 of 4
(2,563 Views)

I did a quick test, and was able to transfer MANY (1000+) doubles at 100 Hz if I pack them all into an array (e.g. all doubles packed into 1 single shared variable) without using too much of the RT CPU. This agrees with your suggestion Tom.

 

However, if I have 100 separate shared variables, I can't update the RT system at more than 5 Hz without bringing the RT system down to it's knees.

 

This is too bad, because it means that I cannot use the "Search Variable Container" function. In other words, if I have to pack all of my variables into a single array to get the desired speed, I loose the benefit of being able to discover what each individual variable is.

 

I am a little bit surprised at the massive performance difference between the two methods. Can anyone shed any light on this?

0 Kudos
Message 4 of 4
(2,543 Views)