LTSpice Automation

Feb 15, 2010 124 Replies

Does LTSpice have much in the way of automation capabilities?



I'm working on a switcher design, half in mathemagic land, half in grotty old real circuits land -- I want to simulate the controller with PWM voltages, and look at how the circuit responds. So I'd like to run the circuit with a bunch of different duty cycles. But it's a complex circuit, so I need a bunch of different PWM's, all synchronized together. Is there a way to get LTSpice to carry a variable, use that variable in it's .trans card, and either set it once and run a simulation, or (better) run a simulation from the command line?



TIA.


www.wescottdesign.com

you can run ltspice from a command line it is the help somewhere, it been discussed here before, search for "wrapper around Spice"

-Lasse

If it's really odd stuff you could pipe it in as WAV files. The help file contains some info about that. Helmut Sennewald had a more clever method with bitstreams but I don't exactly remember that.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Found it, it's called PWL Files, explained here:

formatting link

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

In PSpice, and I would imagine in LTspice, since Mike Engelhardt is quite the clever fellow, you can parameterize the PWM and plot "Performance Analyses". ...Jim Thompson

| James E.Thompson, CTO | 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 | I love to cook with wine. Sometimes I even put it in the food.

Wave files can have many channels in them. IIRC, there is a way to get them in as multiple voltages.

You can also construct a logic circuit to make the needed waveforms to make the inputs. This method only works well if there is a fairly simple rule that can be used to make the waveforms. I have done this by making a counter that just provided all possible combinations of loads on a multiple output power supply. It was better to do this than to do independent runs because the startup time was far longer than the time to react to a change in loads.

grotty=20

Geez, did everybody forget the three phase rectifier efficiency that=20 =46red Bartoli did for me? Note the stepped load on the right.

Version 4 SHEET 1 1652 864 WIRE 192 -384 64 -384 WIRE 288 -384 192 -384 WIRE 560 -384 288 -384 WIRE 624 -384 560 -384 WIRE 944 -384 624 -384 WIRE 64 -288 64 -384 WIRE 192 -288 192 -384 WIRE 288 -288 288 -384 WIRE -192 -64 -688 -64 WIRE 288 -64 288 -224 WIRE 288 -64 -112 -64 WIRE -688 -48 -688 -64 WIRE 624 -16 624 -384 WIRE 752 -16 624 -16 WIRE -688 32 -816 32 WIRE 624 32 624 -16 WIRE 752 32 752 -16 WIRE 944 32 944 -384 WIRE -176 112 -688 112 WIRE 192 112 192 -224 WIRE 192 112 -96 112 WIRE -688 144 -688 112 WIRE 624 160 624 96 WIRE 752 160 752 112 WIRE 752 160 624 160 WIRE -816 256 -816 32 WIRE -688 256 -688 224 WIRE -688 256 -816 256 WIRE -192 288 -688 288 WIRE 64 288 64 -224 WIRE 64 288 -112 288 WIRE -688 368 -688 288 WIRE 64 368 64 288 WIRE 192 368 192 112 WIRE 288 368 288 -64 WIRE -816 496 -816 256 WIRE -752 496 -816 496 WIRE -688 496 -688 448 WIRE -688 496 -752 496 WIRE 64 512 64 432 WIRE 192 512 192 432 WIRE 192 512 64 512 WIRE 288 512 288 432 WIRE 288 512 192 512 WIRE 544 512 288 512 WIRE 624 512 624 160 WIRE 624 512 544 512 WIRE 944 512 944 112 WIRE 944 512 624 512 WIRE -752 544 -752 496 =46LAG 544 512 VLneg =46LAG 560 -384 VLpos =46LAG -752 544 0 SYMBOL diode 48 432 M180 WINDOW 0 24 72 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D1 SYMATTR Value FWD SYMBOL diode 176 432 M180 WINDOW 0 24 72 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D2 SYMATTR Value FWD SYMBOL diode 272 432 M180 WINDOW 0 24 72 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D3 SYMATTR Value FWD SYMBOL diode 48 -224 M180 WINDOW 0 24 72 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D4 SYMATTR Value FWD SYMBOL diode 176 -224 M180 WINDOW 0 24 72 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D5 SYMATTR Value FWD SYMBOL diode 272 -224 M180 WINDOW 0 24 72 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D6 SYMATTR Value FWD SYMBOL ind2 -96 304 M270 WINDOW 0 32 56 VTop 0 WINDOW 3 5 56 VBottom 0 SYMATTR InstName L9 SYMATTR Value 220? SYMATTR Type ind SYMBOL ind2 -80 128 M270 WINDOW 0 32 56 VTop 0 WINDOW 3 5 56 VBottom 0 SYMATTR InstName L10 SYMATTR Value 220? SYMATTR Type ind SYMBOL ind2 -96 -48 M270 WINDOW 0 32 56 VTop 0 WINDOW 3 5 56 VBottom 0 SYMATTR InstName L11 SYMATTR Value 220? SYMATTR Type ind SYMBOL cap 608 32 R0 SYMATTR InstName C1 SYMATTR Value 5600? SYMATTR SpiceLine V=3D400 Rser=3D.5 SYMBOL current 944 32 R0 WINDOW 123 0 0 Left 0 WINDOW 39 24 116 Left 0 SYMATTR SpiceLine load SYMATTR InstName I1 SYMATTR Value 0 SYMBOL voltage -688 48 R180 WINDOW 123 0 0 Left 0 WINDOW 39 24 -12 Left 0 SYMATTR SpiceLine Rser=3D.1 SYMATTR InstName V1 SYMATTR Value SINE(0 163.293 60 0 0 0) SYMBOL voltage -688 240 R180 WINDOW 123 0 0 Left 0 WINDOW 39 24 76 Left 0 SYMATTR SpiceLine Rser=3D.1 SYMATTR InstName V2 SYMATTR Value SINE(0 163.293 60 0 0 120) SYMBOL voltage -688 464 R180 WINDOW 123 0 0 Left 0 WINDOW 39 24 76 Left 0 SYMATTR SpiceLine Rser=3D.1 SYMATTR InstName V3 SYMATTR Value SINE(0 163.293 60 0 0 240) SYMBOL res 736 16 R0 SYMATTR InstName R1 SYMATTR Value 5.6k TEXT 416 24 Left 0 !.ic v(VLpos) 140\n.ic v(VLneg) -140 \n *precharge TEXT -680 -344 Left 0 !.model FWD D Ron=3D10m Roff=3D100e6 Vfwd=3D0.35 = Vrev=3D600 TEXT -512 536 Left 0 !.tran 0 1 0 TEXT -512 584 Left 0 !.meas tran TP avg(V(n001)*I(V1)) *True power TEXT -512 640 Left 0 !.meas tran VRMS rms(V(n001)) TEXT -512 688 Left 0 !.meas tran IRMS rms(I(V1)) TEXT -512 744 Left 0 !.meas tran AP avg(VRMS*IRMS) *Apparent power TEXT -512 800 Left 0 !.meas tran PF param TP/AP *Power factor TEXT -616 0 Left 0 ;200V between phases TEXT 768 192 Left 0 !.step I1 0 100 10 TEXT -232 -144 Left 0 !k1 L9 L10 L11 0.5 TEXT 696 576 Left 0 !.meas tran VL avg(v(VLpos)-v(VLneg))\n.meas tran = Pout param VL*I(I1) TEXT -200 -184 Left 0 ;Line reactor

T'warn't Fred Bartoli,t'was I :-)

-- "Electricity is of two kinds, positive and negative. The difference is, I presume, that one comes a little more expensive, but is more durable; the other is a cheaper thing, but the moths get into it." (Stephen Leacock)

Oh, I thought even I forgot about it :-)

Well, I don't use much LTspice thanks to its poor GUI, so I couldn't have done it...

Thanks, Fred.

You guys are spoiled, or too young. Back when I started the "GUI" of PSpice consisted of a rather small green CRT hanging off some CGA card. I had the deluxe edition, a CRT in nicotine-yellow :-)

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Sheeeesh! When I started using Spice I drew schematics on paper pads, numbered the nodes, typed in the netlist and ran it under DOS.

Aaron eased my pain by writing a pre/post version controller which numbered all the .CIR and .DAT files so I could keep track of all the changes.

Data spewed forth from a tractor feed printer:

.001 * .002 * .003 * .004 *

etc. Anyone else remember those days? ...Jim Thompson

| James E.Thompson, CTO | 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 | I love to cook with wine. Sometimes I even put it in the food.

"Jim Thompson" wrote in message news: snipped-for-privacy@4ax.com...

Ha, I have a text book that contains problems in SPICE. Not PSpice.

I'm astonished that the book is only 1989, and not older!

Tim

Deep Friar: a very philosophical monk. Website: http://webpages.charter.net/dawill/tmoranwms

Well, I did lots of *real design* before committing spice, which happened on the late, maybe 10 years ago...

I often do complicated projects where many design options have to be studied, and when the GUI stands in the way, it's a no-no.

The small sensor I'm finishing right now is a good example. As was also the PSU that powers the DUTs on testers used to wafer test the INTEL and AMD CPUs. (Yep, all your nice CPUs are tested by my design :-) When I did that (circa 2000) I estimated it would have taken 3 to 4 more time on the design pass with another spice, not even speaking of LTspice.

Thanks, Fred.

A friend of mine tried this with a Commodore daisy wheel printer, same that I used to have. It could do microstepping and he just used the dot. Which consequently wore out real fast ...

My first forays in to computing was writing Fortran. Using a Juki punch card machine.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

I always knew that the Romans never completely subdued you guys and you'd come back :-)

Much of my stuff can't even possibly be simulated. Like a lot of transducers.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Summer of 1961 I took a sequence of courses on the Institute's first transistorized mainframe (IIRC IBM 709 ?), FAP (machine language) and FORTRAN... lots of punched cards... don't drop your stack ;-) ...Jim Thompson

| James E.Thompson, CTO | 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 | I love to cook with wine. Sometimes I even put it in the food.

Old trick: _Immediately_ number the cards after taking off the machine. Else on turfing during the bicycle ride and it's all over.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

Sure it can. Well, most of it. That's just a matter of model development and will it pay back to do so or not. And when it's done, it's done :-)

I usually have big time developing adequate models (well, less and less since I now have plenty). Then, with realistic models you gain a lot of insight and have much better designs with less bench work. For ex. it's easier to measure components at high temp, use spice and have it right first time, than discovering pbs when baking the proto, even without saying that investigating at high temp is slow and painful.

Thanks, Fred.

We are doing that as I write this, or rather, a client does. But it has its limits. If you want to perfect it you may slip the time-to-market schedule too much. In the old days it was even worse, once we blew up a Pentium-I during a sim (back when those were just out and really expensive). The client wasn't exactly happy when that happened.

If you design super small stuff with lots of electronics, yes. Poring over one of those right now, custom chips with a few hundred channels that must fit into a little less than 2.5mm diameter tube. Flip-chip bonding these will be fun.

Regards, Joerg http://www.analogconsultants.com/ "gmail" domain blocked because of excessive spam. Use another domain or send PM.

I didn't do ANY simulation until around 1977-78. Prior to that was all hand drawings and math solving; and bread-boarding... so that covers all of my Motorola standard I/C products without a single simulation.

I still "think by hand", but I don't know how you can get by without a simulator when you're talking literally thousands of transistors. ...Jim Thompson

| James E.Thompson, CTO | 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 | I love to cook with wine. Sometimes I even put it in the food.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required