06-11-2007 04:41 PM
06-12-2007 11:06 AM
06-12-2007 05:57 PM
Kevin,
In order to skip the tone measurement VIs (both the "express tone measurement" VI and the "extract single tone information" VI) I changed the DAQmx read output from waveform to 2D DBL and try 2 different approaches:
1) I used the vi proposed in the link you suggested, and the phase difference calculated between signal in channel 1 and any other channel was always 14.4 degrees (sampling rate was 25000S/s per channel). However, this difference was zero when comparing any two signals different from that on channel 1.
2) I tabulated the data and put it in excel and matlab and signals 2 to n overlap, signal 1 has a lag of ~14.4 degrees. I attached an image of the output 2D DBL array, and as you can see signals 2 to 4 are exactly the same, and signal 1 has a lag. However, if you take a look only the 1st element differs and shift all the other measurements 1 position to the right (I put some red lines to show that).
Some thoughts:
1) I'm wondering if the 1st value of channel 1 is not an artifact like for example a value remaining in the DAQ card buffer that was not flushed properly and shows up when a reading takes place (this is just a guess and most likely what I'm saying makes no sense at all, but as I said before my knowledge on these topics is very little). The question would be if the phase lag of channel 1 is due to an artifact (in case it is), why does it follow the calculations based on the sampling rate and the ADC specifications?
2) Why there's no ADC multiplexing-induced phase lag in the other channels (other than channel 1) when read simultaneously, and yet the phase read is always correct? For example (taking into account that both generation and reading are sinchronized) if the signal generated by the AO has a 55 degree phase, channels 2 to n read a 55 degree phase. If I put 5, 33, 47, 90, whatever value I want to put for the phase of the AO, inputs 2 to n give me the right value. Should I consider these readings "wrong" because they don't show the phase lag they are supposed to due to the ADC multiplexing, even though the readings agree with the excitation signal parameters?
3) To try: I'm still trying to get my hands on a signal generator to check the AIs behavior using an extrenal signal source. Also I'll try to add some capacitors of different values to each of the connections. Comparing the capacitor-induced phase shift of each channel with calculated values would be a good way to check if the readings are ok or not.
Thanks,
Pedro.
06-13-2007 10:00 AM
Pedro,
I think you forgot to attach the image of the plotted data.
Also, a thought just came to mind. Suppose you had an analog input task with N channels and output task that was perfectly synchronized and running at the same sample rate. That is, channel 0 of the AI and the AO use exactly the same clock edges and AI channels 1 - N are delayed slightly due to multiplexing. In this situation, AI channel 0 would digitize data exactly at the same time as the AO updates but would never quite get the right value because there will be a physical delay since some distance of wire must carry the signal from the AO to the AI channels. The AI channels 1 - N would sample the correct voltage since the AO has had enough time to send the signal and this signal will not change until the next clock edge of the AO clock. On the next clock edge, the AI channel 0 would sample the previous AO sample since it will see that before the AO can update but the rest of the channels will capture the new AO value. Hence, channel 0 will appear to lag by 1 point but the other channels are appearing to identically sample the AO signal.
If you were to use an external signal generator to produce the same signal, you would start to see the effects of the multiplexing since the signal will change during the sampling of channels 0 - N.
Drew
06-13-2007 12:10 PM
Pedro,
Listen to Drew (aka caz) !!! I really think he's got this issue nailed in his last post. I had completely failed to account for the fact that you're not sampling a true sinusoid, but are instead sampling a piecewise constant approximation of one.
Let us know how this goes...
-Kevin P.
06-13-2007 03:30 PM - edited 06-13-2007 03:30 PM
Drew,
You are right I forgot to attach the file. But it's better since now that I had to do a new run to get the tabulated data I found out that the 1st element of channel 0 of the AI (the one that shifts all the data 1 position as I mentioned in my previous post) seemed to be quite random, then I figured out that this value was exactly the same value at the end of the data arrays of the 1 - N channels once the reading cycle was finished. This means that what you say might actually be the explanation for the behavior I'm witnessing.
Right now I finished running some tests using a simple RC circuit to calculate the capacitance of the capacitor in the system. The capacitor used was 1500uF +/- 20% and I managed to obtain values from 1388 to 1483uF (depending on the frequecy of the signal used for testing) using channels 1 - N. Using channel 0 the capacitance was way off.
I finally will get a signal generator later today. I'll post the results once I run some tests with it.
Thanks a lot,
Pedro.
PS: attached is the image of the tabulated data.
Message Edited by Archivaldo on 06-13-2007 03:33 PM
06-13-2007 04:26 PM
06-13-2007 09:42 PM
Drew,
Your hypothesis was right. The reason why my AI channels, except channel 0, were all in phase when reading a signal generated by the AO of the same DAQ card was because they were synchronized with the AO clock. I just finished some tests with a signal generator and there was always a phase lag between AI channels (all of them connected to the same source). The phase lag was constant from channel to channel (as seen on the attached image) and was a function of sampling rate (up to a point were I think the sampling rate was slow enough to allow the ADC multiplexing without further increasing the phase lag). In summary the multiplexing effect of the ADC is noticeable only when reading a signal that is not tied to the AI clock source.
So now in order to avoid loosing 1/3 of the available sampling bandwidth for my experiments, I can safely remove the extra dummy input I added to my code and use the data of the 1st channel read by the DAQmx vi by removing the 1st element of the array before analyzing the data.
Finally the "mistery" is solved...actually I thought my DAQ card was behaving like a more expensive "S" series card without any lag between AI channels ![]()
Thanks everybody for all the help,
Pedro.
06-14-2007 07:02 AM
One last tidbit -- Drew gave you the right diagnosis, be sure to try what Dan (Mcdan) said as the cure. Your idea to remove the first element of the array on the first channel may not be reliable. His idea of putting a delay between the AO update and the first AI conversion is the better approach.
So now in order to avoid loosing 1/3 of the available sampling bandwidth for my experiments, I can safely remove the extra dummy input I added to my code and use the data of the 1st channel read by the DAQmx vi by removing the 1st element of the array before analyzing the data.
06-17-2007 05:53 PM