LTspice seminar with Mike Engelhardt
Last week I was lucky enough to get tipped off about the last seminar this year for Linear Technology’s free Spice program, LTspice. The seminar was given by the author of the program, Linear Tech employee Mike Engelhardt. From hanging around LT design engineers, I have heard that there is a little PSpice DNA in the company. Mike once said that he hired a former PSpice programmer to help with the project, but LTspice seems to have progressed past PSpice, at least for switching power supply design. Make says that the IC designers at LT use LTspice. This may be why Mike started out with the assertion that a semiconductor company that uses Spice will do a better job than an EDA company that just does programming. I know Barrie Gilbert at Analog Devices would agree, since they have their own awesome Spice, ADICE. I would even accept that for switching power analysis, LTspice has progressed beyond PSpice. But I think my pals at Mentor Graphics and analog IC design standard-bearer Cadence would take exception to the assertions that EDA companies cannot deliver good simulators. Synopsys HSPICE is a standard for a reason, and we won’t even get into to field solvers like Ansoft’s HFSS, that do things Spice programs cannot, like solve Maxwell’s equations in 3-D.
- Mike Engelhardt stands beside the timeline of LTspice.
Still, in a way Mike was being way too modest about his achievements with LTSpice. I had a retired LT IC designer clue me in, when I asked him if it was true that you could only use LT parts in LTSpice. He explained that was not true, indeed one of my buddies at Maxim tells me he uses LTspice almost every day. The LT designer then went on to explain what was really cool about LTspice. See, a switching power supply has the same simulation problem as a PLL (phase-locked loop). It takes milliseconds to start up and get to steady-state. But to help the program converge you want slender nanosecond time slices for the matrix solver. What Mike did was craft a way to speed up the billions of calculations that LTspice does, so you can capture that switching power chip start up in a reasonable amount of computational time. This is what I do hear the big EDA companies bragging about lately, how you can run fast Spice for PLL design, but it seem to me that Engelhardt was doing this a decade ago. And that is what gives rise to the urban legend that LTspice can only run LT parts. LTspice will run any standard model that works in PSpice or other simulators. LTspice is not node-limited or crippled in any way. It is the same program the IC designers at LT use. But Engelhardt writes the models for Linear Tech’s switching regulator chips. That is when he consults the IC designer and uses all his magic to properly model the switcher chip, as well as use all the hooks in LTspice to speed up the simulation as the circuits runs up towards steady-state. So no, most companies don’t even offer models of their switcher parts, and if they did the models would not be able to use all of Mike’s tricks inside LTspice. But if you want to model a controller, or even use a giant slow transistor-level model of a controller or op-amp, LTspice will run it, and probably a lot faster than many other simulators. That is because the specialized tricks are not the only thing making LTspice fast.
Mike explained in the seminar that he started using multithreading and assembly language back in 2008, to get the program to do simulations in what to me appeared to be way under 1 second. He also said that the program self-authors- it examines the hardware, and invokes some of the 50 or so hardware description compliers he has coded. Then the program writes, compiles, and links its own assembly code, and runs the simulation.
Now my programmer consultant buddy said that does not make sense, you should be able to run an interpreted program faster than you can compile and run an assembly language program, so it is likely I have misconstrued what Engelhardt said, or he simplified his explanations for a bunch of hardware folks in the seminar. All I know is that LTspice runs quite fast.
What else? Well Engelhardt said there have been 3 million downloads of LTspice. I assume he is including the earlier SwitherCAD program in that tally. Mike said that a current-feedback switcher is a glorified flip-flop, but the model has to account for every single thing that can set or reset the flip-flop. Engelhardt then did a demo of the program simulating a switching regulator circuit. It was fast and impressive. He showed how to edit symbols three different ways.
One thing he demonstrated is how a perfect output capacitor with no ESR (equivalent series resistor) will make most converters unstable, since the lack of ESR means that there is no ripple generated that you can feedback to the controller. He then showed how you could edit the ideal symbol to add an ESR and then the controller becomes stable. When asked if the capacitor with ESR will then report a power loss if you queried it, he said the program “cannot be better than perfect” and that the cap both accepts and delivers power. You can always add a resistor in series to the output cap and query that for power loss, but Engelhardt felt that was a kludge.
This is where we see the divide between programmers and hardware people. I think that if a real cap with real ESR gets hot, than the simulator should show it. When asked about Spice results not agreeing with your hardware Engelhardt said “If your simulation doesn’t agree with the lab results, you did not build what you simulated.” Spoken like a true programmer, who sees the virtual world as the reality that the real world must emulate. I just had lunch with three experienced RF engineers and they went ballistic when I told them that quote. Then we talked about all the ways Spice will give bad results. We blame the program, and by inference, the programmer. The programmer blames us for not building what we simulated. As I get older, I can see that both positions are right. The thing is, it is the college kids and inexperienced engineers who need Spice the most. None of the three older expert RF engineers put much credence in Spice. So if the young people who need Spice don’t know how to build what they simulated, the old folks who would know how to do that don’t use Spice at all, where does that leave us? I do see my RF buddies’ point. After all, if you knew how to build a circuit that emulates your Spice, why use Spice at all? Save the time and just build it, put in a decade box to tweak the values and save a month or week off the development time. So I think as an industry we all have to try to meet in the middle. Our CAD tools should help understand what will happen in the real world, and even us old guys have to celebrate all the things Spice can do, like Monte Carlo and sensitively analysis, something that would take weeks to do on the bench. Oh, and a buddy that loves LTspice showed me how to get a power level in the output cap. He just built an mathematical entity that took the current inand out of the cap and multiplied the square by the ESR to get power. You can then read that out, if you also think adding a separate little ESR resistor is too kludgey.
All I know is that Spice is an important tool for electrical engineers. Even a tool as advanced as LTSpice will lie to you if you don’t know what you are doing. But if you use Spice to learn, and do analysis, and then most importantly, figure what happened if the simulation does not match the lab, you would be a much better engineer than the zombies that just sit behind a computer or the old salts that just rely on experience.
Finally, Mike Engelhardt mentioned a classic book on modeling “by two Italians,” I assume that is Semiconductor Device Modeling with Spice. I want to toss in the great book Matthew Berggren at Altium tipped me off to, Inside Spice. This out-of-print book is for us system folks. It points out that Spice stands for “simulation program with IC emphasis” and that all the defaults of many programs are set up for ICs. The author, Ron M. Kielkowski, then shows how to tweak all the little setting so your board-level simulation converges. It is way cooler than putting 0.001 ohm resistors in series with all the diodes like I do. No way to get around no capability for floating nodes though, keep those 100Gohm resistors handy.
Here is a picture of Bob Widlar’s Spice, an RC pot box he used to figure out compensation of his amplifiers.
And really really finally, here is a picture of my dear departed Spice-hating friend, Bob Pease, holding a soldering iron I gave him in honor of his assertion that “A soldering iron is my Spice.”
Vignesh commented:
I need to say, youve got 1 of the very best blogs Ive observed in a htngely time. What I wouldnt give to have the ability to create a weblog thats as fascinating as this. I guess Ill just need to maintain reading yours and hope that 1 day I can write on a topic with as much understanding as youve got on this 1!
Carl Van Wormer commented:
I like using .wav files for input to analog stuff, then listening to the output .wav files so I can hear the results of my circuit (filters, etc.) before I build them. If you build what you simulate, it sounds the same!
Hugo Coolens commented:
LTspice is great to a certain point but it's not free (free as in free speech), and that makes it quite vulnerable: if you notice e.g. an error in LTspice and Mike doesn't want to look at it -I had this experience myself- then you can't trust LTspice's results no longer. Mike also won't have the eternal life, so what will happen after Mike with LTspice, it's not the first time a great software package managed essentially by one person ended in oblivion.
John Jolley commented:
fully endorse "the real purpose of simulation is to allow the engineer to understand how the circuit works". It was a most satisfying experience using LTSpice to simulate a circuit that was not performing as expected, and tweak parasitics and compensation until simulation waveforms resembled the real measurements - not to find the 'correct' values, but to discover the effect of each, and how they interact.
Seacrow commented:
LTspice is the best simulator out there, my opinion after using intusoft, pspice, bla bla. If you feel guilty about using "free" LTspice, just design-in more LTC parts!
AE7NM commented:
Mike had the hat with him at the Salt Lake City seminar. It was hanging on something at the front of the conference room. The most recent tour t-shirts have him in a chef's toque blanche.
JimL commented:
I attended Mikes E. LTspice seminar when it came to Minneapolis last fall. I had to leave early and missed some of the Demos'. I'm looking forward to attending again. Does anyone have his program on tape or a pdf?
Where's Mike's famous hat? commented:
Where is Mike's famous hat that appears on all of the T-shirts given away at the seminar? Wanted a picture of Mike Engelhardt wearing his famous "hat".....
Kit commented:
I'll never forget a great quote in EDN c.2000 which said "No one believes the simulation except the person who did the simulation; everyone believes the test except the one who did the test". I think some of both are in order for all my projects.
ACProgrammer commented:
@dick_freebird
There's some documentation here www.ltwiki.org . Some of that behavioral stuff you mention Linear keeps secret (can't reveal the secret sauce), but other very useful pieces are semi documented in examples or as symbols in the schematic capture or the user's group. Besides, much of the behavioral stuff you can make yourself quite easily with the B sources (often overlooked, but very useful).
Many of the pieces outsiders are not supposed to use probably aren't all that useful since they are specific to a particular Linear part (imagine a complex logic block - you probably didn't want that particular function anyway, or perhaps some weird application specific flavor of DAC).
ACProgrammer commented:
Your programmer friend actually doesn't make much sense. Most pure interpreters are very slow. I don't know the details, but it sounds a little like what LTSpice is doing is something much like a JIT (look it up on Wikipedia). You find this style of interpreter in modern languages like Java and C#. In concept, it basically compiles (well, assembles is closer, but still not quite right) code at runtime. It's reported that for certain algorithms, JITed code can actually perform faster than native, compiled or assembled code since there are optimizations that can be done only at run time.
If you note in the options for LTSpice, one of the options for the matrix compiler is "object code". While not conclusive, object code is often associated with JITed interpreters. It's something in between high level (think C) code and low level assembly code. Its used because it retains more information about the program from the high level language than assembly can. This information can be very helpful to the optimizations a JIT needs to do.
But even if it just assembles the core solver code at runtime, the benefits of being able to take advantage of the latest DSP style x86 processor instructions (see SSE, SSE2, etc) can easily outweigh the cost of assembling a small code base since assemblers are generally quite fast.
Analog Hack commented:
Back when I was young and pugnacious hardware designer (some might say, “inexperienced” and/or “defensive”), I complained to a talented friend that simulation programs were great for non-realistic, small-signal analysis where “everything is linear” but fell-short when dealing with the non-linearities, transients and parasitics that exist in the “real world”. His valued response was, “Garbage in, garbage out”. I have since learned that, specifically when it comes to LTspice, my friend was correct (as is Mike Engelhardt) and have since stopped blaming the simulator when simulation and reality disagree; instead, I ask myself, “What did I miss?” Thank you Mike for LTspice. AH
przemek commented:
But, but, LTSpice does calculate power correctly. Check it for yourself: connect a sine voltage source to a capacitor, and plot U*I. I just set it up with 10kHz 1V sine wave going into a 100uF 1 ohm ESR cap, simulated it and added a trace with expression U(n001)*I(C1), which shows oscillating power with RMS 0.5W, as expected.
Perhaps the canned formula Mike built in for the overall circuit efficiency only includes losses in the explicit elements, or something like that---but that is not a problem with the simulator, just a caveat of this specific 'efficiency' macro included for your convenience. If you don't like his formula, just write your own!
jazz commented:
First: LTSpice is great, The way i use it is to verify my initial thoughts, not to get the final design working in the real world and in the simulated one as it never happened that a good running simulation resulted in a good final product and vise versa :) When i see the picture of the rc box of bob then i must say he was more right in his thinking :) I can only say use the best of the 2 ways, don't stare blind to simulation keep the mind fresh with enough coffee.Also its more important to get a stable real world result then something "perfect" as perfect never lasts long.
AE7NM commented:
Englehardt mantains that the real purpose of simulation is to allow the engineer to understand how the circuit works. It is not to tweek compensation or verify performance.
The efficiency calculation feature of LTspice does indeed calculate the power dissipation of capacitors that have ESR specified. Besides reporting the overall efficiency of the power supply it reports the power dissipation of just about everthing, peak voltage, peak and average current (in steady the steady state).
dick_freebird commented:
LTSpice is great, the only thing I would wish for is more documentation of the "black magic" - there are evidently a lot of behavioral type functions that the secret LT-part internals use, which would be broadly valuable but are not disclosed to us freeloading bum types.
ckt nut commented:
I second the motion. So thankful to Linear Tech and Mr. Engelhardt for this incredible resource.
Constant314 commented:
I am of the opinion that if the model is correct, then the simulator ought to converge and produce an accurate result, or stop and tell me that it cannot. I would prefer to put my effort into getting the model right rather than tweaking the simulator. On transient analysis, I sometimes feel that I am compensating the simulator instead of my design. But I do it anyway and it is usually helpful. For linear and AC analysis, SPICE is almost peerless.
Constant314 commented:
Engelhardt deserves an IEEE medal for putting a powerful tool into the hands of tens of thousands of engineers, technicians, students and even hobbyists who could not afford it or convince their bosses to buy it. Perhaps the number is hundreds of thousands. The yahoo LT-SPICE users group has over 33 thousand members. It is the people's SPICE.















