AVG and RMS in LTSpice?

Ok, guys, I don't use Spice much and usually get around this stuff via some extra placed parts. Not this time.

How can one calculate the (running) average of a trace? IOW as if there was an RC or LC lowpass. Or something where I can set a scooting window.

I know you can find out the AVG by zooming the plot, then CTRL-right_click. But I'd like graphs that show me efficiency penalties over the course of simulated load changes. It doesn't spit out the raw data and I don't really want to go via Excel if possible. Also, preferably not the V-Source plus I-Source scheme of LTSpice because that's restricted to one each.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg
Loading thread data ...

Dunno if I've grasped the problem, but it reminds me of the time I was sim'ing PWM instability. It's goofy to check the length of hundreds of pulses in LTSpice. So I made a spice circuit to help me spot PWM variations as LTSpice was plotting. Fake circuits to help design real circuits. :) I just call'm helper circuits to get quick analysis.

Perhaps make the electronic equivalent for the behavior you want to observe.

Maybe that helps..

D from BC British Columbia Canada

Reply to
D from BC

That's exactly what I've been doing for years. This time it would really clutter things though. Lots of currents to be measure and filtered. I was just wondering whether there was a reasonable math approach.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

I just use the mouse to highlight a desired rectangle and release. The chart expands. Then I use ctrl-right-mouse-click, I think, to get the AVG and RMS figures. Something like that... it just pops up in a small dialog box.

Jon

Reply to
Jonathan Kirwan

What about an arbitrary voltage source with something like:

V=idt(V(x)-absdelay(V(x),100n))/100n

for a 100ns moving average?

Reply to
Andrew Holme

Aren't functions AVG (full average) and AVGX (average over a specified range) available in LTspice?

They're in PSpice.

...Jim Thompson

--
| James E.Thompson, P.E.                           |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
           Liberalism is a persistent vegetative state
Reply to
Jim Thompson

Nope :-(

I have a really old DOS PSPICE license, maybe time to fire it up again.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

Also needed an initial value:

Version 4 SHEET 1 880 680 WIRE 64 48 0 48 WIRE 96 48 64 48 WIRE 0 80 0 48 WIRE 0 192 0 160 WIRE 80 272 0 272 WIRE 112 272 80 272 WIRE 0 304 0 272 WIRE 0 416 0 384 FLAG 0 192 0 FLAG 0 416 0 FLAG 64 48 x FLAG 80 272 avgx SYMBOL voltage 0 64 R0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V1 SYMATTR Value PULSE(-1 2 50n 0 0 5n 10n) SYMBOL bv 0 288 R0 SYMATTR InstName B1 SYMATTR Value V=idt(V(x)-delay(V(x),100n),V(x)*100n)/100n TEXT 232 264 Left 0 !.tran 200n

Reply to
Andrew Holme

Perhaps LTspice's .MEASURE (or .MEAS) statement might be useful to you. There are two ways of using the .meas statement. You can place it in your simulation as a statement and view the results in an error log report or execute the statement in an external text file after the simulation is done.

Example: Place the .meas statement (don't put in the "---") in your schematic (click on the ".op" button in the tool bar with the schematic as the active window):

--
.meas tran Vt integ v(B+,d)/200us
+ trig  v(gate) val=.5 td=700us rise=1
+ targ v(gate) val=.5 td=900us rise=1
Reply to
qrk

Thanks, Mark! That may be the ticket here. All I need is a few results, it's ok if I don't really get an efficiency graph. Clicking around in the plot window is too time consuming for rapid-fire optimizations.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.