4
$\begingroup$

I am measuring voltages and currents of a 3-phase electrical machine and I need to calculate the power. Every interrupt (frequency between 30-70kHz) I get values (voltages, currents) from analogue-digital converter and I need to do a simple calculation to determine power. However, I was told to use averaging with a first order filter with a time constant of approximate 1s for the power calculation. This, I believe, means low pass filter with a frequency of approximately 1Hz? What is the simplest solution to this? Moving average?

$\endgroup$
4
$\begingroup$

A first order lowpass filter is usually implemented like this:

$$p[n] = \alpha p[n-1] + (1-\alpha) pi[n]$$

Where $p[n]$ is your filtered power estimation, $p[n-1]$ is the previous result, $pi[n]$ is your new measurement (probably the product of instantaneous voltage and current measurements), and $\alpha$ is a positive parameter just less than 1.

The nearer $\alpha$ gets to 1, the larger the time constant (lower cutoff frequency) of your filter. But beware, especially in embedded systems with limited precision, that getting too near to 1 can make your filter unstable, or at least have problems due to numerical precision.

The cutoff frequency for that filter is around $f_s \frac{1-\alpha}{2\pi\alpha}$, where $f_s$ is your sampling frequency.

$\endgroup$
  • 1
    $\begingroup$ There must be a mistake in the formula for cutoff freq ($\alpha/(1-\alpha)$ is much larger than 1 if $\alpha$ is close to but less than 1, no? I think it is $\frac{1-\alpha}{2\pi \alpha}$ $\endgroup$ – Dan Boschen Apr 9 '17 at 0:03
  • $\begingroup$ Thanks, this looks similar to the solution at the bottom of this page: norwegiancreations.com/2015/10/… $\endgroup$ – jurij Apr 9 '17 at 16:12
  • $\begingroup$ However, your equation states that current measured value needs to be multiplied by (1-alpha) and previous value with alpha, while on the page above, this is vice versa. Which is correct? Also, which equation for cutoff frequency is correct? Thank you very much. $\endgroup$ – jurij Apr 9 '17 at 16:14
  • $\begingroup$ $\alpha$ happens to be the pole location of this simple LPF. i would recommend that $\alpha$ be very close to 1, but less than 1. $$ 0 < 1-\alpha \ll 1 $$. and $pi[n]$ is the instantaneous power at time $n$ and is the product of the instantaneous voltage and instantaneous current as measured by the separate A/D converters. this is necessary to measure real power in a reactive situation. $\endgroup$ – robert bristow-johnson Apr 9 '17 at 17:59
  • $\begingroup$ OK, but in this case, do I have to multiply pi[n] with alpha or with (1 - alpha)? Which is the correct equation for cutoff frequency? $\endgroup$ – jurij Apr 9 '17 at 21:04

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.