Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

usb-6211 phase delay measurement

i need to measure the phase between 2 signals. i have a code that does it, but i have a problem with signals acquire. the daq assistant shows the wrong phase difference (i know it because i compare it to phase measurement in a scope device). i think the signals are not sampled simultaneously. how can i get, from the 2 signals, samples that are taken at the same time?

i attach the simple file with the 2 signals aquisition (without my phase finding code).

thanks in advance, evereybody.

0 Kudos
Message 1 of 11
(3,157 Views)

On a 6211 device, the two channels are indeed *NOT* sampled simultaneously.  That's a multiplexing device that shares access to a single A/D converter by connecting the task's channels to the converter 1 at a time in sequence.  There is some time delay between each channel's access to the converter.

 

You can query (or even set) this delay value with a DAQmx property node, but you'll need to convert from DAQ Assistant code to standard DAQmx function calls.  (There are a lot of shipping examples that demonstrate how to use DAQmx calls.)

 

Then you'll need to use your *knowledge* of this time delay to compensate your phase calculation.  Be careful of your units -- a fixed delay in time units does *not* lead directly to a fixed phase in angle units.  Angle units depend on the frequency in question.

 

Here's a snippet of the DAQmx Timing property node to query for the time between conversions on consecutive channels.

convert delay.png

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 11
(3,149 Views)

And as a test do your measurements twice, with swapped channels 😉

 

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 3 of 11
(3,142 Views)

thanks a lot. i did what u said, but i can't get signal from 2 channels at the same time. could u explain me what did i do wrong? (VI attached)

0 Kudos
Message 4 of 11
(3,120 Views)

more important: what is exactly the meaning of the number i get? (0.000014) is it the delay between 2 channels? because for low frequency (say 100 Hz) it only mean 0.5 degree of phase delay. and it seem like i have more.

thanks a lot again.

0 Kudos
Message 5 of 11
(3,117 Views)

In the most recent code you posted, you've converted to standard DAQmx function calls so that's a a good start.  However, I see that you have 2 distinct AI tasks configured for 2 distinct devices -- Dev1 and Dev2.   I didn't expect that.   Consequently, I begin to wonder about some other things as well.

 

The AIConvertRate property *is* telling you that the delay between channels would be 0.000014 sec -- IF the two channels were in the same task on a single board.  However, since the code you posted has 2 tasks running independently with no attempt to sync their timing, it no longer tells you anything useful about the relative timing (and thus phase) of your two signals.  

 

I see that you're relying on the "Extract Single Tone Information" analysis function. I've only really used that function when my signals were pre-known to be dominated by content that was pretty close to sinusoidal at a single primary frequency.  It works great for those cases, but I don't really know its limitations or the best input settings to use on signals that are more complex.   What kind of signals do you have?

 

To compare relative phase of 2 nearly-sinusoidal signals, you MUST know the relative timing of when they were sampled.  When both signals are part of the same task on 1 device, the AIConvertRate will tell you the time separation between when the 1st signal is sampled for the Nth time and when the 2nd signal is sampled for the Nth time.

 

If the signals go to separate USB-6211 boards, then you will need to CONTROL the sample timing to make sure they correspond.  One board will need to send out timing signals for the other board to use.  You should be able to get samples to occur simultaneously this way, but there's more work to get the software and hardware configuration exactly right.

 

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 11
(3,111 Views)

thank u so much!

first: my signals are pure sinusoidal.

next: i tried to connect 2 channels from one USB device, in the same VI i attached, but the program showed me only one. when i used 2 devices the program showed me both.

what i really want is to have only one device.

i think the problem is that i don't know how to make both signals to be a part of the same task on 1 device.

i searched for tutorials and didn't find.

i would be so glad if you will show me the way!

0 Kudos
Message 7 of 11
(3,107 Views)

Easier to show than to explain in words.   To put multiple channels in a task, pick the drop down arrow for the channel, select Browse..., then you can select 2 or more channels at once.  When done, you'll see the syntax used to designate a multiple channels (Use a colon for a range: "Dev1/ai0:3" is all channels from 0 to 3 inclusive.  Use a comma to separate a list of non-adjacent channels: "Dev1/ai0, Dev1/ai7").

 

I modified your posted code and put in a few comments.  Couldn't test it but it should at least be real close.   It's not generally the best idea to put processing and display code in the same loop as data acq, but we'll leave that lesson for another day.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 8 of 11
(3,099 Views)

thank u so much!

but i cant see your VI, my labview is 15.0!!

0 Kudos
Message 9 of 11
(3,093 Views)

Oops, sorry about that, forgot to check your original version.  Here it is in LV 2015.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 10 of 11
(3,088 Views)