Author Topic: Is there an easy DSP route to measure power?  (Read 772 times)

0 Members and 1 Guest are viewing this topic.

Offline 741Topic starter

  • Frequent Contributor
  • **
  • Posts: 406
  • Country: gb
    • Circuit & PCB Design (small PCB quantities OK)
Is there an easy DSP route to measure power?
« on: December 12, 2019, 05:29:44 pm »
I'm asking on behalf of someone else: we've inherited some hardware with ARM etc (coding is his bit). There are some LPF filters and my guess is that the ARM computes RMS power from V & I samples.

I've been told that (for example) it's pretty straightforward to make an equaliser with ARM because ST dev kits supply free software; "all you do" is specify the response and it spits out some coefficients (I gather). Quite what extra bits the developer supplies like ISRs and ADC setup I do not know.

But, given that, I like to imagine that finding RMS power given LPF V & I signals should be fairly painless.

I would be interested if anyone out there has done this, and in any "not too generic" links. At this point (regrettably) we are not going to be able to learn about DSP in any serious depth, so I'm after more practically orientated information for now.

Online Marco

  • Super Contributor
  • ***
  • Posts: 7043
  • Country: nl
Re: Is there an easy DSP route to measure power?
« Reply #1 on: December 12, 2019, 06:09:04 pm »
I'm going to make a wild guess that whoever was talking about audio DSP was talking about ST Audioweaver, a limited closed source framework for ST Arm devices. But it's far from a generic visual DSP programming platform, so it wouldn't help you.

What's wrong with your existing code?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Is there an easy DSP route to measure power?
« Reply #2 on: December 12, 2019, 07:08:00 pm »
Well, RMS you take the samples, square them (mind the increased number of bits -- probably truncate the fractional end), add them up over whatever period you're averaging over, then divide by the number of samples and sqrt it.  (Presumably the number of samples will be a power of 2, so shifting can be used instead of division.  The sqrt will have to be written out somehow or another, but the compiler or library will have a solution for that.)

For power, instead of multiplying one signal by itself, multiply V times I, i.e. instantaneous power.  Average that, and don't take sqrt.  That's the time domain definition of average power.

Mind offsets -- any DC offset will contribute to the output, just as it's supposed to.  If your signals are biased or unsigned, keep this in mind and adjust the math accordingly.

You can also find the apparent power |S|, which is rms(V) * rms(I).  This is greater than the real power.

You can, finally, find reactive power Q by doing the vector subtraction, since |S| = |P + jQ| = sqrt(P^2 + Q^2).  Of course, as you're taking the difference of two noisy signals, don't expect great accuracy this way.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: Is there an easy DSP route to measure power?
« Reply #3 on: December 12, 2019, 07:41:10 pm »
Depends on what you want to measure.
If it's 50/60 Hz power consumption it's dead simple, I've done it with a 68HC11 8-bit MCU.
Two ADCs synchronously sampling, one for voltage and one for current sampling at 10 ksps (or what you find fitting). Just multiply the samples, depending on polarity of the multiplication it's either RMS power or reactive power.

If you want to measure higher frequencies it gets hairy.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf