LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Align realtime data from remote sensors (UDP)

Hello,
 
I've run into a problem I can't think of a solution to.
 
I have two remote sensors (Labview based) sending the following data to a PC running Labview:
 
- UTC to nearest millisecond
- Phase Angle (the data payload)
 
One sensor is nearby and has a latency of ~1ms.  The other is far away and has a latency of ~120ms.  The sampling rate for the sensors is 10Hz (i.e. one packet every 100ms).
 
I have a Labview VI receiving both streams of data and displaying on two individual charts.  The problem is, I need to compare one stream of data with the other and find the difference in the Phase Angle.  For example,
 
Sensor 1 data:    Sensor 2 data:
 
0.0s, 20deg       0.0s, 14deg
0.1s, 25deg       0.1s, 18deg
0.2s, 30deg       0.3s, 27deg
0.3s, 35deg       --PACKET LOSS--
0.4s, 40deg       0.5s, 40deg
0.5s, 45deg       0.2s, 25deg
 
I would need Labview to align the timestamps and then subtract the angles (either skipping when data is missing or interpolating).  The output of this function is for use in realtime control, so saving to a file and post-processing is out unfortunately.
 
Thanks in advance for any suggestions.
0 Kudos
Message 1 of 5
(2,999 Views)
Hi,

Have a look at the attached example code. It may require a little pre- and post-processing of data (make all data numeric, turn "packet loss" into -1, etc.) but should do what you need.

The VI does the following:
  • Takes clusters of "data packets" and takes the data out of them for analysis. The data packets do not have to be the same size.
  • It then takes the time values in the first set and looks for them in the second.
  • If the values are found, it subtracts the angles as requested, otherwise it returns -1.
  • Values are returned in chronological order.
I tested it with the example you posted and it worked well, I hope it's a suitable example for you!

Best regards,
Tom

Applications Engineering, NI UK
0 Kudos
Message 2 of 5
(2,960 Views)

Hi Tom,

That sounds fantasic, thanks for your help!  Did you definately attach the code, or am I missing something?  The controls on this forum confuse me sometimes.

 

Thanks



Message Edited by laserjet4200 on 03-03-2008 12:02 PM
0 Kudos
Message 3 of 5
(2,956 Views)
Nope, that's just me being stupid, sorry!

Here it is Smiley Very Happy
Tom

Applications Engineering, NI UK
0 Kudos
Message 4 of 5
(2,952 Views)

That's great, thank you.  This looks really good.

 

Cheers.

0 Kudos
Message 5 of 5
(2,949 Views)