LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO shared variables not communicating

Hey everybody,

 

I am using a myRIO and want to communicate between laptop and RT with network-published shared variables (SV). Now I have a problem and many questions.

 

The problem:

In my project under "my computer" I have 2 libraries with one SV each. To test them I want to send "Hello world" from the RT as a string via an SV. Additionaly I have a boolean SV to stop the loop on the RT. Now I get some errors and no value is read.

On "my computer": -1950679034

Shared Variable in WLAN Commu Test.vi<APPEND>
This error or warning occurred while reading the following Shared Variable:
\\My Computer\Test String\Test String
\\172.16.17.40\Test String\Test String

 

On the RT: -1950679035

Shared Variable in Host WLAN Commu Test.vi<APPEND>
This error or warning occurred while writing the following Shared Variable:
\\My Computer\Test String\Test String
\\172.16.17.40\Test String\Test String

 

I have to mention here, that the tagsrv.exe is running and the NI variable engine service is running, too. It is also interesting, that the IPs mentioned in the warnings, are not the ones, the SVs are deployed to. The IP of myRIO via USB is 172.22.11.2. The one mentioned is from a previous test via WLAN (the same errors occured). At the moment, I try to communicate using USB!!

 

General questions:

- Is there a limit for the amount of SVs on the myRIO (I will need approx. 10 SVs some filled with clusters, some with booleans etc...)?

- As I will have to work with WLAN are there any additional points I should think about?

- Should all the libraries of the SVs placed in my project under "my computer"?

- Should I make one library for all SVs or keep one SV with one library?

- Can I set the scan engine under the properties of my RT to the following values: Scan engine 2ms, network publishing 10ms?

 

SVs.PNG

 

hope you can help me.

 

kind regards

 

Slev1n

 

0 Kudos
Message 1 of 7
(3,810 Views)

Short update:

 

If I put the SV which is written to on the RT under the RT in the project, I can read the SV with the VI under "my computer". Very complicated...I try it again.

 

Value is written to the SV. Where? --> On the RT.

Where is the SV library? --> On the RT.

Can you read the SV from the host? ---> Yes

0 Kudos
Message 2 of 7
(3,799 Views)

Ok, here's my input:

 

- Is there a limit for the amount of SVs on the myRIO (I will need approx. 10 SVs some filled with clusters, some with booleans etc...)?

If there is a limit, it's probably more of a theoretical one than a fixed limit (e.g. 10, 20, 100) - you're more likely to run into performance issues before the limits become a problem. The white paper linked below gives lots of information on the performance/limitations of the Scan Engine.

 

- As I will have to work with WLAN are there any additional points I should think about?

WLAN introduces more network latency and is less reliable than a wired connection. You'll need to think about what happens if you lose connection. You'll also need to make sure your network configuration (e.g. firewalls) allows you to communicate between the two on the appropriate port.

 

- Should all the libraries of the SVs placed in my project under "my computer"?

No, they should be placed under the RT target. The reason for this is that you would probably want your myRIO to run headlessly if the computer is disconnected (e.g. poor WiFi, restarting your PC), if the SVs are on the computer, then reading/writing to them will fail while the connection to the PC is down.

 

- Should I make one library for all SVs or keep one SV with one library?

It doesn't matter, whatever makes logical sense for you. I tend to keep all SVs in one library but if I had discrete functional areas or I wanted to use parts of the SV libraries in different projects then I would keep them separate.

 

- Can I set the scan engine under the properties of my RT to the following values: Scan engine 2ms, network publishing 10ms?

According to the white paper on SV performance, you can set the publishing period to 10ms and I think the Scan engine rate is 1kHz (not sure on that...)

 

Note that SVs are not really suitable for transferring 'packets' or 'messages' of data like sending commands. They are good for getting the latest value of a signal/variable but can't really be used for command/response type of communications (not without implementing some handshaking - which would be slow).


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 3 of 7
(3,791 Views)

Thanks for the quick answer Sam,

 

some more infos about my application:

FPGA:

I measure some data and process it on my FPGA. So the results of this processing do not reach a higher "result rate" than 200Hz as I am downsampling a lot on the FPGA. I am also reading some NTCs a valve which can be opened or closed and two sensors are read via I2C. The only parts I am controlling is a heater and a pump, both not time critical at all.

 

RT:

Here I read all the data over indicators, only the I2C bus is read via DMA FIFO (I have some ressource bottleneck 🙂 ). The RT is in a state machine which only changes its state if I change an important parameter on the host or when I stop it. So there are only rare occasions when I send a cmd from host to RT to change the state and they are not time critical.

 

Host: State machine. Sends parameters, reads values, saves values.

0 Kudos
Message 4 of 7
(3,781 Views)

The slow response isn't what makes the SV work, or fail, as a message.  It's the lossy method in which SVs work.  You aren't reading them once.  You're reading them whenever you get to them.  This may happen once.  It may happen several times.  It might not happen at all.  If the SV value changes more than once between reads, you'll miss the first value change.  If it doesn't update for several reads, you'll perform the action multiples times even though it was only requested once.

 

Did you get the SVs working?

0 Kudos
Message 5 of 7
(3,763 Views)

Hey natasftw,

 

yes they worked, but it was only sending "hello world" all the time :). I also noticed an error with green status periodically send by the SV. Maybe it told me that there was no new value.

 

 

Back to the topic:(a few new questions and thoughts of mine)

What is the alternative?

--->Are RT-FIFOs a good choice?

 

It would not be a big problem, if I miss one or two values per hour running the system, but I was already thinking about what happens, if the writing operation to an SV happens two times before reading?

---> So I implemented buffers, 1kB-8kB.

 

Can the SVE read/publish parallel or is it checkig the SVs one after another? ---> reducing the amount of SVs...

 

Any advice would be welcome 🙂

 

kind regards

 

Slev1n

 

0 Kudos
Message 6 of 7
(3,743 Views)

If you want lossless data transfer, you need to use FIFOs to transfer data from FPGA to RT and then use a streaming communication method from RT to PC - this could be network streams or TCP/IP. If you're only interested in the latest value, SVs are fine.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 7
(3,729 Views)