LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting phase difference...problems

I have read every post regarding how to obtain the phase difference between 2 input signals of the same frequency. I am using Labview 7 and have simulated the signals into my vi and everything worked great. I then input a signal into the 2 channels and used an RC filter to induce a phase shift and I can't get the phase results to work, althought the amplitude component works great.

I have tried extracting the phase info by using 3 methods a)tone measurements interface in 7 b) spectral measurements interface in 7 c) extract single tone information.vi

All of the above methods produce the same result, which unfortunately is incorrect. I have set up the 2 inputs with DAQ Assistant and the signals are good and 90 degrees out of ph
ase.

After extracting the phase info from each signal using any of the above methods, I subtract one from the other . I have tried both ways of subtraction and no difference.

Any ideas? Do I have to trigger the signals externally or something like that?

Any suggestions would be greatly appreciated.

Thanks
0 Kudos
Message 1 of 15
(3,916 Views)
When you plot the two signals on a time series graph, do you see the phase difference in the time domain? This might be a good way to check what is going into the FFT where you are calculating magnitude and phase. Also, insure your phase outputs are in degrees, this typically helps visualize the phase differences, as compared to radians.

Just some ideas for additional testing.

prestonj
Preston Johnson
Solutions Manager, Industrial IoT: Condition Monitoring and Predictive Analytics
cbt
512 431 2371
preston.johnson@cbtechinc
0 Kudos
Message 2 of 15
(3,914 Views)
The fact that the amplitude components of your two signals are detected correctly make you think that the VIs are used correctly. Phase difference problems can be caused by different things like:

- If you are using two different boards, they need to be triggered. Obviously the two signals need to be acquired at the same time to give a meaningfull result.

- If you are using a multiplexed MIO board, you'll have to correct for the multiplexing delay, that is the slight time difference between the two acquisitions. This time is reflected by the difference in the two signals timestamp (t0). The resulting phase error depends on the frequency f of your signal, so overall you'll have to correct your phase difference result with:
phi_correction(deg.) = (t0_
1 - t0_0) * f * 360

- Finally your un-expected result could simply be wrapped around with 360 degrees (??)

If none of this helps you identify your problem, could you post a simple VI with sample data and the results of your measurements?
Message 3 of 15
(3,914 Views)
Thanks for the suggestions. I just got off the phone with NI and the engineer thinks that the problem is with our hardware (PCI-6023E). The phase problem seems to be related to the time the hardware switches between channels, thus adding to the phase difference. He suggested trying to set up a sample and hold interface but was unable to help me with a fix at that time. I will post a new question with that problem next.

Dave
0 Kudos
Message 4 of 15
(3,914 Views)
Well, the 6023E is a multiplexed board and the "switching time" is caused, as I mentioned, by the multiplexing of the board. You don't have to use a "physical" sample-hold circuit to get rid of that problem. Just use the formula I gave you in my previous answer to correct for the multiplexing delay.
0 Kudos
Message 5 of 15
(3,915 Views)
I will give that a try. Am I correct in putting that equation after the Daq Asst and the Tone Measurements vi?

Thanks again
0 Kudos
Message 6 of 15
(3,915 Views)
Ok, now I am lost!! How do I put that correction in my vi? I have included the vi to assist in your answer. Thanks very much for your help. The engineer I spoke with this morning figured out the problem but couldn't quite figure out how to work around it.

Dave
0 Kudos
Message 7 of 15
(3,915 Views)
0 Kudos
Message 8 of 15
(3,915 Views)
Thanks for addition to my circuit. I tried it out and unfortunately the results don't seem to make much sense. The amplitude part works perfectly. The phase, however, jumps around and is consistantly too high in value.

Presently I am inputing a 4v sine wave @ 1 khz. Channel 0 is directly from the function generator. Channel 1 is thru an RC filter. The output at 1khz should be -45 degrees. I am consistently seeing phase numbers like 136 or -223 degrees. Is it possible that there is a 180 degree phase shift added somewhere?

Thanks again for your help

Dave
0 Kudos
Message 9 of 15
(3,915 Views)
We are getting there ...
136 and -223 degrees are actually two versions of the same value modulo 360 degrees. You can remove this problem by for example adding 360 to your result and compute the reminder of the division by 360. Or, an easier way to do that is, to add 360 to your result if it is negative.

Then there is a 180 degrees problem left. The most obvious cause could be, if you are running differential input in your MIO-board, that one of the input signal wire-pair is swapped. Is this the case?

One thing you can try is to change your signal frequency to "move away from 90 degrees" and see if you still have an exact 180 deg problem, in which case you are sure that you have an un-wanted signa
l inversion somewhere in your signal paths.
0 Kudos
Message 10 of 15
(3,915 Views)