Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

phase difference for LabView

Solved!
Go to solution

Hi guys,

 

I need help in this program that I'm writing. I am trying to calculate the phase difference between two different simulated sine waves. I have searched online and I have found out that I could do that by using Extract Single Tone Information and subtracting one phase from the other. However, I have trouble connecting the wires and I am unsure why it is not connecting properly. Forgive me if this is a basic problem as I am new to LabView. Thank you. Attached is the program.

 

aclx

0 Kudos
Message 1 of 7
(8,399 Views)
Solution
Accepted by topic author aclx

aclx,

 

It would probably be better if you posted your question to the LabVIEW Board rather than the Signal Conditioning Board. This Board gets only about 1% as much traffic as the LV board and your question has nothing to do with signal conditioning.

 

You have two issues.

1. The (evil) Dynamic Data Type generated by the Express VIs hides all the information about what is on the wire.  It appears that the default conversion performed by the input to Extract Single Tone Information.vi was to an array of waveforms.  That results in an array of phases at the outputs. You can tell what kind of data is on a wire or why a wire is broken by hovering the wiring tool cursor over the wire with the Context Help window open.

2. The phase relationship between two signals of different frequencies is not defined. What point in time should be used as the reference?  How do acquired or simulated signals relate to that time on subsequent iterations of the loop?

 

The first issue can be fixed by explicitly converting the DDT to a waveform as shown below.

 

Phase.png

 

For the second issue you need to define what you mean by the phase difference of two signals of diffeent frequencies.

 

Lynn

Message 2 of 7
(8,355 Views)

Try changing the frequency of one of the signals by a small amount. It appears that the frequencies you have chosen as defaults behave atypically.  For 10.1 and 20.1 the phase difference seems to stay within a small fraction of a degree of zero fro thousands of iterations while for 20.101 or 23.1 it goes +/-360 degrees quickly.

 

Lynn

 

Phase20.1.png

 

Phase23.1.png

 

Phase20.101.png

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

if you compare to sines of the same frequency to get the phase information the tone detection vi works great. One common use is the measurement of the phase (or group) delay of a  unit under test, where you capture stimulus and response (both of the same frequency).

 

The point is that the tone detection vi  assume a relative constant phase (relation in case of two signals) for the time of the signal snipped passed to the tone detection. In case of two different frequencies you don't have a constant phase relation, but two different frequencies and a phase relation at the start point.

 

If you need to measure the (accumulated) phase shift of a doppler signal (in my case heterodyne laser interferometer) I would use a demodulation like generate a IQ signal, arctan, phaseunwrap.

Usually one frequency is fixed and you shift it 90° , multiply both it with your second signal and low pass filter it to get the I and Q signal.

 

So, as more you tell us more about your application, as better could be the answer 😉

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 ǝɥʇ'


Message 4 of 7
(8,333 Views)

Hi johnsold,

 

I'm so sorry for posting it in the wrong area of the NI forums! I'm new to this and I found old posts related to my project so I gave it a try.

 

Thank you so much for your reply. Your solution for (1) really helped me. I was figuring out why my connections are of different types and after seeing your solution, I do recall finding out about data type manipulation in the forums a few days back. Now everything is perfect and I can observe the phase changes.

 

For (2), this is just a simulated signal I'm trying out to learn more about LabView. For my real project, I will be observing two sine waves of the same frequency with some phase difference. I was just tinkering with it and tuning the frequency. Sorry about the confusion.

 

Again, thank you so much. Your solution really was helpful in my progress.

 

aclx

0 Kudos
Message 5 of 7
(8,317 Views)

Hi Henrik_Volkers,

 

Thank you for your reply! Your input really helped in the progress for my project as now I understand more about how these VIs work!

 

I will tell you a brief summary of my project. My group is researching on the phase-sensitive detection of biological interactions through surface plasmon resonance(SPR). We will be observing two light signals. First being the excitation light (reference) that is directed at the biological sample and second being the light that has reflected off the sample. By observing the phase shifts between these two signals with varying concentrations of the biological samples, we can observe the sensitivity of this entire setup.

 

Thanks!

 

aclx

0 Kudos
Message 6 of 7
(8,313 Views)

So the tone detection vi is the way to go 🙂

You should capture at least 12 to 20 periodes (with 20 to 100 samples per periode, capture full periodes) and  at const frequency for best results. Here are some more informations about how the vi works.

 

If you want the best performance synchronize the ligth source frequency with your DAQ samplerate and do a  SAM (Sinus approximation with a linear fit). That way you exactly know the frequency and can concentrate on the phase.

 

Depending on the DAQ and ligth pulse hardware you use, you can share a common reference oscillator or create the ligth pulse  trigger with your DAQ....

 

 

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 7 of 7
(8,257 Views)