LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing data and writing to text in parallel process

Hey Everyone,

 

I haven't dealt with parallel processing in labview, so hopefully someone can help me out. Here is the what I am working on:

I need to read data from TCP Read and write that data into text file. As the data reading is continuous, I was thinking about doing it in parallel processes. Each data packet will be 20kB.

Here is what I was thinking to do:

So the first process will read the data from TCP Read and write to buffer 1. It will write the complete 20kB of data and send a signal to second process to get the data from buffer 1. Second process will then take the data from buffer 1 and write to text file. In the meantime, the first process can write the data to buffer 2 while process 2 is still using the buffer one.

 

I will appreciate any help implementing this or any documents I can refer to get started. 

 

Thanks

0 Kudos
Message 1 of 8
(3,145 Views)

Producer/Consumer


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 8
(3,135 Views)

Why don't you just read 20kB packets from the TCP Read and write them to a file?   The TCP Read already has a parallel process working behind the scenes to fill the buffer from which you read, so further "parallel processing" seems redundant.

0 Kudos
Message 3 of 8
(3,099 Views)

Thanks for the suggestion. I will give it a shot. 

0 Kudos
Message 4 of 8
(3,050 Views)

I end up loosing some data after few frames. Thats why i thought maybe parallel processing would be better

0 Kudos
Message 5 of 8
(3,048 Views)

@manny09 wrote:

I end up loosing some data after few frames. Thats why i thought maybe parallel processing would be better


Better to diagnose your problem then guess.  Figure out why your losing data.

0 Kudos
Message 6 of 8
(3,023 Views)

Thanks for the reply everyone. I dont loose data after I included delay in receiving each frame. But there is a different problem now. I end up getting more data as somehow the data from some samples add addition bytes of carriage return and linefeed which I don't want to read. I am suspecting it has something to do with TCP Read subVI. 

Here is the complete story: 

I have CAN-Ethernet Gateway that sends the data to TCP. Each data sample is 8 bytes, but the gateway adds another 26 bytes of headers to it. When I read using TCP Read, it reads all 34 bytes most of the time (which is correct) but sometimes it also adds 2 bytes of carriage return and linefeed (I dont want to record that). I am not sure why I read those 2 extra bytes with some samples. 
Please let me know if it doesnt make sense.


Thanks

0 Kudos
Message 7 of 8
(3,011 Views)

You should post some code if you want to get better help in debugging your issues.   I would guess from your mention of a "delay" that you are just grabbing whatever has arrived at a particular time, rather than using a method of waiting for the whole message.  No TCP code should ever require a delay.

0 Kudos
Message 8 of 8
(2,992 Views)