LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save file duting streaming from c-rio to host pc

I wrote an application that acquire samples from nine analogue sensor using fpga. By the fifo dma streaming i send this samples to c-rio. Now i'd like to stream this samples to host pc and save it on my hd in tdms format. I've tried by Network shared variable, but the while loop on Host pc is not syncronous with that on c-rio and i save the same samples more time. There's a way to create a buffer between c-rio loop and host pc loop? Thanks for suggestions.

Francesco

0 Kudos
Message 1 of 9
(3,846 Views)

Hello Francesco 🙂

 

As you correctly wrote in your other post, you can use Network Stream functions for your network communication when you need to transfer  losslesly every point of data between your RT target and host computer.

 

network streams.png

 

The picture illustrates the flow of data in a network stream.

First, the writer endpoint writes data to a FIFO buffer.

Then,The Network Streams Engine transfers data over a network to another FIFO buffer on the reader endpoint.

Last, The reader endpoint read the data from that FIFO buffer.

 

In the following link you can find all the information you need on Network streams.

 

http://zone.ni.com/devzone/cda/tut/p/id/12267

 

Did that help?

 

Antonios
0 Kudos
Message 2 of 9
(3,837 Views)

Hello Francesco ,

 

what Antonios suggest is to use Network Streams which is different from Network shared variable which you already tried. I have a similar application like yours and I do it with network shared variables. All I do on host is to check for value change to avoid duplicate entries.

 

regards

Thomas


- Thomas -
0 Kudos
Message 3 of 9
(3,828 Views)

Thank you thomas. I use your method with the network shared variable and a check value (by a while loop whith shift register) ant it seems to work fine. Now I'd like ti use also straming data function. I noticed that streamin data functions work fine with a simple sample application i wrote, but i'm not able to make it works in my more complicated application. I'll try again on monday. If i'll have some problems again, i'll ask for help

Thank you for the moment!

Francesco

0 Kudos
Message 4 of 9
(3,811 Views)

There's a way to avoid buffer underflow/overflow in 'Streaming data' application like these in DMA FIFO?

Francesco

0 Kudos
Message 5 of 9
(3,782 Views)

I need some help because i'm becoming crazy. My application has to sample the data acquired by nine channel of three NI9239 analogue input modules. The max sampling rate is 50 kS/s.

I wrote FPGA programme and C-rio programme based on  Labview example 'NI923x Continuous DMA'. First of all I've syncronized the three module with the internal clock of the master, chosen between one of the module. The DMA FIFO communication with C-rio programme works fine. The problem is transfer the data to HOST pc and save them. In figures attached there are a part of C-rio code and Host code. I try using network shared variable (and also streaming data blocks) and a while loop in HOST pc, but i lose samples from buffer.

Thanks for your help

  .

Download All
0 Kudos
Message 6 of 9
(3,775 Views)

Hello Francesco!

 

I saw the pictures that you uploaded.

The question is, why  are you saving the data inside the host and not inside the crio? 

Why don't you take advantage of the realtime environment of crio to save time?

I would suggest you to save the data inside the crio , transfer them in a network shared variable and just make the visualization inside the host.

The following link explains the way to save a file into the realtime target.

 

http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF?OpenDocument

 

Can you try this? I think you will not have a problem after that.

Antonios
0 Kudos
Message 7 of 9
(3,756 Views)

Francesco,

 

how do you know that you loose data? By comparing the 2 waveforms? As of my understanding you can only loose data if the host loop does not read data in same speed as CRIO write data. Have you configured network buffer on host side? In that case it is not problem if host is slower in reading for a short period of time as long as it will speed up afterwards, so no constant speed is neccessary. A good thing would be if you check the error out of the shared variable on both host and CRIO. There are a couple of errors/warning related to buffer full/empty. You can also measure the loop time of both host and CRIO loop to get a hint about speed. You can disable TDMS writing to see if this is the bottleneck ...

 

As Antonios mentioned writing on CRIO will also be an option. One thing you should know which I discovered recently. When using TDMS Write (on host) i noticed a permanent increase of memory consumption. I found some posts explaining this as a permanent increase of the file index table which is used to speed access data for reading. I you do not need reading in same time as writing I suggest you to switch to VI-based TDMS implementation: http://zone.ni.com/devzone/cda/tut/p/id/6471

 

regards

Thomas


- Thomas -
0 Kudos
Message 8 of 9
(3,739 Views)

Hi Thomas,

  I had yet set network shared variable double array tipe with a buffer size 1 array and 1000000 number of elements. Thanks to your suggestion I tested loop velocity with tick count and shift register: C-rio loop is quite stable, depending on number of sample for cycle, Host pc loop returns strange values...over than 10000 ms. I checked for network variable buffer error (overflow, empty, etc), but no errors occurs. I noticed thath graphs on host pc are refreshed with some seconds delay, but i think this depends on time to tranfer data throught ethernet. This delay of few seconds reflects also on .tdms saved files. There's a method to calculate this delay?

Thanks a lot for your help!

Francesco

 

p.s.

Nicolas, i'll try to save data directly on c-rio also, now 

0 Kudos
Message 9 of 9
(3,732 Views)