09-28-2010 01:13 PM
Hello all,
I am trying to stream data from my RT target (PXI 8196 running LVRT 9.0) to my host using network shared variables. The NSV has a FIFO of about 1500 values. I am writing values to the NSV from a timed loop @ 1000 values/s.
As far as my understanding goes, there should be some mechanism whereby I can read an entire chunk of values on my Host PC (say 1000 values if I poll every 1 second). the whole point is to log the data without losing any values. I have read a few articles which brush on this issue but none mention conclusively how to empty the FIFO of a network shared variable.
If I just read the variable in my slower loop, I only get the latest value which leads to an effective sampling rate of 1 sec.
Where can I find some sample code bzw. can someone post some basic structure to help me through?
Many thanks in advance.
Regards,
Shailesh
09-28-2010
03:50 PM
- last edited on
11-12-2024
12:19 PM
by
Content Cleaner
What version of LabView are you using? They finally released network streaming in LV2010 which would be what you want to do.
There is a good explanation of how it works in this video
http://zone.ni.com/wv/app/doc/p/id/wv-157
Shared variables are great for point by point sharing. They are not good for data streaming like you are trying to do.
09-28-2010 06:12 PM
You could try sending blocks (arrays) of data. Lets say you transmit 10 blocks/s each containing 100 samples.
Then on the PC you could read at a 10hz rate which is doable. Also, you could try setting up your existing system
with a read with timeout set to 1 ms and just spin that puppy as fast as it will go. You may find that it will keep up with the
1000s/s rate.
09-29-2010
04:11 AM
- last edited on
11-12-2024
12:20 PM
by
Content Cleaner
To avoid data loss you have to use the Buffered Network Published Shared Variables
read this first BNPSV
You have to check the timestamp and/or data to avoid multiple reads of the same (last) value if the buffer is empty.
The FIFO you mentioned is probably an SV enabled RT FIFO and ineffective in terms of network traffic.
Hope it helps
Christian
09-29-2010 05:40 AM
Hello All,
many thanks for your replies.
rex: LV2010 is not a possibility right now. But I will keep an eye on it as an option for the near future.
sachsm: I am sending data one set of values at a time. I guess you are suggesting setting up some kind of accumulator and writing that to a network variable? Anyways, I have chosen another approach which seems to work for me.
My Solution: I put the network variable read in a for loop for 1000 entries and read out an array. This method had only one little problem. When the buffer was empty, the last value was being repeated till a new loop iteration could begin. But many thanks to christian w for suggesting variable timestamp comparison. Putting the variable read in a WHILE loop instead of a FOR and wiring the stop condition to a simple timestamp comparison has done the trick. Now I dont lose any data and no data is repeated. Works like a charm.
Many thanks again to you guys!
I have only one grudge and that is that you cannot find example programs for something like this. There must be many people who wish to log data at rates beyond 1 KHz. Am I to assume that everyone else figured this out by themselves? If yes then I have missed a few vital steps of my LabVIEW training 🙂
Regards,
Shailesh
09-29-2010 10:49 AM
Can you post your code?
09-30-2010 09:33 AM
Do you mean the before code or the after code?
Just as a follow up, I have noticed that despite the time stamp comparison, SOME VALUES ARE BEING REPEATED. I can filter them out later offline but I would rather avoid the situation in the first place.
The only explanation I have is that somehow the time stamp is being revised. As a last alternative, I plan to log the time stamps just to see the exact duration between the repeated values. I will keep you posted.
Regards,
Shailesh
04-25-2011 01:28 PM
Hi Shailesh
I wanna do similar stuff from Smart Camera, do u mind sharing your code.
Thanks
Kunal
04-27-2011 02:53 AM
Hello Kunal,
are you using LabVIEW 2009? Do you need code for a specific part or do you want the entire code for logging data from the RT system to the development computer?
Shailesh
04-27-2011 04:40 AM
I have 2010 so any version will work.
Basically I am a newbie and want to learn how to use timed loop, time stamped shared variable, making FIFO.
My project need is to compare current and previous shared variable to see a difference and divide by time diffrence to get velocity.
Right now m using time to wait vi in loop to get data every 400 ms from smart camera. When you said getting repeated data, by chenging this time loop waits for each iteration, repeatation can be avaoided.
Wanna look at the VI for streaming and control of shared varable timing loop.
Thanks for reply