2
\$\begingroup\$

I have a MCU equipped with a single ADC and a single S&H (Sample and Hold) circuit. The board where the MCU is placed has several inputs (let's say 3 x currents, 3 x voltages). The MCU is programmed to sample each input at 1 kS/s. Since it has a single ADC, the ADC sampling frequency is at least 6 kS/s (due to the fact we have 6 inputs), and the ADC input is multiplexed on the various input signals sequentially.

I wish to calculate active power (single-phase and/or three-phases), but unfortunately the ADC has a single S/H, and hence the sample of the voltage and the sample of the current are not taken at the same time. The best solution would be to use an MCU with several ADCs sampling simultaneously, or an MCU with one ADC but several S&H circuits. Nevertheless is there some way to calculate active power accurately (multiplying the instantaneous voltage and current samples) with single ADC and single S&H, for instance through linear interpolation (to align the current and voltage samples to the same instant)?

enter image description here

enter image description here

\$\endgroup\$
  • \$\begingroup\$ "The MCU is programmed to sample each input at 1 kS/s." - Can it be programmed to eg. sample 1 channel at 6kS/s? What sets the limit on sample rate? Can you tell us which MCU you have? \$\endgroup\$ – Bruce Abbott Jan 23 '18 at 13:05
  • \$\begingroup\$ What you should probably do is to look for a MCU with a "continuous conversion" ADC. This allows the ADC to keep running continuously at a high frequency and store the results in individual buffers. The values still won't be read at exactly the same time (since it will be using one single SAR channel), but the accuracy compared to what you have now is some 1000 times better. Depending on how fast the ADC is and how often the MCU can read the results. \$\endgroup\$ – Lundin Jan 23 '18 at 14:38
0
\$\begingroup\$

Nevertheless is there some way to calculate active power accurately (multiplying the instantaneous voltage and current samples) with single ADC and single S&H, for instance through linear interpolation (to align the current and voltage samples to the same instant)?

You can do this digitally by retarding or advancing either voltage or current to make them align temporally. You just need a small buffer for holding values and calculate the in-between value you need. The more values you use in your interpolation routine the better the result. I'd start with trying two values and linearly interpolating to see what kind of error you get. Because voltage is more predictable than current (more sin wave ish) I'd interpolate that waveform to make it align with current.

\$\endgroup\$
  • \$\begingroup\$ Thank you. Hence you suggest to use linear interpolation on voltage, to align the voltage sample with the current sample. But what about in case of three-phase power? In that case I have 6 waveforms, and I need to perform interpolation on n-1 (5) of them. (To everybody, just don't focus on the current waveform I've plotted, it is just an example.) \$\endgroup\$ – Davide Norbiato Jan 23 '18 at 13:57
  • \$\begingroup\$ Yes, for three phase, you should interpolate all three voltages unless you can be sure that they are very identical and phase balanced in which case you don't need to sample them but, that is a very big "if"! \$\endgroup\$ – Andy aka Jan 23 '18 at 14:39
1
\$\begingroup\$

What you are really saying is that there is a delay between measuring the voltage and current.

That delay represents a phase shift dependent on the frequency. At low frequencies, that phase shift is acceptable. At high enough frequency, it is not.

You have to decide what your maximum frequency of interest is, and how much error you can tolerate. Compute the phase shift due to the delay at your highest frequency, then compute the error that causes. If that exceeds the error you are willing to live with, then you need less delay between the two readings.

That all said, 1 kHz sample rate for computing real power and power factor for typical AC power is way too low. You usually want to go 10x faster or more. Remember that short spikes have significant high frequency harmonic content. Again, you need to decide what your error limit is, but usually you want to do a decent job with the first 100 harmonics or so.

Added

You now say that your harmonic content is "low", and that the signals are "sinewave looking". Note that this is NOT the case for the current waveform you show. Those spikes add significant harmonic content.

If at least one of your signals has low harmonic content, then you can measure it first and adjust it in time to the second signal. Usually the voltage is better behaved and more sine-like.

You could, for example, do a polynomial fit on the last few samples, then use that to extrapolate the signal to the same time the other signal is actually measured. Or, if you can measure the two signals alternately, wait one sample so that you can use the average of the last two samples of the low-bandwidth signal to multiply by the other signal. That's basically interpolating the two adjacent samples to approximate the value at the same time as the sample of the high-bandwidth signal.

In short, there are various ways to filter and interpolate multiple samples of one signal to estimate its value at the sample time of the other signal.

\$\endgroup\$
  • \$\begingroup\$ Hi, I was able to accurately compute RMS value of 50 Hz waveforms with 1 kS/s sampling rate, altough waveform was with low harmonic distortion; the 1 kS/s sampling frequency is enough, I am interested in 50/60 Hz sinewave looking signals with low harmonic content. I know that sampling at higher frequency would reduce the error, but I am actually looking for a method to cancel the error. \$\endgroup\$ – Davide Norbiato Jan 23 '18 at 14:00
0
\$\begingroup\$

If your sample rate is fast enough and if you know (calculate) the delay between voltage and current measurements you're all set. In this case, shift voltage in time as it will be much smoother (easier). The bigger problem will be to sample fast enough in order to catch the sharp current waveform. Maybe sample current continuously and voltage only near zero crossings.

Keep in mind all the relevant set-up times when switching multiplexer channels though.

\$\endgroup\$
0
\$\begingroup\$

Your current spikes last about 1 millisecond, with risetimes of 300 uS. You should sample 10X that, in your pursuit of accuracy. Thus 30uS sampling per channel. And for 6 channels? Every 5 microseconds. Thus sampling rate of 200 KHz.

Now, about that phase shift. Will 30uS timing error cause too large an error in computing power? 30uS would be your worst case delay (a full sampling cycle). If you pick sampling slots adjacent for Ix and Vx, then 5uS is your delay.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.