LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subtracting Input Signals in NI Lock-In Amplifier

For part of an undergraduate research project I am working on, I need to detect the phase change of an oscillating gas (~35 Hz) across a flow element. To do this, I have pressure transducers both before and after the flow element, and I would like to measure the phase angle between the first pressure transducer and the difference between the two pressure transducers (so the phase angle between signal 0 and signal (0-1). My research advisor has suggested I use the NI Lock-In Amplifier VI as a starting point, such as is described here: http://zone.ni.com/devzone/cda/tut/p/id/5613.

As provided, the lock-in amplifier works only with the Traditional-DAQ, so I made some modifications to work with DAQmx and it seems to be working properly. I chose not to use the "MultiChannel LockIn" VI because it does not appear to output phase angle as conveniently.

The other significant change I made was to use an index array block to separate the output from the "Analog 2D DBL NChan NSamp" DAQmx Read VI into two separate wires, subtract one from the other, and then recreate a 2D data array of doubles. However, after making this change, the "Reference Error" indicator on the front panel flashes like crazy when I try to run it, even just with the software simulated data. Additionally, I added some graphs and charts to attempt to see what is going on, and it looks like the subtracted signal is just a mess of noise without any resemblance to the original waveforms, even with smoothing filters added to remove noise. I attached a screenshot of this section of the block diagram, below.

 

Based on everything I've read, the simple numeric subtraction block is the way to subtract waveforms, but the best idea I have about what is going wrong here is that the subtraction is not working properly. I would really appreciate any insight anyone might have into this. 

Lock-In Amplifier Signal Subtraction Problem.png

 

 

0 Kudos
Message 1 of 8
(6,593 Views)
I worked on this for a few more hours and was able to get my desired results by adding a "transpose array" block before and after the array is separated and recombined. I thought I would post it in case anyone else ever needs to do something similar.

However, even with the lock-in amplifier now giving me very accurate results for phase (I'm comparing the results to those of an oscilloscope), the reference error indicator remains a solid red, suggesting there might still be a problem somewhere. Does anyone know what might be causing this? I'm wondering if it might have something to do with acquiring signals using the DAQmx drivers rather than the Traditional DAQ drivers, like it was written for, or if it might be something more significant.
0 Kudos
Message 2 of 8
(6,575 Views)
Can you clarify where you are receiving the reference error?

Regards,
Glenn
0 Kudos
Message 3 of 8
(6,566 Views)

It is not an actual error message, and the code appears to run fine, but the reference error indicator is red when I run the code, even with the simulator. On the unmodified version of the Lock-In Amplifier (as downloaded from the NI webpage), this indicator is green. In the document supplied with the VI as part of the "NILockingStartupKit", the only description of the indicator light is:

 

Error Indicator

The unnamed LED located immediately to the right of the “Reference” text will turn RED if an error has been detected while extracting frequency and phase information. Otherwise it is green. 

 

 Here is a screenshot of the indicator in the front panel as the VI is running:

 

ErrorIndicator.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 Thanks for your help,

 

Ted 

 

 

0 Kudos
Message 4 of 8
(6,558 Views)

Hi Ted,

 

Where is this indicator located?  You can find this by double clicking the indicator on the front panel so we can tell what the program thinks is causing the error.

Regards,
Jim Schwartz
0 Kudos
Message 5 of 8
(6,549 Views)

I have looked into that a little bit before, but now I just saw something new. When I open up the Lock-In Engine VI, I can find where the reference error comes from: "LockInPLL.vi," the phase locked loop (which makes sense, since it is related to the reference). Here is what the context help offers for the Lock error output of the PLL:

 

 Lock Error if non-zero, an error has occurred while trying to P11 to the reference signal. Currently supported error codes:
Sampling rate error (-2) Sampling rate is less than 50 kHz
Range Error (-1) A reference frequency out of range has been detected
Order overflow error (-3) Selected order does not satisfy ceiling requirement discussed above (see the Order control in the
Controls section above).

 This makes sense, because I am using a NI USB-6009 and the sampling rate is limited to 24k, so I can't even hit 50k. I know it's not the best product for this application, but it is what I was given to work with for now while I do a calibration away from my typical setup, where I have a PCI card (forgot the number). The error light stay's green if I increase the sampling rate, but I was surprised that the software simulator also used this sampling rate.

 

Aside from the obvious possible aliasing problems from noise, are there any issues with using a 24 kHz sampling frequency to measure a 35 Hz signal with the PLL?

0 Kudos
Message 6 of 8
(6,540 Views)

I'm not sure how th PLL is being incorporated with the sampling frequency. Like you mentioned aside from the aliasing I don't see an issue using that sampling rate to measure a 35 Hz signal.

 

Keep in mind, the 6009 does not have the dynamic range needed to read the voltages beneath the noise floor, which it's usually recommended to use th 449x/446x devices for this type of application.


Regards,
Glenn
0 Kudos
Message 7 of 8
(6,508 Views)

bonjour

je veux savoir comment dessiner un amplificateur de fibre optique sous  LabVIEW ?

 

0 Kudos
Message 8 of 8
(3,465 Views)