LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform generation and phase angle

We are trying to use NI USB-6216 DAQmx board to generate and receive waveform signals to mimic the function of a phase angel voltmeter, I attached snippet for signal generation part of the code.

 

If the signal is measured by North Atlantic 2251 phase angle voltmeter, the measured results are stable and accurate, usually within a fraction of degrees. If we measure the signal by the DAQmx board input channels (generate and receive on the same board), the measured results are not very accurate, in range of one or two degrees for 1k Hz frequency, more error with higher frequency. Also the results are not repeatable, every time we start the signal generation, we read a new value. 

 

We consider the possible cause is that the quality of generated signal is not good enough, we hope someone with this kind of knowledge can give some suggestions. Let us know if you need further details.

0 Kudos
Message 1 of 14
(3,872 Views)

To get an estimate of phase from a sinusoidal signal, you need a reference point in the signal.  How do you synchronize the phase angle voltmeter with your 1 kHz signal (being generated at a 100 kHz sampling rate)?  I presume the repeatability of the PAV is consistent with a timing uncertainty of a sample point or so.

 

When you use the same DAQ Card to generate and record a Waveform, synchronizing the two processes is the tricky part.  Your Snippet gives no indication how you are doing this.  [Next time, attach the entire VI, as a VI).  Also, you should not (in general) have a Wait function inside a DAQ loop -- the DAQ hardware is, by far, a more accurate and precise clock than the LabVIEW/Windows Timing Functions.

 

Bob Schor

Message 2 of 14
(3,825 Views)

Hi Bob_Schor,

 

Thanks for your response. You are correct the inconsistent reading is caused by the two loops are not synced. I added the sync later as shown in the attached snippet,  AC Read Write, the Calc Phase is the subvi. The sync method is from an NI example. After the two loops get synced, the phase reading is very consistent, but not accurate. For 1k frequency, the reading is about 3 degrees off while North Atlantic 2251 has only 0.02 degrees off. 

 

I was thinking the problem is signal generation. I'm thinking probably there are problem on both generation and receiving/processing sides. please advise if you have the experience or knowledge. 

Download All
0 Kudos
Message 3 of 14
(3,821 Views)

The attachments failed, I'll try again. 

 

Download All
0 Kudos
Message 4 of 14
(3,818 Views)

Sorry, for a situation this complex, it is a waste of my time to look at a picture of your code.  If I can't see, examine, move wires around, edit, execute "non-trivial" code, I'll only frustrate myself (and that won't help you) by examining pictures.  Please attach your VIs (or compress the folder holding your Project and attach the resulting .zip file).  If you can't/won't, others will, I hope, try to provide assistance.

 

Bob Schor

0 Kudos
Message 5 of 14
(3,810 Views)

Hi Bob_Schor,

 

I didn't realize the code is removed from the snippet, I saw there's security scan. I attached the zipped code. Thanks.

0 Kudos
Message 6 of 14
(3,805 Views)

One of the key sources of error is that your USB-6215 board is a *multiplexing* device which doesn't sample your reference and signal simultaneously.  They are sampled at slightly different times leading to an apparent phase error.

 

The good news is that you can compensate for this knowable error source.  AI tasks on your device use both a sample clock and a convert clock.  The convert clock is used to multiplex among all the individual channels in a task.  You can call a DAQmx Timing property node to query the convert clock *rate* which will tell you the time separation between sampling Reference and Signal.  This in turn can be converted into an effective phase angle when you know the frequency of the periodic waveform.  The property is found at "More-->AIConvert-->Rate".  (It's also possible to set this property, but you'd need to be careful to honor the board's capabilities.)

 

360 * (Waveform Freq) / (Convert Rate) = effective phase angle in degrees caused by multiplexing.

 

This is a start, but it won't explain all of the ~3 degree discrepancy.  At 100 kHz sampling, the convert clock must be 200 kHz or more to have time to convert 2 multiplexed channels per sample.   With a 1 kHz waveform, this only accounts for a maximum of 1.8 degrees.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 7 of 14
(3,798 Views)

@Bob_Schor wrote:

Sorry, for a situation this complex, it is a waste of my time to look at a picture of your code.  If I can't see, examine, move wires around, edit, execute "non-trivial" code, I'll only frustrate myself (and that won't help you) by examining pictures.  Please attach your VIs (or compress the folder holding your Project and attach the resulting .zip file).  If you can't/won't, others will, I hope, try to provide assistance.

 

Bob Schor


@Bob, his pictures are snippets and they do contain code, you just have to download them first before dragging them into LV.

 

@OP, some of your code was getting removed, but not all of it. Calc Phase.vi isn't showing up for me in the snippet, but the rest of the sampling code is. I don't think snippets save subVI's, just what's on the block diagram.

0 Kudos
Message 8 of 14
(3,794 Views)

@OP, what is the rough voltage values of the signals you're measuring? At very high clock rates and with signals of highly varying range, you can see ghosting on your signals due to the multiplexed nature of the device as Kevin was pointing out.

 

For example, if your reference is a 10 V sine, and your target is a 0.1 V sine, you could see some issues. Can you tell us more about some signals you're generating? Is there an actual DUT or are you just generating a couple signals for reference sake? If there's no DUT then it's probably not ghosting.

0 Kudos
Message 9 of 14
(3,787 Views)

We are trying to use the USB-6216 to perform like a phase angle voltmeter, that's why we are comparing it to the North Atlantic 2251. The final goal is to receive signals from external source, not the signal generated on the same board. I tried to use one board generate the signal and another to receive, the phase angle keeps on changing for continuous write and read. I know if the signal is from a good source, such as Clarke Hess, the reading should be decent. Because our Clarke Hess is out for calibration, we are trying to generate our own, this is where problem started. 

0 Kudos
Message 10 of 14
(3,782 Views)