06-05-2007 06:40 PM
06-05-2007 11:42 PM
Hi Archivaldo,
You're right, thats some weird results. Since your board does not support simultaneous sampling, it must multiplex signals before the ADC so it really bothers me that you have 2 channels of the same signal digitized by the same ADC giving a different result.
Your code looks sound. I don't see any glaring omissions. However, you only mention an error in the phase reading from the extract tone express vi's. Did the graphed data look wrong when measuring the same signal on 2 AI's. It should be obvious based on the numbers you provided.
A couple things to try.
1) Try configuring just 1 AI and see if you get consistent and correct results regardless of what channel you use.
2) If step 1 works, go back to using two AI's and try using just one tone measurement express vi instead of having one for each channel. You can wire the 1D array of measured waveforms and configure the tone express vi to output an array versus a scalar. Make sure to also change the convert from dynamic data vi to output a 1D array of double versus the scalar. You may also want to use the extract single tone vi from the waveform measurements palette instead of the express vi.
3) Try setting the read to be 2D double instead of 1D waveform. You can rebuild the waveforms after indexing the 2D array from the read vi to use the existing measurement vi's in your code.
4) If nothing worked so far, try configuring the read to be a single channel instead of N channels. Hopefully this would behave the same as would you get in 1).
Since you tried flipping the order of the channels to read when using 2 AI's and saw that the first channel always had the phase error, the problem can't be in hardware. If its not something simple like any of the above I will be really interested to hear what the final diagnosis is.
Drew
06-06-2007 05:15 AM
06-06-2007 06:25 PM
Wow. This is very interesting, but I imagine very frustrating for you. The last thing I can recommend is to keep the AO task sample clock the onboard clock but change the AI task to use the AO sample clock devX/ao/sampleclock. This may tighten sychronization between the 2 tasks or at least mitigate a problem you seem to have with the first channel.
Otherwise, my next guess is a DAQmx driver issue. Perhaps, a fresh reload of the driver is all that is needed. After that, my expertise is zippo and I guess a problem to deal with NI about. Perhaps a "bug" or better put "a compatibility issue" with the software and hardware you are using. Please post any updates.
regards,
Drew
06-07-2007 10:26 AM - edited 06-07-2007 10:26 AM
Hi Pedro,
The phase shift between the two analog input channels is expected. The PXI-6031E only has one ADC on board, which means that it uses a multiplexer to read both channels. It can not read the same signal at the same time. All of the S Series boards are capable of reading simultaneous because they have an ADC for each channel.
Now the phase shift between the two channels should be constant so you should be able to account for that shift. Are you getting a constant phase shift?
Message Edited by Robert F on 06-07-2007 10:26 AM
06-07-2007 11:52 AM - edited 06-07-2007 11:52 AM
Rob,
I you look earlier in this thread, you will see that its not just a phase error related to the multiplexing but rather a problem with the first channel read. If he wires the same signal to 2 analog inputs, the second channel read behaves properly where as the first one has a sample rate dependent phase error and the error is NOT something small like the time lag due to 2 channels not sampling simultaneously. The same error is prevalent if he just configures his task to read 1 channel. Something is not behaving normally with his read function.
Drew
Message Edited by caz on 06-07-2007 11:53 AM
06-08-2007 12:12 AM
06-08-2007 10:53 AM
Interesting problem. I looked at the vi's you posted earlier but am not near a LV machine now so will have to work from memory. Some comments:
1. These measurements are being done by one of the built-in analysis vi's. It's probably very good, but most any signal processing algorithm will have some limitations. I would caution against trusting it as a 100% accurate analysis.
2. Nevertheless, the type of discrepancies you observe seem to point away from that anyway.
3. When sampling multiple channels, it's possible to set the multiplexing rate explicitly, otherwise the driver reverts to a default behavior. That default behavior has varied with DAQmx versions, but I *think* that the last several versions will try to use the lowest possible multiplexing rate to maximize the time between channels. This allows more time for the circuitry to bleed off charge and can produce more accurate amplitude measurements. Please tell us which DAQmx version you're using -- maybe someone from NI will know if there's a known issue.
4. Assuming you aren't setting the multiplexing rate explicitly, it does make sense that the measured phase would vary with sample rate. As you increase the sample rate, the multiplexing rate will also increase. That decreases the time between channels, so the measured phase lag also decreases.
To avoid this issue, you should set the multiplexing rate explicitly. If you set it really fast, then you may see some bleed-over if you switch from a large amplitude to a small amplitude -- there may not be time to bleed off the charge from the earler signal and that can induce measurement error in the next one. I'd recommend testing with something like a 5V signal followed by a 0.05 volt signal. Increase the multiplexing rate until you see that the 0.05 volt signal starts measuring out > 0.05 volts.
5. Your "dummy" channel workaround is the only thing I could think to suggest and you're already there.
6. I'm not so sure that your real problem isn't exactly the opposite of what you think. To me, the measured phase lag for the first channel in your task seems more like the truth, given the reality of multiplexing, and the near-0 values for all the others seem suspicious.
-Kevin P.
06-08-2007 05:01 PM
06-11-2007 10:15 AM
Ok, my memory was faulty about the convert rate settings. The older DAQmx versions defaulted to slower rate while the newer ones default to a faster rate, as stated in the help file you consulted. (FYI, here's a link to a posting about the change.) So now I'd agree with you that the measured phase lag shouldn't vary with sampling rate.
Now let's look at your the results in the last table of measurements. For a card capable of 100 kHz max, you'd normally expect a convert clock rate corresponding to 10 usec + 1/100 kHz = 20 usec. If you're measuring 1 kHz signals, then the apparent phase shift you'll see due to the convert clock should be 20 usec / 1000 usec = 1/50th of a cycle, or 7.2 degrees. However, it seems to me that the phase shift should be constant, unless you max out the sampling rate so that the convert clock doesn't add the extra 10 usec for setting.
When you sampled at 10 kHz, you measured a ~36 degree phase shift or 1/10 cycle. At 50 kHz, you measured a ~7.2 degree shift or 1/50 cycle. I can't help but notice that these are exactly the amount of phase shift you'd get from sample (i) to sample (i+1) on the same AI channel. Maybe that's a coincidence, but it would make my troubleshooting nose very suspicious to see such a pattern. It's also even more suspicious that channels 2 through N produce a 0 phase shift measurement. The hardware isn't capable of doing that, so consequently I'm steered toward something in the software. Offhand I'm not sure what because nothing immediately struck me as a problem.
I don't have LV here to look at the code right now again, but I would have to recommend adding a lot of debug probes / indicators into the block diagram so you can examine the data in greater detail. You've been struggling with this for a long enough time that it should be worth the hassle and effort to dig down deep. For example, since you're connecting a single AO to both AI 1 and AI 2, plot AI 1 and AI 2 as separate plots on a graph. Zoom in on a very small portion near a zero crossing (where differences are most pronounced). Verify the apparent phase lag the old fashioned way, with your eye & some interpolation. Make sure the results of the express vi agree with what you can observe. That kind of stuff.
-Kevin P.