Maintaining phase accuracy for kHz power measurements - Page 1
Forum section: electronics / projects

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 05, 2020, 02:51:37 pm
content: I need to measure a 40kHz-100kHz amplifier output for phase and power measurements.I'm planning to simultaneously sample the voltage and current waveform at up to 3MSPS and then perform most of the filtering and phase correction in software.My output is a class D filtered sine wave with no harmonics up to roughly the 11th, and then some minor harmonics (don't have a FFT on hand but I'd guess around -20dBm).Since my output is relatively clean, I'm not too concerned about a steep analog filter. However, component tolerance gives a pretty wide phase delay variance and the current transformer I'm using has a noticeable phase offset.The question is: how do I calibrate out the phase offset over my band of operation? I could just measure it at the two main fundamentals I'll be using (40k and 100k), but that seems inelegant. I'm thinking a FIR that's calibrated with a low reactance resistive load, but no clue how to approach that.Right now my signal path is roughlyvoltage -> filter and ADC buffer opamp (probably ADA4891) with 100:1 attenuation -> 12-bit SAR ADC on a C2000 microcurrent transformer -> filter/ADC buffer with 2-4 V/V gain -> ADCA multiple feedback filter somewhere between Butterworth and Bessel seems ideal according to my simulations, but I'm not particularly married to it.

author: ogden
author_rank: Super Contributor
timestamp: January 05, 2020, 03:37:12 pm
content: Quote from: KaneTW on January 05, 2020, 02:51:37 pmInelegant? Not at all. Even more elegant would be to calibrate at more points. Internet is full with information on "how to calculate phase difference/offset/angle". In short: you cross-correlate sampled waveform with 0-degree shifted sine and 90-degree shifted sine (thus cosine), then do simple trigonometry math to calculate phase angle.https://www.electronics-tutorials.ws/accircuits/phase-difference.html

author: splin
author_rank: Frequent Contributor
timestamp: January 10, 2020, 01:20:40 am
content: Quote from: KaneTW on January 05, 2020, 02:51:37 pmMeasuring the current at 100kHz with low phase shift accurately isn't trivial - depending on your phase accuracy requirements and the currents involved of course. If you use a current shunt it has to have very low inductance - eg. a 10milliohm shunt with 1nH of inductance will cause a phase shift of 3.6 degrees at 100kHz if I've calculated it correctly. Phase errors introduced by shunts are even a concern in 50Hz energy meters, especially when the power factor is low.You can get (or make) low inductance shunts using a coaxial configuration, or at least a bifilar arrangement. This paper covers some of the issues:https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=31690Alternatively you could try to directly measure the phase shift of the shunt but I'm not sure what a good way to go about it might be. Or you could measure its inductance with an LCR meter and rely on calculating the phase shift.Another way would be to use a high bandwidth (10MHz+) Rogowski coil sensor with low phase shift at 100kHz such as:http://www.pemuk.com/products/cwt-current-probe/cwt.aspx.Read the technical notes here for relevant phase performance information:http://www.pemuk.com/Userfiles/CWT/CWT%20-%20Technical%20notes%20-%20001.PDFThey aren't especially cheap however - probably getting on for $1k (it's possible they might be somewhat less than that - I'm not certain). You might be able to get something cheap on Ebay as I doubt there is a big demand on the second hand market. There are other manufacturers of course but many are low bandwidth types designed for 50/60Hz measurments. Also note that the high bandwith types are relatively insensitive and thus not suitable for low currents.Once you have the means to measure your calibration current accurately, I'd have thought that two calibration frequencies would be enough as I would expect only one pole in the frequency response to be significant within the CT's accurate bandwidth. Don't quote me on that however!

author: ogden
author_rank: Super Contributor
timestamp: January 10, 2020, 06:15:46 am
content: Quote from: splin on January 10, 2020, 01:20:40 amMuch better idea is to implement phase error calibration same way as LCR meters do.

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 10, 2020, 07:00:51 am
content: Some inherent phase shift is unavoidable, but as long as I can calibrate it out in software it's fine.How does phase error calibration in LCR meters work?

author: ogden
author_rank: Super Contributor
timestamp: January 10, 2020, 11:16:45 am
content: Quote from: KaneTW on January 10, 2020, 07:00:51 amThey measure amplitude & phase of voltage & current for open, short and load "standards" at frequency of interest. You can skip open and short, measure (purely) resistive load which means that voltage and current at load terminals supposedly is in-phase and phase difference you measure during calibration are errors of your instrument and wiring.Further reading:https://www.keysight.com/zz/en/assets/7018-06840/application-notes/5950-3000.pdfChapter "operation and measurement principles":https://www.emctest.it/public/ebay/pdf/Philips_PM6303A_LCR_Meter_Service_Manual-Fluke_PM6303A_Service-Manual.pdf

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 10, 2020, 03:56:53 pm
content: Nice, that sounds roughly like what I was planning to do. Good to know that's standard practice for metrology.

author: splin
author_rank: Frequent Contributor
timestamp: January 11, 2020, 02:01:21 am
content: Quote from: ogden on January 10, 2020, 11:16:45 amYou can measure the current by measuring the voltage across a load resistor but it's no different in principle to using a current shunt to measure the voltage across part of the total load. It doesn't necessarily help much - there is no such thing as a pure resistive load any more than a non-inductive current shunt. The load resistor will be physically much larger than a current shunt and thus likely to have rather more inductance. The phase error is proprtional to the ratio of the inductance to resistance of the shunt/load resistor.Whether the parasitic inductance is a problem or not depends on the accuracy required and the current and power levels to be measured, which the OP hasn't stated.Since the OP is using a current transformer to measure the current it may well be the case that relatively large currents are involved in which case the load resistor will probably need to dissipate a lot of power, be physically large and thus suffer from large ESL unless a lot of attention is paid to its construction. A high power low inductance load resistor is likely to be rather more expensive than a sutiable shunt. A typical wirewound power resistor would be hopeless with micro-Henry levels of inductance.For example, assume the load has to dissipate 500W - 50A from a 10V source. The resistance would be 200 milliohms. 50nH is a fairly typical value for a 100W, low inductance resistor so assuming this could be achieved for a 500W resistor the phase shift at 100kHz would be 9 degrees - quite significant.For higher voltages and lower current loads the load resistor will be higher resistance and the phase shift will be lower.It would be helpful to know the phase accuracy required and the current and power levels involved.

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 11, 2020, 07:21:29 am
content: Approx. 60W per channel, design load is a 20-25 Ohm transducer. I went with a CT over a shunt+difference amplifier for now but either option is acceptable. I'm aiming for a 1 degree phase accuracy but if that turns out to be unrealistic I'll have to re-evaluate.

author: ogden
author_rank: Super Contributor
timestamp: January 11, 2020, 12:07:19 pm
content: Quote from: splin on January 11, 2020, 02:01:21 amShunt/transformer is compensated by calibration. Properties of the standard load can be characterized using LCR meter and accounted in the calibration math. Unfortunately I can't tell how.

author: splin
author_rank: Frequent Contributor
timestamp: January 14, 2020, 12:07:42 am
content: Quote from: KaneTW on January 11, 2020, 07:21:29 amIf you don't need the isolation provided by a current transformer, and at the relatively low currents involved I'd use a current shunt - much cheaper and simpler and the shunt doesn't need calibrating if you chose the right one. For example, Susumo make some low inductance SMD shunts at 1nH compared to the 3 to 5nH of typical parts:https://www.newark.com/pdfs/techarticles/susumu/LowESLCurrentSensingChipResistor.pdfUsing a 200milliohm shunt with 1nH ESL will give a phase shift of only 0.18 degrees at 100kHz. Increasing the shunt resistance decreases the phase shift at the expense of higher dissipation in the shunt (approx 600mW for 200mohms).It's not clear to me in your OP exactly what you need to measure. I presume you are generating a sine wave between 40kHz and 100kHz to drive a transducer, with some (unwanted) harmonics after the 11th, >= 20dBc down? I assume you don't need to measure the harmonics of the drive voltage as the filter would need to be heroic to allow (say) a 1.2MHz 12th harmonic to be within the passband but provide significant attenuation by 1.5MHz!But what about the current waveform? If the transducer has any non-linearity the current waveform will have additional harmonics along with intermodulation products of the drive signal and its harmonics which could be significant given the latter are only 20dB down. Does this mean the current measurement has to have higher bandwidth than 100kHz? If so the phase shift becomes more of a problem, but probably still easily manageable by using a higher resistance shunt and/or paralleled to redfuce ESL.As to the original question about calibration; the shunt shoudn't need calibration as stated earlier. The anti-alias filter will introduce several degrees of phase shift at 100kHz - but so long as the voltage and current measuring channels are using the same, reasonably close tolerance filter components the phase difference between the channels needn't exceed 0.5 degrees or so at most - simulate to confirm. Thus you can probably get away without having to calibrate the phase response.You may need to measure both filters' amplitude response(s) to correct for droop in the passband and to ensure there are no unexpected anomolies. Alternatively instead of using a C2000, you could buy an LPC-Link2 board for around $24:https://www.nxp.com/design/microcontrollers-developer-resources/lpc-microcontroller-utilities/lpc-link2:OM13054It has an LPC4370 microcontrtoiller with a 12 bit ADC. It has a Cortex M4 and two M0 cores all running at 204MHz. Add anti-alias filters and a 2 channel MUX. The anti-alias filters can be much simpler (first or second order RC). Better still, by sampling each channel at 30 or 40MSPS you can oversample (averaging) to achieve better SNR than the C2000 ADC's.There is free source code around for oscilloscopes using the LPC4370 including:https://github.com/robroyx3m/High_speed_oscilloscope_using_an_NXP_LPC437xEmbedd Artists (who originally made the LPC-Link2 board) used to sell a daughter board called LabTool converting it into a 2 channel scope and logic analyser for which the schematics, firmware and PC code are available.

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 14, 2020, 03:03:00 am
content: I'm generating a sine wave using selective harmonic elimination PWM, which switches at some multiple of the required frequency (depending on how many harmonics you need eliminated). It's then passed through a LC filter to get rid of the rest, and into an output transformer.The C2000 is needed due to its HRPWM capability. I've not found an alternate part that can do its job (unless I roll the implementation myself in a FPGA). HRPWM seems to just be regular PWM with a tapped delay line, but the fine edge positioning is fairly important.I sort of need the isolation (one side of the output has to be at protective ground due to the transducer design), but I can work around that by measuring before the output transformer.Just the fundamental needs to be measured. The harmonics from the full-bridge are attenuated sufficiently with the LC filter that they're barely visible in the time domain on the voltage waveform (don't have a FFT at hand).The transducer is driven at its resonant frequency, and is pretty much a series LCR circuit in parallel with a small shunt capacitance (couple of nf) at that frequency, so the current waveform should be pretty harmonic-free.Eventually this will run in a multi-transducer setup, and I'm not sure how much pickup there will be from the other transducers. But that's solvable in software.Simulations give me an about 1-degree phase shift baseline plus some unknown contribution from the component variances. I actually didn't expect 1% C0Gs to be this cheap, so that pushes phase error due to component tolerance well within error bounds (and I can fiddle a bit to match the phase response of both voltage and current).I have some CT samples with a higher turn ratio arriving soon. Going to see how well they perform compared to the 1:30 I have now.The oversampling is a nice idea, but you lose simultaneous sampling and the ADC driver requirements are steeper. I'll take a look --- I've considered using the ADAR7251 which is a similar idea (but $9/1k and kind of overkill). Would allow me to drop the two ADA4891-4s and a bunch of passives, though.Ultimately the idea is to have a main controller board plus a variable amount (1-5) of dual output channel boards, to drive a total of 2-10 transducers. I might adjust the architecture sometimes; focusing on the driver board side right now.I basically want to drive each of the ultrasonic transducers at their resonant frequency regardless of variations. Current systems drive them at one frequency for the entire set. Innate bonus is being able to drive them at wildly different frequencies.

author: ogden
author_rank: Super Contributor
timestamp: January 14, 2020, 03:34:17 am
content: Quote from: splin on January 14, 2020, 12:07:42 amAny trace longer than few mm will have bigger than 1nH inductance. I do not see how incredibly low inductance shunt helps here to achieve "doesn't need calibrating". Maybe I am missing something - who knows

author: trobbins
author_rank: Frequent Contributor
timestamp: January 14, 2020, 11:49:28 am
content: Some LEM current transducer modules go beyond 100kHz. Eg. the LTS-6P is 1dB down at 200kHz. You may also still find a TEK A6302 and AM503 amp - that has a constant 25ns delay I recall.

author: dmendesf
author_rank: Frequent Contributor
timestamp: January 14, 2020, 12:19:51 pm
content: There are DSPics with high resolution PWMs now. There's also the STM32F334 (not really sure if it has it or just high resolution timers). Not saying you to change, just giving some cheaper data points for the future.

author: ogden
author_rank: Super Contributor
timestamp: January 14, 2020, 04:12:06 pm
content: Quote from: KaneTW on January 14, 2020, 03:03:00 amVirtually any DDS with >=10Msps, like ad9833 will do the job.

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 14, 2020, 06:21:37 pm
content: Seems like a huge pain to implement on a DDS---just the timing seems like a nightmare. I basically have a list of phase angles that I need to switch at (or, equivalently, a list of duty cycles and periods). If I use the AD9833 duty cycle seems to be fixed and I can only adjust phase/frequency, and using the 2nd register for it doesn't seem to be fast enough.Also, it's expensive. A C2000 MCU with 4 sufficiently powerful HRPWM channels is $2.50/1k, whereas a single channel AD9833 is $4.13/1k. Even if you use symmetry to mux the AD9833, that's at least $8 in DDS alone for what a single MCU can do.DSPics are a good call. I'll see if they can handle my requirements.

author: ogden
author_rank: Super Contributor
timestamp: January 14, 2020, 06:52:52 pm
content: Quote from: KaneTW on January 14, 2020, 06:21:37 pmWhat you mean by "AD9833 duty cycle seems to be fixed"? You want to change duty cycle of sine waveform? (attached. pic from web search, LOL obviously).QuoteOk. Fair point. Then what about "software DDS" using precomputed waveform buffer you send into DAC using DMA? Even 1Msps DAC of mentioned STM32F334 with same filter you use for PWM, can reach quite clean 100KHz output. On C2000 MCU you are doing essentially the same, just you use "hi-speed 1-bit DAC" (PWM).

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 14, 2020, 09:25:05 pm
content: SHE-PWM works by calculating optimal switching angles to eliminate harmonics up to some defined limit. For example, the waveformhttps://i.kane.cx/RmKAlSeliminates all harmonics up to the 11th:https://i.kane.cx/DAdCTi. This can then be used via a full-bridge to have a high-efficiency, clean single-tone amplifier.*After* the full-bridge, it gets filtered down to a sine wave.

author: ogden
author_rank: Super Contributor
timestamp: January 14, 2020, 10:00:36 pm
content: Quote from: KaneTW on January 14, 2020, 09:25:05 pmSeems like SHE-PWM needs my further attention, thanxAgreed - *if* you use "switching" amplifier, then DDS is no use. You need "1-bit DAC" with PWM or PDM(DSD) modulation.

author: aandrew
author_rank: Frequent Contributor
timestamp: January 25, 2020, 02:18:44 am
content: SHEPWM looks an awful lot like Don Lancaster's "Magic Sinewaves" from the 80s.

author: KaneTW
author_rank: Frequent Contributor
timestamp: January 25, 2020, 08:55:14 am
content: Looks similar at first glance, but the methodology is completely different. I think the magic sinewaves paper is a special case of SHE-PWM. Haven't read it closely enough to make sure, though.