LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow UDP write

Hi everyone!
I built an application that read data from sensors using a DAQ and send it via UDP to a Java application.

The problem is that Labview sends only 1 or 2 datagrams/s (I saw this fact using "String2 indicator") and the DAQ sample rate is 1k/s. Why do I lose so much data?

I attach a sketch of my program.

(The Java program works well... I test it with another application).

Thanks,
Veronica

0 Kudos
Message 1 of 8
(2,782 Views)

For one thing you have a race condition with your local variable for string and the indicator itself. I assume this is what is triggering your data acquistion to stop. Given that you have a race condition it is very likely you are stopping earlier than you want. You should place your data in a shift register to ensure you are comparing the correct data.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 8
(2,771 Views)

Yes, it's for stopping the subVI.

I didn't understand how a shift register could be help to speed up the program...

0 Kudos
Message 3 of 8
(2,748 Views)

1st make it work.

2nd make it work faster. 😉

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 8
(2,742 Views)

Is it the right way to transmit data?
Is faster than befor but is slower than 1000samples/s.
Thanks for your help!

0 Kudos
Message 5 of 8
(2,723 Views)

You still have the race condition which can lead to problems. If you want to look at speeding things up don't use the express VI. Use teh DAQ primitives to do the work. Express VIs tend to have lots of stuff in them you don't need to do every iteration such as starting/stopping the task every iteration.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 8
(2,712 Views)

I agree with Mark that Express vi's should not be used, however I don't see any race condition in the code.

Best performance is achieved this way:

1) create and initialize the DAQ task

2) start the task

3) read data in a loop

4) after the loop, stop the task

5) clear the task

Depending on your specific measurement, the code to do thid may non be trivial.

Try searching an example that meet your needs in the help.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 8
(2,700 Views)

@pincpanter wrote:

I agree with Mark that Express vi's should not be used, however I don't see any race condition in the code.


 



You are correct, there isn't a race condition. I didn't look at teh names closely enough to notice it was String and String 2. However, I would avoid the use of local variable and use wires instead. Take some time to learn how dataflow works and use it in your programs. Leverage the poswer of LabVIEW, don't use bad practices.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 8
(2,696 Views)