05-19-2003 05:40 PM
05-21-2003 04:11 PM
11-29-2007 08:00 PM
I realize this is an old post, but it is relevant to what I'm working on. I have created a software lock-in amplifier using LabView 8.2 and a PCIe-6259. I am generating CW sinusoidal output with a frequency range of 0.01 to 2,000 Hz, sampling at 10 kHz. The output drives a voltage-controlled current amplifier which feeds a large magnet coil. The input reads an analog voltage from a magnetic field sensor. I want to use the phase array used in my AO loop to generate the sin and cos reference signals for demodulating the input, and here's where the delay issue comes into play. I am doing double-buffered acquisition and excitation by allocating the buffer size to the circular buffer size (8000 samples) and doing reads/writes of half that size. The AO loop writes it's output phase array to a USR-style global variable every time through its loop. The AI loop does the same with the data it reads and then uses a notifier to signal a third thread for processing. As a test, I've wired the output (DAC0) to the input (AI0). Initially, I tried an excitation frequency of 2.5 Hz (the update rate). And integer multiples of this, the phase is consistent, but by changing excitaiton frequency by 0.01 Hz shifts, I found a phase error of 687 deg./Hz!!
To remedy this, the USR-type global for housing the phase array became a 2-D array with read and write pointers to different rows. The phase aligns when the "written" output and the input are shifted by 7 half-buffers. Would disabling regeneration shorten this delay to what I would expect, i.e. 3 half-buffers? If so, where is this property accessed in DAQmx under LabView 8.2? Thanks.
Kevin Pratt
Tristan Technologies, Inc.
11-30-2007
04:29 PM
- last edited on
08-26-2025
09:24 AM
by
Content Cleaner
Hi Kevin,
I'm having some trouble understanding your application and questions. I think it would be helpful to see your code so that we can have a better idea on how you are configuring the analog input and output tasks. We may be able to provide some suggestions regarding the DAQmx programming, but I can't make any guarantees on being able to troubleshoot the lock-in amplifier algorithms.
If this is possible, please highlight the portions of the code that you believe to be introducing the errors. You may also provide screenshots of the front panel in situations where the operation of application is in error.
To answer your question at the end of the post, I do not know yet if disabling regeneration would shorten the delay. To disable regeneration, use the DAQmx Write Property Node in line with the analog output task and wire in a value of "Do Not Allow Regeneration".
It sounds like your application is already fully built but that there are just a few minor things to overcome.
Regards,
Andrew W
National Instruments
11-30-2007 07:11 PM
12-03-2007
05:35 PM
- last edited on
08-26-2025
09:25 AM
by
Content Cleaner
Hello squidmixer,
If I am understanding the issue correctly, you are writing data to your continuous analog output and are seeing a large delay from when you write to when it is actually generated. From what I know about the buffers and the previous posts on this topic, I believe that the FIFO size has a big effect on the behaivior. This is due to the number of samples you must "flush out of the system" before your new data is output. The non-regeneration would shorten (or even eliminate) this difference since the data is not being copied multiple times and essentally remove the FIFO size from the equation.
This being said, the Analog Output FIFO on the two cards you speak of are dramatically different. The PCIe-6259 has an AO FIFO of 8,191 samples, which is shared between all channels used (as seen on page 3 of its spec sheet.). The PCI 6052E, on the other hand, only has 2,048 samples for its AO FIFO (page 6 of its spec sheet). This could change the delay quite significantly.
I am very interested in finding out whether turning off regeneration does what we expect it to. If so, is that amount of delay acceptable? If this does not get rid of the issue, then we may be misunderstanding how your program is working. What is the end goal of this application in terms of the AO and the AI? How much delay is acceptable? Since we are doing this in software and not hardware (i.e. an FPGA), we have to use buffers, so there has to be a delay, but there may be a easier way of going about this.
Since what we are working on is esentially just the DAQ aspects of your program, if you could make a simpler VI with just the DAQ (not the lock-in amplifier, etc) and possibly post it, or even a screenshot of that section, that could help.
12-05-2007 07:17 PM
I found and implemented the "Do Not Allow Regeneration". It reduced the delay from when the output is "written" to when it actually shows up at the output from 7 half buffers (2.4 seconds) to 6 (2 seconds). Anyway, here's the code. It's in 8.2.1.
Kevin
12-06-2007 06:54 PM - edited 12-06-2007 06:55 PM
Hello again squidmixer,
I took a look at your vi and although the structure is good, it is a little
difficult for me to follow since I am not familiar with your application.
I am working on writing an example that shows the behavior we are talking about
so I can actually see the delay on my hardware, but I need to make sure it is
correct, clean it up, and document it. I will post it as soon as I have
something worthy of posting. If you would try to whittle down your
program as much as possible and still show the behavior, I would
appreciate it.
12-07-2007 03:55 PM
Hi Neal,
I pared down the execution to eliminate the FFT, FRF, and noise reduction. I still included the lock-in because it is instrumental in demonstrating the phase shift vs buffer size and frequency. To test this, simply attach a BNC-2110 to your DAQ card and connect DAC0 to AI0.
Thanks,
Kevin Pratt
12-07-2007 07:36 PM
Can someone link this thread to the LabView forum? I realize I kind of hijacked it from the wrong message board.
Kevin