From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rt shared variable from cRIO to computer without loss

Hi

So i have a cRIO 9030, and its going to make some measurements for me, and i originally wanted to send them in to a database, but since database connectivity dose not work on RT I need to get the data though another computer.
I can´t afford to lose data, so I though make a queue on the cRIO where my data is filled in and then share one variable, that variable I then want to read from a Windows Labview and send to my database. But the cRIO needs to make sure that the data have bin sent to the Windows Labview successfully. First I thought I make a RT Fifo share and I would get a error if I fill it, but that is not the case.

I have made a small example where the cRIO makes data with a 10 timers higher rate than the Windows reads, meaning I would get an error if I try to fill it, or so I thought.

Any ideas on how to get data safe from my cRIO?

project.pngvis.png

0 Kudos
Message 1 of 18
(2,994 Views)

Instead of a shared variable, use a Network Stream.  It is a lossless communication using TCP.

 

In your RT, you will want to use a seperate loop that handles the stream and use a RT FIFO to send data to that loop to be sent out.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 18
(2,987 Views)

but then i need a defined target from my cRIO.
And i have the posibility to lose network for periodes of time. I can use a DNS name for the target, but how offen dose the cRIO make a dns lookup? in case that changes.

0 Kudos
Message 3 of 18
(2,980 Views)

Shared variables are intended for tag-oriented communication and are not lossless, and there is no way to make them lossless (just less lossy). If you want to learn more, I'd take a look at CH 2 here: http://www.ni.com/compactriodevguide/, at least the first few pages.

 

Its also not entirely correct to say that cRIOs don't support databases. There are a couple of options available for VxWorks cRIOs and many many more for Linux RT crios. Your 9030 is a linux computer on an intel processor--theres definitely a lot that can run on it. On the other hand setting up all the sw yourself is a relatively advanced task, so if you already have a db set up on your windows machine then you're going in the right direction and as he^^ said, use streams. If you're curious and want to learn more about things you can do on your cRIO, there is a community here: https://decibel.ni.com/content/groups/ni-linux-real-time. There is also a tutorial specifically for adding postgresql to a target: https://decibel.ni.com/content/docs/DOC-30308.

0 Kudos
Message 4 of 18
(2,971 Views)

That is another option that i have thought of, install a local database like mySQL on the cRIO and make a merge from the main database. The Main database i MSSQL2012 btw the there may be some problems there.
its on the more advanced side i give you that, and it is a option but i want the solution also to be for a " not familiar with linux " solution since others than me have to work on it.

 

The network streams is target oriented, i there have to have the RIO to stream to a target, and not having my windows computer fecting the data. but if i could see if the data of my shared variable was read i would be able to make a simple solution. make a set of data ready, wait for pick up, and make new set ready from the measurement queue.
Then i do not need to worry what computer that picks up the data, any computer can do it ( closed network btw ).

0 Kudos
Message 5 of 18
(2,963 Views)

You could create a TCP connection to make some basic commands and use that information to create the stream.  It would not be that difficult to set up and then you have the computer target freedom since the cRIO is a listener (waits for somebody to connect to it).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 18
(2,959 Views)

ahh like a listen for request style...that coud work.

or i could make a shared sting, and in that sting write where the RIO needs to try to stream data to:-)

then if my target changes then the new target writes to the shared variable and the RIO changes its stream.

0 Kudos
Message 7 of 18
(2,953 Views)

I really don't like the shared variable idea here.  What happens if you set that variable with one computer and then another computer changes it at "the same time" and overwrites the variable?  Who do you think should get the stream?  There should be a verification for "ready to stream".  Making that TCP connection is a way of locking out other computers from the stream, kind of like a semaphore.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 18
(2,949 Views)

yes true. a shame its not posibel to share queues over the network.

 

but could i not also stream a sting to the RIO? like if i send a request for a 100data blocks then the RIO would send 100 insted of sending only one at the time.

0 Kudos
Message 9 of 18
(2,943 Views)

If you are getting to that point, you might as well not use the network stream.  Just use the STM library and do all of the transmitting directly over the TCP/IP.  The Network Stream is more for a continuous stream of data.  If you are just requesting packets, then use TCP/IP.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 18
(2,939 Views)