# Power calculation with odd waveforms

Discussion in 'General Electronics Chat' started by Veracohr, Nov 29, 2014.

1. ### Veracohr Thread Starter Well-Known Member

Jan 3, 2011
600
86
The attached image is the current from the voltage supply of an amplifier circuit which I'm trying to figure out efficiency for. How would you calculate the power from an non-sinusoid like this?

LTSpice gives an average current of 36.3mA and RMS of about 45mA. I exported the simulation data and did a manual RMS calculation from a 100ms sample and got 34mA. I don't know why my manual calculation more closely matches LTSpice's average instead of its RMS calculation. It makes a 6% difference in the efficiency figure of the circuit, so which is correct?

File size:
17.3 KB
Views:
45
2. ### crutschow Expert

Mar 14, 2008
16,215
4,335
You need to adjust the RMS calculation "Interval Start" and "Interval End" times so that LTspice performs the calculation for exact multiples of the cycle period. If it performed the calculation for the complete waveform displayed in your picture, the calculation would be off since an integral number of cycles is not being shown.

3. ### Veracohr Thread Starter Well-Known Member

Jan 3, 2011
600
86
I just did a quick zoom so you could see the shape of the waveform. I assume by "Interval Start/End" you mean the time axis of the waveform, and it is an interval number of cycles when I do the calculation, 100ms simulation time with a 1kHz test signal.

4. ### crutschow Expert

Mar 14, 2008
16,215
4,335
That's okay the way you did it, but I meant the Start and Stop times that show in the pop-up when you do the RMS waveform calculation.

So how did you do your manual calculation?

5. ### Veracohr Thread Starter Well-Known Member

Jan 3, 2011
600
86
Hmm...the only way I know how to get an RMS calculation is to Control-Left click on the trace name at the top (actually Command-Control-Left Click, using Windows inside Parallels on a Mac). I looked through menus but couldn't find any settings relating to RMS, and I didn't find anything in the LTSpice User's Guide.

For the manual calculation, I squared each sample, then averaged them, then took the square root of the average. I set the simulation for 1μs maximum time step, but the samples in the data export seemed to be about 1.2μs for some reason.

6. ### ronv AAC Fanatic!

Nov 12, 2008
3,657
2,800
You can get one cycle by using time to start saving data and stop time under edit - spice analysis. In your case it looks like time to start saving data would be 34.75 ms and stop time 35.75ms.
You can get a direct power reading by holding down ALT and mousing over the component you want to measure the power in.

7. ### crutschow Expert

Mar 14, 2008
16,215
4,335
Sounds like you calculated the RMS value correctly. And I'm fairly certain that LTspice calculates the RMS value correctly also. So I don't understand the difference between your calculation and LTspice's.

8. ### Veracohr Thread Starter Well-Known Member

Jan 3, 2011
600
86
Thanks. I guess I'll go with the one that makes the circuit sound better!