From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cross Correlation Velocimetry

Hi everybody !!

 

I'm a french student in internship, and I'm trying to make an application that use 2 temperature signals (provided by 2 thermocouples) to find the velocity of gas flow. I discovered Labview this year, so I know the basics, but not the cross correlation.

 

The aim of my project is to determine the transit time between the 2 thermocouples by cross-correlating the signals. I think I have to "window" the signals (during 2 or 3 sec for exemple), and then apply CC, but I don't know how.

 

Here is the beginning of my VI (wich doesn't work of course ...)

 

If some of you could help me, I would be very grateful !!

 

 

Baptiste.

0 Kudos
Message 1 of 14
(3,773 Views)

Can you also provide a (small) tdms file ?

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 14
(3,738 Views)

Thank you to look into my problem !

 

Here's a TDMS file. I hope it's a good one because I have never done this before. So I have recorded some temperature "'impluses" that I have made by touching the thermocouples.

 

I'm always trying to do something on my side, I thought maybe in a sequence structure, to window a part of the signals, then apply the Xcorr and calculate the delay ...

 

Thanks a lot for your help !!

0 Kudos
Message 3 of 14
(3,731 Views)

I think you may need to remove the large offset first. The raw data has a mean of about 25 to 26 with a signal variation of about 2 or 3.  The image below shows the cross-correlation of the raw signal as calculated by your code on the left and the cross-correlation of the signals with the means removed on the right. The signal on the right was filtered by Elliptic Filter.vi and the cross-correlation performed by Cross Correlation.vi from the Signal Processing palette. These calculations were performed on arrays extracted from the waveforms read from your TDMS file.  I did not use any Express VIs.

 

Lynn

 

Cross correlation.png

Message 4 of 14
(3,720 Views)

Thank you Lynn, you made me understand that I have to store the data and then apply the CCF. So I changed my VI in order to store the last N samples of my filtered signals in arrays, and then do the CCF on those datas and find the peak to calculate the time delay between the temperature impulses.

 

It seems to work, but I'm not sure about the number of samples I have to work on, and when I have to apply the CCF.

 

Moreover, I don't really know which kind of window and filter I have to use. I heard the elliptic filter was a good one for anti-aliasing, wich might occurs with the CCF.

 

And for more information, I use LabVIEW 2012 with cDAQ-9181 ethernet chassis with the NI 9214 (Max sampling rate 100 S/s)

 

Bapt.

 

 

0 Kudos
Message 5 of 14
(3,692 Views)

Baptiste,

 

The choice of windows and filters is very much dependent on the data source, the types of noise or interference which may be present and what you are trying to do with the data.

 

The filter you have now, 49 Hz low pass filter, does almost nothing.  It is filtering at the Nyquist frequency (~Fsample/2).  By definition there is no energy above that frequency so the filter does nothing (except for introducing the filter transient on the DC component).  The anti-aliasing filter must be a hardware filter which bandlimits the signal before the analog to digital conversion. You cannot do anti-aliasing filtering in software after the signal has been digitized.

 

You might consider a smoothing filter to eliminate some of the random noise. Random noise should be uncorrelated so the smoothing may make the charts look nicer but probably will not make much difference in the results.

 

I notice that the time delay between the two channels varies.  I think you said this data was artificially created by running your finger over the sensors. However, you probably expect the gas velocity to vary also. So you should probably extract data segments And analyze them separately.  Each segment should be no longer than the time over which your velocity can change significantly.

 

Lynn

0 Kudos
Message 6 of 14
(3,679 Views)

Baptiste,

 

I looked at doing cross-correlations on segments of the data set and, as I suspected, the correlations and peak times vary substantially. The images below show the cross correlations and peak times for segments of length 400 and 500 samples respectively.

 

CC for 400.png   

 

CC for 500.png

 

More to think about.

 

Lynn

Message 7 of 14
(3,668 Views)

Whoaa, you get those graph with my data set ?? How have you done that ? 

 

Thank you for the tips on the window an filter, but a smoothing filter will **bleep** my signal, am I right ? Can I anticipate this shifting ? If not, I saw the zero phase filter, would it work ? If so, how can I determine the coefficients ? (I know, that's a lot of question ^^)

 

If I know the theoretical speed of my flow, I will know the theoretical transit time between my thermocouples. For example, the delay is about 0.1 sec, so I record 10 samples. Then I apply the CCF, find the delay (easily because there will be only 1 peak ??) and finally find the speed with the gap between the thermocouples. Is it possible to do it in one VI without extracting the data set and making a post treatment, in real time ? 

 

But if I understand, if there is speed variation, like 0.1 to 1 m/s, I will have to adapt the sampling rate.

 

Thank you for all the advices you provide me, they are very helpful !!! 🙂

 

Bapt.

 

PS : On a software point of view, do you think it's possible to pilot a process with this ? Because it is the final aim of my project.

0 Kudos
Message 8 of 14
(3,657 Views)

Baptiste,

 

I need to leave for a meeting.  I will post something tomorrow showing how I have done this.

 

Yes, it is all from the data you posted.

 

Lynn

0 Kudos
Message 9 of 14
(3,650 Views)

Baptiste,

 

Here is the VI I used for the things I have shown. I added some labels on the block diagram to provide brief descriptions of what was done.

 

After your last post I tried the Savitsky-Golay smoothing. It reduces the high frequency noise with a precisely known time shift which can be compensated by padding.  I did not try the cross correlations on smoothed data.

 

This is not finished or well-documented code. It is something thrown together quickly to explore your data.

 

Lynn

Message 10 of 14
(3,637 Views)