02-14-2020 06:10 AM
I'm trying to measure the phase difference between 2 different sinewaves. One is a constant, my reference, 7 Vp@ 400 hz. The other varies as a rotor is turned. This can be anywhere from 0 ( when the rotor is in the middle of a ref point) to 1.70 Vp @400 hz when the rotor is out to an extreme. I've been using the Extract Multiple Tone Information.vi ( 2 separate vis) to get the phase of the rotor and the ref. The way the device I'm using works ( a synchro) is the output is either in phase w the reference or its not. If its in phase the synchro moved clockwise, out of phase it moved CC. I then subtract one phase result from the other and arbitrarily chose 45 degrees to be my limit. If the difference between the 2 is > 45 they are out of phase. Less..in phase. The problem I'm having is that , I think, sometimes when the rotor is real close to zero like 100 mv the Extract Multiple Tone Information.vi can't read it and I get zero phase. The HELP doesn't tell you the minimum "threshold" that vi can measure. I've been using .01 then .001 neither of which seems to help. Does anyone think this is my problem?? That the rotor measurement is too small to use the Extract Multiple Tone Information.vi ? Any suggestions/comments on my above method?
thxs..
Solved! Go to Solution.
02-14-2020 08:32 AM
The usual way to measure relative phase between two signals is by using a Hilbert Transform on one of them and then solving for Phase with Euler's Formula.
I'm no expert on the actual process but it's pretty easy to find articles on the details.
02-14-2020 09:56 AM
I'll have to show my ignorance..been out of school a long time. Googled Hilbert Transform and then solving for Phase with Euler's Formula and was totally confused.
02-14-2020 10:50 AM
Also not an expert on the techniques of phase measurement, but would add that it's *ALSO* important to control (or at least know) the time difference between when the signals were digitized.
Some devices perform simultaneous sampling. Most of them share a single A/D converter via multiplexing, putting a small time delay between the conversion times of the different channels in a task. You can set or query a DAQmx Timing property for the AI Convert Clock Rate.
With a multiplexing device if you feed the same signal to both ai0 and ai1, the data for ai0 will *appear* to have phase lag relative to ai1 due to the finite speed of the AI Convert Clock.
-Kevin P
02-14-2020 11:02 AM
in my case its so fast it doesn't matter.
02-14-2020 04:10 PM - edited 02-14-2020 04:18 PM
You can try the following. Back saved to 2015. You may have to play around with your input signals, theoretically the amplitude of each shouldn't matter as they cancel out. But if your inputs are noisy not sure how it will work. Experiment with this.
mcduff
PS Note in the example above if the random phase is less than -180, for example, -246, the computed phase wraps around, that is you get 114.
EDIT
You also get wrap around when greater than 180.
The atan2 function range is -180 to 180, so it wrap between those values.
02-17-2020 03:58 AM - edited 02-17-2020 04:20 AM
Another challenge migth be noise. If you get close to the optimum position, all signal left is noise (as far as I understood your setup)
A maybe more robust method: You use your reference to exactly measure the frequency (400Hz but I assume your DAQ isn't locked to the 400Hz, tone detection with ~20 periodes should do the job) and apply a linear sine fit at that (~400Hz) frequency (a*sin(wt)+b*cos(wt)+c , a and b define the angle) for a length of data that is as long as possible to assume a constant frequency but at least one 400Hz periode.
For the samplerate I would choose 10kSPS or more ...
It's about the same than the hilbert transform way posted, just without the hilbert transform ... I just don't have enougth experience with the hilbert transform and noise.... but worked a lot with the sine fitting.... If you know your hammer, all problems first look like a nail 😄
However IF your output is zero there is no phase defined! So if the detected amplitude is very low the uncertainty of the detected phase will raise due to noise.
BTW: A syncro would give you two (90° shifted) signals, so if one signal is near zero, the other would give you about max amplitude.
Edit: And if you want to hook up a generator to a power net, the final test as far as I remember, is to monitor the voltages across the switch... before you close the switch. I remember 3 ligthbulbs in our student energy lab experiment....
02-17-2020 12:11 PM
There is another method you could try, but I imagine this one may be more susceptible to noise.
mcduff
02-17-2020 01:20 PM
I do not have LV handy but some ideas...
Using PLL for the reference and measured signal then compare the phase of both...
Extract Signal tone and compare the phase returned...
The right hardware (like that used for LVDT and Resolvers) could make this dirt simple.
Ben
02-17-2020 01:45 PM
@Ben wrote:
I do not have LV handy but some ideas...
Using PLL for the reference and measured signal then compare the phase of both...
Extract Signal tone and compare the phase returned...
The right hardware (like that used for LVDT and Resolvers) could make this dirt simple.
Ben
If I am understanding you correctly, this is similar to a "Lock-in" Amplifier.
I thought about recommending this before, but the Hilbert method has the advantage that no low-pass filtering is needed, less steps.
mcduff